Skip to content

Commit baa27d0

Browse files
committed
setup fixture
1 parent 023cc7d commit baa27d0

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/* eslint-disable @typescript-eslint/no-empty-object-type */
2+
3+
import { test as base, expect } from '@playwright/test';
4+
5+
import { SetupPage } from '../pages/setup.page';
6+
7+
type TestArgs = {
8+
setupPage: SetupPage;
9+
};
10+
11+
export const test = base.extend<TestArgs, {}>({
12+
setupPage: async ({ page }, use) => {
13+
const setupPage = new SetupPage(page);
14+
await setupPage.goto();
15+
return use(setupPage);
16+
}
17+
});
18+
19+
export { expect };

testing/e2e/src/pages/__root.page.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import type { Page } from '@playwright/test';
33

44
export abstract class RootPage {
55
protected readonly $ref: Page;
6+
protected abstract readonly defaultUrl: string;
67

78
constructor(page: Page) {
89
this.$ref = page;
@@ -11,4 +12,8 @@ export abstract class RootPage {
1112
get expect() {
1213
return expect(this.$ref);
1314
}
15+
16+
async goto() {
17+
await this.$ref.goto(this.defaultUrl);
18+
}
1419
}

0 commit comments

Comments
 (0)