From ba6312c2bdf99f39782570dec0cd156322944f1f Mon Sep 17 00:00:00 2001 From: Kevin Aleman Date: Thu, 9 May 2024 09:45:05 -0600 Subject: [PATCH 1/4] conflicts --- .../ee/client/omnichannel/units/UnitEdit.tsx | 4 +-- .../e2e/omnichannel/omnichannel-units.spec.ts | 27 +++++++++++++++++-- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/apps/meteor/ee/client/omnichannel/units/UnitEdit.tsx b/apps/meteor/ee/client/omnichannel/units/UnitEdit.tsx index adb0a2a5c089..b618d2eac89e 100644 --- a/apps/meteor/ee/client/omnichannel/units/UnitEdit.tsx +++ b/apps/meteor/ee/client/omnichannel/units/UnitEdit.tsx @@ -85,8 +85,8 @@ const UnitEdit = ({ unitData, unitMonitors, unitDepartments }: UnitEditProps) => const currUnitMonitors = useMemo( () => - unitMonitors?.map(({ _id, username }) => ({ - value: _id, + unitMonitors?.map(({ monitorId, username }) => ({ + value: monitorId, label: username, })) || [], [unitMonitors], diff --git a/apps/meteor/tests/e2e/omnichannel/omnichannel-units.spec.ts b/apps/meteor/tests/e2e/omnichannel/omnichannel-units.spec.ts index 146885aef55e..8b74fbd315f7 100644 --- a/apps/meteor/tests/e2e/omnichannel/omnichannel-units.spec.ts +++ b/apps/meteor/tests/e2e/omnichannel/omnichannel-units.spec.ts @@ -24,6 +24,8 @@ test.describe('OC - Manage Units', () => { let monitor: Awaited>; + let monitor2: Awaited>; + test.beforeAll(async ({ api }) => { department = await createDepartment(api); department2 = await createDepartment(api); @@ -35,12 +37,14 @@ test.describe('OC - Manage Units', () => { test.beforeAll(async ({ api }) => { monitor = await createMonitor(api, 'user2'); + monitor2 = await createMonitor(api, 'user3'); }); test.afterAll(async () => { await department.delete(); await department2.delete(); await monitor.delete(); + await monitor2.delete(); await agent.delete(); }); @@ -101,8 +105,9 @@ test.describe('OC - Manage Units', () => { return newUnit; }); - await page.reload(); - + await page.goto('/omnichannel'); + await poOmnichannelUnits.sidenav.linkUnits.click(); + await test.step('expect to edit unit', async () => { await poOmnichannelUnits.search(unit.name); await poOmnichannelUnits.findRowByName(unit.name).click(); @@ -117,6 +122,24 @@ test.describe('OC - Manage Units', () => { await expect(poOmnichannelUnits.findRowByName(editedUnitName)).toBeVisible(); }); + await test.step('expect to add another monitor to list', async () => { + await poOmnichannelUnits.findRowByName(editedUnitName).click(); + await expect(poOmnichannelUnits.contextualBar).toBeVisible(); + await poOmnichannelUnits.selectMonitor('user3'); + await poOmnichannelUnits.btnSave.click(); + }); + + await test.step('expect unit to have been edited with 2 monitors', async () => { + await expect(poOmnichannelUnits.inputSearch).toBeVisible(); + await poOmnichannelUnits.search(editedUnitName); + await expect(poOmnichannelUnits.findRowByName(editedUnitName)).toBeVisible(); + await poOmnichannelUnits.findRowByName(editedUnitName).click(); + await expect(poOmnichannelUnits.contextualBar).toBeVisible(); + + await expect(poOmnichannelUnits.inputMonitors).toHaveText(/user2/); + await expect(poOmnichannelUnits.inputMonitors).toHaveText(/user3/); + }); + await test.step('expect to delete unit', async () => { await poOmnichannelUnits.findRowByName(editedUnitName).click(); await expect(poOmnichannelUnits.contextualBar).toBeVisible(); From eafab323193835272b6fc8f14ea49ea5e7b417a8 Mon Sep 17 00:00:00 2001 From: Kevin Aleman Date: Mon, 13 May 2024 08:11:47 -0600 Subject: [PATCH 2/4] another test --- .../e2e/omnichannel/omnichannel-units.spec.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/apps/meteor/tests/e2e/omnichannel/omnichannel-units.spec.ts b/apps/meteor/tests/e2e/omnichannel/omnichannel-units.spec.ts index 8b74fbd315f7..3ac1840fc29b 100644 --- a/apps/meteor/tests/e2e/omnichannel/omnichannel-units.spec.ts +++ b/apps/meteor/tests/e2e/omnichannel/omnichannel-units.spec.ts @@ -140,6 +140,23 @@ test.describe('OC - Manage Units', () => { await expect(poOmnichannelUnits.inputMonitors).toHaveText(/user3/); }); + await test.step('expect unit to remove one of the two monitors', async () => { + await expect(poOmnichannelUnits.inputSearch).toBeVisible(); + await poOmnichannelUnits.search(editedUnitName); + await expect(poOmnichannelUnits.findRowByName(editedUnitName)).toBeVisible(); + await poOmnichannelUnits.findRowByName(editedUnitName).click(); + await expect(poOmnichannelUnits.contextualBar).toBeVisible(); + await poOmnichannelUnits.selectMonitor('user2'); + await poOmnichannelUnits.btnSave.click(); + + await expect(poOmnichannelUnits.inputSearch).toBeVisible(); + await poOmnichannelUnits.search(editedUnitName); + await expect(poOmnichannelUnits.findRowByName(editedUnitName)).toBeVisible(); + await poOmnichannelUnits.findRowByName(editedUnitName).click(); + await expect(poOmnichannelUnits.inputMonitors).toHaveText(/user3/); + await expect(poOmnichannelUnits.inputMonitors).not.toHaveText(/user2/); + }); + await test.step('expect to delete unit', async () => { await poOmnichannelUnits.findRowByName(editedUnitName).click(); await expect(poOmnichannelUnits.contextualBar).toBeVisible(); From 427faee885dc3f9c0380ae8f1bc73b07eb6239db Mon Sep 17 00:00:00 2001 From: Kevin Aleman Date: Tue, 14 May 2024 15:36:21 -0600 Subject: [PATCH 3/4] Update omnichannel-units.spec.ts --- .../tests/e2e/omnichannel/omnichannel-units.spec.ts | 9 --------- 1 file changed, 9 deletions(-) diff --git a/apps/meteor/tests/e2e/omnichannel/omnichannel-units.spec.ts b/apps/meteor/tests/e2e/omnichannel/omnichannel-units.spec.ts index 3ac1840fc29b..7b4b5d2611cc 100644 --- a/apps/meteor/tests/e2e/omnichannel/omnichannel-units.spec.ts +++ b/apps/meteor/tests/e2e/omnichannel/omnichannel-units.spec.ts @@ -124,34 +124,25 @@ test.describe('OC - Manage Units', () => { await test.step('expect to add another monitor to list', async () => { await poOmnichannelUnits.findRowByName(editedUnitName).click(); - await expect(poOmnichannelUnits.contextualBar).toBeVisible(); await poOmnichannelUnits.selectMonitor('user3'); await poOmnichannelUnits.btnSave.click(); }); await test.step('expect unit to have been edited with 2 monitors', async () => { - await expect(poOmnichannelUnits.inputSearch).toBeVisible(); await poOmnichannelUnits.search(editedUnitName); - await expect(poOmnichannelUnits.findRowByName(editedUnitName)).toBeVisible(); await poOmnichannelUnits.findRowByName(editedUnitName).click(); - await expect(poOmnichannelUnits.contextualBar).toBeVisible(); await expect(poOmnichannelUnits.inputMonitors).toHaveText(/user2/); await expect(poOmnichannelUnits.inputMonitors).toHaveText(/user3/); }); await test.step('expect unit to remove one of the two monitors', async () => { - await expect(poOmnichannelUnits.inputSearch).toBeVisible(); await poOmnichannelUnits.search(editedUnitName); - await expect(poOmnichannelUnits.findRowByName(editedUnitName)).toBeVisible(); await poOmnichannelUnits.findRowByName(editedUnitName).click(); - await expect(poOmnichannelUnits.contextualBar).toBeVisible(); await poOmnichannelUnits.selectMonitor('user2'); await poOmnichannelUnits.btnSave.click(); - await expect(poOmnichannelUnits.inputSearch).toBeVisible(); await poOmnichannelUnits.search(editedUnitName); - await expect(poOmnichannelUnits.findRowByName(editedUnitName)).toBeVisible(); await poOmnichannelUnits.findRowByName(editedUnitName).click(); await expect(poOmnichannelUnits.inputMonitors).toHaveText(/user3/); await expect(poOmnichannelUnits.inputMonitors).not.toHaveText(/user2/); From ef567ed2e76b26f4978130bca16185aa84f84984 Mon Sep 17 00:00:00 2001 From: Kevin Aleman Date: Fri, 17 May 2024 07:48:50 -0600 Subject: [PATCH 4/4] Create angry-rocks-try.md --- .changeset/angry-rocks-try.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/angry-rocks-try.md diff --git a/.changeset/angry-rocks-try.md b/.changeset/angry-rocks-try.md new file mode 100644 index 000000000000..8072b9db48fb --- /dev/null +++ b/.changeset/angry-rocks-try.md @@ -0,0 +1,5 @@ +--- +"@rocket.chat/meteor": patch +--- + +Fixed an issue causing monitors to dissapear from a saved unit every time a user saved the item. This was caused by the UI not sending the correct _id of the monitors that were already saved, and this caused the Backend to ignore them and remove from the list.