Skip to content

Commit 071d541

Browse files
committed
improve test
Signed-off-by: Abhinav Kumar <abhinav@avitechlab.com>
1 parent cc17fd2 commit 071d541

File tree

1 file changed

+21
-25
lines changed

1 file changed

+21
-25
lines changed

apps/meteor/tests/e2e/global-search.spec.ts

Lines changed: 21 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -55,33 +55,29 @@ test.describe.serial('Global Search', () => {
5555
]),
5656
);
5757

58-
test(
59-
'opens correct message when jumping from global search in group to channel thread',
60-
{
61-
tag: '@channel',
62-
annotation: {
63-
type: 'issue',
64-
description: 'https://rocketchat.atlassian.net/browse/SUP-858',
65-
},
66-
},
67-
async ({ page }) => {
68-
await page.goto(`/group/${targetGroup.name}/rocket-search`);
58+
test.beforeEach(async ({ page }) => {
59+
await page.goto('/');
60+
});
6961

70-
await expect(page.getByText('Global search')).toBeVisible();
71-
await page.getByText('Global search').click();
62+
test('opens correct message when jumping from global search in group to channel thread', async ({ page }) => {
63+
await page.goto(`/group/${targetGroup.name}`);
64+
await expect(page.getByTitle('Search Messages')).toBeVisible();
65+
await page.getByTitle('Search Messages').click();
7266

73-
await expect(page.getByPlaceholder('Search Messages')).toBeVisible();
74-
await page.getByPlaceholder('Search Messages').fill(threadMessage.msg.slice(10)); // fill partial text to match search
67+
await expect(page.getByText('Global search')).toBeVisible({ timeout: 10000 });
68+
await page.getByText('Global search').click();
7569

76-
const message = page.getByRole('listitem').filter({ hasText: threadMessage.msg });
77-
await expect(message).toBeVisible();
78-
await message.hover();
79-
const jumpToMessageButton = message.getByTitle('Jump to message');
80-
await expect(jumpToMessageButton).toBeVisible();
81-
await jumpToMessageButton.click();
70+
await expect(page.getByPlaceholder('Search Messages')).toBeVisible();
71+
await page.getByPlaceholder('Search Messages').fill(threadMessage.msg.slice(10)); // fill partial text to match search
8272

83-
await expect(page.locator('header').getByRole('button').filter({ hasText: targetChannel.name })).toBeVisible(); // match channel name in room header
84-
await expect(page.getByText(threadMessage.msg)).toBeVisible();
85-
},
86-
);
73+
const message = page.getByRole('listitem').filter({ hasText: threadMessage.msg });
74+
await expect(message).toBeVisible();
75+
await message.hover();
76+
const jumpToMessageButton = message.getByTitle('Jump to message');
77+
await expect(jumpToMessageButton).toBeVisible();
78+
await jumpToMessageButton.click();
79+
80+
await expect(page.locator('header').getByRole('button').filter({ hasText: targetChannel.name })).toBeVisible(); // match channel name in room header
81+
await expect(page.getByText(threadMessage.msg)).toBeVisible();
82+
});
8783
});

0 commit comments

Comments
 (0)