diff --git a/playwright-tests/pages/ServiceLocationPage.ts b/playwright-tests/pages/ServiceLocationPage.ts index 49577e963..375566c04 100644 --- a/playwright-tests/pages/ServiceLocationPage.ts +++ b/playwright-tests/pages/ServiceLocationPage.ts @@ -36,7 +36,6 @@ export class ServiceLocationPage extends BasePage { readonly zipCodeTextBox: Locator; readonly vehicleProtectedYesButton: Locator; readonly vehicleProtectedNoButton: Locator; - readonly saveAddressButton: Locator; readonly repeatedClicksModalCloseButton: Locator; url = process.env['BASE_URL']! + '/fmg/?fmgPage=service-location'; @@ -49,7 +48,7 @@ export class ServiceLocationPage extends BasePage { // Initial selection this.inShopButton = this.page.getByText(/In-shop/); - this.mobileButton = this.page.getByText(/Mobile/); + this.mobileButton = this.page.getByText(/Mobile/).nth(0); this.dropOffButton = this.page.getByText(/Drop-off/); this.RecalWarningMessage1 = this.page.getByText(/We're not able to provide mobile service/); this.RecalWarningMessage2 = this.page.getByText(/advanced safety system recalibration needs to be done in our shop./); @@ -72,7 +71,6 @@ export class ServiceLocationPage extends BasePage { this.zipCodeTextBox = this.page.getByRole('textbox', { name: 'Zip code' }); 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.locator('.QSISlider').locator('img[src*=\'close\']'); } @@ -120,7 +118,9 @@ export class ServiceLocationPage extends BasePage { const { appointmentDetails, customerDetails } = testData; if (appointmentDetails?.serviceAddress) { await this.mobileButton.click(); - await this.enterServiceAddressButton.click(); + if (!(await this.serviceAddressTextBox.isVisible())) { + await this.enterServiceAddressButton.click(); + } await this.addressForm.populateAddress({ address: appointmentDetails.serviceAddress! }); if (await this.repeatedClicksModalCloseButton.isVisible()) { await this.repeatedClicksModalCloseButton.click(); @@ -134,7 +134,6 @@ export class ServiceLocationPage extends BasePage { { await this.mockScheduleResponseForEarlyBird(customerDetails!); } - await this.saveAddressButton.click(); } else { console.error('ServiceLocationPage >> Please supply an address') }