diff --git a/apps/meteor/tests/e2e/feature-preview.spec.ts b/apps/meteor/tests/e2e/feature-preview.spec.ts index 85969debb8fc8..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.fill(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.fill(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); @@ -298,9 +309,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}`); 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..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 @@ -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 { @@ -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 }); }