-
Notifications
You must be signed in to change notification settings - Fork 10.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Chore: create a test for managers screen (#26581)
Co-authored-by: souzaramon <[email protected]>
- Loading branch information
1 parent
7c36c15
commit fd37ff4
Showing
8 changed files
with
73 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); | ||
} | ||
} |