Skip to content

Commit f61911a

Browse files
committed
fix: change strategy for download, enable, join locators
1 parent e673b35 commit f61911a

File tree

8 files changed

+46
-17
lines changed

8 files changed

+46
-17
lines changed

run/test/specs/disappearing_link.spec.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
OutgoingMessageStatusSent,
1313
SendButton,
1414
} from './locators/conversation';
15+
import { EnableLinkPreviewsModalButton } from './locators/global';
1516
import { open_Alice1_Bob1_friends } from './state_builder';
1617
import { sleepFor } from './utils';
1718
import { closeApp, SupportedPlatformsType } from './utils/open_app';
@@ -61,7 +62,7 @@ async function disappearingLinkMessage1o1Ios(platform: SupportedPlatformsType, t
6162
englishStrippedStr('linkPreviewsFirstDescription').toString()
6263
);
6364
});
64-
await alice1.clickOnByAccessibilityID('Enable');
65+
await alice1.clickOnElementAll(new EnableLinkPreviewsModalButton(alice1));
6566
// On iOS, Appium doesn't paste but type, and the link preview modal interrupts typing the link, the text must be deleted and typed again
6667
await alice1.deleteText(new MessageInput(alice1));
6768
await alice1.inputText(testLink, new MessageInput(alice1));
@@ -115,7 +116,7 @@ async function disappearingLinkMessage1o1Android(
115116
englishStrippedStr('linkPreviewsFirstDescription').toString()
116117
);
117118
});
118-
await alice1.clickOnByAccessibilityID('Enable');
119+
await alice1.clickOnElementAll(new EnableLinkPreviewsModalButton(alice1));
119120
// Preview takes a while to load
120121
await sleepFor(5000);
121122
await alice1.clickOnElementAll(new SendButton(alice1));

run/test/specs/group_disappearing_messages_link.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
OutgoingMessageStatusSent,
1313
SendButton,
1414
} from './locators/conversation';
15+
import { EnableLinkPreviewsModalButton } from './locators/global';
1516
import { open_Alice1_Bob1_Charlie1_friends_group } from './state_builder';
1617
import { sleepFor } from './utils';
1718
import { closeApp, SupportedPlatformsType } from './utils/open_app';
@@ -58,7 +59,7 @@ async function disappearingLinkMessageGroup(platform: SupportedPlatformsType, te
5859
);
5960
});
6061
// Accept link preview modal
61-
await alice1.clickOnByAccessibilityID('Enable');
62+
await alice1.clickOnElementAll(new EnableLinkPreviewsModalButton(alice1));
6263
// On iOS, Appium types so the link preview modal interrupts typing the link, must be deleted and typed again
6364
await alice1.onIOS().deleteText(new MessageInput(alice1));
6465
await alice1.onIOS().inputText(testLink, new MessageInput(alice1));

