Updates PayPal login flow

Adds username input and "next" button handling to the PayPal login flow.
This update is necessary to support the new PayPal login screen, which requires entering the username before the password.
This commit is contained in:
maguire-arman 2025-05-19 16:26:41 -04:00
parent 5a5be03cc1
commit aa43e2941a
2 changed files with 12 additions and 2 deletions

View file

@ -28,6 +28,7 @@ const defaultAfterpayDetails: IPaymentDetails = {
const defaultPaypalDetails: IPaymentDetails = {
paymentType: PaymentType.Paypal,
username: 'itqatest@safelite.com',
password: 'Safelite1'
}

View file

@ -5,6 +5,9 @@ import { IPaymentDetails } from '@business-logic/types/CustomerDetails';
export class PaypalPage extends BasePage {
readonly page: Page;
readonly loginWithPasswordButton: Locator;
readonly usernameTextBox: Locator;
readonly nextButton: Locator;
readonly usePasswordInsteadButton: Locator;
readonly passwordTextBox: Locator;
readonly paypalLoginButton: Locator;
readonly completePurchaseButton: Locator;
@ -12,13 +15,19 @@ export class PaypalPage extends BasePage {
constructor(page: Page) {
super(page);
this.page = page;
this.loginWithPasswordButton = page.getByRole('link', { name: 'Log in with a password instead' });
this.usernameTextBox = page.getByPlaceholder('Email');
this.nextButton = page.getByRole('button', { name: 'Next' });
this.loginWithPasswordButton = page.getByRole('button', { name: 'Use Password Instead' });
this.passwordTextBox = page.getByPlaceholder('Password');
this.paypalLoginButton = page.getByRole('button', { name: 'Log In', exact: true });
this.completePurchaseButton = page.getByTestId('submit-button-initial');
this.completePurchaseButton = page.getByRole('button', { name: 'Pay $' });
}
async completePaypalPurchase(paymentDetails: IPaymentDetails){
if (!await this.loginWithPasswordButton.isVisible()) {
await this.usernameTextBox.fill(paymentDetails.username!);
await this.nextButton.click();
}
await this.loginWithPasswordButton.click();
await this.passwordTextBox.fill(paymentDetails.password!);
await this.paypalLoginButton.click();