Skip to content
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

Chore: create a test for managers screen #26581

Merged
merged 24 commits into from
Aug 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
fe08eda
test: create a test for managers
weslley543 Aug 16, 2022
d236b1d
fix: intermitences on transfer between tests
weslley543 Aug 16, 2022
210d3ba
fix: message selector
weslley543 Aug 17, 2022
1139e6f
fix: test errors
weslley543 Aug 17, 2022
c310dfc
Merge branch 'develop' into test/omnichannel-manager
weslley543 Aug 17, 2022
099865a
Merge branch 'develop' into test/omnichannel-manager
weslley543 Aug 18, 2022
671b71b
Update apps/meteor/client/views/omnichannel/managers/ManagersRoute.tsx
weslley543 Aug 18, 2022
bee5a87
Update apps/meteor/tests/e2e/page-objects/omnichannel-manager.ts
weslley543 Aug 18, 2022
71da789
fix: test intermitences for transfer chat
weslley543 Aug 18, 2022
f883b83
fix: test intermitences
weslley543 Aug 18, 2022
76dd102
Merge branch 'develop' into test/omnichannel-manager
weslley543 Aug 19, 2022
59e3096
merging from develop
weslley543 Aug 19, 2022
3b2b69b
Merge branch 'develop' into test/omnichannel-manager
weslley543 Aug 22, 2022
9babd24
Merge branch 'develop' into test/omnichannel-manager
weslley543 Aug 23, 2022
6d8c3a3
lint: fix
weslley543 Aug 23, 2022
0ff2502
Merge branch 'develop' into test/omnichannel-manager
weslley543 Aug 23, 2022
785ff33
Merge branch 'develop' into test/omnichannel-manager
weslley543 Aug 24, 2022
9f9e301
Merge branch 'develop' into test/omnichannel-manager
weslley543 Aug 24, 2022
17d45c1
Merge branch 'develop' into test/omnichannel-manager
weslley543 Aug 25, 2022
e1f0f0d
Merge branch 'develop' into test/omnichannel-manager
weslley543 Aug 25, 2022
dc3a25a
Merge branch 'develop' into test/omnichannel-manager
weslley543 Aug 26, 2022
5f8f9de
lint:fix
weslley543 Aug 26, 2022
0e9ebe5
Merge branch 'develop' into test/omnichannel-manager
weslley543 Aug 26, 2022
153698b
Merge branch 'develop' into test/omnichannel-manager
weslley543 Aug 26, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ const ManagersRoute = (): ReactElement => {
{t('Remove')}
</GenericTableHeaderCell>
</GenericTableHeader>
<GenericTableBody>
<GenericTableBody data-qa-id='GenericTableManagerInfoBody'>
{result.phase === AsyncStatePhase.LOADING && <GenericTableLoadingTable headerCells={2} />}
{result.phase === AsyncStatePhase.RESOLVED &&
result.value.users.length > 0 &&
Expand Down
1 change: 0 additions & 1 deletion apps/meteor/tests/e2e/homepage.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ const CardIds = {
Desktop: 'homepage-desktop-apps-card',
Docs: 'homepage-documentation-card',
};

test.use({ storageState: 'admin-session.json' });

test.describe.serial('homepage', () => {
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/tests/e2e/message-actions.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ test.describe.serial('message-actions', () => {
await poHomeChannel.content.sendMessage(message);
await poHomeChannel.content.openLastMessageMenu();
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 expect(poHomeChannel.content.waitForLastMessageTextAttachmentEqualsText).toHaveText(message);
Expand Down
31 changes: 31 additions & 0 deletions apps/meteor/tests/e2e/omnichannel-manager.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
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();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export class HomeSidenav {
async openChat(name: string): Promise<void> {
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-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() :(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ export class OmnichannelSidenav {
return this.page.locator('a[href="omnichannel/agents"]');
}

get linkManagers(): Locator {
return this.page.locator('a[href="omnichannel/managers"]');
}

get linkCustomFields(): Locator {
return this.page.locator('a[href="/omnichannel/customfields"]');
}
Expand Down
1 change: 1 addition & 0 deletions apps/meteor/tests/e2e/page-objects/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ export * from './omnichannel-agents';
export * from './omnichannel-departments';
export * from './omnichannel-current-chats';
export * from './omnichannel-livechat';
export * from './omnichannel-manager';
export * from './omnichannel-custom-fields';
34 changes: 34 additions & 0 deletions apps/meteor/tests/e2e/page-objects/omnichannel-manager.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
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');
}
}