Skip to content

Commit 94a6321

Browse files
committed
addresses feedback and renames delete contact to be delete conversation
1 parent a54bf18 commit 94a6321

File tree

2 files changed

+21
-47
lines changed

2 files changed

+21
-47
lines changed

run/test/specs/linked_device_change_username.spec.ts

Lines changed: 18 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -72,56 +72,30 @@ async function changeUsernameLinkedAndroid(platform: SupportedPlatformsType) {
7272
await device1.deleteText(new UsernameInput(device1));
7373
await device1.inputText(newUsername, new UsernameInput(device1));
7474
await device1.clickOnElementAll(new TickButton(device1));
75-
const username = await device1.waitForTextElementToBePresent({
76-
strategy: 'accessibility id',
77-
selector: 'Display name',
78-
});
79-
const changedUsername = await device1.getTextFromElement(username);
75+
const usernameEl = await device1.waitForTextElementToBePresent(new UsernameSettings(device1));
76+
const changedUsername = await device1.getTextFromElement(usernameEl);
8077
if (changedUsername === userA.userName) {
8178
throw new Error('Username change unsuccessful');
8279
}
8380
// Get the initial linked username from device2
84-
const username2 = await device2.waitForTextElementToBePresent({
85-
strategy: 'accessibility id',
86-
selector: 'Display name',
87-
});
81+
const username2 = await device2.waitForTextElementToBePresent(new UsernameSettings(device2));
8882
let currentLinkedUsername = await device2.getTextFromElement(username2);
8983

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');
84+
let currentWait = 0;
85+
const waitPerLoop = 500;
86+
const maxWait = 50000;
87+
88+
do {
89+
await sleepFor(waitPerLoop);
90+
// Close the screen and navigate back to the User Settings
91+
await device2.closeScreen();
92+
await device2.clickOnElementAll(new UserSettings(device2));
93+
currentWait += waitPerLoop;
94+
const linkedUsernameEl = await device2.waitForTextElementToBePresent(new UsernameSettings(device2));
95+
currentLinkedUsername = await device2.getTextFromElement(linkedUsernameEl);
96+
97+
} while(currentLinkedUsername === userA.userName && currentWait < maxWait) {
98+
console.log('Username not changed yet')
12599
}
126100
await closeApp(device1, device2);
127101
}

run/test/specs/user_actions_delete_contact.spec.ts renamed to run/test/specs/user_actions_delete_conversation.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ import { newContact } from './utils/create_contact';
77
import { linkedDevice } from './utils/link_device';
88
import { openAppMultipleDevices, SupportedPlatformsType } from './utils/open_app';
99

10-
bothPlatformsIt('Delete contact', 'high', deleteContact);
10+
bothPlatformsIt('Delete conversation', 'high', deleteConversation);
1111

12-
async function deleteContact(platform: SupportedPlatformsType) {
12+
async function deleteConversation(platform: SupportedPlatformsType) {
1313
const [device1, device2, device3] = await openAppMultipleDevices(platform, 3);
1414
const [Alice, Bob] = await Promise.all([
1515
linkedDevice(device1, device3, USERNAME.ALICE),
@@ -33,7 +33,7 @@ async function deleteContact(platform: SupportedPlatformsType) {
3333
text: Bob.userName,
3434
}),
3535
]);
36-
// Delete contact
36+
// Delete conversation
3737
await device1.onIOS().swipeLeft('Conversation list item', Bob.userName);
3838
await device1.onAndroid().longPressConversation(Bob.userName);
3939
await device1.clickOnElementAll({ strategy: 'accessibility id', selector: 'Delete' });

0 commit comments

Comments
 (0)