-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathpageFixtures.ts
50 lines (47 loc) · 1.61 KB
/
pageFixtures.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
//@ts-check
import { test as base } from '@playwright/test';
import { ArticleEditorPage } from '../pages/ArticleEditorPAge';
import { ArticlePage } from '../pages/ArticlePage';
import { HomePage } from '../pages/HomePage';
import { LoggedInUserPage } from '../pages/LoggedInUserPage';
import { SignInPage } from '../pages/SignInPage';
import { SignUpPage } from '../pages/SignUpPage';
type Fixtures = {
homePage: HomePage,
signInPage: SignInPage,
signUpPage: SignUpPage,
loggedInUserPage: LoggedInUserPage,
articleEditorPage: ArticleEditorPage,
articlePage: ArticlePage
}
export const test = base.extend<Fixtures>({
homePage: async ({ page }, use) => {
const homePage = new HomePage(page);
await homePage.open();
await use(homePage);
},
signInPage: async ({ page }, use) => {
const signInPage = new SignInPage(page);
await signInPage.open();
await use(signInPage);
},
signUpPage: async ({ page }, use) => {
const signUpPage = new SignUpPage(page);
signUpPage.open();
await use(signUpPage);
},
loggedInUserPage: async({ page }, use) => {
const loggedInUserPage = new LoggedInUserPage(page);
await loggedInUserPage.open();
await use(loggedInUserPage);
},
articleEditorPage: async({ page }, use) => {
const articleEditorPage = new ArticleEditorPage(page);
await use(articleEditorPage);
},
articlePage: async({ page }, use) => {
const articlePage = new ArticlePage(page);
await use(articlePage);
}
});
export { expect } from '@playwright/test';