diff --git a/playwright-tests/pages/AfterpayPage.ts b/playwright-tests/pages/AfterpayPage.ts index cf71e250..b6b9c0b9 100644 --- a/playwright-tests/pages/AfterpayPage.ts +++ b/playwright-tests/pages/AfterpayPage.ts @@ -1,6 +1,7 @@ import { Locator, Page } from "@playwright/test"; import { BasePage } from "./BasePage"; -import { IPaymentDetails } from "@business-logic/types/CustomerDetails"; +import { IClaimDetails, IPaymentDetails } from "@business-logic/types/CustomerDetails"; +import { ServicePackage } from "@business-logic/types/Enums"; export class AfterpayPage extends BasePage { readonly page: Page; @@ -33,9 +34,12 @@ export class AfterpayPage extends BasePage { await this.submitButton.click(); } - async executeAfterpayPayment(paymentDetails: IPaymentDetails) { + async executeAfterpayPayment(paymentDetails: IPaymentDetails, claimDetails: IClaimDetails, servicePackage: ServicePackage) { await this.login(paymentDetails.password!); + if (claimDetails.policyDeductible === 50 && servicePackage === ServicePackage.GlassOnly) { + await this.confirmButton.click(); + } else { // 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' }); @@ -46,9 +50,7 @@ export class AfterpayPage extends BasePage { await this.selectAfterpayWithInterestButton.click(); await this.continueAfterpayButton.click(); } - await this.confirmButton.click(); + } } - - } \ No newline at end of file