diff --git a/apps/meteor/tests/e2e/channel-management.spec.ts b/apps/meteor/tests/e2e/channel-management.spec.ts index d74e91acab303..07d9f9290e0a0 100644 --- a/apps/meteor/tests/e2e/channel-management.spec.ts +++ b/apps/meteor/tests/e2e/channel-management.spec.ts @@ -28,6 +28,7 @@ test.describe.serial('channel-management', () => { await poHomeChannel.navbar.openChat(targetChannel); await poHomeChannel.content.sendMessage('hello composer'); await poHomeChannel.roomHeaderFavoriteBtn.focus(); + await expect(poHomeChannel.roomHeaderFavoriteBtn).toBeFocused(); await page.keyboard.press('Tab'); await page.keyboard.press('Tab'); @@ -40,6 +41,7 @@ test.describe.serial('channel-management', () => { test('should move the focus away from toolbar using tab key', async ({ page }) => { await poHomeChannel.navbar.openChat(targetChannel); await poHomeChannel.roomHeaderFavoriteBtn.focus(); + await expect(poHomeChannel.roomHeaderFavoriteBtn).toBeFocused(); await page.keyboard.press('Tab'); await page.keyboard.press('Tab'); @@ -137,6 +139,7 @@ test.describe.serial('channel-management', () => { test('should open room info when clicking on roomName', async ({ page }) => { await poHomeChannel.navbar.openChat(targetChannel); await page.getByRole('button', { name: targetChannel }).first().focus(); + await expect(page.getByRole('button', { name: targetChannel }).first()).toBeFocused(); await page.keyboard.press('Space'); await page.getByRole('dialog').waitFor(); @@ -159,6 +162,7 @@ test.describe.serial('channel-management', () => { await page.getByRole('listitem', { name: discussionName }).getByRole('button', { name: 'Reply' }).click(); await page.getByRole('button', { name: `Back to ${targetChannel} channel`, exact: true }).focus(); + await expect(page.getByRole('button', { name: `Back to ${targetChannel} channel`, exact: true })).toBeFocused(); await page.keyboard.press('Space'); await expect(page).toHaveURL(`/channel/${targetChannel}`); diff --git a/apps/meteor/tests/e2e/e2e-encryption/e2ee-file-encryption.spec.ts b/apps/meteor/tests/e2e/e2e-encryption/e2ee-file-encryption.spec.ts index 0c246f0425d14..7e3d2eca348cb 100644 --- a/apps/meteor/tests/e2e/e2e-encryption/e2ee-file-encryption.spec.ts +++ b/apps/meteor/tests/e2e/e2e-encryption/e2ee-file-encryption.spec.ts @@ -77,7 +77,7 @@ test.describe('E2EE File Encryption', () => { await poHomeChannel.content.openLastMessageMenu(); await poHomeChannel.content.btnOptionEditMessage.click(); - expect(await poHomeChannel.composer.inputMessage.inputValue()).toBe('any_description'); + await expect(poHomeChannel.composer.inputMessage).toHaveValue('any_description'); await poHomeChannel.composer.inputMessage.fill('edited any_description'); await page.keyboard.press('Enter'); diff --git a/apps/meteor/tests/e2e/feature-preview.spec.ts b/apps/meteor/tests/e2e/feature-preview.spec.ts index 260da835e3a1a..68c150fb5d56d 100644 --- a/apps/meteor/tests/e2e/feature-preview.spec.ts +++ b/apps/meteor/tests/e2e/feature-preview.spec.ts @@ -106,8 +106,7 @@ test.describe.serial('feature preview', () => { test('should display new channel from team on the sidepanel', async ({ page, api }) => { newChannelModal = new CreateNewChannelModal(page); - await page.goto(`/group/${sidepanelTeam}`); - await poHomeTeam.content.waitForChannel(); + await poHomeTeam.gotoGroup(sidepanelTeam); await poHomeTeam.headerToolbar.openTeamChannels(); await poHomeTeam.tabs.channels.btnCreateNew.click(); @@ -143,8 +142,8 @@ test.describe.serial('feature preview', () => { await expect(poHomeChannel.sidepanel.getItemByName(sidepanelTeam)).not.toHaveText(parsedWrong); }); - test('should show channel in sidepanel after adding existing one', async ({ page }) => { - await page.goto(`/group/${sidepanelTeam}`); + test('should show channel in sidepanel after adding existing one', async () => { + await poHomeTeam.gotoGroup(sidepanelTeam); await poHomeTeam.headerToolbar.openTeamChannels(); await poHomeTeam.tabs.channels.addExistingChannel(targetChannel); @@ -156,7 +155,7 @@ test.describe.serial('feature preview', () => { const user1Page = await browser.newPage({ storageState: Users.user1.state }); const user1Channel = new HomeChannel(user1Page); - await page.goto(`/group/${sidepanelTeam}`); + await poHomeTeam.gotoGroup(sidepanelTeam); await poHomeTeam.headerToolbar.openTeamChannels(); await poHomeTeam.tabs.channels.addExistingChannel(targetChannel); @@ -225,9 +224,8 @@ test.describe.serial('feature preview', () => { await expect(poHomeChannel.sidebar.discussionsTeamCollabFilter).toBeVisible(); }); - test('should show favorite team on the sidepanel', async ({ page }) => { - await page.goto(`/group/${sidepanelTeam}`); - await poHomeChannel.content.waitForChannel(); + test('should show favorite team on the sidepanel', async () => { + await poHomeChannel.gotoGroup(sidepanelTeam); await poHomeChannel.sidebar.favoritesTeamCollabFilter.click(); await expect(poHomeChannel.sidepanel.getTeamItemByName(sidepanelTeam)).not.toBeVisible(); @@ -239,8 +237,7 @@ test.describe.serial('feature preview', () => { test('should show discussion in discussions and all sidepanel filter, should remove after deleting discussion', async ({ page }) => { const poHomeDiscussion = new HomeDiscussion(page); - await page.goto(`/group/${sidepanelTeam}`); - await poHomeChannel.content.waitForChannel(); + await poHomeChannel.gotoGroup(sidepanelTeam); const discussionName = faker.string.uuid(); diff --git a/apps/meteor/tests/e2e/messaging.spec.ts b/apps/meteor/tests/e2e/messaging.spec.ts index b862952a48a4f..5733d5ae6dfbd 100644 --- a/apps/meteor/tests/e2e/messaging.spec.ts +++ b/apps/meteor/tests/e2e/messaging.spec.ts @@ -142,6 +142,7 @@ test.describe('Messaging', () => { test('should focus the latest message when moving the focus on the list and theres no previous focus', async ({ page }) => { await page.getByRole('button', { name: targetChannel }).first().focus(); + await expect(page.getByRole('button', { name: targetChannel }).first()).toBeFocused(); await test.step('move focus to the list', async () => { await page.keyboard.press('Tab'); @@ -152,6 +153,7 @@ test.describe('Messaging', () => { await test.step('move focus to the list again', async () => { await page.getByRole('button', { name: targetChannel }).first().focus(); + await expect(page.getByRole('button', { name: targetChannel }).first()).toBeFocused(); await page.keyboard.press('Tab'); await page.keyboard.press('Tab'); await page.keyboard.press('Tab'); @@ -165,9 +167,10 @@ test.describe('Messaging', () => { await channelPage.navbar.openChat(targetChannel); await test.step('focus on the second message', async () => { + await expect(channelPage.composer.inputMessage).toBeFocused(); await page.keyboard.press('ArrowUp'); - expect(await channelPage.composer.inputMessage.inputValue()).toBe('msg2'); + await expect(channelPage.composer.inputMessage).toHaveValue('msg2'); }); await test.step('send edited message', async () => { @@ -187,6 +190,7 @@ test.describe('Messaging', () => { ); for (const element of ['edited msg2 a', 'edited msg2 b', 'edited msg2 c', 'edited msg2 d', 'edited msg2 e']) { + await expect(channelPage.composer.inputMessage).toBeFocused(); await page.keyboard.press('ArrowUp'); await channelPage.content.sendMessage(element, false); diff --git a/apps/meteor/tests/e2e/page-objects/home-channel.ts b/apps/meteor/tests/e2e/page-objects/home-channel.ts index bc44a80dba5f7..dcdf7cf77c0f5 100644 --- a/apps/meteor/tests/e2e/page-objects/home-channel.ts +++ b/apps/meteor/tests/e2e/page-objects/home-channel.ts @@ -101,6 +101,11 @@ export class HomeChannel { await this.content.waitForChannel(); } + async gotoGroup(name: string) { + await this.page.goto(`/group/${name}`); + await this.content.waitForChannel(); + } + get btnContextualbarClose(): Locator { return this.page.locator('[data-qa="ContextualbarActionClose"]'); } diff --git a/apps/meteor/tests/e2e/rooms-join.spec.ts b/apps/meteor/tests/e2e/rooms-join.spec.ts index 16e9afb053739..4e410f67764ed 100644 --- a/apps/meteor/tests/e2e/rooms-join.spec.ts +++ b/apps/meteor/tests/e2e/rooms-join.spec.ts @@ -143,8 +143,8 @@ test.describe.serial('Join rooms', () => { await api.post('/groups.delete', { roomId: group._id }); }); - test('should let a parent member join a discussion in a private channel', async ({ page }) => { - await page.goto(`/group/${discussion.name}`); + test('should let a parent member join a discussion in a private channel', async () => { + await poHomeChannel.gotoGroup(discussion.name); await expect(poHomeChannel.composer.btnJoinRoom).toBeVisible(); await poHomeChannel.composer.btnJoinRoom.click(); diff --git a/apps/meteor/tests/e2e/sidebar.spec.ts b/apps/meteor/tests/e2e/sidebar.spec.ts index 5c95f4cc72fd5..cebe9f1131db6 100644 --- a/apps/meteor/tests/e2e/sidebar.spec.ts +++ b/apps/meteor/tests/e2e/sidebar.spec.ts @@ -64,6 +64,7 @@ test.describe.serial('Sidebar', () => { }); test('should navigate on navbar toolbar pressing tab', async ({ page }) => { await poHomeChannel.navbar.btnHome.focus(); + await expect(poHomeChannel.navbar.btnHome).toBeFocused(); await test.step('move focus to directory button', async () => { await page.keyboard.press('Tab'); @@ -135,6 +136,7 @@ test.describe.serial('Sidebar', () => { await expect(async () => { await collapser.focus(); + await expect(collapser).toBeFocused(); await page.keyboard.press('Space'); const isExpanded = (await collapser.getAttribute('aria-expanded')) === 'true'; expect(isExpanded).toBeTruthy(); diff --git a/apps/meteor/tests/e2e/team-management.spec.ts b/apps/meteor/tests/e2e/team-management.spec.ts index 26487727e7e1f..1de89bd8f25b5 100644 --- a/apps/meteor/tests/e2e/team-management.spec.ts +++ b/apps/meteor/tests/e2e/team-management.spec.ts @@ -254,6 +254,7 @@ test.describe.serial('teams-management', () => { test('should access team channel through targetTeam header', async ({ page }) => { await poHomeTeam.navbar.openChat(targetChannel); await page.getByRole('button', { name: targetChannel }).first().focus(); + await expect(page.getByRole('button', { name: targetChannel }).first()).toBeFocused(); await page.keyboard.press('Shift+Tab'); await page.keyboard.press('Space'); @@ -437,8 +438,7 @@ test.describe.serial('teams-management', () => { test('should user1 leave from targetTeam', async ({ browser }) => { const user1Page = await browser.newPage({ storageState: Users.user1.state }); const user1Channel = new HomeTeam(user1Page); - await user1Page.goto(`/group/${targetTeam}`); - await user1Channel.content.waitForChannel(); + await user1Channel.gotoGroup(targetTeam); await user1Channel.headerToolbar.openTeamInfo(); await user1Channel.tabs.room.leaveRoom(); diff --git a/apps/meteor/tests/e2e/video-conference.spec.ts b/apps/meteor/tests/e2e/video-conference.spec.ts index 2c6842aefe213..56776f39d08d8 100644 --- a/apps/meteor/tests/e2e/video-conference.spec.ts +++ b/apps/meteor/tests/e2e/video-conference.spec.ts @@ -49,6 +49,7 @@ test.describe('video conference', () => { await poHomeChannel.navbar.openChat(targetChannel); await poHomeChannel.content.sendMessage('hello video conference'); await poHomeChannel.roomHeaderFavoriteBtn.focus(); + await expect(poHomeChannel.roomHeaderFavoriteBtn).toBeFocused(); await test.step('opens video conference popup', async () => { await page.keyboard.press('Tab');