Fixes service location page selector issue
Updates the selectors for the first appointment button and the repeated clicks modal close button on the service location page. Also, adjusts the logic to ensure the shop selection is visible and clickable, particularly when dealing with dynamic content loading or potential rendering issues. Additionally, shop address is saved in appointment details This resolves issues with element selection and interaction on the service location page, improving the reliability of the tests.
This commit is contained in:
parent
c26b214084
commit
abb78523c9
2 changed files with 17 additions and 7 deletions
|
|
@ -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();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue