-
Notifications
You must be signed in to change notification settings - Fork 13.6k
fix: Inquiry SLA updates not being reflected in real time #36815
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
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@rocket.chat/meteor": patch | ||
| --- | ||
|
|
||
| Fixes queued conversations not being sorted in real time based on the room's SLA policy |
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
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
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
151 changes: 151 additions & 0 deletions
151
apps/meteor/tests/e2e/omnichannel/omnichannel-sla-policies-sidebar.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,151 @@ | ||
| import { | ||
| OmnichannelSortingMechanismSettingType, | ||
| type IOmnichannelServiceLevelAgreements, | ||
| type Serialized, | ||
| } from '@rocket.chat/core-typings'; | ||
|
|
||
| import { createFakeVisitor } from '../../mocks/data'; | ||
| import { IS_EE } from '../config/constants'; | ||
| import { Users } from '../fixtures/userStates'; | ||
| import { HomeOmnichannel } from '../page-objects'; | ||
| import { OmnichannelRoomInfo } from '../page-objects/omnichannel-room-info'; | ||
| import { createConversation } from '../utils/omnichannel/rooms'; | ||
| import { createSLA } from '../utils/omnichannel/sla'; | ||
| import { test, expect } from '../utils/test'; | ||
|
|
||
| const visitorA = createFakeVisitor(); | ||
| const visitorB = createFakeVisitor(); | ||
| const visitorC = createFakeVisitor(); | ||
|
|
||
| test.skip(!IS_EE, 'Omnichannel SLAs > Enterprise Only'); | ||
|
|
||
| test.use({ storageState: Users.user1.state }); | ||
|
|
||
| test.describe('OC - SLA Policies [Sidebar]', () => { | ||
| let poHomeChannel: HomeOmnichannel; | ||
| let poRoomInfo: OmnichannelRoomInfo; | ||
| let conversations: Awaited<ReturnType<typeof createConversation>>[] = []; | ||
| let slas: Serialized<Omit<IOmnichannelServiceLevelAgreements, '_updatedAt'>>[] = []; | ||
|
|
||
| test.beforeAll('create SLAs', async ({ api }) => { | ||
| slas = await Promise.all([ | ||
| createSLA(api, { name: 'Very Urgent', dueTimeInMinutes: 1 }), | ||
| createSLA(api, { name: 'Urgent', dueTimeInMinutes: 10 }), | ||
| createSLA(api, { name: 'Not Urgent', dueTimeInMinutes: 30 }), | ||
| ]); | ||
| }); | ||
|
|
||
| test.beforeAll(async ({ api }) => { | ||
| ( | ||
| await Promise.all([ | ||
| // Create agent and manager | ||
| api.post('/livechat/users/agent', { username: 'user1' }), | ||
| api.post('/livechat/users/manager', { username: 'user1' }), | ||
| // Settings | ||
| api.post('/settings/Livechat_Routing_Method', { value: 'Manual_Selection' }), | ||
| api.post('/settings/Omnichannel_sorting_mechanism', { value: OmnichannelSortingMechanismSettingType.SLAs }), | ||
| ]) | ||
| ).every((res) => expect(res.status()).toBe(200)); | ||
| }); | ||
|
|
||
| test.beforeEach(async ({ page }) => { | ||
| poHomeChannel = new HomeOmnichannel(page); | ||
| poRoomInfo = new OmnichannelRoomInfo(page); | ||
| }); | ||
|
|
||
| test.beforeEach(async ({ page }) => { | ||
| await page.goto('/'); | ||
| await page.locator('#main-content').waitFor(); | ||
| }); | ||
|
|
||
| test.beforeEach(async ({ api }) => { | ||
| conversations = await Promise.all([ | ||
| createConversation(api, { visitorName: visitorA.name, agentId: 'user1' }), | ||
| createConversation(api, { visitorName: visitorB.name, agentId: 'user1' }), | ||
| createConversation(api, { visitorName: visitorC.name, agentId: 'user1' }), | ||
| ]); | ||
| }); | ||
|
|
||
| test.afterAll('delete SLAs', async ({ api }) => { | ||
| const responses = await Promise.all(slas.map((sla) => api.delete(`/livechat/sla/${sla._id}`))); | ||
| responses.every((res) => expect(res.status()).toBe(200)); | ||
| }); | ||
|
|
||
| test.afterAll(async ({ api }) => { | ||
| // Delete conversations | ||
| await Promise.all(conversations.map((conversation) => conversation.delete())); | ||
|
|
||
| ( | ||
| await Promise.all([ | ||
| // Delete agent and manager | ||
| api.delete('/livechat/users/agent/user1'), | ||
| api.delete('/livechat/users/manager/user1'), | ||
| // Reset settings | ||
| api.post('/settings/Livechat_Routing_Method', { value: 'Auto_Selection' }), | ||
| api.post('/settings/Omnichannel_sorting_mechanism', { value: OmnichannelSortingMechanismSettingType.Timestamp }), | ||
| ]) | ||
| ).every((res) => expect(res.status()).toBe(200)); | ||
| }); | ||
|
|
||
| test('OC - SLA Policies [Sidebar] - Update conversation SLA Policy', async () => { | ||
|
aleksandernsilva marked this conversation as resolved.
|
||
| await test.step('expect to change room SLA policy to "Not urgent"', async () => { | ||
| await test.step('expect to open room and room info to be visible', async () => { | ||
| await poHomeChannel.sidenav.getSidebarItemByName(visitorA.name).click(); | ||
| await expect(poRoomInfo.dialogRoomInfo).toBeVisible(); | ||
| }); | ||
|
|
||
| await test.step('expect to update room SLA policy', async () => { | ||
| await expect(poRoomInfo.getInfoByLabel('SLA Policy')).not.toBeVisible(); | ||
| await poRoomInfo.btnEditRoomInfo.click(); | ||
| await poRoomInfo.selectSLA('Not Urgent'); | ||
| await poRoomInfo.btnSaveEditRoom.click(); | ||
| }); | ||
|
|
||
| await test.step('expect SLA to have been updated in the room info and queue order to be correct', async () => { | ||
| await expect(poRoomInfo.getInfoByLabel('SLA Policy')).toHaveText('Not Urgent'); | ||
|
aleksandernsilva marked this conversation as resolved.
|
||
| await expect(poHomeChannel.sidenav.getSidebarListItemByName(visitorA.name)).toHaveAttribute('data-index', '1'); | ||
| }); | ||
| }); | ||
|
|
||
| await test.step('expect to change room SLA policy to "Urgent"', async () => { | ||
| await test.step('expect to open room and room info to be visible', async () => { | ||
| await poHomeChannel.sidenav.getSidebarItemByName(visitorB.name).click(); | ||
| await expect(poRoomInfo.dialogRoomInfo).toBeVisible(); | ||
| }); | ||
|
|
||
| await test.step('expect to update room SLA policy', async () => { | ||
| await expect(poRoomInfo.getInfoByLabel('SLA Policy')).not.toBeVisible(); | ||
| await poRoomInfo.btnEditRoomInfo.click(); | ||
| await poRoomInfo.selectSLA('Urgent'); | ||
| await poRoomInfo.btnSaveEditRoom.click(); | ||
| }); | ||
|
|
||
| await test.step('expect SLA to have been updated in the room info and queue order to be correct', async () => { | ||
| await expect(poRoomInfo.getInfoByLabel('SLA Policy')).toHaveText('Urgent'); | ||
|
aleksandernsilva marked this conversation as resolved.
|
||
| await expect(poHomeChannel.sidenav.getSidebarListItemByName(visitorB.name)).toHaveAttribute('data-index', '1'); | ||
| await expect(poHomeChannel.sidenav.getSidebarListItemByName(visitorA.name)).toHaveAttribute('data-index', '2'); | ||
| }); | ||
| }); | ||
|
|
||
| await test.step('expect to change room SLA policy to "Very Urgent"', async () => { | ||
| await test.step('expect to open room and room info to be visible', async () => { | ||
| await poHomeChannel.sidenav.getSidebarItemByName(visitorC.name).click(); | ||
| await expect(poRoomInfo.dialogRoomInfo).toBeVisible(); | ||
| }); | ||
|
|
||
| await test.step('expect to update room SLA policy', async () => { | ||
| await expect(poRoomInfo.getInfoByLabel('SLA Policy')).not.toBeVisible(); | ||
| await poRoomInfo.btnEditRoomInfo.click(); | ||
| await poRoomInfo.selectSLA('Very Urgent'); | ||
| await poRoomInfo.btnSaveEditRoom.click(); | ||
| }); | ||
|
|
||
| await test.step('expect SLA to have been updated in the room info and queue order to be correct', async () => { | ||
| await expect(poRoomInfo.getInfoByLabel('SLA Policy')).toHaveText('Very Urgent'); | ||
|
aleksandernsilva marked this conversation as resolved.
|
||
| await expect(poHomeChannel.sidenav.getSidebarListItemByName(visitorC.name)).toHaveAttribute('data-index', '1'); | ||
| await expect(poHomeChannel.sidenav.getSidebarListItemByName(visitorB.name)).toHaveAttribute('data-index', '2'); | ||
| await expect(poHomeChannel.sidenav.getSidebarListItemByName(visitorA.name)).toHaveAttribute('data-index', '3'); | ||
| }); | ||
| }); | ||
| }); | ||
| }); | ||
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
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
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.