Skip to content

Commit b145ed8

Browse files
committed
feat: add tests for groups version warning banner
1 parent 1983bbf commit b145ed8

File tree

3 files changed

+92
-0
lines changed

3 files changed

+92
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import { bothPlatformsIt } from '../../types/sessionIt';
2+
import { USERNAME } from '../../types/testing';
3+
import { PlusButton } from './locators/home';
4+
import { CreateGroupOption } from './locators/start_conversation';
5+
import { newUser } from './utils/create_account';
6+
import { closeApp, openAppTwoDevices, SupportedPlatformsType } from './utils/open_app';
7+
import { newContact } from './utils/create_contact';
8+
import { LatestReleaseBanner } from './locators/groups';
9+
10+
bothPlatformsIt('Create group banner', 'high', createGroupBanner);
11+
12+
async function createGroupBanner(platform: SupportedPlatformsType) {
13+
const { device1, device2 } = await openAppTwoDevices(platform);
14+
// Create users A and B
15+
const [userA, userB] = await Promise.all([
16+
newUser(device1, USERNAME.ALICE),
17+
newUser(device2, USERNAME.BOB),
18+
]);
19+
await newContact(platform, device1, userA, device2, userB);
20+
await device1.navigateBack();
21+
// Open the Create Group screen from home
22+
await device1.clickOnElementAll(new PlusButton(device1));
23+
await device1.clickOnElementAll(new CreateGroupOption(device1));
24+
const groupsBanner = await device1.doesElementExist(new LatestReleaseBanner(device1));
25+
if (!groupsBanner) {
26+
throw new Error('v2 groups warning banner is not shown or text is incorrect');
27+
}
28+
await closeApp(device1, device2);
29+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import { bothPlatformsIt } from '../../types/sessionIt';
2+
import { USERNAME } from '../../types/testing';
3+
import { newUser } from './utils/create_account';
4+
import { closeApp, openAppThreeDevices, SupportedPlatformsType } from './utils/open_app';
5+
import { createGroup } from './utils/create_group';
6+
import { ConversationSettings } from './locators/conversation';
7+
import { EditGroup } from './locators';
8+
import { LatestReleaseBanner } from './locators/groups';
9+
10+
bothPlatformsIt('Edit group banner', 'medium', editGroupBanner);
11+
12+
async function editGroupBanner(platform: SupportedPlatformsType) {
13+
const { device1, device2, device3 } = await openAppThreeDevices(platform);
14+
// Create users A, B and C
15+
const [userA, userB, userC] = await Promise.all([
16+
newUser(device1, USERNAME.ALICE),
17+
newUser(device2, USERNAME.BOB),
18+
newUser(device3, USERNAME.CHARLIE),
19+
]);
20+
// Create group
21+
const testGroupName = 'Test group';
22+
await createGroup(platform, device1, userA, device2, userB, device3, userC, testGroupName);
23+
// Navigate to Edit Group screen
24+
await device1.clickOnElementAll(new ConversationSettings(device1));
25+
await device1.clickOnElementAll(new EditGroup(device1));
26+
const groupsBanner = await device1.doesElementExist(new LatestReleaseBanner(device1));
27+
if (!groupsBanner) {
28+
throw new Error('v2 groups warning banner is not shown or text is incorrect');
29+
}
30+
await closeApp(device1, device2, device3);
31+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import { bothPlatformsIt } from '../../types/sessionIt';
2+
import { USERNAME } from '../../types/testing';
3+
import { newUser } from './utils/create_account';
4+
import { closeApp, openAppThreeDevices, SupportedPlatformsType } from './utils/open_app';
5+
import { createGroup } from './utils/create_group';
6+
import { ConversationSettings } from './locators/conversation';
7+
import { EditGroup, InviteContactsButton } from './locators';
8+
import { LatestReleaseBanner } from './locators/groups';
9+
10+
bothPlatformsIt('Invite contacts banner', 'medium', inviteContactGroupBanner);
11+
12+
async function inviteContactGroupBanner(platform: SupportedPlatformsType) {
13+
const { device1, device2, device3 } = await openAppThreeDevices(platform);
14+
// Create users A, B and C
15+
const [userA, userB, userC] = await Promise.all([
16+
newUser(device1, USERNAME.ALICE),
17+
newUser(device2, USERNAME.BOB),
18+
newUser(device3, USERNAME.CHARLIE),
19+
]);
20+
// Create group
21+
const testGroupName = 'Test group';
22+
await createGroup(platform, device1, userA, device2, userB, device3, userC, testGroupName);
23+
// Navigate to Invite Contacts screen
24+
await device1.clickOnElementAll(new ConversationSettings(device1));
25+
await device1.clickOnElementAll(new EditGroup(device1));
26+
await device1.clickOnElementAll(new InviteContactsButton(device1));
27+
const groupsBanner = await device1.doesElementExist(new LatestReleaseBanner(device1));
28+
if (!groupsBanner) {
29+
throw new Error('v2 groups warning banner is not shown or text is incorrect');
30+
}
31+
await closeApp(device1, device2, device3);
32+
}

0 commit comments

Comments
 (0)