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
Code scanning - action / CodeQL-Build (push) Failing after 1s
Auto-close duplicate issues / auto-close-duplicates (push) Failing after 1s
149 lines
6.3 KiB
TypeScript
149 lines
6.3 KiB
TypeScript
import {
|
|
OmnichannelSortingMechanismSettingType,
|
|
type IOmnichannelServiceLevelAgreements,
|
|
type Serialized,
|
|
} from '@rocket.chat/core-typings';
|
|
|
|
import { createFakeVisitor } from '../../mocks/data';
|
|
import { IS_EE } from '../config/constants';
|
|
import { Users } from '../fixtures/userStates';
|
|
import { HomeOmnichannel } from '../page-objects';
|
|
import { createConversation } from '../utils/omnichannel/rooms';
|
|
import { createSLA } from '../utils/omnichannel/sla';
|
|
import { test, expect } from '../utils/test';
|
|
|
|
const visitorA = createFakeVisitor();
|
|
const visitorB = createFakeVisitor();
|
|
const visitorC = createFakeVisitor();
|
|
|
|
test.skip(!IS_EE, 'Omnichannel SLAs > Enterprise Only');
|
|
|
|
test.use({ storageState: Users.user1.state });
|
|
|
|
test.describe('OC - SLA Policies [Sidebar]', () => {
|
|
let poHomeChannel: HomeOmnichannel;
|
|
let conversations: Awaited<ReturnType<typeof createConversation>>[] = [];
|
|
let slas: Serialized<Omit<IOmnichannelServiceLevelAgreements, '_updatedAt'>>[] = [];
|
|
|
|
test.beforeAll('create SLAs', async ({ api }) => {
|
|
slas = await Promise.all([
|
|
createSLA(api, { name: 'Very Urgent', dueTimeInMinutes: 1 }),
|
|
createSLA(api, { name: 'Urgent', dueTimeInMinutes: 10 }),
|
|
createSLA(api, { name: 'Not Urgent', dueTimeInMinutes: 30 }),
|
|
]);
|
|
});
|
|
|
|
test.beforeAll(async ({ api }) => {
|
|
(
|
|
await Promise.all([
|
|
// Create agent and manager
|
|
api.post('/livechat/users/agent', { username: 'user1' }),
|
|
api.post('/livechat/users/manager', { username: 'user1' }),
|
|
// Settings
|
|
api.post('/settings/Livechat_Routing_Method', { value: 'Manual_Selection' }),
|
|
api.post('/settings/Omnichannel_sorting_mechanism', { value: OmnichannelSortingMechanismSettingType.SLAs }),
|
|
])
|
|
).every((res) => expect(res.status()).toBe(200));
|
|
});
|
|
|
|
test.beforeEach(async ({ page }) => {
|
|
poHomeChannel = new HomeOmnichannel(page);
|
|
});
|
|
|
|
test.beforeEach(async () => {
|
|
await poHomeChannel.goto();
|
|
});
|
|
|
|
test.beforeEach(async ({ api }) => {
|
|
conversations = await Promise.all([
|
|
createConversation(api, { visitorName: visitorA.name, agentId: 'user1' }),
|
|
createConversation(api, { visitorName: visitorB.name, agentId: 'user1' }),
|
|
createConversation(api, { visitorName: visitorC.name, agentId: 'user1' }),
|
|
]);
|
|
});
|
|
|
|
test.afterAll('delete SLAs', async ({ api }) => {
|
|
const responses = await Promise.all(slas.map((sla) => api.delete(`/livechat/sla/${sla._id}`)));
|
|
responses.every((res) => expect(res.status()).toBe(200));
|
|
});
|
|
|
|
test.afterAll(async ({ api }) => {
|
|
// Delete conversations
|
|
await Promise.all(conversations.map((conversation) => conversation.delete()));
|
|
|
|
(
|
|
await Promise.all([
|
|
// Delete agent and manager
|
|
api.delete('/livechat/users/agent/user1'),
|
|
api.delete('/livechat/users/manager/user1'),
|
|
// Reset settings
|
|
api.post('/settings/Livechat_Routing_Method', { value: 'Auto_Selection' }),
|
|
api.post('/settings/Omnichannel_sorting_mechanism', { value: OmnichannelSortingMechanismSettingType.Timestamp }),
|
|
])
|
|
).every((res) => expect(res.status()).toBe(200));
|
|
});
|
|
|
|
test('OC - SLA Policies [Sidebar] - Update conversation SLA Policy', async () => {
|
|
await test.step('expect to change room SLA policy to "Not urgent"', async () => {
|
|
await test.step('expect to open room and room info to be visible', async () => {
|
|
await poHomeChannel.sidebar.getSidebarItemByName(visitorA.name).click();
|
|
await expect(poHomeChannel.roomInfo.root).toBeVisible();
|
|
});
|
|
|
|
await test.step('expect to update room SLA policy', async () => {
|
|
await expect(poHomeChannel.roomInfo.getInfoByLabel('SLA Policy')).not.toBeVisible();
|
|
await poHomeChannel.roomInfo.btnEdit.click();
|
|
await poHomeChannel.editRoomInfo.selectSLA('Not Urgent');
|
|
await poHomeChannel.editRoomInfo.btnSave.click();
|
|
});
|
|
|
|
await test.step('expect SLA to have been updated in the room info and queue order to be correct', async () => {
|
|
await expect(poHomeChannel.roomInfo.getInfoByLabel('SLA Policy')).toHaveText('Not Urgent');
|
|
await expect(poHomeChannel.sidebar.getSidebarListItem(visitorA.name)).toBeVisible();
|
|
await expect(poHomeChannel.sidebar.getSidebarListItem(visitorA.name)).toHaveAttribute('data-index', '1');
|
|
});
|
|
});
|
|
|
|
await test.step('expect to change room SLA policy to "Urgent"', async () => {
|
|
await test.step('expect to open room and room info to be visible', async () => {
|
|
await poHomeChannel.sidebar.getSidebarItemByName(visitorB.name).click();
|
|
await expect(poHomeChannel.roomInfo.root).toBeVisible();
|
|
});
|
|
|
|
await test.step('expect to update room SLA policy', async () => {
|
|
await expect(poHomeChannel.roomInfo.getInfoByLabel('SLA Policy')).not.toBeVisible();
|
|
await poHomeChannel.roomInfo.btnEdit.click();
|
|
await poHomeChannel.editRoomInfo.selectSLA('Urgent');
|
|
await poHomeChannel.editRoomInfo.btnSave.click();
|
|
});
|
|
|
|
await test.step('expect SLA to have been updated in the room info and queue order to be correct', async () => {
|
|
await expect(poHomeChannel.roomInfo.getInfoByLabel('SLA Policy')).toHaveText('Urgent');
|
|
await expect(poHomeChannel.sidebar.getSidebarListItem(visitorB.name)).toHaveAttribute('data-index', '1');
|
|
await expect(poHomeChannel.sidebar.getSidebarListItem(visitorA.name)).toHaveAttribute('data-index', '2');
|
|
});
|
|
});
|
|
|
|
await test.step('expect to change room SLA policy to "Very Urgent"', async () => {
|
|
await test.step('expect to open room and room info to be visible', async () => {
|
|
await poHomeChannel.sidebar.getSidebarItemByName(visitorC.name).click();
|
|
await expect(poHomeChannel.roomInfo.root).toBeVisible();
|
|
});
|
|
|
|
await test.step('expect to update room SLA policy', async () => {
|
|
await expect(poHomeChannel.roomInfo.getInfoByLabel('SLA Policy')).not.toBeVisible();
|
|
await poHomeChannel.roomInfo.btnEdit.click();
|
|
await poHomeChannel.editRoomInfo.selectSLA('Very Urgent');
|
|
await poHomeChannel.editRoomInfo.btnSave.click();
|
|
});
|
|
|
|
await test.step('expect SLA to have been updated in the room info and queue order to be correct', async () => {
|
|
await expect(poHomeChannel.roomInfo.getInfoByLabel('SLA Policy')).toHaveText('Very Urgent');
|
|
await expect(poHomeChannel.sidebar.getSidebarListItem(visitorC.name)).toHaveAttribute('data-index', '1');
|
|
await expect(poHomeChannel.sidebar.getSidebarListItem(visitorB.name)).toHaveAttribute('data-index', '2');
|
|
await expect(poHomeChannel.sidebar.getSidebarListItem(visitorA.name)).toHaveAttribute('data-index', '3');
|
|
});
|
|
});
|
|
});
|
|
});
|