Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fae6b3f

Browse files
committed
Push functionality up to BasePOM API
1 parent 7997a16 commit fae6b3f

File tree

3 files changed

+12
-16
lines changed

3 files changed

+12
-16
lines changed

site/e2e/pom/BasePom.ts

+10-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
import { Page } from "@playwright/test"
22

33
export abstract class BasePom {
4-
abstract get url(): string
4+
protected readonly baseURL: string | undefined
5+
protected readonly path: string
6+
protected readonly page: Page
57

6-
protected page: Page
7-
protected baseURL: string | undefined
8-
9-
constructor(baseURL: string | undefined, page: Page) {
10-
this.page = page
8+
constructor(baseURL: string | undefined, path: string, page: Page) {
119
this.baseURL = baseURL
10+
this.path = path
11+
this.page = page
12+
}
13+
14+
get url(): string {
15+
return this.baseURL + this.path
1216
}
1317
}

site/e2e/pom/ProjectsPage.ts

+1-5
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,7 @@ import { Page } from "@playwright/test"
22
import { BasePom } from "./BasePom"
33

44
export class ProjectsPage extends BasePom {
5-
public get url(): string {
6-
return this.baseURL + "/projects"
7-
}
8-
95
constructor(baseURL: string | undefined, page: Page) {
10-
super(baseURL, page)
6+
super(baseURL, "/projects", page)
117
}
128
}

site/e2e/pom/SignInPage.ts

+1-5
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,8 @@ import { Page } from "@playwright/test"
22
import { BasePom } from "./BasePom"
33

44
export class SignInPage extends BasePom {
5-
public get url(): string {
6-
return this.baseURL + "/login"
7-
}
8-
95
constructor(baseURL: string | undefined, page: Page) {
10-
super(baseURL, page)
6+
super(baseURL, "/login", page)
117
}
128

139
async submitBuiltInAuthentication(email: string, password: string): Promise<void> {

0 commit comments

Comments
 (0)