
* test(user-interface): add tests with playwright * test: refactor UI configuration tests --------- Co-authored-by: Ali BARIN <ali.barin53@gmail.com>
30 lines
652 B
JavaScript
30 lines
652 B
JavaScript
const path = require('node:path');
|
|
|
|
export class BasePage {
|
|
screenshotPath = '/';
|
|
|
|
/**
|
|
* @param {import('@playwright/test').Page} page
|
|
*/
|
|
constructor(page) {
|
|
this.page = page;
|
|
this.snackbar = this.page.locator('#notistack-snackbar');
|
|
}
|
|
|
|
async clickAway() {
|
|
await this.page.locator('body').click({ position: { x: 0, y: 0 } });
|
|
}
|
|
|
|
async screenshot(options = {}) {
|
|
const { path: plainPath, ...restOptions } = options;
|
|
|
|
const computedPath = path.join(
|
|
'output/screenshots',
|
|
this.screenshotPath,
|
|
plainPath
|
|
);
|
|
|
|
return await this.page.screenshot({ path: computedPath, ...restOptions });
|
|
}
|
|
}
|