Added locators and steps to fix Afterpay flow
This commit is contained in:
parent
c899e367d1
commit
6ffe7e229d
1 changed files with 22 additions and 0 deletions
|
|
@ -9,12 +9,22 @@ export class AfterpayPage extends BasePage {
|
||||||
readonly submitButton: Locator;
|
readonly submitButton: Locator;
|
||||||
readonly confirmButton: Locator;
|
readonly confirmButton: Locator;
|
||||||
|
|
||||||
|
readonly selectAfterpayWithInterestButton: Locator;
|
||||||
|
readonly selectAfterpayWithoutInterestButton: Locator;
|
||||||
|
readonly continueAfterpayButton: Locator;
|
||||||
|
|
||||||
constructor(page: Page) {
|
constructor(page: Page) {
|
||||||
super(page);
|
super(page);
|
||||||
this.page = page;
|
this.page = page;
|
||||||
this.passwordTextBox = page.getByTestId('login-password-input');
|
this.passwordTextBox = page.getByTestId('login-password-input');
|
||||||
this.submitButton = page.getByRole('button', { name: 'Continue' });
|
this.submitButton = page.getByRole('button', { name: 'Continue' });
|
||||||
this.confirmButton = page.getByRole('button', { name: 'Confirm' });
|
this.confirmButton = page.getByRole('button', { name: 'Confirm' });
|
||||||
|
|
||||||
|
// Monthly with interest option
|
||||||
|
this.selectAfterpayWithInterestButton = page.getByRole('radio', { name: /month/ });
|
||||||
|
// Biweekly without interest option
|
||||||
|
this.selectAfterpayWithoutInterestButton = page.getByTestId('payment-types-label').filter({ hasText: /every 2 weeks/ });
|
||||||
|
this.continueAfterpayButton = page.getByRole('button', { name: 'Continue' });
|
||||||
}
|
}
|
||||||
|
|
||||||
async login(password: string) {
|
async login(password: string) {
|
||||||
|
|
@ -25,6 +35,18 @@ export class AfterpayPage extends BasePage {
|
||||||
|
|
||||||
async executeAfterpayPayment(paymentDetails: IPaymentDetails) {
|
async executeAfterpayPayment(paymentDetails: IPaymentDetails) {
|
||||||
await this.login(paymentDetails.password!);
|
await this.login(paymentDetails.password!);
|
||||||
|
|
||||||
|
// For orders greater than $50, user will have 2 options to choose from: monthly with interest or biweekly without interest
|
||||||
|
await this.selectAfterpayWithoutInterestButton.waitFor({ state: 'visible' });
|
||||||
|
|
||||||
|
if (await this.selectAfterpayWithoutInterestButton.isVisible()) {
|
||||||
|
await this.selectAfterpayWithoutInterestButton.click();
|
||||||
|
await this.continueAfterpayButton.click();
|
||||||
|
} else if (await this.selectAfterpayWithInterestButton.isVisible()) {
|
||||||
|
await this.selectAfterpayWithInterestButton.click();
|
||||||
|
await this.continueAfterpayButton.click();
|
||||||
|
}
|
||||||
|
|
||||||
await this.confirmButton.click();
|
await this.confirmButton.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue