From f61849a9b61754d7bd3679d435ee1137970ed598 Mon Sep 17 00:00:00 2001 From: juliajforesti Date: Fri, 17 Jan 2025 11:36:37 -0300 Subject: [PATCH 1/4] test: feature-preview flaky tests --- .../tests/e2e/page-objects/fragments/home-flextab-channels.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/meteor/tests/e2e/page-objects/fragments/home-flextab-channels.ts b/apps/meteor/tests/e2e/page-objects/fragments/home-flextab-channels.ts index b7040c9bd2794..3dff26c02554c 100644 --- a/apps/meteor/tests/e2e/page-objects/fragments/home-flextab-channels.ts +++ b/apps/meteor/tests/e2e/page-objects/fragments/home-flextab-channels.ts @@ -20,7 +20,7 @@ export class HomeFlextabChannels { } get inputChannels(): Locator { - return this.page.locator('#modal-root input').first(); + return this.page.locator('#modal-root').getByRole('dialog').getByRole('textbox'); } get btnAdd(): Locator { From 9b98bf1797cab603d8d26fde092ce2b73e75f9d7 Mon Sep 17 00:00:00 2001 From: juliajforesti Date: Mon, 20 Jan 2025 20:16:25 -0300 Subject: [PATCH 2/4] test: fix flaky --- apps/meteor/tests/e2e/feature-preview.spec.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/apps/meteor/tests/e2e/feature-preview.spec.ts b/apps/meteor/tests/e2e/feature-preview.spec.ts index 85969debb8fc8..97ce132b8708f 100644 --- a/apps/meteor/tests/e2e/feature-preview.spec.ts +++ b/apps/meteor/tests/e2e/feature-preview.spec.ts @@ -298,9 +298,12 @@ test.describe.serial('feature preview', () => { await targetChannelItem.click(); expect(page.url()).toContain(`/channel/${targetChannel}`); await poHomeChannel.content.sendMessage('hello channel'); - await sidepanelTeamItem.focus(); - await sidepanelTeamItem.click(); - expect(page.url()).toContain(`/group/${sidepanelTeam}`); + + await expect(async () => { + await sidepanelTeamItem.focus(); + await sidepanelTeamItem.click(); + expect(page.url()).toContain(`/group/${sidepanelTeam}`); + }).toPass(); await poHomeChannel.content.sendMessage('hello team'); await user1Page.goto(`/channel/${targetChannel}`); From ad16aaef28291879eff1e1558a58eccd39eada44 Mon Sep 17 00:00:00 2001 From: juliajforesti Date: Wed, 22 Jan 2025 14:13:46 -0300 Subject: [PATCH 3/4] test: replace `fill` with `pressSequentially` --- apps/meteor/tests/e2e/feature-preview.spec.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/meteor/tests/e2e/feature-preview.spec.ts b/apps/meteor/tests/e2e/feature-preview.spec.ts index 97ce132b8708f..2296958713c0d 100644 --- a/apps/meteor/tests/e2e/feature-preview.spec.ts +++ b/apps/meteor/tests/e2e/feature-preview.spec.ts @@ -272,7 +272,7 @@ test.describe.serial('feature preview', () => { await poHomeChannel.tabs.btnChannels.click(); await poHomeChannel.tabs.channels.btnAddExisting.click(); - await poHomeChannel.tabs.channels.inputChannels.fill(targetChannel); + await poHomeChannel.tabs.channels.inputChannels.pressSequentially(targetChannel); await page.getByRole('listbox').getByRole('option', { name: targetChannel }).click(); await poHomeChannel.tabs.channels.btnAdd.click(); await poHomeChannel.content.waitForChannel(); @@ -288,7 +288,7 @@ test.describe.serial('feature preview', () => { await poHomeChannel.tabs.btnChannels.click(); await poHomeChannel.tabs.channels.btnAddExisting.click(); - await poHomeChannel.tabs.channels.inputChannels.fill(targetChannel); + await poHomeChannel.tabs.channels.inputChannels.pressSequentially(targetChannel); await page.getByRole('listbox').getByRole('option', { name: targetChannel }).click(); await poHomeChannel.tabs.channels.btnAdd.click(); From 21c640d6771449f1effb028c1d5110133532983d Mon Sep 17 00:00:00 2001 From: juliajforesti Date: Thu, 23 Jan 2025 18:23:43 -0300 Subject: [PATCH 4/4] test: fix flaky addExisting channel --- apps/meteor/tests/e2e/feature-preview.spec.ts | 19 +++++++++++++++---- .../fragments/home-flextab-channels.ts | 4 ++++ 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/apps/meteor/tests/e2e/feature-preview.spec.ts b/apps/meteor/tests/e2e/feature-preview.spec.ts index 2296958713c0d..dc3222714a74c 100644 --- a/apps/meteor/tests/e2e/feature-preview.spec.ts +++ b/apps/meteor/tests/e2e/feature-preview.spec.ts @@ -272,8 +272,14 @@ test.describe.serial('feature preview', () => { await poHomeChannel.tabs.btnChannels.click(); await poHomeChannel.tabs.channels.btnAddExisting.click(); - await poHomeChannel.tabs.channels.inputChannels.pressSequentially(targetChannel); - await page.getByRole('listbox').getByRole('option', { name: targetChannel }).click(); + // flaky: workarround for when AutoComplete does not close the list box before trying to click `Add` + await expect(async () => { + await poHomeChannel.tabs.channels.inputChannels.fill(targetChannel); + const option = poHomeChannel.tabs.channels.getListboxOption(targetChannel); + await option.click(); + await expect(option).not.toBeVisible(); + }).toPass(); + await poHomeChannel.tabs.channels.btnAdd.click(); await poHomeChannel.content.waitForChannel(); @@ -288,8 +294,13 @@ test.describe.serial('feature preview', () => { await poHomeChannel.tabs.btnChannels.click(); await poHomeChannel.tabs.channels.btnAddExisting.click(); - await poHomeChannel.tabs.channels.inputChannels.pressSequentially(targetChannel); - await page.getByRole('listbox').getByRole('option', { name: targetChannel }).click(); + // flaky: workarround for when AutoComplete does not close the list box before trying to click `Add` + await expect(async () => { + await poHomeChannel.tabs.channels.inputChannels.fill(targetChannel); + const option = poHomeChannel.tabs.channels.getListboxOption(targetChannel); + await option.click(); + await expect(option).not.toBeVisible(); + }).toPass(); await poHomeChannel.tabs.channels.btnAdd.click(); const sidepanelTeamItem = poHomeChannel.sidepanel.getItemByName(sidepanelTeam); diff --git a/apps/meteor/tests/e2e/page-objects/fragments/home-flextab-channels.ts b/apps/meteor/tests/e2e/page-objects/fragments/home-flextab-channels.ts index 3dff26c02554c..7b95c17d14c49 100644 --- a/apps/meteor/tests/e2e/page-objects/fragments/home-flextab-channels.ts +++ b/apps/meteor/tests/e2e/page-objects/fragments/home-flextab-channels.ts @@ -31,6 +31,10 @@ export class HomeFlextabChannels { return this.channelsTab.getByRole('list'); } + getListboxOption(name: string): Locator { + return this.page.getByRole('listbox').getByRole('option', { name }); + } + channelOption(name: string) { return this.channelsTab.locator('li', { hasText: name }); }