Merge pull request #2973 from Safelite/feature/CASH-2032

Updated few playwright scripts
This commit is contained in:
kpatel8hs4io 2025-12-16 15:23:25 -05:00 committed by GitHub
commit d3a4c10b9e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 13 additions and 5 deletions

View file

@ -47,7 +47,7 @@ export class HomePage extends BasePage {
//Zip Entry //Zip Entry
this.enterServiceZipTextBox = this.page.locator('#zipCodeTextbox'); this.enterServiceZipTextBox = this.page.locator('#zipCodeTextbox');
this.zipEntryLetsGetStartedButton = this.page.locator('#zipCodeTextboxButton'); this.zipEntryLetsGetStartedButton = this.page.locator('#zipCodeTextbox');
this.getQuoteAndScheduleButton = this.page.getByLabel('main').getByRole('link', { name: 'Get quote + schedule' }); this.getQuoteAndScheduleButton = this.page.getByLabel('main').getByRole('link', { name: 'Get quote + schedule' });
} }
@ -61,10 +61,11 @@ export class HomePage extends BasePage {
async letsGetStarted(zip: string, enterFunnelWithZip: boolean) { async letsGetStarted(zip: string, enterFunnelWithZip: boolean) {
if (enterFunnelWithZip) { if (enterFunnelWithZip) {
await this.letsGetStartedButton.evaluate((element, zip) => { await this.zipEntryLetsGetStartedButton.fill(zip);
/* await this.letsGetStartedButton.evaluate((element, zip) => {
const currentHref = element.getAttribute('href') || ''; const currentHref = element.getAttribute('href') || '';
element.setAttribute('href', `${currentHref}&zipCode=${zip}`); element.setAttribute('href', `${currentHref}?zipCode=${zip}`);
}, zip); }, zip);*/
} }
// Wait until modal pop up opens and close pop up // Wait until modal pop up opens and close pop up

View file

@ -41,6 +41,8 @@ export class PaypalPage extends BasePage {
await this.paypalLoginButton.click(); await this.paypalLoginButton.click();
await this.completePurchaseButton.click(); await this.completePurchaseButton.click();
} else { } else {
await this.usernameTextBox.waitFor({ state: 'visible' });
await this.page.screenshot({ path: `test-results\\ortoni-data\\paypal-username-${Date.now()}.png`, fullPage: true });
await this.usernameTextBox.fill(paymentDetails.username!); await this.usernameTextBox.fill(paymentDetails.username!);
await this.nextButton.click(); await this.nextButton.click();
await this.tryAnotherWayButton.click(); await this.tryAnotherWayButton.click();

View file

@ -35,6 +35,7 @@ export class SchedulePage extends BasePage {
readonly timeSlots: Locator; readonly timeSlots: Locator;
readonly allDayDropOffButton: Locator; readonly allDayDropOffButton: Locator;
readonly pickATimeButton: Locator; readonly pickATimeButton: Locator;
readonly mobileFirstModalCloseButton: Locator;
constructor(page: Page) { constructor(page: Page) {
super(page); super(page);
@ -65,6 +66,7 @@ export class SchedulePage extends BasePage {
this.viewMoreDatesLink = this.page.getByText(/View more dates/).first(); this.viewMoreDatesLink = this.page.getByText(/View more dates/).first();
this.appointmentDuration = this.page.locator('.duration-text-block'); this.appointmentDuration = this.page.locator('.duration-text-block');
this.timeSlots = this.page.locator('fieldset:has(>legend#chooseTimeSlot) label').filter({ visible: true}); this.timeSlots = this.page.locator('fieldset:has(>legend#chooseTimeSlot) label').filter({ visible: true});
this.mobileFirstModalCloseButton = this.page.getByRole('dialog').getByRole('button', { name: 'Close' });
} }
async selectLocation(testData: Partial<ITestData>) { async selectLocation(testData: Partial<ITestData>) {
@ -229,6 +231,9 @@ export class SchedulePage extends BasePage {
async handleSchedulePage(testData: Partial<ITestData>) { async handleSchedulePage(testData: Partial<ITestData>) {
const { appointmentDetails } = testData; const { appointmentDetails } = testData;
await this.validateProgressBar(ProgressBarPercentages.SchedulePage); await this.validateProgressBar(ProgressBarPercentages.SchedulePage);
if (await this.mobileFirstModalCloseButton.isVisible()) {
await this.mobileFirstModalCloseButton.click();
}
await this.selectLocation(testData); await this.selectLocation(testData);
await this.scheduleFirstAppointment(testData); await this.scheduleFirstAppointment(testData);
await this.nextPage(); await this.nextPage();

View file

@ -35,7 +35,7 @@ const cashReplaceMultiSlidingGlassDropoffData: Partial<ITestData> = {
appointmentDetails: { appointmentDetails: {
serviceLocation: ServiceLocation.DropOff, serviceLocation: ServiceLocation.DropOff,
appointmentDate: getDefaultTestData().appointmentDetails?.appointmentDate, appointmentDate: getDefaultTestData().appointmentDetails?.appointmentDate,
shopAddress: "6826 sawmill rd, Columbus, OH 43235" shopAddress: "1343 cameron ave, lewis center, oh 43035"
}, },
// Override vehicle details // Override vehicle details