Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: flaky feature-preview #34960

Merged
merged 7 commits into from
Jan 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 21 additions & 7 deletions apps/meteor/tests/e2e/feature-preview.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand All @@ -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);
Expand All @@ -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}`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 });
}
Expand Down
Loading