-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: nabim777 <[email protected]>
- Loading branch information
Showing
5 changed files
with
27 additions
and
27 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
20 changes: 10 additions & 10 deletions
20
packages/web-app-progress-bars/tests/e2e/progressBar.spec.ts
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 |
---|---|---|
@@ -1,23 +1,23 @@ | ||
import { test, Page, expect } from '@playwright/test' | ||
import { AccountPage } from "../../../../support/pages/accountPage"; | ||
import { AccountPage } from '../../../../support/pages/accountPage' | ||
import { loginAsUser, logout } from '../../../../support/helpers/authHelper' | ||
|
||
let adminPage: Page | ||
|
||
test.beforeEach(async ({ browser }) => { | ||
const admin = await loginAsUser(browser, 'admin', 'admin') | ||
adminPage = admin.page | ||
const admin = await loginAsUser(browser, 'admin', 'admin') | ||
adminPage = admin.page | ||
}) | ||
|
||
test.afterEach(async () => { | ||
await logout(adminPage) | ||
await logout(adminPage) | ||
}) | ||
|
||
test('select the progressBarOption', async () => { | ||
const accountPage = new AccountPage(adminPage) | ||
await accountPage.goToAccountPage() | ||
await accountPage.selectProgressBarExtension('Nyan Cat progress bar') | ||
const accountPage = new AccountPage(adminPage) | ||
await accountPage.goToAccountPage() | ||
await accountPage.selectProgressBarExtension('Nyan Cat progress bar') | ||
|
||
const progressBarCurrent = await accountPage.progressBarCurrent.textContent() | ||
expect(progressBarCurrent).toEqual('Nyan Cat progress bar') | ||
}) | ||
const progressBarCurrent = await accountPage.progressBarCurrent.textContent() | ||
expect(progressBarCurrent).toEqual('Nyan Cat progress bar') | ||
}) |
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 |
---|---|---|
@@ -1,32 +1,32 @@ | ||
import { Locator, Page } from '@playwright/test' | ||
import util from 'util' | ||
|
||
export class AccountPage { | ||
readonly page: Page | ||
readonly accountMenuButton: Locator | ||
readonly accountManageButton: Locator | ||
readonly accountMenuBtn: Locator | ||
readonly accountManageBtn: Locator | ||
readonly progressBarSelector: Locator | ||
readonly progressBarOption: Locator | ||
readonly progressBarCurrent: Locator | ||
readonly progressBarOption: String | ||
|
||
constructor(page: Page) { | ||
this.page = page | ||
this.accountMenuButton = this.page.locator('.oc-topbar-avatar') | ||
this.accountManageButton = this.page.locator('#oc-topbar-account-manage') | ||
this.accountMenuBtn = this.page.locator('.oc-topbar-avatar') | ||
this.accountManageBtn = this.page.locator('#oc-topbar-account-manage') | ||
|
||
this.progressBarSelector = this.page.locator('.account-page-extensions .extension-preference .vs__search') | ||
this.progressBarOption = this.page.locator('//div[@class="extension-preference"]//span[text()="%s"]') | ||
this.progressBarCurrent = this.page.locator('.account-page-extensions .extension-preference .vs__selected span') | ||
this.progressBarOption = '//div[@class="extension-preference"]//span[text()="%s"]' | ||
} | ||
|
||
async goToAccountPage() { | ||
await this.accountMenuButton.click() | ||
await this.accountManageButton.click() | ||
await this.accountMenuBtn.click() | ||
await this.accountManageBtn.click() | ||
} | ||
|
||
async selectProgressBarExtension(name: string){ | ||
await new Promise((resolve) => setTimeout(resolve, 500)) | ||
await this.progressBarSelector.waitFor() | ||
await this.progressBarSelector.click() | ||
await this.page.getByText(name).click(); | ||
await this.page.locator(util.format(this.progressBarOption, name)).click() | ||
} | ||
} |