From 5908b7b807e6d2d139e8e0b4228456afc5d64c43 Mon Sep 17 00:00:00 2001 From: JennyNou Date: Mon, 2 Mar 2026 14:35:53 -0500 Subject: [PATCH] Update locators for Paypal flow --- .../business-logic/data/ClientData.ts | 1 + playwright-tests/pages/PaypalPage.ts | 50 +++++++++++-------- 2 files changed, 29 insertions(+), 22 deletions(-) diff --git a/playwright-tests/business-logic/data/ClientData.ts b/playwright-tests/business-logic/data/ClientData.ts index adce9400..1f1c2da6 100644 --- a/playwright-tests/business-logic/data/ClientData.ts +++ b/playwright-tests/business-logic/data/ClientData.ts @@ -235,6 +235,7 @@ const defaultAfterpayDetails: IPaymentDetails = { const defaultPaypalDetails: IPaymentDetails = { paymentType: PaymentType.Paypal, + username:'Itqatest@safelite.com', password: 'Safelite1' } diff --git a/playwright-tests/pages/PaypalPage.ts b/playwright-tests/pages/PaypalPage.ts index 862a97ed..adb6ba5d 100644 --- a/playwright-tests/pages/PaypalPage.ts +++ b/playwright-tests/pages/PaypalPage.ts @@ -1,27 +1,33 @@ -import { expect, type Locator, type Page } from '@playwright/test'; -import { BasePage } from './BasePage'; -import { IPaymentDetails } from '@business-logic/types/CustomerDetails'; +import { expect, type Locator, type Page } from "@playwright/test"; +import { BasePage } from "./BasePage"; +import { IPaymentDetails } from "@business-logic/types/CustomerDetails"; export class PaypalPage extends BasePage { - readonly page: Page; - readonly loginWithPasswordButton: Locator; - readonly passwordTextBox: Locator; - readonly paypalLoginButton: Locator; - readonly completePurchaseButton: Locator; + readonly page: Page; + readonly usernameTextBox: Locator; + readonly nextButton: Locator; + readonly passwordTextBox: Locator; + readonly paypalLoginButton: Locator; + readonly payButton: Locator; - constructor(page: Page) { - super(page); - this.page = page; - this.loginWithPasswordButton = page.getByRole('link', { name: 'Log in with a password instead' }); - this.passwordTextBox = page.getByPlaceholder('Password'); - this.paypalLoginButton = page.getByRole('button', { name: 'Log In', exact: true }); - this.completePurchaseButton = page.getByTestId('submit-button-initial'); - } + constructor(page: Page) { + super(page); + this.page = page; + this.usernameTextBox = page.locator("#email"); + this.nextButton = page.getByRole("button", { name: "Next" }); + this.passwordTextBox = page.getByRole("textbox", { name: "Password" }); + this.paypalLoginButton = page.getByRole("button", { + name: "Log In", + exact: true, + }); + this.payButton = page.getByRole("button", { name: "Pay $" }); + } - async completePaypalPurchase(paymentDetails: IPaymentDetails){ - await this.loginWithPasswordButton.click(); - await this.passwordTextBox.fill(paymentDetails.password!); - await this.paypalLoginButton.click(); - await this.completePurchaseButton.click(); - } + async completePaypalPurchase(paymentDetails: IPaymentDetails) { + await this.usernameTextBox.fill(paymentDetails.username!); + await this.nextButton.click(); + await this.passwordTextBox.fill(paymentDetails.password!); + await this.paypalLoginButton.click(); + await this.payButton.click(); + } }