snapshot of https://github.com/RocketChat/Rocket.Chat.git (develop, 2026-09-16; blobs > 131072B omitted)
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
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
This commit is contained in:
@@ -0,0 +1,184 @@
|
||||
import { faker } from '@faker-js/faker';
|
||||
import type { Page } from '@playwright/test';
|
||||
|
||||
import { IS_EE } from '../config/constants';
|
||||
import { Users } from '../fixtures/userStates';
|
||||
import { OmnichannelDepartments } 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';
|
||||
|
||||
const MONITOR = 'user3';
|
||||
|
||||
test.use({ storageState: Users.user3.state });
|
||||
|
||||
test.describe.serial('OC - Monitor Role', () => {
|
||||
test.skip(!IS_EE, 'Enterprise Edition Only');
|
||||
|
||||
let departments: Awaited<ReturnType<typeof createDepartment>>[];
|
||||
let agents: Awaited<ReturnType<typeof createAgent>>[];
|
||||
let monitor: Awaited<ReturnType<typeof createMonitor>>;
|
||||
let units: Awaited<ReturnType<typeof createOrUpdateUnit>>[];
|
||||
let poOmnichannelDepartments: OmnichannelDepartments;
|
||||
const newDepartmentName = faker.string.uuid();
|
||||
|
||||
// Reset user3 roles
|
||||
test.beforeAll(async ({ api }) => {
|
||||
const res = await api.post('/users.update', { data: { roles: ['user'] }, userId: MONITOR });
|
||||
await expect(res.status()).toBe(200);
|
||||
});
|
||||
|
||||
// Create agents
|
||||
test.beforeAll(async ({ api }) => {
|
||||
agents = await Promise.all([createAgent(api, 'user1'), createAgent(api, 'user2')]);
|
||||
});
|
||||
|
||||
// Create department
|
||||
test.beforeAll(async ({ api }) => {
|
||||
departments = await Promise.all([createDepartment(api), createDepartment(api)]);
|
||||
});
|
||||
|
||||
// Create monitor
|
||||
test.beforeAll(async ({ api }) => {
|
||||
monitor = await createMonitor(api, MONITOR);
|
||||
});
|
||||
|
||||
// Create unit
|
||||
test.beforeAll(async ({ api }) => {
|
||||
const [departmentA, departmentB] = departments.map((dep) => dep.data);
|
||||
|
||||
units = await Promise.all([
|
||||
await createOrUpdateUnit(api, {
|
||||
monitors: [{ monitorId: 'user2', username: 'user2' }],
|
||||
departments: [{ departmentId: departmentB._id }],
|
||||
}),
|
||||
await createOrUpdateUnit(api, {
|
||||
monitors: [{ monitorId: MONITOR, username: MONITOR }],
|
||||
departments: [{ departmentId: departmentA._id }],
|
||||
}),
|
||||
await createOrUpdateUnit(api, {
|
||||
monitors: [{ monitorId: MONITOR, username: MONITOR }],
|
||||
departments: [{ departmentId: departmentA._id }],
|
||||
}),
|
||||
]);
|
||||
await setSettingValueById(api, 'Omnichannel_enable_department_removal', true);
|
||||
});
|
||||
|
||||
// Delete all created data
|
||||
test.afterAll(async ({ api }) => {
|
||||
await Promise.all([
|
||||
...agents.map((agent) => agent.delete()),
|
||||
...departments.map((department) => department.delete()),
|
||||
...units.map((unit) => unit.delete()),
|
||||
monitor.delete(),
|
||||
]);
|
||||
await setSettingValueById(api, 'Omnichannel_enable_department_removal', false);
|
||||
});
|
||||
|
||||
test.beforeEach(async ({ page }: { page: Page }) => {
|
||||
poOmnichannelDepartments = new OmnichannelDepartments(page);
|
||||
|
||||
await poOmnichannelDepartments.goto();
|
||||
});
|
||||
|
||||
test('OC - Monitor Role - Create department with business unit', async () => {
|
||||
const [departmentA] = departments.map((dep) => dep.data);
|
||||
const [unitA, unitB, unitC] = units.map((unit) => unit.data);
|
||||
|
||||
await test.step('expect to see only departmentA in the list', async () => {
|
||||
await expect(poOmnichannelDepartments.table.findRowByName(departmentA.name)).toBeVisible();
|
||||
});
|
||||
|
||||
await test.step('expect to fill departments mandatory field', async () => {
|
||||
await poOmnichannelDepartments.createNew();
|
||||
await poOmnichannelDepartments.inputName.fill(newDepartmentName);
|
||||
await poOmnichannelDepartments.inputEmail.fill(faker.internet.email());
|
||||
});
|
||||
|
||||
await test.step('expect to only have the units from monitor visible', async () => {
|
||||
await expect(poOmnichannelDepartments.inputUnit).not.toBeDisabled();
|
||||
await poOmnichannelDepartments.inputUnit.click();
|
||||
await expect(poOmnichannelDepartments.findOption(unitA.name)).not.toBeVisible();
|
||||
await expect(poOmnichannelDepartments.findOption(unitB.name)).toBeVisible();
|
||||
await expect(poOmnichannelDepartments.findOption(unitC.name)).toBeVisible();
|
||||
});
|
||||
|
||||
await test.step('expect to be able to switch freely between available units', async () => {
|
||||
await poOmnichannelDepartments.findOption(unitC.name).click();
|
||||
await expect(poOmnichannelDepartments.inputUnit).not.toBeDisabled();
|
||||
await poOmnichannelDepartments.inputUnit.click();
|
||||
await poOmnichannelDepartments.findOption(unitB.name).click();
|
||||
});
|
||||
|
||||
await test.step('expect unit field to be required', async () => {
|
||||
await poOmnichannelDepartments.inputUnit.click();
|
||||
await poOmnichannelDepartments.findOption('None').click();
|
||||
await poOmnichannelDepartments.btnSave.click();
|
||||
await expect(poOmnichannelDepartments.errorMessage('Unit required')).toBeVisible();
|
||||
|
||||
await poOmnichannelDepartments.inputUnit.click();
|
||||
await poOmnichannelDepartments.findOption(unitB.name).click();
|
||||
await expect(poOmnichannelDepartments.errorMessage('Unit required')).not.toBeVisible();
|
||||
});
|
||||
|
||||
await test.step('expect to save department', async () => {
|
||||
await poOmnichannelDepartments.labelEnabled.click();
|
||||
await poOmnichannelDepartments.btnSave.click();
|
||||
});
|
||||
|
||||
await test.step('expect to have departmentA and departmentB visible', async () => {
|
||||
await expect(poOmnichannelDepartments.table.findRowByName(departmentA.name)).toBeVisible();
|
||||
await expect(poOmnichannelDepartments.table.findRowByName(newDepartmentName)).toBeVisible();
|
||||
});
|
||||
});
|
||||
|
||||
test('OC - Monitor Role - Not allow editing department business unit', async () => {
|
||||
await test.step('expect not to be able to edit unit', async () => {
|
||||
await poOmnichannelDepartments.search(newDepartmentName);
|
||||
await poOmnichannelDepartments.getDepartmentMenuByName(newDepartmentName).click();
|
||||
await poOmnichannelDepartments.menuEditOption.click();
|
||||
await expect(poOmnichannelDepartments.inputUnit).toBeDisabled();
|
||||
});
|
||||
});
|
||||
|
||||
// TODO: We are going to prevent editing busines unit for now
|
||||
test.skip('OC - Monitor Role - Edit department business unit', async () => {
|
||||
const [departmentA] = departments.map((dep) => dep.data);
|
||||
const [, , unitC] = units.map((unit) => unit.data);
|
||||
|
||||
await test.step('expect to edit unit', async () => {
|
||||
await poOmnichannelDepartments.search(newDepartmentName);
|
||||
await poOmnichannelDepartments.getDepartmentMenuByName(newDepartmentName).click();
|
||||
await poOmnichannelDepartments.menuEditOption.click();
|
||||
await poOmnichannelDepartments.selectUnit(unitC.name);
|
||||
await poOmnichannelDepartments.labelEnabled.click();
|
||||
await poOmnichannelDepartments.btnSave.click();
|
||||
});
|
||||
|
||||
await test.step('expect departmentB to still be visible', async () => {
|
||||
await expect(poOmnichannelDepartments.table.findRowByName(departmentA.name)).toBeVisible();
|
||||
await expect(poOmnichannelDepartments.table.findRowByName(newDepartmentName)).toBeVisible();
|
||||
});
|
||||
});
|
||||
|
||||
test.skip('OC - Monitor Role - Edit department and remove business unit', async () => {
|
||||
const [departmentA] = departments.map((dep) => dep.data);
|
||||
|
||||
await test.step('expect to edit unit', async () => {
|
||||
await poOmnichannelDepartments.search(newDepartmentName);
|
||||
await poOmnichannelDepartments.getDepartmentMenuByName(newDepartmentName).click();
|
||||
await poOmnichannelDepartments.menuEditOption.click();
|
||||
await poOmnichannelDepartments.selectUnit('None');
|
||||
await poOmnichannelDepartments.labelEnabled.click();
|
||||
await poOmnichannelDepartments.btnSave.click();
|
||||
});
|
||||
|
||||
await test.step('expect departmentB to not be visible', async () => {
|
||||
await expect(poOmnichannelDepartments.table.findRowByName(departmentA.name)).toBeVisible();
|
||||
await expect(poOmnichannelDepartments.table.findRowByName(newDepartmentName)).not.toBeVisible();
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user