|
|
|
|
@ -18,6 +18,7 @@ test.describe('OC - Manage Units', () => { |
|
|
|
|
let poOmnichannelUnits: OmnichannelUnits; |
|
|
|
|
|
|
|
|
|
let department: Awaited<ReturnType<typeof createDepartment>>; |
|
|
|
|
let department2: Awaited<ReturnType<typeof createDepartment>>; |
|
|
|
|
|
|
|
|
|
let agent: Awaited<ReturnType<typeof createAgent>>; |
|
|
|
|
|
|
|
|
|
@ -25,6 +26,7 @@ test.describe('OC - Manage Units', () => { |
|
|
|
|
|
|
|
|
|
test.beforeAll(async ({ api }) => { |
|
|
|
|
department = await createDepartment(api); |
|
|
|
|
department2 = await createDepartment(api); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
test.beforeAll(async ({ api }) => { |
|
|
|
|
@ -37,20 +39,20 @@ test.describe('OC - Manage Units', () => { |
|
|
|
|
|
|
|
|
|
test.afterAll(async () => { |
|
|
|
|
await department.delete(); |
|
|
|
|
await department2.delete(); |
|
|
|
|
await monitor.delete(); |
|
|
|
|
await agent.delete(); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
test.beforeEach(async ({ page }: { page: Page }) => { |
|
|
|
|
poOmnichannelUnits = new OmnichannelUnits(page); |
|
|
|
|
await page.goto('/omnichannel'); |
|
|
|
|
await poOmnichannelUnits.sidenav.linkUnits.click(); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
test('OC - Manage Units - Create Unit', async ({ page }) => { |
|
|
|
|
const unitName = faker.string.uuid(); |
|
|
|
|
|
|
|
|
|
await page.goto('/omnichannel'); |
|
|
|
|
await poOmnichannelUnits.sidenav.linkUnits.click(); |
|
|
|
|
|
|
|
|
|
await test.step('expect correct form default state', async () => { |
|
|
|
|
await poOmnichannelUnits.btnCreateUnit.click(); |
|
|
|
|
await expect(poOmnichannelUnits.contextualBar).toBeVisible(); |
|
|
|
|
@ -76,49 +78,30 @@ test.describe('OC - Manage Units', () => { |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
await test.step('expect to delete unit', async () => { |
|
|
|
|
await test.step('expect confirm delete unit', async () => { |
|
|
|
|
await test.step('expect to be able to cancel delete', async () => { |
|
|
|
|
await poOmnichannelUnits.btnDeleteByName(unitName).click(); |
|
|
|
|
await expect(poOmnichannelUnits.confirmDeleteModal).toBeVisible(); |
|
|
|
|
await poOmnichannelUnits.btnCancelDeleteModal.click(); |
|
|
|
|
await expect(poOmnichannelUnits.confirmDeleteModal).not.toBeVisible(); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
await test.step('expect to confirm delete', async () => { |
|
|
|
|
await poOmnichannelUnits.btnDeleteByName(unitName).click(); |
|
|
|
|
await expect(poOmnichannelUnits.confirmDeleteModal).toBeVisible(); |
|
|
|
|
await poOmnichannelUnits.btnConfirmDeleteModal.click(); |
|
|
|
|
await expect(poOmnichannelUnits.confirmDeleteModal).not.toBeVisible(); |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
await test.step('expect to have been deleted', async () => { |
|
|
|
|
if (await poOmnichannelUnits.inputSearch.isVisible()) { |
|
|
|
|
await poOmnichannelUnits.search(unitName); |
|
|
|
|
await expect(poOmnichannelUnits.findRowByName(unitName)).not.toBeVisible(); |
|
|
|
|
} else { |
|
|
|
|
await expect(page.locator('h3 >> text="No units yet"')).toBeVisible(); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
await poOmnichannelUnits.btnDeleteByName(unitName).click(); |
|
|
|
|
await expect(poOmnichannelUnits.confirmDeleteModal).toBeVisible(); |
|
|
|
|
await poOmnichannelUnits.btnConfirmDeleteModal.click(); |
|
|
|
|
await expect(poOmnichannelUnits.confirmDeleteModal).not.toBeVisible(); |
|
|
|
|
await expect(page.locator('h3 >> text="No units yet"')).toBeVisible(); |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
test('OC - Manage Units - Edit unit', async ({ api, page }) => { |
|
|
|
|
test('OC - Manage Units - Edit unit name', async ({ api, page }) => { |
|
|
|
|
const unitName = faker.string.uuid(); |
|
|
|
|
const editedUnitName = faker.string.uuid(); |
|
|
|
|
|
|
|
|
|
const unit = await test.step('expect to create new unit', async () => { |
|
|
|
|
const { data: unit } = await createOrUpdateUnit(api, { |
|
|
|
|
name: faker.string.uuid(), |
|
|
|
|
const { data: newUnit } = await createOrUpdateUnit(api, { |
|
|
|
|
name: unitName, |
|
|
|
|
visibility: 'public', |
|
|
|
|
monitors: [{ monitorId: monitor.data._id, username: 'user2' }], |
|
|
|
|
departments: [{ departmentId: department.data._id }], |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
return unit; |
|
|
|
|
return newUnit; |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
await page.goto('/omnichannel'); |
|
|
|
|
await poOmnichannelUnits.sidenav.linkUnits.click(); |
|
|
|
|
await page.reload(); |
|
|
|
|
|
|
|
|
|
await test.step('expect to edit unit', async () => { |
|
|
|
|
await poOmnichannelUnits.search(unit.name); |
|
|
|
|
@ -138,29 +121,75 @@ test.describe('OC - Manage Units', () => { |
|
|
|
|
await poOmnichannelUnits.findRowByName(editedUnitName).click(); |
|
|
|
|
await expect(poOmnichannelUnits.contextualBar).toBeVisible(); |
|
|
|
|
|
|
|
|
|
await test.step('expect confirm delete unit', async () => { |
|
|
|
|
await test.step('expect to be able to cancel delete', async () => { |
|
|
|
|
await poOmnichannelUnits.btnDelete.click(); |
|
|
|
|
await expect(poOmnichannelUnits.confirmDeleteModal).toBeVisible(); |
|
|
|
|
await poOmnichannelUnits.btnCancelDeleteModal.click(); |
|
|
|
|
await expect(poOmnichannelUnits.confirmDeleteModal).not.toBeVisible(); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
await test.step('expect to confirm delete', async () => { |
|
|
|
|
await poOmnichannelUnits.btnDelete.click(); |
|
|
|
|
await expect(poOmnichannelUnits.confirmDeleteModal).toBeVisible(); |
|
|
|
|
await poOmnichannelUnits.btnConfirmDeleteModal.click(); |
|
|
|
|
await expect(poOmnichannelUnits.confirmDeleteModal).not.toBeVisible(); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
await expect(poOmnichannelUnits.contextualBar).not.toBeVisible(); |
|
|
|
|
await test.step('expect to confirm delete', async () => { |
|
|
|
|
await poOmnichannelUnits.btnDelete.click(); |
|
|
|
|
await expect(poOmnichannelUnits.confirmDeleteModal).toBeVisible(); |
|
|
|
|
await poOmnichannelUnits.btnConfirmDeleteModal.click(); |
|
|
|
|
await expect(poOmnichannelUnits.confirmDeleteModal).not.toBeVisible(); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
await test.step('expect to have been deleted', async () => { |
|
|
|
|
await expect(poOmnichannelUnits.inputSearch).toBeVisible(); |
|
|
|
|
await poOmnichannelUnits.inputSearch.clear(); |
|
|
|
|
await expect(page.locator('h3 >> text="No units yet"')).toBeVisible(); |
|
|
|
|
}); |
|
|
|
|
await expect(poOmnichannelUnits.contextualBar).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.findRowByName(unit.name).click(); |
|
|
|
|
await expect(poOmnichannelUnits.contextualBar).toBeVisible(); |
|
|
|
|
await poOmnichannelUnits.selectDepartment({ name: department2.data.name, _id: department2.data._id }); |
|
|
|
|
await poOmnichannelUnits.btnSave.click(); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
await test.step('expect department to be in the chosen departments list', async () => { |
|
|
|
|
await poOmnichannelUnits.search(unit.name); |
|
|
|
|
await poOmnichannelUnits.findRowByName(unit.name).click(); |
|
|
|
|
await expect(poOmnichannelUnits.contextualBar).toBeVisible(); |
|
|
|
|
await expect(page.getByRole('option', { name: department2.data.name })).toBeVisible(); |
|
|
|
|
await poOmnichannelUnits.btnContextualbarClose.click(); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
await test.step('expect to remove unit departments', async () => { |
|
|
|
|
await poOmnichannelUnits.search(unit.name); |
|
|
|
|
await poOmnichannelUnits.findRowByName(unit.name).click(); |
|
|
|
|
await expect(poOmnichannelUnits.contextualBar).toBeVisible(); |
|
|
|
|
await poOmnichannelUnits.selectDepartment({ name: department2.data.name, _id: department2.data._id }); |
|
|
|
|
await poOmnichannelUnits.selectMonitor('user2'); |
|
|
|
|
await poOmnichannelUnits.btnSave.click(); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
await test.step('expect department to not be in the chosen departments list', async () => { |
|
|
|
|
await poOmnichannelUnits.search(unit.name); |
|
|
|
|
await poOmnichannelUnits.findRowByName(unit.name).click(); |
|
|
|
|
await expect(poOmnichannelUnits.contextualBar).toBeVisible(); |
|
|
|
|
await expect(page.getByRole('option', { name: department2.data.name })).toBeHidden(); |
|
|
|
|
await poOmnichannelUnits.btnContextualbarClose.click(); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
await test.step('expect to delete unit', async () => { |
|
|
|
|
await poOmnichannelUnits.findRowByName(unit.name).click(); |
|
|
|
|
await expect(poOmnichannelUnits.contextualBar).toBeVisible(); |
|
|
|
|
await test.step('expect to confirm delete', async () => { |
|
|
|
|
await poOmnichannelUnits.btnDelete.click(); |
|
|
|
|
await expect(poOmnichannelUnits.confirmDeleteModal).toBeVisible(); |
|
|
|
|
await poOmnichannelUnits.btnConfirmDeleteModal.click(); |
|
|
|
|
await expect(poOmnichannelUnits.confirmDeleteModal).not.toBeVisible(); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
await expect(poOmnichannelUnits.contextualBar).not.toBeVisible(); |
|
|
|
|
}); |
|
|
|
|
}) |
|
|
|
|
}); |
|
|
|
|
|