Update locators for vehicle damage buttons
This commit is contained in:
parent
7505742467
commit
80663bea23
1 changed files with 23 additions and 21 deletions
|
|
@ -4,13 +4,13 @@ import { VehicleDamage } from '@business-logic/types/Enums';
|
|||
|
||||
export class VehicleDamagePage extends BasePage {
|
||||
readonly page: Page;
|
||||
readonly windshieldChkBox: Locator;
|
||||
readonly crackButton: Locator;
|
||||
readonly chipButton: Locator;
|
||||
readonly windshieldButton: Locator;
|
||||
readonly sideDoorButton: Locator;
|
||||
readonly replaceButton: Locator;
|
||||
readonly repairButton: Locator;
|
||||
readonly singleWindshieldButton: Locator;
|
||||
readonly splitWindshieldDriverSideButton: Locator;
|
||||
readonly splitWindshieldPassengerSideButton: Locator;
|
||||
readonly sideDoorButton: Locator;
|
||||
readonly driverSideButton: Locator;
|
||||
readonly passengerSideButton: Locator;
|
||||
readonly driverQuarterPanelChkBox: Locator;
|
||||
|
|
@ -30,9 +30,11 @@ export class VehicleDamagePage extends BasePage {
|
|||
constructor(page: Page) {
|
||||
super(page);
|
||||
this.page = page;
|
||||
this.windshieldChkBox = this.page.locator('[buttonlabel="Windshield"]');
|
||||
this.crackButton = this.page.locator('[buttonlabel="Crack"]');
|
||||
this.chipButton = this.page.locator('[buttonlabel="Chip(s)"]');
|
||||
this.windshieldButton = this.page.locator('[buttonlabel="Windshield"]');
|
||||
this.sideDoorButton = this.page.locator('[buttonlabel="Side door"]');
|
||||
this.rearWindowChkBox = this.page.locator('[buttonlabel="Rear window"]');
|
||||
this.replaceButton = this.page.locator('div.list-card-content:has-text("Replace")');
|
||||
this.repairButton = this.page.locator('div.list-card-content:has-text("Repair")');
|
||||
this.singleWindshieldButton = this.page.locator('[buttonlabel="Single windshield"]');
|
||||
this.splitWindshieldDriverSideButton = this.page.locator('[buttonlabel="Split windshield, driver side"]');
|
||||
this.splitWindshieldPassengerSideButton = this.page.locator('[buttonlabel="Split windshield, passenger side"]');
|
||||
|
|
@ -55,17 +57,17 @@ export class VehicleDamagePage extends BasePage {
|
|||
|
||||
async checkSeparateApptsWarning() {
|
||||
// Select conflict
|
||||
await this.windshieldChkBox.check();
|
||||
await this.chipButton.check();
|
||||
await this.windshieldButton.check();
|
||||
await this.repairButton.check();
|
||||
await this.rearWindowChkBox.check();
|
||||
|
||||
// Expect warning
|
||||
await expect.soft(this.separateApptsWarning).toBeAttached();
|
||||
|
||||
// Undo changes
|
||||
await this.crackButton.check();
|
||||
await this.windshieldChkBox.uncheck();
|
||||
await expect.soft(this.crackButton).not.toBeVisible();
|
||||
await this.replaceButton.check();
|
||||
await this.windshieldButton.uncheck();
|
||||
await expect.soft(this.replaceButton).not.toBeVisible();
|
||||
await this.rearWindowChkBox.uncheck();
|
||||
}
|
||||
|
||||
|
|
@ -73,33 +75,33 @@ export class VehicleDamagePage extends BasePage {
|
|||
for (const damage of vehicleDamage) {
|
||||
switch(damage) {
|
||||
case VehicleDamage.WindshieldOneChip:
|
||||
await this.windshieldChkBox.check();
|
||||
await this.windshieldButton.check();
|
||||
await this.selectChips('1');
|
||||
break;
|
||||
case VehicleDamage.WindshieldTwoChips:
|
||||
await this.windshieldChkBox.check();
|
||||
await this.windshieldButton.check();
|
||||
await this.selectChips('2');
|
||||
break;
|
||||
case VehicleDamage.WindshieldThreeChips:
|
||||
await this.windshieldChkBox.check();
|
||||
await this.windshieldButton.check();
|
||||
await this.selectChips('3');
|
||||
break;
|
||||
case VehicleDamage.WindshieldCrack:
|
||||
await this.windshieldChkBox.check();
|
||||
await this.windshieldButton.check();
|
||||
await this.selectCrack();
|
||||
break;
|
||||
case VehicleDamage.WindshieldCrackSingleWindshield:
|
||||
await this.windshieldChkBox.check();
|
||||
await this.windshieldButton.check();
|
||||
await this.selectCrack();
|
||||
await this.singleWindshieldButton.check();
|
||||
break;
|
||||
case VehicleDamage.WindshieldCrackDriverSide:
|
||||
await this.windshieldChkBox.check();
|
||||
await this.windshieldButton.check();
|
||||
await this.selectCrack();
|
||||
await this.splitWindshieldDriverSideButton.check();
|
||||
break;
|
||||
case VehicleDamage.WindshieldCrackPassengerSide:
|
||||
await this.windshieldChkBox.check();
|
||||
await this.windshieldButton.check();
|
||||
await this.selectCrack();
|
||||
await this.splitWindshieldPassengerSideButton.check();
|
||||
break;
|
||||
|
|
@ -156,12 +158,12 @@ export class VehicleDamagePage extends BasePage {
|
|||
}
|
||||
|
||||
async selectCrack(){
|
||||
await this.crackButton.check();
|
||||
await this.replaceButton.click();
|
||||
}
|
||||
|
||||
async selectChips(numChips: string){
|
||||
const numChipsButton = this.page.getByText(numChips, {exact: true});
|
||||
await this.chipButton.check();
|
||||
await this.repairButton.check();
|
||||
await numChipsButton.check();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue