Skip to content

Commit ecac9bc

Browse files
niamh-colemanprithivraj
authored andcommitted
Updating the UI tests to use the new modal close button where needed
1 parent ecd2bd1 commit ecac9bc

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

example/e2e/helpers.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,17 @@ const closeOverlay = async (customCloseButtonId?: string) => {
4545
await closeButton.waitForDisplayed({ timeout: 22000 });
4646
await closeButton.click();
4747
};
48+
49+
const closeModalOverlay = async (customCloseButtonId?: string) => {
50+
const buttonId = browser.isAndroid ? `~Close` : customCloseButtonId || `~intercom modal close button`;
51+
52+
const closeButton = await $(buttonId);
53+
await closeButton.waitForDisplayed({ timeout: 22000 });
54+
await closeButton.click();
55+
};
56+
4857
browser.addCommand('closeOverlay', closeOverlay);
58+
browser.addCommand('closeModalOverlay', closeModalOverlay);
4959

5060
const closeArticleOverlay = async () => {
5161
if (browser.isAndroid) {
@@ -55,7 +65,7 @@ const closeArticleOverlay = async () => {
5565
await closeButton.waitForDisplayed({ timeout: 22000 });
5666
await closeButton.click();
5767
} else {
58-
await closeOverlay();
68+
await closeModalOverlay();
5969
}
6070
};
6171
browser.addCommand('closeArticleOverlay', closeArticleOverlay);

example/e2e/tests/mainIntercom.e2e.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ describe('Intercom E2E', () => {
7070
it('Should display carousel', async () => {
7171
await driver.scrollToElementByAccessibilityLabel('display-carousel');
7272
await (await $('~display-carousel')).click();
73-
await driver.closeOverlay();
73+
await driver.closeModalOverlay();
7474
});
7575

7676
it('Should get unread messages count', async () => {

0 commit comments

Comments
 (0)