1
0
Fork 0
mirror of https://github.com/elementor/hello-theme.git synced 2026-07-30 15:16:56 +08:00
hello-theme/tests/playwright/pages/base-page.ts
Rami Yushuvaev aa9eed2933
Some checks failed
Build / Build theme (push) Failing after 1s
Lint / ESLint (push) Failing after 0s
PHPUnit / File Diff (push) Failing after 1s
Lint / PHPCS (push) Failing after 41s
PHPUnit / PHPUnit - WordPress 6.8 - PHP version 7.4 (push) Has been skipped
PHPUnit / PHPUnit - WordPress 6.9 - PHP version 7.4 (push) Has been skipped
PHPUnit / PHPUnit - WordPress latest - PHP version 7.4 (push) Has been skipped
PHPUnit / PHPUnit - WordPress nightly - PHP version 7.4 (push) Has been skipped
PHPUnit / PHPUnit - WordPress 6.8 - PHP version 8.0 (push) Has been skipped
PHPUnit / PHPUnit - WordPress 6.9 - PHP version 8.0 (push) Has been skipped
PHPUnit / PHPUnit - WordPress latest - PHP version 8.0 (push) Has been skipped
PHPUnit / PHPUnit - WordPress nightly - PHP version 8.0 (push) Has been skipped
PHPUnit / PHPUnit - WordPress 6.8 - PHP version 8.1 (push) Has been skipped
PHPUnit / PHPUnit - WordPress 6.9 - PHP version 8.1 (push) Has been skipped
PHPUnit / PHPUnit - WordPress latest - PHP version 8.1 (push) Has been skipped
PHPUnit / PHPUnit - WordPress nightly - PHP version 8.1 (push) Has been skipped
PHPUnit / PHPUnit - WordPress 6.8 - PHP version 8.2 (push) Has been skipped
PHPUnit / PHPUnit - WordPress 6.9 - PHP version 8.2 (push) Has been skipped
PHPUnit / PHPUnit - WordPress latest - PHP version 8.2 (push) Has been skipped
PHPUnit / PHPUnit - WordPress nightly - PHP version 8.2 (push) Has been skipped
PHPUnit / PHPUnit - WordPress 6.8 - PHP version 8.3 (push) Has been skipped
PHPUnit / PHPUnit - WordPress 6.9 - PHP version 8.3 (push) Has been skipped
PHPUnit / PHPUnit - WordPress latest - PHP version 8.3 (push) Has been skipped
PHPUnit / PHPUnit - WordPress nightly - PHP version 8.3 (push) Has been skipped
PHPUnit / PHPUnit - Test Results (push) Successful in 2s
Internal: Setup prettier and fix all lint/format issues [TMZ-1051] (#671)
* Setup prettier

* Fix lint/format issues
2026-07-01 00:41:16 -07:00

49 lines
1.2 KiB
TypeScript

import { type Page, type TestInfo } from '@playwright/test';
export default class BasePage {
readonly page: Page;
readonly testInfo: TestInfo;
/**
* @param {import('@playwright/test').Page} page
* @param {import('@playwright/test').TestInfo} testInfo
*/
constructor(page: Page, testInfo: TestInfo) {
if (!page || !testInfo) {
throw new Error('Page and TestInfo must be provided');
}
/**
* @type {import('@playwright/test').Page}
*/
this.page = page;
/**
* @type {import('@playwright/test').TestInfo}
*/
this.testInfo = testInfo;
const { baseURL, proxy } = this.testInfo.config.projects[0].use;
// If wordpress is not located on the domain's top-level (e.g: http://local.host/test-wordpress ), playwright's `baseURL` cannot handle it.
if (proxy) {
this.page = new Proxy(this.page, {
get: (target, key) => {
switch (key) {
case 'goto':
return (path: string) => page.goto(baseURL + path);
case 'waitForNavigation': {
return (args: { url?: string }) => {
args = args.url ? { url: baseURL + args.url } : args;
return page.waitForNavigation(args);
};
}
}
return target[key];
},
});
}
}
}