* feat: video recorder on failures * feat: fixture for sample page class * feat: video recorder on failures * feat: fixture for sample page class * feat: video recorder on failures * feat: fixture for sample page class * feat: Apply Screenshot on failures * feat: set timeout by default * chore: clean up import * feat: video recorder on failures * feat: fixture for sample page class * feat: add wait for app update * chore: correct timeout * chore: correct timeout * chore: test timeout * chore: test timeout * chore: test timeout * chore: browser context config * chore: temporally disable the video recorder to bypass issue
50 lines
1.2 KiB
TypeScript
50 lines
1.2 KiB
TypeScript
import { Page, expect } from '@playwright/test'
|
|
import { CommonActions } from './commonActions'
|
|
import { TIMEOUT } from '../config/fixtures'
|
|
|
|
export class BasePage {
|
|
menuId: string
|
|
|
|
constructor(
|
|
protected readonly page: Page,
|
|
readonly action: CommonActions,
|
|
protected containerId: string
|
|
) {}
|
|
|
|
public getValue(key: string) {
|
|
return this.action.getValue(key)
|
|
}
|
|
|
|
public setValue(key: string, value: string) {
|
|
this.action.setValue(key, value)
|
|
}
|
|
|
|
async takeScreenshot(name: string = '') {
|
|
await this.action.takeScreenshot(name)
|
|
}
|
|
|
|
async navigateByMenu() {
|
|
await this.page.getByTestId(this.menuId).first().click()
|
|
}
|
|
|
|
async verifyContainerVisible() {
|
|
const container = this.page.getByTestId(this.containerId)
|
|
expect(container.isVisible()).toBeTruthy()
|
|
}
|
|
|
|
async waitUpdateLoader() {
|
|
await this.isElementVisible('img[alt="Jan - Logo"]')
|
|
}
|
|
|
|
//wait and find a specific element with it's selector and return Visible
|
|
async isElementVisible(selector: any) {
|
|
let isVisible = true
|
|
await this.page
|
|
.waitForSelector(selector, { state: 'visible', timeout: TIMEOUT })
|
|
.catch(() => {
|
|
isVisible = false
|
|
})
|
|
return isVisible
|
|
}
|
|
}
|