-
Notifications
You must be signed in to change notification settings - Fork 13k
test: add tags to the room #36869
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
test: add tags to the room #36869
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
d3e813a
test: implementation of tags feature
Harmeet221 0225f09
test: assign tags to room
Harmeet221 7b60674
Delete repeated file
Harmeet221 4be496b
refactor: improved tags info a11y
aleksandernsilva 0dd7c75
updated tests for tags visibility
Harmeet221 e7decf3
remove comments
Harmeet221 58c6a2b
updated agents cleanup and close browser
Harmeet221 7f49492
added check for tags field visibility
Harmeet221 79b008c
remove await and afterEach block
Harmeet221 726794c
Merge branch 'develop' into tags-implementation
kodiakhq[bot] 4157bd3
Merge branch 'develop' into tags-implementation
aleksandernsilva 2b0a402
Merge branch 'develop' into tags-implementation
kodiakhq[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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
135 changes: 135 additions & 0 deletions
135
apps/meteor/tests/e2e/omnichannel/omnichannel-assign-room-tags.spec.ts
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,135 @@ | ||
| import { createFakeVisitor } from '../../mocks/data'; | ||
| import { IS_EE } from '../config/constants'; | ||
| import { Users } from '../fixtures/userStates'; | ||
| import { HomeOmnichannel } from '../page-objects'; | ||
| import { createAgent } from '../utils/omnichannel/agents'; | ||
| import { addAgentToDepartment, createDepartment } from '../utils/omnichannel/departments'; | ||
| import { createConversation } from '../utils/omnichannel/rooms'; | ||
| import { createTag } from '../utils/omnichannel/tags'; | ||
| import { test, expect } from '../utils/test'; | ||
|
|
||
| const visitorA = createFakeVisitor(); | ||
| const visitorB = createFakeVisitor(); | ||
|
|
||
| test.use({ storageState: Users.user1.state }); | ||
|
|
||
| test.describe('OC - Tags Visibility', () => { | ||
| test.skip(!IS_EE, 'OC - Tags Visibility > Enterprise Edition Only'); | ||
|
|
||
| let poOmnichannel: HomeOmnichannel; | ||
| let conversations: Awaited<ReturnType<typeof createConversation>>[] = []; | ||
| let departmentA: Awaited<ReturnType<typeof createDepartment>>; | ||
| let departmentB: Awaited<ReturnType<typeof createDepartment>>; | ||
| let agent: Awaited<ReturnType<typeof createAgent>>; | ||
| let tags: Awaited<ReturnType<typeof createTag>>[] = []; | ||
|
|
||
| test.beforeAll('Create departments', async ({ api }) => { | ||
| departmentA = await createDepartment(api, { name: 'Department A' }); | ||
| departmentB = await createDepartment(api, { name: 'Department B' }); | ||
| }); | ||
|
|
||
| test.beforeAll('Create agent', async ({ api }) => { | ||
| agent = await createAgent(api, 'user1'); | ||
| }); | ||
|
|
||
| test.beforeAll('Add agents to departments', async ({ api }) => { | ||
| await Promise.all([ | ||
| addAgentToDepartment(api, { department: departmentA.data, agentId: 'user1' }), | ||
| addAgentToDepartment(api, { department: departmentB.data, agentId: 'user1' }), | ||
| ]); | ||
| }); | ||
|
|
||
| test.beforeAll('Create tags', async ({ api }) => { | ||
| tags = await Promise.all([ | ||
| createTag(api, { name: 'TagA', description: 'tag A', departments: [departmentA.data._id] }), | ||
| createTag(api, { name: 'TagB', description: 'tag B', departments: [departmentB.data._id] }), | ||
| createTag(api, { name: 'GlobalTag', description: 'public tag', departments: [] }), | ||
| createTag(api, { | ||
| name: 'SharedTag', | ||
| description: 'tag for both departments', | ||
| departments: [departmentA.data._id, departmentB.data._id], | ||
| }), | ||
| ]); | ||
| }); | ||
|
|
||
| test.beforeAll('Create conversations', async ({ api }) => { | ||
| conversations = await Promise.all([ | ||
| createConversation(api, { visitorName: visitorA.name, agentId: 'user1', departmentId: departmentA.data._id }), | ||
| createConversation(api, { visitorName: visitorB.name, agentId: 'user1', departmentId: departmentB.data._id }), | ||
| ]); | ||
| }); | ||
|
|
||
| test.beforeEach(async ({ page }) => { | ||
| poOmnichannel = new HomeOmnichannel(page); | ||
| await page.goto('/'); | ||
| }); | ||
|
|
||
| test.afterAll(async () => { | ||
| await Promise.all(conversations.map((conversation) => conversation.delete())); | ||
| await Promise.all(tags.map((tag) => tag.delete())); | ||
| await agent.delete(); | ||
| await departmentA.delete(); | ||
| await departmentB.delete(); | ||
| }); | ||
|
|
||
| test('Verify agent should see correct tags based on department association', async () => { | ||
| await test.step('Agent opens room', async () => { | ||
| await poOmnichannel.sidenav.getSidebarItemByName(visitorA.name).click(); | ||
| }); | ||
|
|
||
| await test.step('should not be able to see tags field', async () => { | ||
| await expect(poOmnichannel.roomInfo.getLabel('Tags')).not.toBeVisible(); | ||
| }); | ||
|
|
||
| await test.step('check available tags', async () => { | ||
| await poOmnichannel.roomInfo.btnEditRoomInfo.click(); | ||
| await expect(poOmnichannel.roomInfo.dialogEditRoom).toBeVisible(); | ||
| await poOmnichannel.roomInfo.inputTags.click(); | ||
| }); | ||
|
|
||
| await test.step('Should see TagA (department A specific)', async () => { | ||
Harmeet221 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| await expect(poOmnichannel.roomInfo.optionTags('TagA')).toBeVisible(); | ||
| }); | ||
|
|
||
| await test.step('Should see SharedTag (both departments)', async () => { | ||
| await expect(poOmnichannel.roomInfo.optionTags('SharedTag')).toBeVisible(); | ||
| }); | ||
|
|
||
| await test.step('Should see Public Tags for all chats (no department restriction)', async () => { | ||
| await expect(poOmnichannel.roomInfo.optionTags('GlobalTag')).toBeVisible(); | ||
| }); | ||
|
|
||
| await test.step('Should not see TagB (department B specific)', async () => { | ||
| await expect(poOmnichannel.roomInfo.optionTags('TagB')).not.toBeVisible(); | ||
| }); | ||
|
|
||
| await test.step('add tags and save', async () => { | ||
| await poOmnichannel.roomInfo.selectTag('TagA'); | ||
| await poOmnichannel.roomInfo.selectTag('GlobalTag'); | ||
| await poOmnichannel.roomInfo.btnSaveEditRoom.click(); | ||
| }); | ||
|
|
||
| await test.step('verify selected tags are displayed under room information', async () => { | ||
| await expect(poOmnichannel.roomInfo.getLabel('Tags')).toBeVisible(); | ||
| await expect(poOmnichannel.roomInfo.getTagInfoByLabel('TagA')).toBeVisible(); | ||
| await expect(poOmnichannel.roomInfo.getTagInfoByLabel('GlobalTag')).toBeVisible(); | ||
| }); | ||
| }); | ||
|
|
||
| test('Verify tags visibility for agent associated with multiple departments', async () => { | ||
| await test.step('Open room info', async () => { | ||
| await poOmnichannel.sidenav.getSidebarItemByName(visitorB.name).click(); | ||
| await poOmnichannel.roomInfo.btnEditRoomInfo.click(); | ||
| await expect(poOmnichannel.roomInfo.dialogEditRoom).toBeVisible(); | ||
| await poOmnichannel.roomInfo.inputTags.click(); | ||
| }); | ||
|
|
||
| await test.step('Agent associated with DepartmentB should be able to see tags for Department B', async () => { | ||
| await expect(poOmnichannel.roomInfo.optionTags('TagB')).toBeVisible(); | ||
| }); | ||
|
|
||
| await test.step('Agent associated with DepartmentB should not be able to see tags for DepartmentA', async () => { | ||
| await expect(poOmnichannel.roomInfo.optionTags('TagA')).not.toBeVisible(); | ||
| }); | ||
| }); | ||
| }); | ||
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.