diff --git a/apps/meteor/client/components/FilterByText.tsx b/apps/meteor/client/components/FilterByText.tsx index 0bc5a78b5c5f..0f317dea61e4 100644 --- a/apps/meteor/client/components/FilterByText.tsx +++ b/apps/meteor/client/components/FilterByText.tsx @@ -23,7 +23,7 @@ const isFilterByTextPropsWithButton = (props: any): props is FilterByTextPropsWi 'displayButton' in props && props.displayButton === true; const FilterByText = forwardRef(function FilterByText( - { placeholder, onChange: setFilter, shouldAutoFocus, children, ...props }, + { placeholder, onChange: setFilter, shouldAutoFocus = false, children, ...props }, ref, ) { const t = useTranslation(); diff --git a/apps/meteor/client/views/omnichannel/managers/ManagersTable.tsx b/apps/meteor/client/views/omnichannel/managers/ManagersTable.tsx index 7662f740c7d3..afb2ae8f351b 100644 --- a/apps/meteor/client/views/omnichannel/managers/ManagersTable.tsx +++ b/apps/meteor/client/views/omnichannel/managers/ManagersTable.tsx @@ -100,9 +100,9 @@ const ManagersTable = () => { )} {isSuccess && data.users.length > 0 && ( <> - + {headers} - + {data.users.map((user) => ( diff --git a/apps/meteor/tests/e2e/omnichannel/omnichannel-agents.spec.ts b/apps/meteor/tests/e2e/omnichannel/omnichannel-agents.spec.ts index 658296fb3387..70b5e51f681c 100644 --- a/apps/meteor/tests/e2e/omnichannel/omnichannel-agents.spec.ts +++ b/apps/meteor/tests/e2e/omnichannel/omnichannel-agents.spec.ts @@ -50,7 +50,7 @@ test.describe.serial('OC - Manage Agents', () => { await test.step('expect remove "user1" as agent', async () => { await poOmnichannelAgents.inputSearch.fill('user1'); - await poOmnichannelAgents.btnDeletefirstRowInTable.click(); + await poOmnichannelAgents.btnDeleteFirstRowInTable.click(); await poOmnichannelAgents.btnModalRemove.click(); await poOmnichannelAgents.inputSearch.fill('user1'); diff --git a/apps/meteor/tests/e2e/omnichannel/omnichannel-manager-role.spec.ts b/apps/meteor/tests/e2e/omnichannel/omnichannel-manager-role.spec.ts index 74bcaff7c919..a07f0e7b808f 100644 --- a/apps/meteor/tests/e2e/omnichannel/omnichannel-manager-role.spec.ts +++ b/apps/meteor/tests/e2e/omnichannel/omnichannel-manager-role.spec.ts @@ -169,12 +169,11 @@ test.describe('OC - Manager Role', () => { }); }); - test('OC - Manager Role - Add/remove agents', async ({ page }) => { + test('OC - Manager Role - Add/remove agents', async () => { await poOmnichannel.agents.sidenav.linkAgents.click(); await test.step('expect add "user1" as agent', async () => { - await poOmnichannel.agents.inputUsername.type('user1'); - await page.locator('role=option[name="user1"]').click(); + await poOmnichannel.agents.selectUsername('user1'); await poOmnichannel.agents.btnAdd.click(); await poOmnichannel.agents.inputSearch.fill('user1'); @@ -183,32 +182,31 @@ test.describe('OC - Manager Role', () => { await test.step('expect remove "user1" as agent', async () => { await poOmnichannel.agents.inputSearch.fill('user1'); - await poOmnichannel.agents.btnDeletefirstRowInTable.click(); + await poOmnichannel.agents.btnDeleteFirstRowInTable.click(); await poOmnichannel.agents.btnModalRemove.click(); await poOmnichannel.agents.inputSearch.fill(''); - await poOmnichannel.agents.inputSearch.type('user1'); + await poOmnichannel.agents.inputSearch.fill('user1'); await expect(poOmnichannel.agents.findRowByName('user1')).toBeHidden(); }); }); - test('OC - Manager Role - Add/remove managers', async ({ page }) => { + test('OC - Manager Role - Add/remove managers', async () => { await poOmnichannel.omnisidenav.linkManagers.click(); await test.step('expect add "user1" as manager', async () => { - await poOmnichannel.managers.inputUsername.type('user1'); - await page.locator('role=option[name="user1"]').click(); + await poOmnichannel.managers.selectUsername('user1'); await poOmnichannel.managers.btnAdd.click(); - await expect(poOmnichannel.managers.firstRowInTable('user1')).toBeVisible(); + await expect(poOmnichannel.managers.findRowByName('user1')).toBeVisible(); }); await test.step('expect search for manager', async () => { await poOmnichannel.managers.search('user1'); - await expect(poOmnichannel.managers.firstRowInTable('user1')).toBeVisible(); + await expect(poOmnichannel.managers.findRowByName('user1')).toBeVisible(); await poOmnichannel.managers.search('NonExistingUser'); - await expect(poOmnichannel.managers.firstRowInTable('user1')).toBeHidden(); + await expect(poOmnichannel.managers.findRowByName('user1')).toBeHidden(); await poOmnichannel.managers.clearSearch(); }); @@ -218,7 +216,7 @@ test.describe('OC - Manager Role', () => { await poOmnichannel.managers.btnDeleteSelectedAgent('user1').click(); await poOmnichannel.managers.btnModalRemove.click(); - await expect(poOmnichannel.managers.firstRowInTable('user1')).toBeHidden(); + await expect(poOmnichannel.managers.findRowByName('user1')).toBeHidden(); }); }); diff --git a/apps/meteor/tests/e2e/omnichannel/omnichannel-manager.spec.ts b/apps/meteor/tests/e2e/omnichannel/omnichannel-manager.spec.ts index c7b1ff4a86c0..c11978abcb69 100644 --- a/apps/meteor/tests/e2e/omnichannel/omnichannel-manager.spec.ts +++ b/apps/meteor/tests/e2e/omnichannel/omnichannel-manager.spec.ts @@ -16,26 +16,23 @@ test.describe.serial('omnichannel-manager', () => { test('OC - Manage Managers - Add, Search and Remove', async ({ page }) => { await test.step('expect "user1" be first ', async () => { - await poOmnichannelManagers.inputUsername.type('user'); + await poOmnichannelManagers.inputUsername.fill('user'); await expect(page.locator('role=option[name="user1"]')).toContainText('user1'); - - await poOmnichannelManagers.inputUsername.type(''); }); - + await test.step('expect add "user1" as manager', async () => { - await poOmnichannelManagers.inputUsername.type('user1'); - await page.locator('role=option[name="user1"]').click(); + await poOmnichannelManagers.selectUsername('user1'); await poOmnichannelManagers.btnAdd.click(); - await expect(poOmnichannelManagers.firstRowInTable('user1')).toBeVisible(); + await expect(poOmnichannelManagers.findRowByName('user1')).toBeVisible(); }); await test.step('expect search for manager', async () => { await poOmnichannelManagers.search('user1'); - await expect(poOmnichannelManagers.firstRowInTable('user1')).toBeVisible(); - + await expect(poOmnichannelManagers.findRowByName('user1')).toBeVisible(); + await poOmnichannelManagers.search('NonExistingUser'); - await expect(poOmnichannelManagers.firstRowInTable('user1')).toBeHidden(); + await expect(poOmnichannelManagers.findRowByName('user1')).toBeHidden(); await poOmnichannelManagers.clearSearch(); }); @@ -45,7 +42,7 @@ test.describe.serial('omnichannel-manager', () => { await poOmnichannelManagers.btnDeleteSelectedAgent('user1').click(); await poOmnichannelManagers.btnModalRemove.click(); - await expect(poOmnichannelManagers.firstRowInTable('user1')).toBeHidden(); + await expect(poOmnichannelManagers.findRowByName('user1')).toBeHidden(); }); }); }); diff --git a/apps/meteor/tests/e2e/page-objects/omnichannel-agents.ts b/apps/meteor/tests/e2e/page-objects/omnichannel-agents.ts index 8f7199326444..63818a06032a 100644 --- a/apps/meteor/tests/e2e/page-objects/omnichannel-agents.ts +++ b/apps/meteor/tests/e2e/page-objects/omnichannel-agents.ts @@ -34,7 +34,7 @@ export class OmnichannelAgents { return this.page.locator('[data-qa-id="agents-table"] tr:first-child td:first-child'); } - get btnDeletefirstRowInTable() { + get btnDeleteFirstRowInTable() { return this.page.locator('[data-qa-id="agents-table"] tr:first-child').locator('role=button[name="Remove"]'); } diff --git a/apps/meteor/tests/e2e/page-objects/omnichannel-manager.ts b/apps/meteor/tests/e2e/page-objects/omnichannel-manager.ts index c2551e6e87df..0f2e9ac516e7 100644 --- a/apps/meteor/tests/e2e/page-objects/omnichannel-manager.ts +++ b/apps/meteor/tests/e2e/page-objects/omnichannel-manager.ts @@ -12,7 +12,7 @@ export class OmnichannelManager { this.sidenav = new OmnichannelSidenav(page); } - get inputSearch() { + private get inputSearch() { return this.page.locator('[placeholder="Search"]'); } @@ -30,16 +30,17 @@ export class OmnichannelManager { return this.page.locator('input').first(); } - get btnAdd(): Locator { - return this.page.locator('button.rcx-button--primary.rcx-button >> text="Add manager"'); + async selectUsername(username: string) { + await this.inputUsername.fill(username); + await this.page.locator(`role=option[name="${username}"]`).click(); } - firstRowInTable(userId: string) { - return this.page.locator(`[data-qa-id="GenericTableManagerInfoBody"] [qa-user-id="${userId}"]`); + get btnAdd(): Locator { + return this.page.locator('button.rcx-button--primary.rcx-button >> text="Add manager"'); } - get btnDeleteFirstRowInTable() { - return this.page.locator('button[title="Remove"]'); + findRowByName(name: string) { + return this.page.locator('role=table[name="Managers"] >> role=row', { has: this.page.locator(`role=cell[name="${name}"]`) }); } btnDeleteSelectedAgent(text: string) {