Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
refactor: use page object for Reply in DM menu item locator in e2e tests
  • Loading branch information
ricardogarim committed Apr 8, 2026
commit daef4a13c877e92aa76908c76743913453b90fea
8 changes: 4 additions & 4 deletions apps/meteor/tests/e2e/message-actions.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,11 @@ test.describe.serial('message-actions', () => {
await sendTargetChannelMessage(api, targetChannel, { msg: 'message from admin for reply in DM' });
});

test('expect option not be visible without create-d permission and no existing DM', async ({ page, api }) => {
test('expect option not be visible without create-d permission and no existing DM', async ({ api }) => {
expect((await api.post('/permissions.update', { permissions: [{ _id: 'create-d', roles: ['admin'] }] })).status()).toBe(200);

await poHomeChannel.content.openLastMessageMenu();
await expect(page.locator('role=menuitem[name="Reply in direct message"]')).toBeHidden();
await expect(poHomeChannel.content.btnOptionReplyInDm).toBeHidden();
});

test('expect option be visible and redirect to DM', async ({ page, api }) => {
Expand All @@ -182,7 +182,7 @@ test.describe.serial('message-actions', () => {
).toBe(200);

await poHomeChannel.content.openLastMessageMenu();
await page.locator('role=menuitem[name="Reply in direct message"]').click();
await poHomeChannel.content.btnOptionReplyInDm.click();

await expect(page).toHaveURL(/.*reply/);
});
Expand All @@ -209,7 +209,7 @@ test.describe.serial('message-actions', () => {
test('expect reply the message in direct', async ({ page }) => {
await poHomeChannel.content.sendMessage('this is a message for reply in direct');
await poHomeChannel.content.openLastMessageMenu();
await page.locator('role=menuitem[name="Reply in direct message"]').click();
await poHomeChannel.content.btnOptionReplyInDm.click();

await expect(page).toHaveURL(/.*reply/);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,10 @@ export class HomeContent {
return this.menuMore.getByRole('menuitem', { name: 'Star', exact: true });
}

get btnOptionReplyInDm(): Locator {
return this.menuMore.getByRole('menuitem', { name: 'Reply in direct message', exact: true });
}

get btnVoiceCall(): Locator {
return this.primaryRoomActionsToolbar.getByRole('button', { name: 'Voice call' });
}
Expand Down
Loading