Some checks failed
Create issues from TODOs / todos (push) Failing after 3s
Close inactive issues / close-issues (push) Has been cancelled
Deploy GitHub Pages / deploy-preview (push) Has been cancelled
CI / ⚙️ Variables Setup (push) Has been cancelled
CI / ⚙️ Test Guard (push) Has been cancelled
CI / 🚀 Notify external services - draft (push) Has been cancelled
CI / 📦 Build Packages (push) Has been cancelled
CI / 📦 Meteor Build (coverage) (push) Has been cancelled
CI / 📦 Meteor Build (production) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [account-service presence-service omnichannel-transcript-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [account-service presence-service omnichannel-transcript-service], fips) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [authorization-service queue-worker-service ddp-streamer-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [authorization-service queue-worker-service ddp-streamer-service], fips) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], coverage) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], fips) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [account-service presence-service omnichannel-transcript-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [authorization-service queue-worker-service ddp-streamer-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [rocketchat], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [rocketchat], coverage) (push) Has been cancelled
CI / 🚢 Publish Docker Images (ghcr.io) (push) Has been cancelled
CI / 📦 Track Image Sizes (push) Has been cancelled
CI / 🔎 Code Check - Action Lint (push) Has been cancelled
CI / 🔎 Code Check (push) Has been cancelled
CI / 🔨 Test Storybook (push) Has been cancelled
CI / 🔨 Test Unit (push) Has been cancelled
CI / 🔨 Test API (CE) (push) Has been cancelled
CI / 🔨 Test API Livechat (CE) (push) Has been cancelled
CI / 🔨 Test UI (CE) (push) Has been cancelled
CI / 🔨 Test API (EE) (push) Has been cancelled
CI / 🔨 Test API Livechat (EE) (push) Has been cancelled
CI / 🔨 Test API Apps (deno-runtime - EE) (push) Has been cancelled
CI / 🔨 Test UI (EE) (push) Has been cancelled
CI / 🔨 Test API (FIPS) (push) Has been cancelled
CI / 🔨 Test API Livechat (FIPS) (push) Has been cancelled
CI / 🔨 Test UI (FIPS) (push) Has been cancelled
CI / 🔨 Test Federation Matrix (push) Has been cancelled
CI / 📊 Report Coverage (push) Has been cancelled
CI / ✅ Tests Done (push) Has been cancelled
CI / 🚀 Publish build assets (push) Has been cancelled
CI / 🚀 Publish Docker Images (DockerHub) (push) Has been cancelled
CI / 🚀 Notify external services (push) Has been cancelled
CI / Update Version Durability (push) Has been cancelled
Release / Release (push) Has been cancelled
Auto-close duplicate issues / auto-close-duplicates (push) Failing after 1s
Code scanning - action / CodeQL-Build (push) Failing after 1s
79 lines
3.4 KiB
TypeScript
79 lines
3.4 KiB
TypeScript
import type { Page } from '@playwright/test';
|
|
|
|
import { IS_EE } from './config/constants';
|
|
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-receipts-thread', () => {
|
|
let poHomeChannel: HomeChannel;
|
|
let targetChannel: string;
|
|
let auxContext: { page: Page; poHomeChannel: HomeChannel } | undefined;
|
|
|
|
test.skip(!IS_EE, 'Enterprise Only');
|
|
|
|
test.beforeAll(async ({ api }) => {
|
|
targetChannel = await createTargetChannel(api, { members: ['user1'] });
|
|
await setSettingValueById(api, 'Message_Read_Receipt_Enabled', true);
|
|
await setSettingValueById(api, 'Message_Read_Receipt_Store_Users', true);
|
|
});
|
|
|
|
test.afterAll(async ({ api }) => {
|
|
await setSettingValueById(api, 'Message_Read_Receipt_Enabled', false);
|
|
await setSettingValueById(api, 'Message_Read_Receipt_Store_Users', false);
|
|
});
|
|
|
|
test.beforeEach(async ({ page }) => {
|
|
poHomeChannel = new HomeChannel(page);
|
|
await poHomeChannel.goto();
|
|
});
|
|
|
|
test.afterEach(async () => {
|
|
if (auxContext) {
|
|
await auxContext.page.close();
|
|
}
|
|
auxContext = undefined;
|
|
});
|
|
|
|
test('should show read receipt as viewed in thread when both users have the thread open', async ({ browser }) => {
|
|
await poHomeChannel.navbar.openChat(targetChannel);
|
|
await poHomeChannel.content.sendMessage('thread parent message');
|
|
await poHomeChannel.content.openReplyInThread();
|
|
await poHomeChannel.content.sendMessageInThread('first thread reply');
|
|
|
|
const { page: auxPage } = await createAuxContext(browser, Users.user1);
|
|
auxContext = { page: auxPage, poHomeChannel: new HomeChannel(auxPage) };
|
|
await auxContext.poHomeChannel.navbar.openChat(targetChannel);
|
|
await auxContext.poHomeChannel.content.openReplyInThread();
|
|
|
|
// the read receipt only flips once user1 has actually read the reply, so wait for it to render on their side first
|
|
await expect(auxContext.poHomeChannel.content.lastUserThreadMessage).toContainText('first thread reply');
|
|
|
|
await expect(poHomeChannel.content.lastUserThreadMessage.getByRole('status', { name: 'Message viewed' })).toBeVisible();
|
|
});
|
|
|
|
test('should show read receipt as viewed when the last unread user opens the thread', async ({ browser }) => {
|
|
const { page: auxPage } = await createAuxContext(browser, Users.user1);
|
|
auxContext = { page: auxPage, poHomeChannel: new HomeChannel(auxPage) };
|
|
await auxContext.poHomeChannel.navbar.openChat(targetChannel);
|
|
|
|
await poHomeChannel.navbar.openChat(targetChannel);
|
|
await poHomeChannel.content.sendMessage('thread for delayed read');
|
|
await poHomeChannel.content.openReplyInThread();
|
|
await poHomeChannel.content.sendMessageInThread('reply in thread');
|
|
|
|
await expect(poHomeChannel.content.lastUserThreadMessage.getByRole('status', { name: 'Message sent' })).toBeVisible();
|
|
|
|
await expect(auxContext.poHomeChannel.content.lastThreadMessagePreview).toContainText('reply in thread');
|
|
|
|
await auxContext.poHomeChannel.content.openReplyInThread();
|
|
|
|
await expect(poHomeChannel.content.lastUserThreadMessage.getByRole('status', { name: 'Message viewed' })).toBeVisible();
|
|
await expect(auxContext.poHomeChannel.content.lastUserThreadMessage.getByRole('status', { name: 'Message viewed' })).toBeVisible();
|
|
});
|
|
});
|