Skip to content
Snippets Groups Projects
Unverified Commit 2155e04f authored by Weslley Campos's avatar Weslley Campos Committed by GitHub
Browse files

Chore: create a test for managers screen (#26581)

parent 0790192a
No related branches found
No related tags found
No related merge requests found
...@@ -82,7 +82,7 @@ const ManagersRoute = (): ReactElement => { ...@@ -82,7 +82,7 @@ const ManagersRoute = (): ReactElement => {
{t('Remove')} {t('Remove')}
</GenericTableHeaderCell> </GenericTableHeaderCell>
</GenericTableHeader> </GenericTableHeader>
<GenericTableBody> <GenericTableBody data-qa-id='GenericTableManagerInfoBody'>
{result.phase === AsyncStatePhase.LOADING && <GenericTableLoadingTable headerCells={2} />} {result.phase === AsyncStatePhase.LOADING && <GenericTableLoadingTable headerCells={2} />}
{result.phase === AsyncStatePhase.RESOLVED && {result.phase === AsyncStatePhase.RESOLVED &&
result.value.users.length > 0 && result.value.users.length > 0 &&
......
...@@ -11,7 +11,6 @@ const CardIds = { ...@@ -11,7 +11,6 @@ const CardIds = {
Desktop: 'homepage-desktop-apps-card', Desktop: 'homepage-desktop-apps-card',
Docs: 'homepage-documentation-card', Docs: 'homepage-documentation-card',
}; };
test.use({ storageState: 'admin-session.json' }); test.use({ storageState: 'admin-session.json' });
test.describe.serial('homepage', () => { test.describe.serial('homepage', () => {
......
...@@ -50,7 +50,7 @@ test.describe.serial('message-actions', () => { ...@@ -50,7 +50,7 @@ test.describe.serial('message-actions', () => {
await poHomeChannel.content.sendMessage(message); await poHomeChannel.content.sendMessage(message);
await poHomeChannel.content.openLastMessageMenu(); await poHomeChannel.content.openLastMessageMenu();
await page.locator('[data-qa-id="quote-message"]').click(); await page.locator('[data-qa-id="quote-message"]').click();
await page.locator('[name="msg"]').type('this is a quote message'); await page.locator('[name="msg"]').fill('this is a quote message');
await page.keyboard.press('Enter'); await page.keyboard.press('Enter');
await expect(poHomeChannel.content.waitForLastMessageTextAttachmentEqualsText).toHaveText(message); await expect(poHomeChannel.content.waitForLastMessageTextAttachmentEqualsText).toHaveText(message);
......
import { test, expect } from './utils/test';
import { OmnichannelManager } from './page-objects';
test.use({ storageState: 'admin-session.json' });
test.describe.serial('omnichannel-manager', () => {
const user1 = 'user1';
let poOmnichannelManagers: OmnichannelManager;
test.beforeEach(async ({ page }) => {
poOmnichannelManagers = new OmnichannelManager(page);
await page.goto('/omnichannel');
await poOmnichannelManagers.sidenav.linkManagers.click();
});
test('expect add "user1" as manager', async ({ page }) => {
await poOmnichannelManagers.inputUsername.type(user1, { delay: 1000 });
await page.keyboard.press('Enter');
await poOmnichannelManagers.btnAdd.click();
await expect(poOmnichannelManagers.firstRowInTable(user1)).toBeVisible();
});
test('expect remove "user1" as manager', async () => {
await poOmnichannelManagers.btnDeleteFirstRowInTable.click();
await poOmnichannelManagers.btnModalRemove.click();
await expect(poOmnichannelManagers.firstRowInTable(user1)).toBeHidden();
});
});
...@@ -44,7 +44,7 @@ export class HomeSidenav { ...@@ -44,7 +44,7 @@ export class HomeSidenav {
async openChat(name: string): Promise<void> { async openChat(name: string): Promise<void> {
await this.page.locator('[data-qa="sidebar-search"]').click(); await this.page.locator('[data-qa="sidebar-search"]').click();
await this.page.locator('[data-qa="sidebar-search-input"]').type(name); await this.page.locator('[data-qa="sidebar-search-input"]').type(name);
await this.page.locator('[data-qa="sidebar-item-title"]', { hasText: name }).first().click(); await this.page.locator(`[data-qa="sidebar-item-title"] >> text="${name}"`).first().click();
} }
// Note: this is a workaround for now since queued omnichannel chats are not searchable yet so we can't use openChat() :( // Note: this is a workaround for now since queued omnichannel chats are not searchable yet so we can't use openChat() :(
......
...@@ -15,6 +15,10 @@ export class OmnichannelSidenav { ...@@ -15,6 +15,10 @@ export class OmnichannelSidenav {
return this.page.locator('a[href="omnichannel/agents"]'); return this.page.locator('a[href="omnichannel/agents"]');
} }
get linkManagers(): Locator {
return this.page.locator('a[href="omnichannel/managers"]');
}
get linkCustomFields(): Locator { get linkCustomFields(): Locator {
return this.page.locator('a[href="/omnichannel/customfields"]'); return this.page.locator('a[href="/omnichannel/customfields"]');
} }
......
...@@ -9,4 +9,5 @@ export * from './omnichannel-agents'; ...@@ -9,4 +9,5 @@ export * from './omnichannel-agents';
export * from './omnichannel-departments'; export * from './omnichannel-departments';
export * from './omnichannel-current-chats'; export * from './omnichannel-current-chats';
export * from './omnichannel-livechat'; export * from './omnichannel-livechat';
export * from './omnichannel-manager';
export * from './omnichannel-custom-fields'; export * from './omnichannel-custom-fields';
import type { Locator, Page } from '@playwright/test';
import { OmnichannelSidenav } from './fragments';
export class OmnichannelManager {
private readonly page: Page;
readonly sidenav: OmnichannelSidenav;
constructor(page: Page) {
this.page = page;
this.sidenav = new OmnichannelSidenav(page);
}
get inputUsername(): Locator {
return this.page.locator('input').first();
}
get btnAdd(): Locator {
return this.page.locator('button.rcx-button--primary.rcx-button >> text="Add"');
}
firstRowInTable(userId: string) {
return this.page.locator(`[data-qa-id="GenericTableManagerInfoBody"] [qa-user-id="${userId}"]`);
}
get btnDeleteFirstRowInTable() {
return this.page.locator('button[title="Remove"]');
}
get btnModalRemove(): Locator {
return this.page.locator('#modal-root dialog .rcx-modal__inner .rcx-modal__footer .rcx-button--danger');
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment