Skip to content

Commit 7183f05

Browse files
test: channel-management tests running before home page is ready (RocketChat#40028)
1 parent 53e036c commit 7183f05

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

apps/meteor/tests/e2e/channel-management.spec.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ test.describe.serial('channel-management', () => {
2121
poHomeChannel = new HomeChannel(page);
2222

2323
await page.goto('/home');
24+
await poHomeChannel.waitForHome();
2425
});
2526

2627
test('should navigate on toolbar using arrow keys', async ({ page }) => {
@@ -57,7 +58,7 @@ test.describe.serial('channel-management', () => {
5758
await expect(poHomeChannel.content.getSystemMessageByText('added user1')).toBeVisible();
5859
});
5960

60-
test('should edit topic of targetChannel', async ({ page }) => {
61+
test('should edit topic of targetChannel', async () => {
6162
await poHomeChannel.navbar.openChat(targetChannel);
6263
await poHomeChannel.roomToolbar.openRoomInfo();
6364
await poHomeChannel.tabs.room.btnEdit.click();
@@ -67,11 +68,11 @@ test.describe.serial('channel-management', () => {
6768
await poHomeChannel.toastMessage.dismissToast();
6869
await poHomeChannel.roomToolbar.openRoomInfo();
6970

70-
await expect(page.getByRole('dialog', { name: 'Channel info' })).toContainText('hello-topic-edited');
71+
await expect(poHomeChannel.tabs.room.panelChannelInfo).toContainText('hello-topic-edited');
7172
await expect(poHomeChannel.content.getSystemMessageByText('changed room topic to hello-topic-edited')).toBeVisible();
7273
});
7374

74-
test('should edit announcement of targetChannel', async ({ page }) => {
75+
test('should edit announcement of targetChannel', async () => {
7576
await poHomeChannel.navbar.openChat(targetChannel);
7677
await poHomeChannel.roomToolbar.openRoomInfo();
7778
await poHomeChannel.tabs.room.btnEdit.click();
@@ -80,11 +81,11 @@ test.describe.serial('channel-management', () => {
8081

8182
await poHomeChannel.toastMessage.dismissToast();
8283
await poHomeChannel.roomToolbar.openRoomInfo();
83-
await expect(page.getByRole('dialog', { name: 'Channel info' })).toContainText('hello-announcement-edited');
84+
await expect(poHomeChannel.tabs.room.panelChannelInfo).toContainText('hello-announcement-edited');
8485
await expect(poHomeChannel.content.getSystemMessageByText('changed room announcement to: hello-announcement-edited')).toBeVisible();
8586
});
8687

87-
test('should edit description of targetChannel', async ({ page }) => {
88+
test('should edit description of targetChannel', async () => {
8889
await poHomeChannel.navbar.openChat(targetChannel);
8990
await poHomeChannel.roomToolbar.openRoomInfo();
9091
await poHomeChannel.tabs.room.btnEdit.click();
@@ -93,7 +94,7 @@ test.describe.serial('channel-management', () => {
9394

9495
await poHomeChannel.toastMessage.dismissToast();
9596
await poHomeChannel.roomToolbar.openRoomInfo();
96-
await expect(page.getByRole('dialog', { name: 'Channel info' })).toContainText('hello-description-edited');
97+
await expect(poHomeChannel.tabs.room.panelChannelInfo).toContainText('hello-description-edited');
9798
await expect(poHomeChannel.content.getSystemMessageByText('changed room description to: hello-description-edited')).toBeVisible();
9899
});
99100

@@ -105,7 +106,7 @@ test.describe.serial('channel-management', () => {
105106
await poHomeChannel.tabs.room.btnSave.click();
106107

107108
targetChannel = `NAME-EDITED-${targetChannel}`;
108-
await expect(page.locator(`role=main >> role=heading[name="${targetChannel}"]`)).toBeVisible();
109+
await expect(page.getByRole('main').getByRole('heading', { name: targetChannel })).toBeVisible();
109110
await poHomeChannel.navbar.openChat(targetChannel);
110111

111112
await expect(page).toHaveURL(`/channel/${targetChannel}`);

apps/meteor/tests/e2e/page-objects/fragments/home-flextab-room.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,4 +131,8 @@ export class HomeFlextabRoom {
131131
await this.checkboxChannels.click();
132132
await this.checkboxDiscussions.click();
133133
}
134+
135+
get panelChannelInfo(): Locator {
136+
return this.page.getByRole('dialog', { name: 'Channel info' });
137+
}
134138
}

0 commit comments

Comments
 (0)