Skip to content

Commit a54bf18

Browse files
committed
chore: changes based on android PR 1.22.0
1 parent c6b141e commit a54bf18

File tree

6 files changed

+58
-29
lines changed

6 files changed

+58
-29
lines changed
Lines changed: 2 additions & 2 deletions
Loading
Lines changed: 2 additions & 2 deletions
Loading

run/test/specs/linked_device_change_username.spec.ts

Lines changed: 43 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -75,27 +75,53 @@ async function changeUsernameLinkedAndroid(platform: SupportedPlatformsType) {
7575
const username = await device1.waitForTextElementToBePresent({
7676
strategy: 'accessibility id',
7777
selector: 'Display name',
78-
text: newUsername,
7978
});
8079
const changedUsername = await device1.getTextFromElement(username);
8180
if (changedUsername === userA.userName) {
8281
throw new Error('Username change unsuccessful');
8382
}
84-
await device1.closeScreen();
85-
await device1.clickOnElementAll(new UserSettings(device1));
86-
await device2.closeScreen();
87-
await device2.clickOnElementAll(new UserSettings(device2));
88-
await Promise.all([
89-
device1.waitForTextElementToBePresent({
90-
strategy: 'accessibility id',
91-
selector: 'Display name',
92-
text: newUsername,
93-
}),
94-
device2.waitForTextElementToBePresent({
95-
strategy: 'accessibility id',
96-
selector: 'Display name',
97-
text: newUsername,
98-
}),
99-
]);
83+
// Get the initial linked username from device2
84+
const username2 = await device2.waitForTextElementToBePresent({
85+
strategy: 'accessibility id',
86+
selector: 'Display name',
87+
});
88+
let currentLinkedUsername = await device2.getTextFromElement(username2);
89+
90+
// If the linked username still equals the original, then enter a loop to try again.
91+
if (currentLinkedUsername === userA.userName) {
92+
let currentWait = 0;
93+
const waitPerLoop = 500;
94+
const maxWait = 50000;
95+
96+
while (currentWait < maxWait) {
97+
// Wait before trying again
98+
await sleepFor(waitPerLoop);
99+
100+
// Close the screen and navigate back to the User Settings
101+
await device2.closeScreen();
102+
await device2.clickOnElementAll(new UserSettings(device2));
103+
104+
currentWait += waitPerLoop;
105+
106+
// Retrieve the updated username
107+
const linkedUsernameEl = await device2.waitForTextElementToBePresent({
108+
strategy: 'accessibility id',
109+
selector: 'Display name',
110+
});
111+
currentLinkedUsername = await device2.getTextFromElement(linkedUsernameEl);
112+
// If the linked username now matches the changed username, break out.
113+
if (currentLinkedUsername === changedUsername) {
114+
console.log('Username change successful');
115+
break;
116+
}
117+
}
118+
119+
// After looping, if the linked username still equals the original, then fail.
120+
if (currentLinkedUsername === userA.userName) {
121+
throw new Error('Username change unsuccessful');
122+
}
123+
} else {
124+
console.log('Username change successful');
125+
}
100126
await closeApp(device1, device2);
101127
}

run/test/specs/user_actions_block_conversation_options.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ async function blockUserInConversationOptions(platform: SupportedPlatformsType)
3131
// Check modal strings
3232
await device1.checkModalStrings(
3333
englishStripped('block').toString(),
34-
englishStripped('blockDescription').withArgs({ name: userB.userName }).toString()
34+
englishStripped('blockDescription').withArgs({ name: userB.userName }).toString(),
35+
true
3536
);
3637
// Confirm block option
3738
await device1.clickOnElementAll(new BlockUserConfirmationModal(device1));

run/test/specs/user_actions_unblock_user.spec.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ async function unblockUser(platform: SupportedPlatformsType) {
2121
await device1.clickOnElementAll(new BlockUser(device1));
2222
await device1.checkModalStrings(
2323
englishStripped('block').toString(),
24-
englishStripped('blockDescription').withArgs({ name: userB.userName }).toString()
24+
englishStripped('blockDescription').withArgs({ name: userB.userName }).toString(),
25+
true
2526
);
2627
await device1.clickOnElementAll(new BlockUserConfirmationModal(device1));
2728
await device1.onIOS().navigateBack();
@@ -47,13 +48,13 @@ async function unblockUser(platform: SupportedPlatformsType) {
4748
await device1.clickOnElementAll({ strategy: 'accessibility id', selector: 'Blocked banner' });
4849
await device1.checkModalStrings(
4950
englishStripped('blockUnblock').toString(),
50-
englishStripped('blockUnblockName').withArgs({ name: userB.userName }).toString()
51+
englishStripped('blockUnblockName').withArgs({ name: userB.userName }).toString(),
52+
true
5153
);
5254
await device1.clickOnElementAll({ strategy: 'accessibility id', selector: 'Unblock' });
53-
// Blocked message should now be visible
54-
await device1.waitForTextElementToBePresent({
55+
await device1.doesElementExist({
5556
strategy: 'accessibility id',
56-
selector: 'Message body',
57-
text: blockedMessage,
57+
selector: 'Blocked banner',
58+
maxWait: 2000,
5859
});
5960
}

run/types/DeviceWrapper.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1141,7 +1141,7 @@ export class DeviceWrapper {
11411141
text: 'Allow',
11421142
});
11431143
await this.clickOnByAccessibilityID('Show roots');
1144-
await sleepFor(100);
1144+
await sleepFor(500);
11451145
await this.clickOnTextElementById(`android:id/title`, 'Downloads');
11461146
await sleepFor(100);
11471147
const testImage = await this.doesElementExist({
@@ -1254,6 +1254,7 @@ export class DeviceWrapper {
12541254
await sleepFor(200);
12551255
// Select video
12561256
const mediaButtons = await this.findElementsByClass('android.widget.Button');
1257+
await sleepFor(500);
12571258
const videosButton = await this.findMatchingTextInElementArray(mediaButtons, 'Videos');
12581259
if (!videosButton) {
12591260
throw new Error('videosButton was not found');

0 commit comments

Comments
 (0)