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
215 lines
8.8 KiB
TypeScript
215 lines
8.8 KiB
TypeScript
import { faker } from '@faker-js/faker';
|
|
import type { Page } from '@playwright/test';
|
|
|
|
import { IS_EE } from '../config/constants';
|
|
import { Users } from '../fixtures/userStates';
|
|
import { OmnichannelUnits } from '../page-objects/omnichannel';
|
|
import { setSettingValueById } from '../utils';
|
|
import { createAgent } from '../utils/omnichannel/agents';
|
|
import { createDepartment } from '../utils/omnichannel/departments';
|
|
import { createMonitor } from '../utils/omnichannel/monitors';
|
|
import { createOrUpdateUnit } from '../utils/omnichannel/units';
|
|
import { test, expect } from '../utils/test';
|
|
|
|
test.use({ storageState: Users.admin.state });
|
|
|
|
test.describe('OC - Manage Units', () => {
|
|
test.skip(!IS_EE, 'OC - Manage Units > Enterprise Edition Only');
|
|
|
|
let poOmnichannelUnits: OmnichannelUnits;
|
|
|
|
let department: Awaited<ReturnType<typeof createDepartment>>;
|
|
let department2: Awaited<ReturnType<typeof createDepartment>>;
|
|
|
|
let agent: Awaited<ReturnType<typeof createAgent>>;
|
|
|
|
let monitor: Awaited<ReturnType<typeof createMonitor>>;
|
|
|
|
let monitor2: Awaited<ReturnType<typeof createMonitor>>;
|
|
|
|
test.beforeAll(async ({ api }) => {
|
|
department = await createDepartment(api);
|
|
department2 = await createDepartment(api);
|
|
});
|
|
|
|
test.beforeAll(async ({ api }) => {
|
|
agent = await createAgent(api, 'user2');
|
|
});
|
|
|
|
test.beforeAll(async ({ api }) => {
|
|
monitor = await createMonitor(api, 'user2');
|
|
monitor2 = await createMonitor(api, 'user3');
|
|
});
|
|
|
|
test.beforeAll(async ({ api }) => {
|
|
await setSettingValueById(api, 'Omnichannel_enable_department_removal', true);
|
|
});
|
|
|
|
test.afterAll(async ({ api }) => {
|
|
await department.delete();
|
|
await department2.delete();
|
|
await monitor.delete();
|
|
await monitor2.delete();
|
|
await agent.delete();
|
|
await setSettingValueById(api, 'Omnichannel_enable_department_removal', false);
|
|
});
|
|
|
|
test.beforeEach(async ({ page }: { page: Page }) => {
|
|
poOmnichannelUnits = new OmnichannelUnits(page);
|
|
await poOmnichannelUnits.goto();
|
|
});
|
|
|
|
test('OC - Manage Units - Create Unit', async () => {
|
|
const unitName = faker.string.uuid();
|
|
|
|
await test.step('expect correct form default state', async () => {
|
|
await poOmnichannelUnits.createNew();
|
|
await expect(poOmnichannelUnits.manageUnit.root).toBeVisible();
|
|
await expect(poOmnichannelUnits.manageUnit.btnSave).toBeEnabled();
|
|
await expect(poOmnichannelUnits.manageUnit.btnCancel).toBeEnabled();
|
|
await poOmnichannelUnits.manageUnit.btnCancel.click();
|
|
await expect(poOmnichannelUnits.manageUnit.root).not.toBeVisible();
|
|
});
|
|
|
|
await test.step('expect to create new unit', async () => {
|
|
await poOmnichannelUnits.createNew();
|
|
await poOmnichannelUnits.manageUnit.inputName.fill(unitName);
|
|
await poOmnichannelUnits.manageUnit.selectVisibility('public');
|
|
await poOmnichannelUnits.manageUnit.selectDepartment(department.data.name);
|
|
await poOmnichannelUnits.manageUnit.selectMonitor('user2');
|
|
await expect(poOmnichannelUnits.manageUnit.findMonitorChipOption('user2')).toBeVisible();
|
|
await poOmnichannelUnits.manageUnit.btnSave.click();
|
|
await expect(poOmnichannelUnits.manageUnit.root).not.toBeVisible();
|
|
|
|
await poOmnichannelUnits.search(unitName);
|
|
await expect(poOmnichannelUnits.table.findRowByName(unitName)).toBeVisible();
|
|
});
|
|
|
|
await test.step('expect to delete unit', async () => {
|
|
await poOmnichannelUnits.deleteUnit(unitName);
|
|
await expect(poOmnichannelUnits.table.findRowByName(unitName)).toHaveCount(0);
|
|
});
|
|
});
|
|
|
|
test('OC - Manage Units - Edit unit name', async ({ api }) => {
|
|
const unitName = faker.string.uuid();
|
|
const editedUnitName = faker.string.uuid();
|
|
|
|
const unit = await test.step('expect to create new unit', async () => {
|
|
const { data: newUnit } = await createOrUpdateUnit(api, {
|
|
name: unitName,
|
|
visibility: 'public',
|
|
monitors: [{ monitorId: monitor.data._id, username: 'user2' }],
|
|
departments: [{ departmentId: department.data._id }],
|
|
});
|
|
|
|
return newUnit;
|
|
});
|
|
|
|
await poOmnichannelUnits.goto();
|
|
|
|
await test.step('expect to edit unit', async () => {
|
|
await poOmnichannelUnits.search(unit.name);
|
|
await poOmnichannelUnits.table.findRowByName(unit.name).click();
|
|
await expect(poOmnichannelUnits.manageUnit.root).toBeVisible();
|
|
await poOmnichannelUnits.manageUnit.inputName.fill(editedUnitName);
|
|
await poOmnichannelUnits.manageUnit.btnSave.click();
|
|
await expect(poOmnichannelUnits.manageUnit.root).not.toBeVisible();
|
|
await expect(poOmnichannelUnits.inputSearch).toBeVisible();
|
|
await poOmnichannelUnits.search(editedUnitName);
|
|
await expect(poOmnichannelUnits.table.findRowByName(editedUnitName)).toBeVisible();
|
|
});
|
|
|
|
await test.step('expect to add another monitor to list', async () => {
|
|
await poOmnichannelUnits.table.findRowByName(editedUnitName).click();
|
|
await poOmnichannelUnits.manageUnit.selectMonitor('user3');
|
|
await poOmnichannelUnits.manageUnit.btnSave.click();
|
|
await expect(poOmnichannelUnits.manageUnit.root).not.toBeVisible();
|
|
|
|
await poOmnichannelUnits.search(editedUnitName);
|
|
await poOmnichannelUnits.table.findRowByName(editedUnitName).click();
|
|
|
|
await expect(poOmnichannelUnits.manageUnit.findMonitorChipOption('user2')).toBeVisible();
|
|
await expect(poOmnichannelUnits.manageUnit.findMonitorChipOption('user3')).toBeVisible();
|
|
});
|
|
|
|
await test.step('expect unit to remove one of the two monitors', async () => {
|
|
await poOmnichannelUnits.search(editedUnitName);
|
|
await poOmnichannelUnits.table.findRowByName(editedUnitName).click();
|
|
await poOmnichannelUnits.manageUnit.removeMonitor('user2');
|
|
await poOmnichannelUnits.manageUnit.btnSave.click();
|
|
await expect(poOmnichannelUnits.manageUnit.root).not.toBeVisible();
|
|
|
|
await poOmnichannelUnits.search(editedUnitName);
|
|
await poOmnichannelUnits.table.findRowByName(editedUnitName).click();
|
|
await expect(poOmnichannelUnits.manageUnit.findMonitorChipOption('user3')).toBeVisible();
|
|
await expect(poOmnichannelUnits.manageUnit.findMonitorChipOption('user2')).toBeHidden();
|
|
});
|
|
|
|
await test.step('expect to delete unit', async () => {
|
|
await poOmnichannelUnits.table.findRowByName(editedUnitName).click();
|
|
await expect(poOmnichannelUnits.manageUnit.root).toBeVisible();
|
|
|
|
await poOmnichannelUnits.deleteUnit(editedUnitName);
|
|
await expect(poOmnichannelUnits.table.findRowByName(editedUnitName)).not.toBeVisible();
|
|
});
|
|
});
|
|
|
|
test('OC - Manage Units - Edit unit departments', async ({ api, page }) => {
|
|
const unit = await test.step('expect to create new unit', async () => {
|
|
const { data: unit } = await createOrUpdateUnit(api, {
|
|
name: faker.string.uuid(),
|
|
visibility: 'public',
|
|
monitors: [{ monitorId: monitor.data._id, username: 'user2' }],
|
|
departments: [{ departmentId: department.data._id }],
|
|
});
|
|
|
|
return unit;
|
|
});
|
|
|
|
await page.reload();
|
|
|
|
await test.step('expect to add unit departments', async () => {
|
|
await poOmnichannelUnits.search(unit.name);
|
|
await poOmnichannelUnits.table.findRowByName(unit.name).click();
|
|
await expect(poOmnichannelUnits.manageUnit.root).toBeVisible();
|
|
await poOmnichannelUnits.manageUnit.selectDepartment(department2.data.name);
|
|
await poOmnichannelUnits.manageUnit.btnSave.click();
|
|
await expect(poOmnichannelUnits.manageUnit.root).not.toBeVisible();
|
|
|
|
await poOmnichannelUnits.search(unit.name);
|
|
await poOmnichannelUnits.table.findRowByName(unit.name).click();
|
|
await expect(poOmnichannelUnits.manageUnit.root).toBeVisible();
|
|
await expect(poOmnichannelUnits.manageUnit.findDepartmentsChipOption(department2.data.name)).toBeVisible();
|
|
await poOmnichannelUnits.manageUnit.findDepartmentsChipOption(department2.data.name).hover();
|
|
|
|
await expect(page.getByRole('tooltip', { name: department2.data.name })).toBeVisible();
|
|
await poOmnichannelUnits.manageUnit.close();
|
|
});
|
|
|
|
await test.step('expect to remove unit departments', async () => {
|
|
await poOmnichannelUnits.search(unit.name);
|
|
await poOmnichannelUnits.table.findRowByName(unit.name).click();
|
|
await expect(poOmnichannelUnits.manageUnit.root).toBeVisible();
|
|
await poOmnichannelUnits.manageUnit.selectDepartment(department2.data.name);
|
|
await poOmnichannelUnits.manageUnit.btnSave.click();
|
|
await expect(poOmnichannelUnits.manageUnit.root).not.toBeVisible();
|
|
|
|
await poOmnichannelUnits.search(unit.name);
|
|
await poOmnichannelUnits.table.findRowByName(unit.name).click();
|
|
await expect(poOmnichannelUnits.manageUnit.root).toBeVisible();
|
|
await expect(poOmnichannelUnits.manageUnit.findDepartmentsChipOption(department2.data.name)).toBeHidden();
|
|
await poOmnichannelUnits.manageUnit.close();
|
|
});
|
|
|
|
await test.step('expect to delete unit', async () => {
|
|
await poOmnichannelUnits.search(unit.name);
|
|
await poOmnichannelUnits.table.findRowByName(unit.name).click();
|
|
await expect(poOmnichannelUnits.manageUnit.root).toBeVisible();
|
|
|
|
await poOmnichannelUnits.deleteUnit(unit.name);
|
|
await expect(poOmnichannelUnits.table.findRowByName(unit.name)).not.toBeVisible();
|
|
});
|
|
});
|
|
});
|