From 99ac5c4f9dc57f1d4516f0033f9467bf27dab877 Mon Sep 17 00:00:00 2001 From: Jessica Schelly Souza Date: Mon, 4 May 2026 12:11:17 -0300 Subject: [PATCH 1/4] test: fix channel flaky navigation --- apps/meteor/tests/e2e/export-messages.spec.ts | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/apps/meteor/tests/e2e/export-messages.spec.ts b/apps/meteor/tests/e2e/export-messages.spec.ts index eb5c5f5fa474b..5e3a9ed32dcdd 100644 --- a/apps/meteor/tests/e2e/export-messages.spec.ts +++ b/apps/meteor/tests/e2e/export-messages.spec.ts @@ -20,7 +20,8 @@ test.describe('export-messages', () => { test.beforeEach(async ({ page }) => { poHomeChannel = new HomeChannel(page); - await page.goto('/home'); + await page.goto(`/channel/${targetChannel}`); + await poHomeChannel.content.waitForChannel(); }); test.afterAll(async ({ api }) => { @@ -31,7 +32,6 @@ test.describe('export-messages', () => { }); test('should all export methods be available in targetChannel', async () => { - await poHomeChannel.navbar.openChat(targetChannel); await poHomeChannel.roomToolbar.openMoreOptions(); await poHomeChannel.roomToolbar.menuItemExportMessages.click(); @@ -42,7 +42,6 @@ test.describe('export-messages', () => { }); test('should display export output format correctly depending on the selected method', async () => { - await poHomeChannel.navbar.openChat(targetChannel); await poHomeChannel.roomToolbar.openMoreOptions(); await poHomeChannel.roomToolbar.menuItemExportMessages.click(); @@ -71,7 +70,6 @@ test.describe('export-messages', () => { test('when trying to send email without filling to users or to additional emails, should mark both fields as invalid', async () => { const testMessage = uniqueMessage(); - await poHomeChannel.navbar.openChat(targetChannel); await poHomeChannel.content.sendMessage(testMessage); await poHomeChannel.roomToolbar.openMoreOptions(); await poHomeChannel.roomToolbar.menuItemExportMessages.click(); @@ -94,7 +92,6 @@ test.describe('export-messages', () => { }); test('should display an error when trying to send email without selecting any message', async ({ page }) => { - await poHomeChannel.navbar.openChat(targetChannel); await poHomeChannel.roomToolbar.openMoreOptions(); await poHomeChannel.roomToolbar.menuItemExportMessages.click(); @@ -112,7 +109,6 @@ test.describe('export-messages', () => { const message1 = uniqueMessage(); const message2 = uniqueMessage(); - await poHomeChannel.navbar.openChat(targetChannel); await poHomeChannel.content.sendMessage(message1); await poHomeChannel.roomToolbar.openMoreOptions(); await poHomeChannel.roomToolbar.menuItemExportMessages.click(); @@ -128,7 +124,6 @@ test.describe('export-messages', () => { const message1 = uniqueMessage(); const message2 = uniqueMessage(); - await poHomeChannel.navbar.openChat(targetChannel); await poHomeChannel.content.sendMessage(message1); await poHomeChannel.content.sendMessage(message2); @@ -153,7 +148,6 @@ test.describe('export-messages', () => { const message1 = uniqueMessage(); const message2 = uniqueMessage(); - await poHomeChannel.navbar.openChat(targetChannel); await poHomeChannel.content.sendMessage(message1); await poHomeChannel.content.sendMessage(message2); From a980423c8e5effbcad5ce2d0e95c21dce2e3f565 Mon Sep 17 00:00:00 2001 From: Jessica Schelly Souza Date: Mon, 4 May 2026 12:41:05 -0300 Subject: [PATCH 2/4] test: change remaining navigation channels --- apps/meteor/tests/e2e/emojis.spec.ts | 14 ++++----- apps/meteor/tests/e2e/export-messages.spec.ts | 2 +- .../meteor/tests/e2e/files-management.spec.ts | 4 +-- apps/meteor/tests/e2e/message-actions.spec.ts | 29 ++++++++++++------- .../meteor/tests/e2e/message-composer.spec.ts | 18 ++---------- .../tests/e2e/page-objects/home-channel.ts | 4 +++ apps/meteor/tests/e2e/read-receipts.spec.ts | 9 +++--- apps/meteor/tests/e2e/report-message.spec.ts | 19 ++++-------- apps/meteor/tests/e2e/threads.spec.ts | 8 ++--- 9 files changed, 46 insertions(+), 61 deletions(-) diff --git a/apps/meteor/tests/e2e/emojis.spec.ts b/apps/meteor/tests/e2e/emojis.spec.ts index 6f0c99284c525..88c9f6e30e195 100644 --- a/apps/meteor/tests/e2e/emojis.spec.ts +++ b/apps/meteor/tests/e2e/emojis.spec.ts @@ -17,11 +17,11 @@ test.describe.serial('emoji', () => { test.beforeEach(async ({ page }) => { poHomeChannel = new HomeChannel(page); - await page.goto('/home'); + await poHomeChannel.gotoChannel(targetChannel); + await poHomeChannel.content.waitForChannel(); }); test('should display emoji picker properly', async ({ page }) => { - await poHomeChannel.navbar.openChat(targetChannel); await poHomeChannel.composer.btnEmoji.click(); await test.step('should display scroller', async () => { @@ -37,7 +37,6 @@ test.describe.serial('emoji', () => { }); await test.step('should pick and send grinning emoji', async () => { - await poHomeChannel.navbar.openChat(targetChannel); await poHomeChannel.pickEmoji('grinning'); await page.keyboard.press('Enter'); @@ -46,7 +45,6 @@ test.describe.serial('emoji', () => { }); test('expect send emoji via text', async ({ page }) => { - await poHomeChannel.navbar.openChat(targetChannel); await poHomeChannel.content.sendMessage(':innocent:'); await page.keyboard.press('Enter'); @@ -54,8 +52,6 @@ test.describe.serial('emoji', () => { }); test('expect render special characters and numbers properly', async () => { - await poHomeChannel.navbar.openChat(targetChannel); - await poHomeChannel.content.sendMessage('® © ™ # *'); await expect(poHomeChannel.content.lastUserMessage).toContainText('® © ™ # *'); }); @@ -79,7 +75,8 @@ test.describe.serial('emoji', () => { await poAdminEmoji.addEmojiFlexTab.save(); await poAdminEmoji.sidebar.close(); - await poHomeChannel.navbar.openChat(targetChannel); + await poHomeChannel.gotoChannel(targetChannel); + await poHomeChannel.content.waitForChannel(); await poHomeChannel.content.sendMessage(`:${emojiName}:`); await page.keyboard.press('Enter'); @@ -94,7 +91,8 @@ test.describe.serial('emoji', () => { await poAdminEmoji.editEmojiFlexTab.save(); await poAdminEmoji.sidebar.close(); - await poHomeChannel.navbar.openChat(targetChannel); + await poHomeChannel.gotoChannel(targetChannel); + await poHomeChannel.content.waitForChannel(); await poHomeChannel.content.sendMessage(`:${newEmojiName}:`); await page.keyboard.press('Enter'); diff --git a/apps/meteor/tests/e2e/export-messages.spec.ts b/apps/meteor/tests/e2e/export-messages.spec.ts index 5e3a9ed32dcdd..7399cbc805f32 100644 --- a/apps/meteor/tests/e2e/export-messages.spec.ts +++ b/apps/meteor/tests/e2e/export-messages.spec.ts @@ -20,7 +20,7 @@ test.describe('export-messages', () => { test.beforeEach(async ({ page }) => { poHomeChannel = new HomeChannel(page); - await page.goto(`/channel/${targetChannel}`); + await poHomeChannel.gotoChannel(targetChannel); await poHomeChannel.content.waitForChannel(); }); diff --git a/apps/meteor/tests/e2e/files-management.spec.ts b/apps/meteor/tests/e2e/files-management.spec.ts index 55d9e41dcb172..8dad3d07c7a77 100644 --- a/apps/meteor/tests/e2e/files-management.spec.ts +++ b/apps/meteor/tests/e2e/files-management.spec.ts @@ -18,8 +18,8 @@ test.describe.serial('files-management', () => { test.beforeEach(async ({ page }) => { poHomeChannel = new HomeChannel(page); - await page.goto('/home'); - await poHomeChannel.navbar.openChat(targetChannel); + await poHomeChannel.gotoChannel(targetChannel); + await poHomeChannel.content.waitForChannel(); }); test.afterAll(async ({ api }) => { diff --git a/apps/meteor/tests/e2e/message-actions.spec.ts b/apps/meteor/tests/e2e/message-actions.spec.ts index 0561ba13e136d..6cbb142a50ba0 100644 --- a/apps/meteor/tests/e2e/message-actions.spec.ts +++ b/apps/meteor/tests/e2e/message-actions.spec.ts @@ -19,8 +19,8 @@ test.describe.serial('message-actions', () => { }); test.beforeEach(async ({ page }) => { poHomeChannel = new HomeChannel(page); - await page.goto('/home'); - await poHomeChannel.navbar.openChat(targetChannel); + await poHomeChannel.gotoChannel(targetChannel); + await poHomeChannel.content.waitForChannel(); }); test('expect reply the message', async ({ page }) => { @@ -127,7 +127,8 @@ test.describe.serial('message-actions', () => { await createDiscussionModal.inputName.fill(discussionName); await createButton.click(); await expect(page.locator('header h1')).toHaveText(discussionName); - await poHomeChannel.navbar.openChat(targetChannel); + await poHomeChannel.gotoChannel(targetChannel); + await poHomeChannel.content.waitForChannel(); // Should fail if more than one discussion has been created await expect(poHomeChannel.content.getMessageByText(discussionName)).toHaveCount(1); }); @@ -203,8 +204,8 @@ test.describe.serial('message-actions', () => { }); test.beforeEach(async ({ page }) => { poHomeChannel = new HomeChannel(page); - await page.goto('/home'); - await poHomeChannel.navbar.openChat(targetChannel); + await poHomeChannel.gotoChannel(targetChannel); + await poHomeChannel.content.waitForChannel(); }); test('expect reply the message in direct', async ({ page }) => { await poHomeChannel.content.sendMessage('this is a message for reply in direct'); @@ -220,7 +221,8 @@ test.describe.serial('message-actions', () => { await poHomeChannel.content.sendMessage(message); await poHomeChannel.content.forwardMessage(forwardChannel); - await poHomeChannel.navbar.openChat(forwardChannel); + await poHomeChannel.gotoChannel(forwardChannel); + await poHomeChannel.content.waitForChannel(); await expect(poHomeChannel.content.lastUserMessage).toContainText(message); }); @@ -253,7 +255,8 @@ test.describe.serial('message-actions', () => { await poHomeChannel.content.forwardMessage(forwardChannel); - await poHomeChannel.navbar.openChat(forwardChannel); + await poHomeChannel.gotoChannel(forwardChannel); + await poHomeChannel.content.waitForChannel(); await expect(poHomeChannel.content.lastUserMessage).toContainText(filename); }); @@ -265,7 +268,8 @@ test.describe.serial('message-actions', () => { await poHomeChannel.content.forwardMessage(forwardChannel); - await poHomeChannel.navbar.openChat(forwardChannel); + await poHomeChannel.gotoChannel(forwardChannel); + await poHomeChannel.content.waitForChannel(); await expect(poHomeChannel.content.lastUserMessage).toContainText(filename); }); @@ -277,7 +281,8 @@ test.describe.serial('message-actions', () => { await poHomeChannel.content.forwardMessage(forwardChannel); - await poHomeChannel.navbar.openChat(forwardChannel); + await poHomeChannel.gotoChannel(forwardChannel); + await poHomeChannel.content.waitForChannel(); await expect(poHomeChannel.content.lastUserMessage).toContainText(filename); }); @@ -289,7 +294,8 @@ test.describe.serial('message-actions', () => { await poHomeChannel.content.forwardMessage(forwardChannel); - await poHomeChannel.navbar.openChat(forwardChannel); + await poHomeChannel.gotoChannel(forwardChannel); + await poHomeChannel.content.waitForChannel(); await expect(poHomeChannel.content.lastUserMessage).toContainText(filename); }); @@ -301,7 +307,8 @@ test.describe.serial('message-actions', () => { await poHomeChannel.content.forwardMessage(forwardChannel); - await poHomeChannel.navbar.openChat(forwardChannel); + await poHomeChannel.gotoChannel(forwardChannel); + await poHomeChannel.content.waitForChannel(); await expect(poHomeChannel.content.lastUserMessage).toContainText(filename); }); }); diff --git a/apps/meteor/tests/e2e/message-composer.spec.ts b/apps/meteor/tests/e2e/message-composer.spec.ts index a36a6afd7a290..1b8a4b9ff4c67 100644 --- a/apps/meteor/tests/e2e/message-composer.spec.ts +++ b/apps/meteor/tests/e2e/message-composer.spec.ts @@ -18,11 +18,11 @@ test.describe.serial('message-composer', () => { test.beforeEach(async ({ page }) => { poHomeChannel = new HomeChannel(page); - await page.goto('/home'); + await poHomeChannel.gotoChannel(targetChannel); + await poHomeChannel.content.waitForChannel(); }); test('should have all formatters and the main actions visible on toolbar', async () => { - await poHomeChannel.navbar.openChat(targetChannel); await poHomeChannel.content.sendMessage('hello composer'); await expect(poHomeChannel.composer.allPrimaryActions).toHaveCount(12); @@ -30,14 +30,11 @@ test.describe.serial('message-composer', () => { test('should have only the main formatter and the main action', async ({ page }) => { await page.setViewportSize({ width: 768, height: 600 }); - await poHomeChannel.navbar.openChat(targetChannel); await expect(poHomeChannel.composer.allPrimaryActions).toHaveCount(6); }); test('should navigate on toolbar using arrow keys', async ({ page }) => { - await poHomeChannel.navbar.openChat(targetChannel); - await page.keyboard.press('Tab'); await page.keyboard.press('ArrowRight'); await page.keyboard.press('ArrowRight'); @@ -48,8 +45,6 @@ test.describe.serial('message-composer', () => { }); test('should move the focus away from toolbar using tab key', async ({ page }) => { - await poHomeChannel.navbar.openChat(targetChannel); - await page.keyboard.press('Tab'); await page.keyboard.press('Tab'); @@ -58,7 +53,6 @@ test.describe.serial('message-composer', () => { test('should add a link to the selected text', async ({ page }) => { const url = faker.internet.url(); - await poHomeChannel.navbar.openChat(targetChannel); await page.keyboard.type('hello composer'); await page.keyboard.press('Control+A'); // on Windows and Linux @@ -71,7 +65,6 @@ test.describe.serial('message-composer', () => { }); test('should select popup item and not send the message when pressing enter', async ({ page }) => { - await poHomeChannel.navbar.openChat(targetChannel); await poHomeChannel.content.sendMessage('hello composer'); await test.step('mention popup', async () => { @@ -106,7 +99,6 @@ test.describe.serial('message-composer', () => { }); test('should list popup items correctly', async ({ page }) => { - await poHomeChannel.navbar.openChat(targetChannel); await poHomeChannel.content.sendMessage('hello composer'); await test.step('mention popup', async () => { @@ -117,7 +109,6 @@ test.describe.serial('message-composer', () => { }); test('should close mention popup when canceling a message edit via "Cancel" button', async ({ page }) => { - await poHomeChannel.navbar.openChat(targetChannel); await poHomeChannel.content.sendMessage('hello composer'); await test.step('expect to edit last message', async () => { @@ -145,7 +136,6 @@ test.describe.serial('message-composer', () => { }); test('should close mention popup when canceling a message edit via keyboard', async ({ page }) => { - await poHomeChannel.navbar.openChat(targetChannel); await poHomeChannel.content.sendMessage('hello composer'); await test.step('expect to edit last message', async () => { @@ -174,8 +164,6 @@ test.describe.serial('message-composer', () => { test.describe('audio recorder', () => { test('should open audio recorder', async () => { - await poHomeChannel.navbar.openChat(targetChannel); - await test.step('should be able to record an audio with text content in composer ', async () => { await poHomeChannel.composer.inputMessage.fill('this is a message with audio message'); await expect(poHomeChannel.composer.btnAudioMessage).toBeEnabled(); @@ -186,7 +174,6 @@ test.describe.serial('message-composer', () => { }); test('should stop recording when clicking on cancel', async () => { - await poHomeChannel.navbar.openChat(targetChannel); await poHomeChannel.composer.btnAudioMessage.click(); await expect(poHomeChannel.audioRecorder).toBeVisible(); @@ -195,7 +182,6 @@ test.describe.serial('message-composer', () => { }); test('should attach file to the composer when clicking on "Finish recording"', async ({ page }) => { - await poHomeChannel.navbar.openChat(targetChannel); await poHomeChannel.composer.btnAudioMessage.click(); await expect(poHomeChannel.audioRecorder).toBeVisible(); diff --git a/apps/meteor/tests/e2e/page-objects/home-channel.ts b/apps/meteor/tests/e2e/page-objects/home-channel.ts index 523b7e0996899..32d25e4ab3f61 100644 --- a/apps/meteor/tests/e2e/page-objects/home-channel.ts +++ b/apps/meteor/tests/e2e/page-objects/home-channel.ts @@ -96,6 +96,10 @@ export class HomeChannel { return this.page.goto('/home'); } + gotoChannel(name: string) { + return this.page.goto(`/channel/${name}`); + } + get btnContextualbarClose(): Locator { return this.page.locator('[data-qa="ContextualbarActionClose"]'); } diff --git a/apps/meteor/tests/e2e/read-receipts.spec.ts b/apps/meteor/tests/e2e/read-receipts.spec.ts index fbd091860a98d..99051d582eba8 100644 --- a/apps/meteor/tests/e2e/read-receipts.spec.ts +++ b/apps/meteor/tests/e2e/read-receipts.spec.ts @@ -22,12 +22,12 @@ test.describe.serial('read-receipts', () => { test.beforeEach(async ({ page }) => { poHomeChannel = new HomeChannel(page); - await page.goto('/home'); + await poHomeChannel.gotoChannel(targetChannel); + await poHomeChannel.content.waitForChannel(); }); test.describe('read receipt settings disabled', async () => { test('should not show read receipts item menu', async ({ page }) => { - await poHomeChannel.navbar.openChat(targetChannel); await poHomeChannel.content.sendMessage('hello world'); await poHomeChannel.content.openLastMessageMenu(); await expect(page.locator('role=menuitem[name="Read receipts"]')).not.toBeVisible(); @@ -57,19 +57,18 @@ test.describe.serial('read-receipts', () => { test('should show read receipts message sent status in the sent message', async ({ browser }) => { const { page } = await createAuxContext(browser, Users.user1); auxContext = { page, poHomeChannel: new HomeChannel(page) }; - await auxContext.poHomeChannel.navbar.openChat(targetChannel); + await auxContext.poHomeChannel.gotoChannel(targetChannel); + await auxContext.poHomeChannel.content.waitForChannel(); await auxContext.poHomeChannel.content.sendMessage('hello admin'); await expect(auxContext.poHomeChannel.content.lastUserMessage.getByRole('status', { name: 'Message sent' })).toBeVisible(); }); test('should show read receipts message viewed status in the sent message', async () => { - await poHomeChannel.navbar.openChat(targetChannel); await expect(poHomeChannel.content.lastUserMessage.getByRole('status', { name: 'Message viewed' })).toBeVisible(); }); test('should show the reads receipt modal with the users who read the message', async ({ page }) => { - await poHomeChannel.navbar.openChat(targetChannel); await poHomeChannel.content.openLastMessageMenu(); await page.locator('role=menuitem[name="Read receipts"]').click(); diff --git a/apps/meteor/tests/e2e/report-message.spec.ts b/apps/meteor/tests/e2e/report-message.spec.ts index 40e0fdfe8dccf..24bba2fff50ad 100644 --- a/apps/meteor/tests/e2e/report-message.spec.ts +++ b/apps/meteor/tests/e2e/report-message.spec.ts @@ -34,20 +34,21 @@ test.describe.serial('report message', () => { test.beforeEach(async ({ page }) => { poHomeChannel = new HomeChannel(page); - await page.goto('/home'); - await adminPage.goto('/home'); + await poHomeChannel.gotoChannel(targetChannel); + await poHomeChannel.content.waitForChannel(); + const adminHomeChannel = new HomeChannel(adminPage); + await adminHomeChannel.gotoChannel(targetChannel); + await adminHomeChannel.content.waitForChannel(); }); test('should show report message option in message menu for other users messages', async () => { await test.step('send message as user1', async () => { - await poHomeChannel.navbar.openChat(targetChannel); const testMessage = faker.lorem.sentence(); await poHomeChannel.content.sendMessage(testMessage); }); await test.step('verify report option is visible for the other user', async () => { const adminHomeChannel = new HomeChannel(adminPage); - await adminHomeChannel.navbar.openChat(targetChannel); await adminHomeChannel.content.openLastMessageMenu(); await expect(adminPage.getByRole('menuitem', { name: 'Report' })).toBeVisible(); }); @@ -55,7 +56,6 @@ test.describe.serial('report message', () => { test('should not show report message option in message menu for own messages', async ({ page }) => { await test.step('send message as user1', async () => { - await poHomeChannel.navbar.openChat(targetChannel); const testMessage = faker.lorem.sentence(); await poHomeChannel.content.sendMessage(testMessage); }); @@ -68,15 +68,12 @@ test.describe.serial('report message', () => { test('should validate empty report description', async () => { await test.step('send message as user1', async () => { - await poHomeChannel.navbar.openChat(targetChannel); const testMessage = faker.lorem.sentence(); await poHomeChannel.content.sendMessage(testMessage); }); await test.step('try to submit empty report', async () => { const adminHomeChannel = new HomeChannel(adminPage); - await adminHomeChannel.navbar.openChat(targetChannel); - await adminHomeChannel.content.openLastMessageMenu(); await adminPage.getByRole('menuitem', { name: 'Report' }).click(); await reportModal.submitReport(); @@ -85,15 +82,12 @@ test.describe.serial('report message', () => { test('should be able to cancel reporting a message', async () => { await test.step('send message as user1', async () => { - await poHomeChannel.navbar.openChat(targetChannel); const testMessage = faker.lorem.sentence(); await poHomeChannel.content.sendMessage(testMessage); }); await test.step('open and cancel report modal', async () => { const adminHomeChannel = new HomeChannel(adminPage); - await adminHomeChannel.navbar.openChat(targetChannel); - await adminHomeChannel.content.openLastMessageMenu(); await adminPage.getByRole('menuitem', { name: 'Report' }).click(); await reportModal.cancelReport(); @@ -105,7 +99,6 @@ test.describe.serial('report message', () => { let reportDescription: string; await test.step('send message as user1', async () => { - await poHomeChannel.navbar.openChat(targetChannel); testMessage = faker.lorem.sentence(); await poHomeChannel.content.sendMessage(testMessage); }); @@ -114,8 +107,6 @@ test.describe.serial('report message', () => { reportDescription = faker.lorem.sentence(); const adminHomeChannel = new HomeChannel(adminPage); - await adminHomeChannel.navbar.openChat(targetChannel); - await adminHomeChannel.content.openLastMessageMenu(); await adminPage.getByRole('menuitem', { name: 'Report' }).click(); await reportModal.submitReport(reportDescription); diff --git a/apps/meteor/tests/e2e/threads.spec.ts b/apps/meteor/tests/e2e/threads.spec.ts index 88782e0d2b3e1..15845eac829d3 100644 --- a/apps/meteor/tests/e2e/threads.spec.ts +++ b/apps/meteor/tests/e2e/threads.spec.ts @@ -12,8 +12,8 @@ test.describe.serial('Threads', () => { }); test.beforeEach(async ({ page }) => { poHomeChannel = new HomeChannel(page); - await page.goto('/home'); - await poHomeChannel.navbar.openChat(targetChannel); + await poHomeChannel.gotoChannel(targetChannel); + await poHomeChannel.content.waitForChannel(); }); test.afterAll(async ({ api }) => deleteChannel(api, targetChannel)); @@ -92,8 +92,8 @@ test.describe.serial('Threads', () => { test.describe('thread message actions', () => { test.beforeEach(async ({ page }) => { poHomeChannel = new HomeChannel(page); - await page.goto('/home'); - await poHomeChannel.navbar.openChat(targetChannel); + await poHomeChannel.gotoChannel(targetChannel); + await poHomeChannel.content.waitForChannel(); await poHomeChannel.content.sendMessage('this is a message for reply'); await poHomeChannel.content.openReplyInThread(); }); From 72cdec52d26838041b7c018b8eea32bffb81d3eb Mon Sep 17 00:00:00 2001 From: Jessica Schelly Souza Date: Mon, 4 May 2026 12:45:45 -0300 Subject: [PATCH 3/4] fix: add missing ones --- apps/meteor/tests/e2e/report-message.spec.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/apps/meteor/tests/e2e/report-message.spec.ts b/apps/meteor/tests/e2e/report-message.spec.ts index 24bba2fff50ad..83c8476ecdf67 100644 --- a/apps/meteor/tests/e2e/report-message.spec.ts +++ b/apps/meteor/tests/e2e/report-message.spec.ts @@ -11,6 +11,7 @@ test.use({ storageState: Users.user1.state }); test.describe.serial('report message', () => { let poHomeChannel: HomeChannel; + let adminHomeChannel: HomeChannel; let targetChannel: string; let adminPage: Page; let reportModal: ReportMessageModal; @@ -33,10 +34,10 @@ test.describe.serial('report message', () => { test.beforeEach(async ({ page }) => { poHomeChannel = new HomeChannel(page); + adminHomeChannel = new HomeChannel(adminPage); await poHomeChannel.gotoChannel(targetChannel); await poHomeChannel.content.waitForChannel(); - const adminHomeChannel = new HomeChannel(adminPage); await adminHomeChannel.gotoChannel(targetChannel); await adminHomeChannel.content.waitForChannel(); }); @@ -48,7 +49,6 @@ test.describe.serial('report message', () => { }); await test.step('verify report option is visible for the other user', async () => { - const adminHomeChannel = new HomeChannel(adminPage); await adminHomeChannel.content.openLastMessageMenu(); await expect(adminPage.getByRole('menuitem', { name: 'Report' })).toBeVisible(); }); @@ -73,7 +73,6 @@ test.describe.serial('report message', () => { }); await test.step('try to submit empty report', async () => { - const adminHomeChannel = new HomeChannel(adminPage); await adminHomeChannel.content.openLastMessageMenu(); await adminPage.getByRole('menuitem', { name: 'Report' }).click(); await reportModal.submitReport(); @@ -87,7 +86,6 @@ test.describe.serial('report message', () => { }); await test.step('open and cancel report modal', async () => { - const adminHomeChannel = new HomeChannel(adminPage); await adminHomeChannel.content.openLastMessageMenu(); await adminPage.getByRole('menuitem', { name: 'Report' }).click(); await reportModal.cancelReport(); @@ -106,7 +104,6 @@ test.describe.serial('report message', () => { await test.step('report message as the other user', async () => { reportDescription = faker.lorem.sentence(); - const adminHomeChannel = new HomeChannel(adminPage); await adminHomeChannel.content.openLastMessageMenu(); await adminPage.getByRole('menuitem', { name: 'Report' }).click(); await reportModal.submitReport(reportDescription); From 7aba1e9427fcab657d230c79023eeaaf0be3379f Mon Sep 17 00:00:00 2001 From: Jessica Schelly Souza Date: Mon, 4 May 2026 16:39:27 -0300 Subject: [PATCH 4/4] fix: add wait on gotoChannel --- apps/meteor/tests/e2e/emojis.spec.ts | 3 --- apps/meteor/tests/e2e/export-messages.spec.ts | 1 - apps/meteor/tests/e2e/files-management.spec.ts | 1 - apps/meteor/tests/e2e/message-actions.spec.ts | 9 --------- apps/meteor/tests/e2e/message-composer.spec.ts | 1 - apps/meteor/tests/e2e/page-objects/home-channel.ts | 5 +++-- apps/meteor/tests/e2e/read-receipts.spec.ts | 2 -- apps/meteor/tests/e2e/report-message.spec.ts | 2 -- apps/meteor/tests/e2e/threads.spec.ts | 3 +-- 9 files changed, 4 insertions(+), 23 deletions(-) diff --git a/apps/meteor/tests/e2e/emojis.spec.ts b/apps/meteor/tests/e2e/emojis.spec.ts index 88c9f6e30e195..b14b0986a720b 100644 --- a/apps/meteor/tests/e2e/emojis.spec.ts +++ b/apps/meteor/tests/e2e/emojis.spec.ts @@ -18,7 +18,6 @@ test.describe.serial('emoji', () => { poHomeChannel = new HomeChannel(page); await poHomeChannel.gotoChannel(targetChannel); - await poHomeChannel.content.waitForChannel(); }); test('should display emoji picker properly', async ({ page }) => { @@ -76,7 +75,6 @@ test.describe.serial('emoji', () => { await poAdminEmoji.sidebar.close(); await poHomeChannel.gotoChannel(targetChannel); - await poHomeChannel.content.waitForChannel(); await poHomeChannel.content.sendMessage(`:${emojiName}:`); await page.keyboard.press('Enter'); @@ -92,7 +90,6 @@ test.describe.serial('emoji', () => { await poAdminEmoji.sidebar.close(); await poHomeChannel.gotoChannel(targetChannel); - await poHomeChannel.content.waitForChannel(); await poHomeChannel.content.sendMessage(`:${newEmojiName}:`); await page.keyboard.press('Enter'); diff --git a/apps/meteor/tests/e2e/export-messages.spec.ts b/apps/meteor/tests/e2e/export-messages.spec.ts index 7399cbc805f32..faf25d830667e 100644 --- a/apps/meteor/tests/e2e/export-messages.spec.ts +++ b/apps/meteor/tests/e2e/export-messages.spec.ts @@ -21,7 +21,6 @@ test.describe('export-messages', () => { poHomeChannel = new HomeChannel(page); await poHomeChannel.gotoChannel(targetChannel); - await poHomeChannel.content.waitForChannel(); }); test.afterAll(async ({ api }) => { diff --git a/apps/meteor/tests/e2e/files-management.spec.ts b/apps/meteor/tests/e2e/files-management.spec.ts index 8dad3d07c7a77..5b37ec4fb061c 100644 --- a/apps/meteor/tests/e2e/files-management.spec.ts +++ b/apps/meteor/tests/e2e/files-management.spec.ts @@ -19,7 +19,6 @@ test.describe.serial('files-management', () => { poHomeChannel = new HomeChannel(page); await poHomeChannel.gotoChannel(targetChannel); - await poHomeChannel.content.waitForChannel(); }); test.afterAll(async ({ api }) => { diff --git a/apps/meteor/tests/e2e/message-actions.spec.ts b/apps/meteor/tests/e2e/message-actions.spec.ts index 6cbb142a50ba0..26ec840ee0b30 100644 --- a/apps/meteor/tests/e2e/message-actions.spec.ts +++ b/apps/meteor/tests/e2e/message-actions.spec.ts @@ -20,7 +20,6 @@ test.describe.serial('message-actions', () => { test.beforeEach(async ({ page }) => { poHomeChannel = new HomeChannel(page); await poHomeChannel.gotoChannel(targetChannel); - await poHomeChannel.content.waitForChannel(); }); test('expect reply the message', async ({ page }) => { @@ -128,7 +127,6 @@ test.describe.serial('message-actions', () => { await createButton.click(); await expect(page.locator('header h1')).toHaveText(discussionName); await poHomeChannel.gotoChannel(targetChannel); - await poHomeChannel.content.waitForChannel(); // Should fail if more than one discussion has been created await expect(poHomeChannel.content.getMessageByText(discussionName)).toHaveCount(1); }); @@ -205,7 +203,6 @@ test.describe.serial('message-actions', () => { test.beforeEach(async ({ page }) => { poHomeChannel = new HomeChannel(page); await poHomeChannel.gotoChannel(targetChannel); - await poHomeChannel.content.waitForChannel(); }); test('expect reply the message in direct', async ({ page }) => { await poHomeChannel.content.sendMessage('this is a message for reply in direct'); @@ -222,7 +219,6 @@ test.describe.serial('message-actions', () => { await poHomeChannel.content.forwardMessage(forwardChannel); await poHomeChannel.gotoChannel(forwardChannel); - await poHomeChannel.content.waitForChannel(); await expect(poHomeChannel.content.lastUserMessage).toContainText(message); }); @@ -256,7 +252,6 @@ test.describe.serial('message-actions', () => { await poHomeChannel.content.forwardMessage(forwardChannel); await poHomeChannel.gotoChannel(forwardChannel); - await poHomeChannel.content.waitForChannel(); await expect(poHomeChannel.content.lastUserMessage).toContainText(filename); }); @@ -269,7 +264,6 @@ test.describe.serial('message-actions', () => { await poHomeChannel.content.forwardMessage(forwardChannel); await poHomeChannel.gotoChannel(forwardChannel); - await poHomeChannel.content.waitForChannel(); await expect(poHomeChannel.content.lastUserMessage).toContainText(filename); }); @@ -282,7 +276,6 @@ test.describe.serial('message-actions', () => { await poHomeChannel.content.forwardMessage(forwardChannel); await poHomeChannel.gotoChannel(forwardChannel); - await poHomeChannel.content.waitForChannel(); await expect(poHomeChannel.content.lastUserMessage).toContainText(filename); }); @@ -295,7 +288,6 @@ test.describe.serial('message-actions', () => { await poHomeChannel.content.forwardMessage(forwardChannel); await poHomeChannel.gotoChannel(forwardChannel); - await poHomeChannel.content.waitForChannel(); await expect(poHomeChannel.content.lastUserMessage).toContainText(filename); }); @@ -308,7 +300,6 @@ test.describe.serial('message-actions', () => { await poHomeChannel.content.forwardMessage(forwardChannel); await poHomeChannel.gotoChannel(forwardChannel); - await poHomeChannel.content.waitForChannel(); await expect(poHomeChannel.content.lastUserMessage).toContainText(filename); }); }); diff --git a/apps/meteor/tests/e2e/message-composer.spec.ts b/apps/meteor/tests/e2e/message-composer.spec.ts index 1b8a4b9ff4c67..7af3095ed04e4 100644 --- a/apps/meteor/tests/e2e/message-composer.spec.ts +++ b/apps/meteor/tests/e2e/message-composer.spec.ts @@ -19,7 +19,6 @@ test.describe.serial('message-composer', () => { poHomeChannel = new HomeChannel(page); await poHomeChannel.gotoChannel(targetChannel); - await poHomeChannel.content.waitForChannel(); }); test('should have all formatters and the main actions visible on toolbar', async () => { diff --git a/apps/meteor/tests/e2e/page-objects/home-channel.ts b/apps/meteor/tests/e2e/page-objects/home-channel.ts index 32d25e4ab3f61..bc44a80dba5f7 100644 --- a/apps/meteor/tests/e2e/page-objects/home-channel.ts +++ b/apps/meteor/tests/e2e/page-objects/home-channel.ts @@ -96,8 +96,9 @@ export class HomeChannel { return this.page.goto('/home'); } - gotoChannel(name: string) { - return this.page.goto(`/channel/${name}`); + async gotoChannel(name: string) { + await this.page.goto(`/channel/${name}`); + await this.content.waitForChannel(); } get btnContextualbarClose(): Locator { diff --git a/apps/meteor/tests/e2e/read-receipts.spec.ts b/apps/meteor/tests/e2e/read-receipts.spec.ts index 99051d582eba8..583697336676b 100644 --- a/apps/meteor/tests/e2e/read-receipts.spec.ts +++ b/apps/meteor/tests/e2e/read-receipts.spec.ts @@ -23,7 +23,6 @@ test.describe.serial('read-receipts', () => { poHomeChannel = new HomeChannel(page); await poHomeChannel.gotoChannel(targetChannel); - await poHomeChannel.content.waitForChannel(); }); test.describe('read receipt settings disabled', async () => { @@ -58,7 +57,6 @@ test.describe.serial('read-receipts', () => { const { page } = await createAuxContext(browser, Users.user1); auxContext = { page, poHomeChannel: new HomeChannel(page) }; await auxContext.poHomeChannel.gotoChannel(targetChannel); - await auxContext.poHomeChannel.content.waitForChannel(); await auxContext.poHomeChannel.content.sendMessage('hello admin'); await expect(auxContext.poHomeChannel.content.lastUserMessage.getByRole('status', { name: 'Message sent' })).toBeVisible(); diff --git a/apps/meteor/tests/e2e/report-message.spec.ts b/apps/meteor/tests/e2e/report-message.spec.ts index 83c8476ecdf67..f12b4eff6ec67 100644 --- a/apps/meteor/tests/e2e/report-message.spec.ts +++ b/apps/meteor/tests/e2e/report-message.spec.ts @@ -37,9 +37,7 @@ test.describe.serial('report message', () => { adminHomeChannel = new HomeChannel(adminPage); await poHomeChannel.gotoChannel(targetChannel); - await poHomeChannel.content.waitForChannel(); await adminHomeChannel.gotoChannel(targetChannel); - await adminHomeChannel.content.waitForChannel(); }); test('should show report message option in message menu for other users messages', async () => { diff --git a/apps/meteor/tests/e2e/threads.spec.ts b/apps/meteor/tests/e2e/threads.spec.ts index 15845eac829d3..485afdd38fed5 100644 --- a/apps/meteor/tests/e2e/threads.spec.ts +++ b/apps/meteor/tests/e2e/threads.spec.ts @@ -7,13 +7,13 @@ test.use({ storageState: Users.admin.state }); test.describe.serial('Threads', () => { let poHomeChannel: HomeChannel; let targetChannel: string; + test.beforeAll(async ({ api }) => { targetChannel = await createTargetChannel(api); }); test.beforeEach(async ({ page }) => { poHomeChannel = new HomeChannel(page); await poHomeChannel.gotoChannel(targetChannel); - await poHomeChannel.content.waitForChannel(); }); test.afterAll(async ({ api }) => deleteChannel(api, targetChannel)); @@ -93,7 +93,6 @@ test.describe.serial('Threads', () => { test.beforeEach(async ({ page }) => { poHomeChannel = new HomeChannel(page); await poHomeChannel.gotoChannel(targetChannel); - await poHomeChannel.content.waitForChannel(); await poHomeChannel.content.sendMessage('this is a message for reply'); await poHomeChannel.content.openReplyInThread(); });