Files
automatisch/packages/e2e-tests/fixtures/base-page.js
Rıdvan Akca a3b3038709 test(user-interface-configuration): write initial tests (#1242)
* test(user-interface): add tests with playwright

* test: refactor UI configuration tests

---------

Co-authored-by: Ali BARIN <ali.barin53@gmail.com>
2023-08-25 21:31:02 +02:00

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 });
}
}