From 0e0c5c9003569458488cda218a2c79532e87f222 Mon Sep 17 00:00:00 2001 From: juliajforesti Date: Wed, 18 Dec 2024 11:52:15 -0300 Subject: [PATCH] test: `omnichannel-livechat-api` --- .../omnichannel-livechat-api.spec.ts | 31 +++++-------------- 1 file changed, 8 insertions(+), 23 deletions(-) diff --git a/apps/meteor/tests/e2e/omnichannel/omnichannel-livechat-api.spec.ts b/apps/meteor/tests/e2e/omnichannel/omnichannel-livechat-api.spec.ts index 3daaa540402ae..0b9f6fc52d9a3 100644 --- a/apps/meteor/tests/e2e/omnichannel/omnichannel-livechat-api.spec.ts +++ b/apps/meteor/tests/e2e/omnichannel/omnichannel-livechat-api.spec.ts @@ -355,11 +355,8 @@ test.describe('OC - Livechat API', () => { await test.step('Expect chat not be transferred', async () => { await poLiveChat.page.evaluate((depId) => window.RocketChat.livechat.setDepartment(depId), depId); - await poAuxContext2.page.locator('role=navigation >> role=button[name=Search]').click(); - await poAuxContext2.page.locator('role=search >> role=searchbox').fill(registerGuestVisitor.name); - await expect( - poAuxContext2.page.locator(`role=search >> role=listbox >> role=link >> text="${registerGuestVisitor.name}"`), - ).not.toBeVisible(); + await poAuxContext2.poHomeOmnichannel.sidebar.typeSearch(registerGuestVisitor.name); + await expect(poAuxContext2.poHomeOmnichannel.sidebar.getSearchRoomByName(registerGuestVisitor.name)).not.toBeVisible(); }); await test.step('Expect registered guest to still be in dep1', async () => { @@ -385,21 +382,12 @@ test.describe('OC - Livechat API', () => { await poLiveChat.btnSendMessageToOnlineAgent.click(); await test.step('Expect registered guest to be in dep2', async () => { - await poAuxContext2.page.locator('role=navigation >> role=button[name=Search]').click(); - await poAuxContext2.page.locator('role=search >> role=searchbox').fill(registerGuestVisitor.name); - await poAuxContext2.page.locator(`role=search >> role=listbox >> role=link >> text="${registerGuestVisitor.name}"`).click(); - await poAuxContext2.page.locator('role=main').waitFor(); - await poAuxContext2.page.locator('role=main >> role=heading[level=1]').waitFor(); - await expect(poAuxContext2.page.locator('role=main >> .rcx-skeleton')).toHaveCount(0); - await expect(poAuxContext2.page.locator('role=main >> role=list')).not.toHaveAttribute('aria-busy', 'true'); + await poAuxContext2.poHomeOmnichannel.sidebar.openChat(registerGuestVisitor.name); }); await test.step('Expect registered guest not to be in dep1', async () => { - await poAuxContext.page.locator('role=navigation >> role=button[name=Search]').click(); - await poAuxContext.page.locator('role=search >> role=searchbox').fill(registerGuestVisitor.name); - await expect( - poAuxContext.page.locator(`role=search >> role=listbox >> role=link >> text="${registerGuestVisitor.name}"`), - ).not.toBeVisible(); + await poAuxContext.poHomeOmnichannel.sidebar.typeSearch(registerGuestVisitor.name); + await expect(poAuxContext.poHomeOmnichannel.sidebar.getSearchRoomByName(registerGuestVisitor.name)).not.toBeVisible(); }); }); }); @@ -446,11 +434,8 @@ test.describe('OC - Livechat API', () => { await test.step('Expect chat to be transferred', async () => { await poLiveChat.page.evaluate((depId) => window.RocketChat.livechat.transferChat(depId), depId); - await poAuxContext2.page.locator('role=navigation >> role=button[name=Search]').click(); - await poAuxContext2.page.locator('role=search >> role=searchbox').fill(registerGuestVisitor.name); - await expect( - poAuxContext2.page.locator(`role=search >> role=listbox >> role=link >> text="${registerGuestVisitor.name}"`), - ).toBeVisible(); + await poAuxContext2.poHomeOmnichannel.sidebar.typeSearch(registerGuestVisitor.name); + await expect(poAuxContext2.poHomeOmnichannel.sidebar.getSearchRoomByName(registerGuestVisitor.name)).toBeVisible(); }); }); }); @@ -687,7 +672,7 @@ test.describe('OC - Livechat API', () => { }); }); - test.describe('Widget Listeners', () => { + test.describe.only('Widget Listeners', () => { // Tests that listen to events from the widget, and check if they are being triggered let poAuxContext: { page: Page; poHomeOmnichannel: HomeOmnichannel };