-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add additional page objects for storefront account
- Loading branch information
Showing
5 changed files
with
117 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import type { Page, Locator } from '@playwright/test'; | ||
import type { PageObject } from '../../types/PageObject'; | ||
|
||
export class AccountAddresses implements PageObject { | ||
public readonly addNewAddressButton: Locator; | ||
public readonly editBillingAddressButton: Locator; | ||
public readonly editShippingAddressButton: Locator; | ||
public readonly useDefaultBillingAddressButton: Locator; | ||
public readonly useDefaultShippingAddressButton: Locator; | ||
|
||
constructor(public readonly page: Page) { | ||
this.addNewAddressButton = page.getByRole('link', { name: 'Add new address' }); | ||
this.editBillingAddressButton = page.getByRole('link', { name: 'Edit address' }).first(); | ||
this.editShippingAddressButton = page.getByRole('link', { name: 'Edit address' }).nth(1); | ||
this.useDefaultBillingAddressButton = page.getByRole('button', { name: 'Use as default billing address' }); | ||
this.useDefaultShippingAddressButton = page.getByRole('button', { name: 'Use as default shipping address' }); | ||
} | ||
|
||
async goTo() { | ||
await this.page.goto('account/address'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import type { Page, Locator } from '@playwright/test'; | ||
import type { PageObject } from '../../types/PageObject'; | ||
|
||
export class AccountPayment implements PageObject { | ||
public readonly cashOnDeliveryOption: Locator; | ||
public readonly paidInAdvanceOption: Locator; | ||
public readonly invoiceOption: Locator; | ||
public readonly changeDefaultPaymentButton: Locator; | ||
|
||
constructor(public readonly page: Page) { | ||
this.cashOnDeliveryOption = page.getByLabel('Cash on delivery'); | ||
this.paidInAdvanceOption = page.getByLabel('Paid in advance'); | ||
this.invoiceOption = page.getByLabel('Invoice'); | ||
this.changeDefaultPaymentButton = page.getByRole('button', { name: 'Change' }); | ||
} | ||
|
||
async goTo() { | ||
await this.page.goto('account/payment'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import type { Page, Locator } from '@playwright/test'; | ||
import type { PageObject } from '../../types/PageObject'; | ||
|
||
export class AccountProfile implements PageObject { | ||
public readonly salutationSelect: Locator; | ||
public readonly firstNameInput: Locator; | ||
public readonly lastNameInput: Locator; | ||
public readonly saveProfileButton: Locator; | ||
|
||
public readonly changeEmailButton: Locator; | ||
public readonly emailAddressInput: Locator; | ||
public readonly emailAddressConfirmInput: Locator; | ||
public readonly emailConfirmPasswordInput: Locator; | ||
public readonly saveEmailAddressButton: Locator; | ||
|
||
public readonly changePasswordButton: Locator; | ||
public readonly newPasswordInput: Locator; | ||
public readonly newPasswordConfirmInput: Locator; | ||
public readonly currentPasswordInput: Locator; | ||
public readonly saveNewPasswordButton: Locator; | ||
|
||
constructor(public readonly page: Page) { | ||
this.salutationSelect = page.getByLabel('Salutation'); | ||
this.firstNameInput = page.getByPlaceholder('Enter first name...'); | ||
this.lastNameInput = page.getByPlaceholder('Enter last name...'); | ||
this.saveProfileButton = page.locator('#profilePersonalForm').getByRole('button', { name: 'Save changes' }) | ||
|
||
this.changeEmailButton = page.getByRole('button', { name: 'Change email address' }); | ||
this.emailAddressInput = page.getByPlaceholder('Enter email address...'); | ||
this.emailAddressConfirmInput = page.getByPlaceholder('Enter your email address once again...'); | ||
this.emailConfirmPasswordInput = page.getByPlaceholder('Enter password...'); | ||
this.saveEmailAddressButton = page.locator('#profileMailForm').getByRole('button', { name: 'Save changes' }); | ||
|
||
this.changePasswordButton = page.getByRole('button', { name: 'Change password' }); | ||
this.newPasswordInput = page.getByPlaceholder('Enter new password...'); | ||
this.newPasswordConfirmInput = page.getByPlaceholder('Enter your new password once again...'); | ||
this.currentPasswordInput = page.getByPlaceholder('Enter current password...'); | ||
this.saveNewPasswordButton = page.locator('#profilePasswordForm').getByRole('button', { name: 'Save changes' }); | ||
} | ||
|
||
async goTo() { | ||
await this.page.goto('account/profile'); | ||
} | ||
} |