-
Notifications
You must be signed in to change notification settings - Fork 10k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c2119fc
commit 0ca2cf8
Showing
3 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { createAuxContext } from './fixtures/createAuxContext'; | ||
import { Users } from './fixtures/userStates'; | ||
import { HomeChannel } from './page-objects'; | ||
import { createTargetChannel, setSettingValueById } from './utils'; | ||
import { expect, test } from './utils/test'; | ||
|
||
test.use({ storageState: Users.admin.state }); | ||
|
||
test.describe.serial('read-receipt', () => { | ||
let poHomeChannel: HomeChannel; | ||
let targetChannel: string; | ||
|
||
test.beforeAll(async ({ api }) => { | ||
await setSettingValueById(api, 'Message_Read_Receipt_Enabled', true); | ||
targetChannel = await createTargetChannel(api); | ||
}); | ||
|
||
test.beforeEach(async ({ page }) => { | ||
poHomeChannel = new HomeChannel(page); | ||
|
||
await page.goto('/home'); | ||
}); | ||
|
||
test('should show read receipts message sent status in the sent message', async () => { | ||
await poHomeChannel.sidenav.openChat(targetChannel); | ||
await poHomeChannel.content.sendMessage('hello world'); | ||
|
||
await expect(poHomeChannel.content.lastUserMessage.getByRole('status', { name: 'Message sent' })).toBeVisible(); | ||
}); | ||
|
||
test('should show read receipts message viewed status in the sent message', async ({ browser }) => { | ||
const { page } = await createAuxContext(browser, Users.user1); | ||
const auxContext = { page, poHomeChannel: new HomeChannel(page) }; | ||
await auxContext.poHomeChannel.sidenav.openChat(targetChannel); | ||
await auxContext.poHomeChannel.content.sendMessage('hello admin'); | ||
|
||
await poHomeChannel.sidenav.openChat(targetChannel); | ||
await expect(poHomeChannel.content.lastUserMessage.getByRole('status', { name: 'Message viewed' })).toBeVisible(); | ||
|
||
await auxContext.page.close(); | ||
}); | ||
|
||
test('should show the reads receipt modal with the users who read the message', async ({ page, api }) => { | ||
await setSettingValueById(api, 'Message_Read_Receipt_Store_Users', true); | ||
|
||
await poHomeChannel.sidenav.openChat(targetChannel); | ||
await poHomeChannel.content.openLastMessageMenu(); | ||
await page.locator('role=menuitem[name="Info"]').click(); | ||
|
||
await expect(page.getByRole('dialog').getByRole('listitem')).toHaveCount(2); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export * from './create-target-channel'; | ||
export * from './setSettingValueById'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters