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
107 lines
4.1 KiB
TypeScript
107 lines
4.1 KiB
TypeScript
import type { Page } from '@playwright/test';
|
|
|
|
import { createFakeVisitor } from '../../mocks/data';
|
|
import { ADMIN_CREDENTIALS, IS_EE } from '../config/constants';
|
|
import { createAuxContext } from '../fixtures/createAuxContext';
|
|
import { Users } from '../fixtures/userStates';
|
|
import { HomeChannel } from '../page-objects';
|
|
import { OmnichannelLiveChat } from '../page-objects/omnichannel';
|
|
import { getPriorityByi18nLabel } from '../utils/omnichannel/priority';
|
|
import { createSLA } from '../utils/omnichannel/sla';
|
|
import { test, expect } from '../utils/test';
|
|
|
|
const getRoomId = (page: Page): string => {
|
|
// url is of the form: http://localhost:3000/live/:rid/room-info
|
|
const url = page?.url();
|
|
// rid comes after /live/ and before /room-info (or /)
|
|
const rid = url?.split('/live/')[1].split('/')[0];
|
|
if (!rid) {
|
|
throw new Error(`Could not get room id from url: ${page.url()}`);
|
|
}
|
|
return rid;
|
|
};
|
|
|
|
test.describe.serial('omnichannel-changing-room-priority-and-sla', () => {
|
|
test.skip(!IS_EE, 'Enterprise Only');
|
|
|
|
let poLiveChat: OmnichannelLiveChat;
|
|
let newVisitor: { email: string; name: string };
|
|
|
|
let agent: { page: Page; poHomeChannel: HomeChannel };
|
|
|
|
test.beforeAll(async ({ api, browser }) => {
|
|
let statusCode = (await api.post('/livechat/users/agent', { username: ADMIN_CREDENTIALS.username })).status();
|
|
expect(statusCode).toBe(200);
|
|
|
|
statusCode = (await api.post('/livechat/users/manager', { username: ADMIN_CREDENTIALS.username })).status();
|
|
expect(statusCode).toBe(200);
|
|
|
|
statusCode = (await api.post('/livechat/agent.status', { status: 'available' })).status();
|
|
expect(statusCode).toBe(200);
|
|
|
|
statusCode = (await api.post('/settings/Livechat_Routing_Method', { value: 'Manual_Selection' })).status();
|
|
expect(statusCode).toBe(200);
|
|
|
|
const { page } = await createAuxContext(browser, Users.admin);
|
|
agent = { page, poHomeChannel: new HomeChannel(page) };
|
|
|
|
await agent.poHomeChannel.navbar.changeUserStatus('online');
|
|
});
|
|
|
|
test.afterAll(async ({ api }) => {
|
|
await agent.page.close();
|
|
|
|
await Promise.all([
|
|
api.delete(`/livechat/users/agent/${ADMIN_CREDENTIALS.username}`),
|
|
api.delete(`/livechat/users/manager/${ADMIN_CREDENTIALS.username}`),
|
|
api.post('/settings/Livechat_Routing_Method', { value: 'Auto_Selection' }),
|
|
]);
|
|
});
|
|
|
|
test('expect to initiate a new livechat conversation', async ({ page, api }) => {
|
|
newVisitor = createFakeVisitor();
|
|
poLiveChat = new OmnichannelLiveChat(page, api);
|
|
await poLiveChat.goto();
|
|
await poLiveChat.openLiveChat();
|
|
await poLiveChat.sendMessage(newVisitor, false);
|
|
await poLiveChat.onlineAgentMessage.type('this_a_test_message_from_user');
|
|
await poLiveChat.btnSendMessageToOnlineAgent.click();
|
|
|
|
await agent.poHomeChannel.sidebar.getSidebarItemByName(newVisitor.name).click();
|
|
});
|
|
|
|
test('expect to change priority of room and corresponding system message should be displayed', async ({ api }) => {
|
|
const priority = await getPriorityByi18nLabel(api, 'High');
|
|
|
|
await test.step('change priority of room to the new priority', async () => {
|
|
const status = (await api.post(`/livechat/room/${getRoomId(agent.page)}/priority`, { priorityId: priority._id })).status();
|
|
await expect(status).toBe(200);
|
|
|
|
await agent.page.waitForTimeout(1000);
|
|
});
|
|
|
|
await expect(agent.poHomeChannel.content.lastSystemMessageBody).toHaveText(
|
|
`Priority changed: ${ADMIN_CREDENTIALS.username} changed the priority to ${priority.name || priority.i18n}`,
|
|
);
|
|
});
|
|
|
|
test('expect to change SLA of room and corresponding system message should be displayed', async ({ api }) => {
|
|
const sla = await createSLA(api);
|
|
|
|
await test.step('change SLA of room to the new SLA', async () => {
|
|
const status = (await api.put(`/livechat/inquiry.setSLA`, { sla: sla.name, roomId: getRoomId(agent.page) })).status();
|
|
expect(status).toBe(200);
|
|
await agent.page.waitForTimeout(1000);
|
|
});
|
|
|
|
await expect(agent.poHomeChannel.content.lastSystemMessageBody).toHaveText(
|
|
`SLA Policy changed: ${ADMIN_CREDENTIALS.username} changed the SLA Policy to ${sla.name}`,
|
|
);
|
|
|
|
await test.step('cleanup SLA', async () => {
|
|
const status = (await api.delete(`/livechat/sla/${sla._id}`)).status();
|
|
expect(status).toBe(200);
|
|
});
|
|
});
|
|
});
|