|
1 | | -import { expect, Locator, Page } from '@playwright/test'; |
| 1 | +import { Locator, Page } from '@playwright/test'; |
2 | 2 |
|
3 | 3 | export class DanubeShopPage { |
4 | | - readonly page: Page; |
5 | | - readonly shopItems: Locator; |
6 | | - readonly shopSearchBar: Locator; |
7 | | - readonly shopSearchButton: Locator; |
8 | | - readonly buttonLogin: Locator; |
9 | | - readonly fieldLoginEmail: Locator; |
10 | | - readonly fieldLoginPassword: Locator; |
11 | | - readonly buttonLoginProceed: Locator; |
12 | | - readonly loginMessage: Locator; |
13 | | - readonly logo: Locator; |
| 4 | + readonly page: Page; |
| 5 | + readonly shopItems: Locator; |
| 6 | + readonly shopSearchBar: Locator; |
| 7 | + readonly shopSearchButton: Locator; |
| 8 | + readonly buttonLogin: Locator; |
| 9 | + readonly fieldLoginEmail: Locator; |
| 10 | + readonly fieldLoginPassword: Locator; |
| 11 | + readonly buttonLoginProceed: Locator; |
| 12 | + readonly loginMessage: Locator; |
| 13 | + readonly logo: Locator; |
14 | 14 |
|
15 | | - constructor(page: Page) { |
16 | | - this.page = page; |
17 | | - this.shopItems = page.locator('.preview > .preview-author'); |
18 | | - this.shopSearchBar = page.locator('input'); |
19 | | - this.shopSearchButton = page.locator('#button-search'); |
20 | | - this.buttonLogin = page.locator('#login'); |
21 | | - this.fieldLoginEmail = page.locator('#n-email'); |
22 | | - this.fieldLoginPassword = page.locator('#n-password2'); |
23 | | - this.buttonLoginProceed = page.locator('#goto-signin-btn'); |
24 | | - this.loginMessage = page.locator('#login-message'); |
25 | | - this.logo = page.locator('#logo'); |
26 | | - } |
| 15 | + constructor(page: Page) { |
| 16 | + this.page = page; |
| 17 | + this.shopItems = page.locator('.preview > .preview-author'); |
| 18 | + this.shopSearchBar = page.locator('input'); |
| 19 | + this.shopSearchButton = page.locator('#button-search'); |
| 20 | + this.buttonLogin = page.locator('#login'); |
| 21 | + this.fieldLoginEmail = page.locator('#n-email'); |
| 22 | + this.fieldLoginPassword = page.locator('#n-password2'); |
| 23 | + this.buttonLoginProceed = page.locator('#goto-signin-btn'); |
| 24 | + this.loginMessage = page.locator('#login-message'); |
| 25 | + this.logo = page.locator('#logo'); |
| 26 | + } |
27 | 27 |
|
28 | | - async selectShopItem() { |
29 | | - await this.shopItems.first().click(); |
30 | | - } |
| 28 | + async selectShopItem() { |
| 29 | + await this.shopItems.first().click(); |
| 30 | + } |
31 | 31 |
|
32 | | - async performSearch(searchString: string) { |
33 | | - await this.shopSearchBar.fill(searchString); |
34 | | - await this.shopSearchButton.click(); |
35 | | - } |
| 32 | + async performSearch(searchString: string) { |
| 33 | + await this.shopSearchBar.fill(searchString); |
| 34 | + await this.shopSearchButton.click(); |
| 35 | + } |
36 | 36 |
|
37 | | - async performLogin(user) { |
38 | | - await this.buttonLogin.click(); |
39 | | - await this.fieldLoginEmail.fill(user.username); |
40 | | - await this.fieldLoginPassword.fill(user.password); |
41 | | - await this.buttonLoginProceed.click(); |
42 | | - } |
| 37 | + async performLogin(user) { |
| 38 | + await this.buttonLogin.click(); |
| 39 | + await this.fieldLoginEmail.fill(user.username); |
| 40 | + await this.fieldLoginPassword.fill(user.password); |
| 41 | + await this.buttonLoginProceed.click(); |
| 42 | + } |
43 | 43 |
|
44 | | - async isPastLogin() { |
45 | | - return this.loginMessage.isVisible(); |
46 | | - } |
| 44 | + async isPastLogin() { |
| 45 | + return this.loginMessage.isVisible(); |
| 46 | + } |
47 | 47 |
|
48 | | - async goto() { |
49 | | - await this.logo.click(); |
50 | | - } |
| 48 | + async goto() { |
| 49 | + await this.logo.click(); |
| 50 | + } |
51 | 51 | } |
0 commit comments