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
192 lines
7.4 KiB
TypeScript
192 lines
7.4 KiB
TypeScript
import { createFakeDepartment } from '../../mocks/data';
|
|
import { IS_EE } from '../config/constants';
|
|
import { Users } from '../fixtures/userStates';
|
|
import { OmnichannelAgents } from '../page-objects/omnichannel';
|
|
import { setSettingValueById } from '../utils';
|
|
import { createDepartment } from '../utils/omnichannel/departments';
|
|
import { test, expect } from '../utils/test';
|
|
|
|
test.use({ storageState: Users.admin.state });
|
|
|
|
test.describe.serial('OC - Manage Agents', () => {
|
|
let poOmnichannelAgents: OmnichannelAgents;
|
|
let department: Awaited<ReturnType<typeof createDepartment>>;
|
|
|
|
// Create agent and department
|
|
test.beforeEach(async ({ api }) => {
|
|
department = await createDepartment(api);
|
|
});
|
|
|
|
test.beforeEach(async ({ page }) => {
|
|
poOmnichannelAgents = new OmnichannelAgents(page);
|
|
await poOmnichannelAgents.goto();
|
|
});
|
|
|
|
test.beforeAll(async ({ api }) => {
|
|
expect((await setSettingValueById(api, 'Omnichannel_enable_department_removal', true)).status()).toBe(200);
|
|
});
|
|
|
|
test.afterAll(async ({ api }) => {
|
|
expect((await setSettingValueById(api, 'Omnichannel_enable_department_removal', false)).status()).toBe(200);
|
|
});
|
|
|
|
// Ensure that there is no leftover data even if test fails
|
|
test.afterEach(async ({ api }) => {
|
|
await api.delete('/livechat/users/agent/user1');
|
|
await department.delete();
|
|
});
|
|
|
|
test('OC - Manage Agents - Add, search and remove using table', async ({ page }) => {
|
|
await test.step('expect "user1" be first ', async () => {
|
|
await poOmnichannelAgents.inputUsername.type('user');
|
|
await expect(page.locator('role=option[name="user1"]')).toContainText('user1');
|
|
|
|
await poOmnichannelAgents.inputUsername.fill('');
|
|
});
|
|
|
|
await test.step('expect add "user1" as agent', async () => {
|
|
await poOmnichannelAgents.selectUsername('user1');
|
|
await poOmnichannelAgents.btnAddAgent.click();
|
|
|
|
await poOmnichannelAgents.search('user1');
|
|
await expect(poOmnichannelAgents.table.findRowByName('user1')).toBeVisible();
|
|
});
|
|
|
|
await test.step('expect remove "user1" as agent', async () => {
|
|
await poOmnichannelAgents.search('user1');
|
|
await poOmnichannelAgents.deleteAgent('user1');
|
|
|
|
await poOmnichannelAgents.search('user1');
|
|
await expect(poOmnichannelAgents.table.findRowByName('user1')).not.toBeVisible();
|
|
});
|
|
});
|
|
|
|
test('OC - Manage Agents [CE]- Edit and Remove', async () => {
|
|
test.skip(IS_EE, 'Community Edition Only');
|
|
|
|
await poOmnichannelAgents.selectUsername('user1');
|
|
await poOmnichannelAgents.btnAddAgent.click();
|
|
|
|
await poOmnichannelAgents.search('user1');
|
|
await poOmnichannelAgents.table.findRowByName('user1').click();
|
|
await poOmnichannelAgents.agentInfo.btnEdit.click();
|
|
|
|
await test.step('expect max chats fields to be hidden', async () => {
|
|
await expect(poOmnichannelAgents.editAgent.inputMaxChats).toBeHidden();
|
|
});
|
|
|
|
await test.step('expect update "user1" information', async () => {
|
|
await poOmnichannelAgents.editAgent.selectStatus('Not Available');
|
|
await poOmnichannelAgents.editAgent.selectDepartment(department.data.name);
|
|
await poOmnichannelAgents.editAgent.save();
|
|
});
|
|
|
|
await test.step('expect removing "user1" via sidebar', async () => {
|
|
await poOmnichannelAgents.search('user1');
|
|
await poOmnichannelAgents.table.findRowByName('user1').click();
|
|
await poOmnichannelAgents.agentInfo.btnRemove.click();
|
|
});
|
|
});
|
|
|
|
test('OC - Manage Agents [EE] - Edit ', async () => {
|
|
test.skip(!IS_EE, 'Enterprise Only');
|
|
|
|
await poOmnichannelAgents.selectUsername('user1');
|
|
await poOmnichannelAgents.btnAddAgent.click();
|
|
|
|
await poOmnichannelAgents.search('user1');
|
|
await poOmnichannelAgents.table.findRowByName('user1').click();
|
|
await poOmnichannelAgents.agentInfo.btnEdit.click();
|
|
|
|
await test.step('expect max chats field to be visible', async () => {
|
|
await expect(poOmnichannelAgents.editAgent.inputMaxChats).toBeVisible();
|
|
});
|
|
|
|
await test.step('expect update "user1" information', async () => {
|
|
await poOmnichannelAgents.editAgent.inputMaxChats.click();
|
|
await poOmnichannelAgents.editAgent.inputMaxChats.fill('2');
|
|
await poOmnichannelAgents.editAgent.btnSave.click();
|
|
});
|
|
});
|
|
|
|
test('OC - Edit agent - Manage departments', async ({ page }) => {
|
|
await poOmnichannelAgents.selectUsername('user1');
|
|
await poOmnichannelAgents.btnAddAgent.click();
|
|
await poOmnichannelAgents.search('user1');
|
|
await poOmnichannelAgents.table.findRowByName('user1').click();
|
|
|
|
await poOmnichannelAgents.agentInfo.btnEdit.click();
|
|
await poOmnichannelAgents.editAgent.selectDepartment(department.data.name);
|
|
const response = page.waitForResponse('**/api/v1/livechat/agents.saveInfo');
|
|
await poOmnichannelAgents.editAgent.btnSave.click();
|
|
|
|
/**
|
|
* between saving and opening the agent info again it is necessary to
|
|
* wait for the agent to be saved, since after successfully saving
|
|
* the contextual bar is closed
|
|
* otherwise content will be closed even if the current one is not the editing one
|
|
*/
|
|
|
|
await response;
|
|
|
|
await expect(poOmnichannelAgents.editAgent.root).not.toBeVisible();
|
|
|
|
await test.step('expect the selected department is visible', async () => {
|
|
await poOmnichannelAgents.table.findRowByName('user1').click();
|
|
|
|
// mock the endpoint to use the one without pagination
|
|
await page.route('/api/v1/livechat/department?showArchived=true', async (route) => {
|
|
await route.fulfill({ json: { departments: [] } });
|
|
});
|
|
|
|
await poOmnichannelAgents.agentInfo.btnEdit.click();
|
|
await expect(poOmnichannelAgents.editAgent.findSelectedDepartment(department.data.name)).toBeVisible();
|
|
});
|
|
});
|
|
|
|
test('OC - Edit agent - Departments pagination', async ({ page }) => {
|
|
const data = Array.from({ length: 100 }, (_, i) => createFakeDepartment({ name: `Department ${i}` }));
|
|
await page.route('**/v1/livechat/department*', async (route, request) => {
|
|
const url = new URL(request.url());
|
|
const offset = parseInt(url.searchParams.get('offset') || '0', 10);
|
|
const count = parseInt(url.searchParams.get('count') || '50', 10);
|
|
const departments = data.slice(offset, offset + count);
|
|
|
|
await route.fulfill({
|
|
status: 200,
|
|
contentType: 'application/json',
|
|
body: JSON.stringify({ departments, offset, count, total: data.length }),
|
|
});
|
|
});
|
|
|
|
await test.step('expect to add agent', async () => {
|
|
await poOmnichannelAgents.selectUsername('user1');
|
|
await poOmnichannelAgents.btnAddAgent.click();
|
|
});
|
|
|
|
await test.step('expect to edit agent', async () => {
|
|
await poOmnichannelAgents.search('user1');
|
|
await poOmnichannelAgents.table.findRowByName('user1').click();
|
|
await poOmnichannelAgents.agentInfo.btnEdit.click();
|
|
});
|
|
|
|
await test.step('expect department field to be paginated', async () => {
|
|
await poOmnichannelAgents.editAgent.inputDepartment.click();
|
|
await expect(poOmnichannelAgents.editAgent.getDepartmentOption('Department 0')).toBeVisible();
|
|
await poOmnichannelAgents.scrollToListBottom();
|
|
await expect(poOmnichannelAgents.editAgent.getDepartmentOption('Department 49')).toBeVisible();
|
|
await poOmnichannelAgents.scrollToListBottom();
|
|
await expect(poOmnichannelAgents.editAgent.getDepartmentOption('Department 99')).toBeVisible();
|
|
await poOmnichannelAgents.editAgent.close();
|
|
});
|
|
|
|
await test.step('expect remove "user1" as agent', async () => {
|
|
await poOmnichannelAgents.search('user1');
|
|
await poOmnichannelAgents.deleteAgent('user1');
|
|
|
|
await poOmnichannelAgents.search('user1');
|
|
await expect(poOmnichannelAgents.table.findRowByName('user1')).not.toBeVisible();
|
|
});
|
|
});
|
|
});
|