run/test/specs/group_message_link_preview.spec.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
OutgoingMessageStatusSent,
1111
SendButton,
1212
} from './locators/conversation';
13+
import { EnableLinkPreviewsModalButton } from './locators/global';
1314
import { open_Alice1_Bob1_Charlie1_friends_group } from './state_builder';
1415
import { sleepFor } from './utils';
1516
import { closeApp, SupportedPlatformsType } from './utils/open_app';
@@ -52,7 +53,7 @@ async function sendLinkGroupiOS(platform: SupportedPlatformsType, testInfo: Test
5253
englishStrippedStr('linkPreviewsEnable').toString(),
5354
englishStrippedStr('linkPreviewsFirstDescription').toString()
5455
);
55-
await alice1.clickOnByAccessibilityID('Enable');
56+
await alice1.clickOnElementAll(new EnableLinkPreviewsModalButton(alice1));
5657
// No preview on first send
5758
await alice1.clickOnElementAll(new SendButton(alice1));
5859
await alice1.waitForTextElementToBePresent({
@@ -100,7 +101,7 @@ async function sendLinkGroupAndroid(platform: SupportedPlatformsType, testInfo:
100101
englishStrippedStr('linkPreviewsEnable').toString(),
101102
englishStrippedStr('linkPreviewsFirstDescription').toString()
102103
);
103-
await alice1.clickOnByAccessibilityID('Enable');
104+
await alice1.clickOnElementAll(new EnableLinkPreviewsModalButton(alice1));
104105
//wait for preview to generate
105106
await sleepFor(5000);
106107
// No preview on first send

run/test/specs/locators/global.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,18 @@ export class ContinueButton extends LocatorsInterface {
5454

5555
export class EnableLinkPreviewsModalButton extends LocatorsInterface {
5656
public build() {
57-
return {
58-
strategy: 'accessibility id',
59-
selector: 'Enable',
60-
} as const;
57+
switch (this.platform) {
58+
case 'android':
59+
return {
60+
strategy: 'id',
61+
selector: 'Enable',
62+
} as const;
63+
case 'ios':
64+
return {
65+
strategy: 'accessibility id',
66+
selector: 'Enable',
67+
} as const;
68+
}
6169
}
6270
}
6371

run/test/specs/locators/index.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,23 @@ export class JoinCommunityButton extends LocatorsInterface {
253253
}
254254
}
255255

256+
export class JoinCommunityModalButton extends LocatorsInterface {
257+
public build(): StrategyExtractionObj {
258+
switch (this.platform) {
259+
case 'android':
260+
return {
261+
strategy: 'id',
262+
selector: 'Join',
263+
} as const;
264+
case 'ios':
265+
return {
266+
strategy: 'accessibility id',
267+
selector: 'Join',
268+
};
269+
}
270+
}
271+
}
272+
256273
export class CommunityInput extends LocatorsInterface {
257274
public build(): StrategyExtractionObj {
258275
switch (this.platform) {
@@ -438,7 +455,7 @@ export class DownloadMediaButton extends LocatorsInterface {
438455
switch (this.platform) {
439456
case 'android':
440457
return {
441-
strategy: 'accessibility id',
458+
strategy: 'id',
442459
selector: 'Download',
443460
};
444461
case 'ios':

run/test/specs/message_community_invitation.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { TestInfo } from '@playwright/test';
33
import { englishStrippedStr } from '../../localizer/englishStrippedStr';
44
import { bothPlatformsIt } from '../../types/sessionIt';
55
import { testCommunityLink, testCommunityName } from './../../constants/community';
6-
import { InviteContactsMenuItem } from './locators';
6+
import { InviteContactsMenuItem, JoinCommunityModalButton } from './locators';
77
import {
88
CommunityInvitation,
99
CommunityInviteConfirmButton,
@@ -49,7 +49,7 @@ async function sendCommunityInvitation(platform: SupportedPlatformsType, testInf
4949
.withArgs({ community_name: testCommunityName })
5050
.toString()
5151
);
52-
await bob1.clickOnElementAll({ strategy: 'accessibility id', selector: 'Join' });
52+
await bob1.clickOnElementAll(new JoinCommunityModalButton(bob1));
5353
await bob1.navigateBack();
5454
await bob1.waitForTextElementToBePresent(new ConversationItem(bob1, testCommunityName));
5555
await closeApp(alice1, bob1);

run/test/specs/message_link_preview.spec.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
OutgoingMessageStatusSent,
1111
SendButton,
1212
} from './locators/conversation';
13+
import { EnableLinkPreviewsModalButton } from './locators/global';
1314
import { open_Alice1_Bob1_friends } from './state_builder';
1415
import { sleepFor } from './utils';
1516
import { closeApp, SupportedPlatformsType } from './utils/open_app';
@@ -45,7 +46,7 @@ async function sendLinkIos(platform: SupportedPlatformsType, testInfo: TestInfo)
4546
englishStrippedStr('linkPreviewsEnable').toString(),
4647
englishStrippedStr('linkPreviewsFirstDescription').toString()
4748
);
48-
await alice1.clickOnByAccessibilityID('Enable');
49+
await alice1.clickOnElementAll(new EnableLinkPreviewsModalButton(alice1));
4950
await alice1.clickOnElementAll(new SendButton(alice1));
5051
await alice1.waitForTextElementToBePresent({
5152
...new OutgoingMessageStatusSent(alice1).build(),
@@ -81,10 +82,7 @@ async function sendLinkAndroid(platform: SupportedPlatformsType, testInfo: TestI
8182
englishStrippedStr('linkPreviewsEnable').toString(),
8283
englishStrippedStr('linkPreviewsFirstDescription').toString()
8384
);
84-
await alice1.clickOnElementAll({
85-
strategy: 'accessibility id',
86-
selector: 'Enable',
87-
});
85+
await alice1.clickOnElementAll(new EnableLinkPreviewsModalButton(alice1));
8886
//wait for preview to generate
8987
await sleepFor(5000);
9088
await alice1.clickOnElementAll(new SendButton(alice1));

run/types/testing.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,9 +483,11 @@ export type Id =
483483
| 'Disappearing messages type and time'
484484
| 'Display name'
485485
| 'donate-menu-item'
486+
| 'Download'
486487
| 'Download media'
487488
| 'edit-profile-icon'
488489
| 'Empty list'
490+
| 'Enable'
489491
| 'enjoy-session-negative-button'
490492
| 'enjoy-session-positive-button'
491493
| 'Enter display name'
@@ -503,6 +505,7 @@ export type Id =
503505
| 'invite-contacts-menu-option'
504506
| 'Invite button'
505507
| 'Invite friend button'
508+
| 'Join'
506509
| 'Join community button'
507510
| 'Last updated timestamp'
508511
| 'Learn about staking link'

0 commit comments

Comments
 (0)