19
19
20
20
import { faker } from '@faker-js/faker' ;
21
21
22
+ import { Services } from './data/serviceInfo' ;
22
23
import { getUser , User } from './data/user' ;
23
24
import { AccountPage } from './pages/account.page' ;
24
25
import { AppLockModal } from './pages/appLock.modal' ;
@@ -30,6 +31,7 @@ import {DataShareConsentModal} from './pages/dataShareConsent.modal';
30
31
import { DeleteAccountModal } from './pages/deleteAccount.modal' ;
31
32
import { DeleteAccountPage } from './pages/deleteAccount.page' ;
32
33
import { EmailVerificationPage } from './pages/emailVerification.page' ;
34
+ import { GroupCreationPage } from './pages/groupCreation.page' ;
33
35
import { LoginPage } from './pages/login.page' ;
34
36
import { MarketingConsentModal } from './pages/marketingConsent.modal' ;
35
37
import { OutgoingConnectionPage } from './pages/outgoingConnection.page' ;
@@ -46,6 +48,69 @@ const webAppPath = process.env.WEBAPP_URL ?? '';
46
48
const createdUsers : User [ ] = [ ] ;
47
49
const createdTeams : Map < User , string > = new Map ( ) ;
48
50
51
+ test ( 'Team owner adds whole team to an all team chat' , { tag : [ '@TC-8631' , '@crit-flow' ] } , async ( { page, api} ) => {
52
+ // Generating test data
53
+ const owner = getUser ( ) ;
54
+ const member1 = getUser ( ) ;
55
+ const member2 = getUser ( ) ;
56
+ const teamName = 'Critical' ;
57
+ const conversationName = 'Crits' ;
58
+
59
+ // Initializing page objects
60
+ const singleSignOnPage = new SingleSignOnPage ( page ) ;
61
+ const loginPage = new LoginPage ( page ) ;
62
+ const dataShareConsentModal = new DataShareConsentModal ( page ) ;
63
+ const conversationListPage = new ConversationListPage ( page ) ;
64
+ const groupCreationPage = new GroupCreationPage ( page ) ;
65
+ const startUIPage = new StartUIPage ( page ) ;
66
+
67
+ await test . step ( 'Preconditions: Creating preconditions for the test via API' , async ( ) => {
68
+ await api . createTeamOwner ( owner , teamName ) ;
69
+ owner . teamId = await api . team . getTeamIdForUser ( owner ) ;
70
+ createdTeams . set ( owner , owner . teamId ) ;
71
+ const invitationIdForMember1 = await api . team . inviteUserToTeam ( member1 . email , owner ) ;
72
+ const invitationCodeForMember1 = await api . brig . getTeamInvitationCodeForEmail ( owner . teamId , invitationIdForMember1 ) ;
73
+
74
+ const invitationIdForMember2 = await api . team . inviteUserToTeam ( member2 . email , owner ) ;
75
+ const invitationCodeForMember2 = await api . brig . getTeamInvitationCodeForEmail ( owner . teamId , invitationIdForMember2 ) ;
76
+
77
+ await api . createPersonalUser ( member1 , invitationCodeForMember1 ) ;
78
+ await api . createPersonalUser ( member2 , invitationCodeForMember2 ) ;
79
+ } ) ;
80
+
81
+ await test . step ( 'Team owner logs in into a client and creates group conversation' , async ( ) => {
82
+ await page . goto ( webAppPath ) ;
83
+ await singleSignOnPage . enterEmailOnSSOPage ( owner . email ) ;
84
+ await loginPage . inputPassword ( owner . password ) ;
85
+ await loginPage . clickSignInButton ( ) ;
86
+ await dataShareConsentModal . clickDecline ( ) ;
87
+ } ) ;
88
+
89
+ await test . step ( 'Team owner adds a service to newly created group' , async ( ) => {
90
+ await api . team . addServiceToTeamWhitelist ( owner . teamId ! , Services . POLL_SERVICE , owner . token ! ) ;
91
+ } ) ;
92
+
93
+ await test . step ( 'Team owner adds team members to a group' , async ( ) => {
94
+ await conversationListPage . clickCreateGroup ( ) ;
95
+ await groupCreationPage . setGroupName ( conversationName ) ;
96
+ await startUIPage . selectUsers ( [ member1 . username , member2 . username ] ) ;
97
+ await groupCreationPage . clickCreateGroupButton ( ) ;
98
+ expect ( await conversationListPage . isConversationItemVisible ( conversationName ) ) . toBeTruthy ( ) ;
99
+ } ) ;
100
+
101
+ // Steps below require [WPB-18075] and [WPB-17547]
102
+
103
+ await test . step ( 'All group participants send messages in a group' , async ( ) => { } ) ;
104
+
105
+ await test . step ( 'Team owner and group members react on received messages with reactions' , async ( ) => { } ) ;
106
+
107
+ await test . step ( 'All group participants make sure they see reactions from other group participants' , async ( ) => { } ) ;
108
+
109
+ await test . step ( 'Team owner removes one group member from a group' , async ( ) => { } ) ;
110
+
111
+ await test . step ( 'Team owner removes a service from a group' , async ( ) => { } ) ;
112
+ } ) ;
113
+
49
114
test ( 'Account Management' , { tag : [ '@TC-8639' , '@crit-flow' ] } , async ( { page, api} ) => {
50
115
test . slow ( ) ; // Increasing test timeout to 90 seconds to accommodate the full flow
51
116
@@ -73,12 +138,7 @@ test('Account Management', {tag: ['@TC-8639', '@crit-flow']}, async ({page, api}
73
138
}
74
139
const teamId = await api . team . getTeamIdForUser ( owner ) ;
75
140
createdTeams . set ( owner , teamId ) ;
76
- const invitationId = await api . team . inviteUserToTeam (
77
- teamId ,
78
- member . email ,
79
- `${ owner . firstName } ${ owner . lastName } ` ,
80
- owner . token ,
81
- ) ;
141
+ const invitationId = await api . team . inviteUserToTeam ( member . email , owner ) ;
82
142
const invitationCode = await api . brig . getTeamInvitationCodeForEmail ( teamId , invitationId ) ;
83
143
84
144
await api . createPersonalUser ( member , invitationCode ) ;
@@ -115,7 +175,6 @@ test('Account Management', {tag: ['@TC-8639', '@crit-flow']}, async ({page, api}
115
175
await test . step ( 'Member verifies if applock is working' , async ( ) => {
116
176
await page . reload ( ) ;
117
177
expect ( await appLockModal . isVisible ( ) ) ;
118
- expect ( await conversationListPage . isConversationItemVisible ( conversationName ) ) . toBeFalsy ( ) ;
119
178
expect ( await appLockModal . getAppLockModalHeader ( ) ) . toContain ( 'Enter passcode to unlock' ) ;
120
179
expect ( await appLockModal . getAppLockModalText ( ) ) . toContain ( 'Passcode' ) ;
121
180
@@ -209,8 +268,7 @@ test('Personal Account Lifecycle', {tag: ['@TC-8638', '@crit-flow']}, async ({pa
209
268
210
269
await test . step ( 'Personal user A searches for other personal user B' , async ( ) => {
211
270
await conversationSidebar . clickConnectButton ( ) ;
212
- await startUIPage . searchForUser ( userB . username ) ;
213
- await startUIPage . clickUserFromSearchResults ( userB . username ) ;
271
+ await startUIPage . selectUser ( userB . username ) ;
214
272
expect ( await userProfileModal . isVisible ( ) ) ;
215
273
} ) ;
216
274
0 commit comments