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 standardPackageButton: Locator;
|
||||
readonly premiumPackageButton: Locator;
|
||||
readonly glassOnlyButton: Locator;
|
||||
readonly glassOnlyPackageButton: Locator;
|
||||
readonly wiperModal: Locator;
|
||||
readonly wiperModalCloseButton: Locator;
|
||||
readonly continueButton: Locator;
|
||||
issPageValue = 'service-packages';
|
||||
|
||||
constructor(page: Page) {
|
||||
super(page);
|
||||
this.page = page;
|
||||
this.standardPackageButton = this.page.locator('li').filter({ hasText: 'Standard' });
|
||||
this.premiumPackageButton = this.page.locator('li').filter({ hasText: 'Premium' });
|
||||
this.glassOnlyButton = this.page.locator('li').filter({ hasText: 'Glass service' });
|
||||
this.standardPackageButton = this.page.locator('label[for="ServicePackageQuestion-TierTwo"]'); // standard package
|
||||
this.premiumPackageButton = this.page.locator('label[for="ServicePackageQuestion-TierThree"]'); // premium package
|
||||
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);
|
||||
}
|
||||
|
||||
async selectServicePackage(servicePackage: ServicePackage){
|
||||
await this.page.getByText(servicePackage).click();
|
||||
return (`${await this.page.locator('li').filter({ hasText: 'Premium' }).locator('[class="pricing-info"]').allInnerTexts()}`);
|
||||
//return (`${await this.page.getByText(servicePackage).locator('[class="pricing-info"]').allInnerTexts()}`);
|
||||
if (servicePackage === ServicePackage.Standard) {
|
||||
await this.standardPackageButton.check();
|
||||
} 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