diff --git a/playwright-tests/pages/ServiceLocationPage.ts b/playwright-tests/pages/ServiceLocationPage.ts index c9cb6c98f..609f2d1db 100644 --- a/playwright-tests/pages/ServiceLocationPage.ts +++ b/playwright-tests/pages/ServiceLocationPage.ts @@ -55,7 +55,7 @@ export class ServiceLocationPage extends BasePage { // For in-shop and drop off this.selectAShopOptions = this.page.locator('[class="shop-question"]'); - this.firstAppointmentButton = this.page.locator('div').filter({ hasText: /Appts/}).first(); + this.firstAppointmentButton = this.page.locator('fieldset:has(legend#chooseShop)').locator('label').first(); this.changeZipButton = this.page.locator('a:has(span.sr-only:has-text("edit zip code"))'); this.updateZipTextBox = this.page.locator('#serviceZipCode'); this.saveZipButton = this.page.getByText('Save ZIP code', { exact: true }); @@ -71,7 +71,7 @@ export class ServiceLocationPage extends BasePage { this.vehicleProtectedYesButton = this.page.locator('label').filter({ hasText: 'Yes' }).locator('div'); this.vehicleProtectedNoButton = this.page.locator('label').filter({ hasText: 'No' }).locator('div'); this.saveAddressButton = this.page.getByRole('button', { name: 'Continue' }) - this.repeatedClicksModalCloseButton = this.page.getByRole('img').nth(1); + this.repeatedClicksModalCloseButton = this.page.locator('.QSISlider').locator('img[src*=\'close\']'); } async selectLocation(appointmentDetails: IAppointmentDetails){ @@ -103,9 +103,14 @@ export class ServiceLocationPage extends BasePage { await this.saveZipButton.click(); } await this.inShopButton.click(); - await this.selectAShopOptions.locator(`[buttonbodycopy="${appointmentDetails.shopAddress}"]`).check(); + await this.selectAShopOptions.locator(`[buttonbodycopy="${appointmentDetails.shopAddress}"]`).scrollIntoViewIfNeeded().then(() => this.selectAShopOptions.locator(`[buttonbodycopy="${appointmentDetails.shopAddress}"]`).click()); } else { - await this.firstAppointmentButton.click(); + await this.firstAppointmentButton.scrollIntoViewIfNeeded().then(async () => { + await this.firstAppointmentButton.click(); + if (appointmentDetails) { + appointmentDetails.shopAddress = await this.firstAppointmentButton.locator('.row-two').innerText(); + } + }); } } @@ -130,8 +135,13 @@ export class ServiceLocationPage extends BasePage { if (appointmentDetails && appointmentDetails.shopAddress) { await this.selectAShopOptions.locator(`[buttonbodycopy="${appointmentDetails.shopAddress}"]`).check(); } else { - // await this.firstAppointmentButton.click(); - await this.clickWithRetry(this.firstAppointmentButton, this.page); + /// await this.clickWithRetry(this.firstAppointmentButton, this.page); + await this.firstAppointmentButton.scrollIntoViewIfNeeded().then(async () => { + await this.firstAppointmentButton.click(); + if (appointmentDetails) { + appointmentDetails.shopAddress = await this.firstAppointmentButton.locator('.row-two').innerText(); + } + }); } } diff --git a/playwright-tests/pages/ServicePackagesPage.ts b/playwright-tests/pages/ServicePackagesPage.ts index 8b1597598..65bba63b8 100644 --- a/playwright-tests/pages/ServicePackagesPage.ts +++ b/playwright-tests/pages/ServicePackagesPage.ts @@ -41,7 +41,7 @@ export class ServicePackagesPage extends BasePage { this.closeButton = this.page. getByRole('dialog').locator('button').filter({ hasText: 'Close' }); this.promoCodeTextbox = this.page.getByLabel('Enter a promo code'); this.applyPromoButton = this.page.getByRole('button', { name: 'Apply promo code' }); - this.repeatedClicksModalCloseButton = this.page.locator('#app').getByRole('dialog').locator('button').filter({ hasText: 'Close' }); + this.repeatedClicksModalCloseButton = this.page.locator('.QSISlider').locator('img[src*=\'close\']'); // this.validateURL(this.url); }