-
Notifications
You must be signed in to change notification settings - Fork 11.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: improved agents e2e tests (#31196)
* chore: added qa ids * chore: refactored agents e2e tests
- Loading branch information
1 parent
d08b1d0
commit 08e597c
Showing
8 changed files
with
155 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
98 changes: 81 additions & 17 deletions
98
apps/meteor/tests/e2e/omnichannel/omnichannel-agents.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,108 @@ | ||
import { IS_EE } from '../config/constants'; | ||
import { Users } from '../fixtures/userStates'; | ||
import { OmnichannelAgents } from '../page-objects'; | ||
import { createDepartment } from '../utils/omnichannel/departments'; | ||
import { test, expect } from '../utils/test'; | ||
|
||
test.use({ storageState: Users.admin.state }); | ||
|
||
test.describe.serial('omnichannel-agents', () => { | ||
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); | ||
}); | ||
|
||
// Create page object and redirect to home | ||
test.beforeEach(async ({ page }) => { | ||
poOmnichannelAgents = new OmnichannelAgents(page); | ||
|
||
await page.goto('/omnichannel'); | ||
await poOmnichannelAgents.sidenav.linkAgents.click(); | ||
}); | ||
|
||
test('expect add "user1" as agent', async ({ page }) => { | ||
await poOmnichannelAgents.inputUsername.type('user1'); | ||
await page.locator('role=option[name="user1"]').click(); | ||
await poOmnichannelAgents.btnAdd.click(); | ||
// Ensure that there is no leftover data even if test fails | ||
test.afterEach(async ({ api }) => { | ||
await await api.delete('/livechat/users/agent/user1'); | ||
await api.post('/settings/Omnichannel_enable_department_removal', { value: true }).then((res) => expect(res.status()).toBe(200)); | ||
await department.delete(); | ||
await api.post('/settings/Omnichannel_enable_department_removal', { value: false }).then((res) => expect(res.status()).toBe(200)); | ||
}); | ||
|
||
await poOmnichannelAgents.inputSearch.fill('user1'); | ||
await expect(poOmnichannelAgents.firstRowInTable).toBeVisible(); | ||
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.btnAdd.click(); | ||
|
||
await poOmnichannelAgents.inputSearch.fill('user1'); | ||
await expect(poOmnichannelAgents.firstRowInTable).toBeVisible(); | ||
await expect(poOmnichannelAgents.firstRowInTable).toHaveText('user1'); | ||
}); | ||
|
||
await test.step('expect remove "user1" as agent', async () => { | ||
await poOmnichannelAgents.inputSearch.fill('user1'); | ||
await poOmnichannelAgents.btnDeletefirstRowInTable.click(); | ||
await poOmnichannelAgents.btnModalRemove.click(); | ||
|
||
await poOmnichannelAgents.inputSearch.fill('user1'); | ||
await expect(poOmnichannelAgents.findRowByUsername('user1')).not.toBeVisible(); | ||
}); | ||
}); | ||
|
||
test('expect update "user1" status', async ({ page }) => { | ||
test('OC - Manage Agents [CE]- Edit and Remove', async () => { | ||
test.skip(IS_EE, 'Community Edition Only'); | ||
|
||
await poOmnichannelAgents.selectUsername('user1'); | ||
await poOmnichannelAgents.btnAdd.click(); | ||
|
||
await poOmnichannelAgents.inputSearch.fill('user1'); | ||
await poOmnichannelAgents.firstRowInTable.click(); | ||
|
||
await poOmnichannelAgents.btnEdit.click(); | ||
await poOmnichannelAgents.btnStatus.click(); | ||
await page.locator(`.rcx-option__content:has-text("Not available")`).click(); | ||
await poOmnichannelAgents.btnSave.click(); | ||
|
||
await test.step('expect max chats fields to be hidden', async () => { | ||
await expect(poOmnichannelAgents.inputMaxChats).toBeHidden(); | ||
}); | ||
|
||
await test.step('expect update "user1" information', async () => { | ||
await poOmnichannelAgents.selectStatus('Not available'); | ||
await poOmnichannelAgents.selectDepartment(department.data.name); | ||
await poOmnichannelAgents.btnSave.click(); | ||
}); | ||
|
||
await test.step('expect removing "user1" via sidebar', async () => { | ||
await poOmnichannelAgents.inputSearch.fill('user1'); | ||
await poOmnichannelAgents.firstRowInTable.click(); | ||
await poOmnichannelAgents.btnRemove.click(); | ||
}); | ||
}); | ||
|
||
test('expect remove "user1" as agent', async () => { | ||
await poOmnichannelAgents.inputSearch.fill('user1'); | ||
await poOmnichannelAgents.btnDeletefirstRowInTable.click(); | ||
await poOmnichannelAgents.btnModalRemove.click(); | ||
test('OC - Manage Agents [EE] - Edit ', async () => { | ||
test.skip(!IS_EE, 'Enterprise Only'); | ||
|
||
await poOmnichannelAgents.selectUsername('user1'); | ||
await poOmnichannelAgents.btnAdd.click(); | ||
|
||
await poOmnichannelAgents.inputSearch.fill('user1'); | ||
await expect(poOmnichannelAgents.firstRowInTable).toBeHidden(); | ||
await poOmnichannelAgents.findRowByUsername('user1').click(); | ||
await poOmnichannelAgents.btnEdit.click(); | ||
|
||
await test.step('expect max chats field to be visible', async () => { | ||
await expect(poOmnichannelAgents.inputMaxChats).toBeVisible(); | ||
}); | ||
|
||
await test.step('expect update "user1" information', async () => { | ||
await poOmnichannelAgents.inputMaxChats.click(); | ||
await poOmnichannelAgents.inputMaxChats.fill('2'); | ||
await poOmnichannelAgents.btnSave.click(); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters