Update service package logic
This commit is contained in:
parent
303fc24735
commit
df9f24aaa3
1 changed files with 22 additions and 7 deletions
|
|
@ -6,21 +6,36 @@ export class ServicePackagesPage extends BasePage {
|
||||||
readonly page: Page;
|
readonly page: Page;
|
||||||
readonly standardPackageButton: Locator;
|
readonly standardPackageButton: Locator;
|
||||||
readonly premiumPackageButton: Locator;
|
readonly premiumPackageButton: Locator;
|
||||||
readonly glassOnlyButton: Locator;
|
readonly glassOnlyPackageButton: Locator;
|
||||||
|
readonly wiperModal: Locator;
|
||||||
|
readonly wiperModalCloseButton: Locator;
|
||||||
|
readonly continueButton: Locator;
|
||||||
issPageValue = 'service-packages';
|
issPageValue = 'service-packages';
|
||||||
|
|
||||||
constructor(page: Page) {
|
constructor(page: Page) {
|
||||||
super(page);
|
super(page);
|
||||||
this.page = page;
|
this.page = page;
|
||||||
this.standardPackageButton = this.page.locator('li').filter({ hasText: 'Standard' });
|
this.standardPackageButton = this.page.locator('label[for="ServicePackageQuestion-TierTwo"]'); // standard package
|
||||||
this.premiumPackageButton = this.page.locator('li').filter({ hasText: 'Premium' });
|
this.premiumPackageButton = this.page.locator('label[for="ServicePackageQuestion-TierThree"]'); // premium package
|
||||||
this.glassOnlyButton = this.page.locator('li').filter({ hasText: 'Glass service' });
|
this.glassOnlyPackageButton = this.page.locator('label[for="ServicePackageQuestion-TierOne"]'); // glass only package
|
||||||
|
this.wiperModal = this.page.locator('#FrontWiperModal #modalbtn');
|
||||||
|
this.wiperModalCloseButton = this.page.locator('#FrontWiperModal').getByLabel('Close')
|
||||||
|
this.continueButton = this.page.getByRole('button', { name: 'Continue' });
|
||||||
// this.validateURL(this.url);
|
// this.validateURL(this.url);
|
||||||
}
|
}
|
||||||
|
|
||||||
async selectServicePackage(servicePackage: ServicePackage){
|
async selectServicePackage(servicePackage: ServicePackage){
|
||||||
await this.page.getByText(servicePackage).click();
|
if (servicePackage === ServicePackage.Standard) {
|
||||||
return (`${await this.page.locator('li').filter({ hasText: 'Premium' }).locator('[class="pricing-info"]').allInnerTexts()}`);
|
await this.standardPackageButton.check();
|
||||||
//return (`${await this.page.getByText(servicePackage).locator('[class="pricing-info"]').allInnerTexts()}`);
|
} else if (servicePackage === ServicePackage.Premium) {
|
||||||
|
await this.premiumPackageButton.check();
|
||||||
|
if (await this.wiperModal.isVisible()) {
|
||||||
|
await this.wiperModal.waitFor({ state: 'visible', timeout: 5000 });
|
||||||
|
await this.wiperModalCloseButton.click();
|
||||||
|
}
|
||||||
|
} else if (servicePackage === ServicePackage.GlassOnly) {
|
||||||
|
await this.glassOnlyPackageButton.check();
|
||||||
|
}
|
||||||
|
await this.continueButton.click();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in a new issue