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 {
|
export class VehicleDamagePage extends BasePage {
|
||||||
readonly page: Page;
|
readonly page: Page;
|
||||||
readonly windshieldChkBox: Locator;
|
readonly windshieldButton: Locator;
|
||||||
readonly crackButton: Locator;
|
readonly sideDoorButton: Locator;
|
||||||
readonly chipButton: Locator;
|
readonly replaceButton: Locator;
|
||||||
|
readonly repairButton: Locator;
|
||||||
readonly singleWindshieldButton: Locator;
|
readonly singleWindshieldButton: Locator;
|
||||||
readonly splitWindshieldDriverSideButton: Locator;
|
readonly splitWindshieldDriverSideButton: Locator;
|
||||||
readonly splitWindshieldPassengerSideButton: Locator;
|
readonly splitWindshieldPassengerSideButton: Locator;
|
||||||
readonly sideDoorButton: Locator;
|
|
||||||
readonly driverSideButton: Locator;
|
readonly driverSideButton: Locator;
|
||||||
readonly passengerSideButton: Locator;
|
readonly passengerSideButton: Locator;
|
||||||
readonly driverQuarterPanelChkBox: Locator;
|
readonly driverQuarterPanelChkBox: Locator;
|
||||||
|
|
@ -30,9 +30,11 @@ export class VehicleDamagePage extends BasePage {
|
||||||
constructor(page: Page) {
|
constructor(page: Page) {
|
||||||
super(page);
|
super(page);
|
||||||
this.page = page;
|
this.page = page;
|
||||||
this.windshieldChkBox = this.page.locator('[buttonlabel="Windshield"]');
|
this.windshieldButton = this.page.locator('[buttonlabel="Windshield"]');
|
||||||
this.crackButton = this.page.locator('[buttonlabel="Crack"]');
|
this.sideDoorButton = this.page.locator('[buttonlabel="Side door"]');
|
||||||
this.chipButton = this.page.locator('[buttonlabel="Chip(s)"]');
|
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.singleWindshieldButton = this.page.locator('[buttonlabel="Single windshield"]');
|
||||||
this.splitWindshieldDriverSideButton = this.page.locator('[buttonlabel="Split windshield, driver side"]');
|
this.splitWindshieldDriverSideButton = this.page.locator('[buttonlabel="Split windshield, driver side"]');
|
||||||
this.splitWindshieldPassengerSideButton = this.page.locator('[buttonlabel="Split windshield, passenger side"]');
|
this.splitWindshieldPassengerSideButton = this.page.locator('[buttonlabel="Split windshield, passenger side"]');
|
||||||
|
|
@ -55,17 +57,17 @@ export class VehicleDamagePage extends BasePage {
|
||||||
|
|
||||||
async checkSeparateApptsWarning() {
|
async checkSeparateApptsWarning() {
|
||||||
// Select conflict
|
// Select conflict
|
||||||
await this.windshieldChkBox.check();
|
await this.windshieldButton.check();
|
||||||
await this.chipButton.check();
|
await this.repairButton.check();
|
||||||
await this.rearWindowChkBox.check();
|
await this.rearWindowChkBox.check();
|
||||||
|
|
||||||
// Expect warning
|
// Expect warning
|
||||||
await expect.soft(this.separateApptsWarning).toBeAttached();
|
await expect.soft(this.separateApptsWarning).toBeAttached();
|
||||||
|
|
||||||
// Undo changes
|
// Undo changes
|
||||||
await this.crackButton.check();
|
await this.replaceButton.check();
|
||||||
await this.windshieldChkBox.uncheck();
|
await this.windshieldButton.uncheck();
|
||||||
await expect.soft(this.crackButton).not.toBeVisible();
|
await expect.soft(this.replaceButton).not.toBeVisible();
|
||||||
await this.rearWindowChkBox.uncheck();
|
await this.rearWindowChkBox.uncheck();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -73,33 +75,33 @@ export class VehicleDamagePage extends BasePage {
|
||||||
for (const damage of vehicleDamage) {
|
for (const damage of vehicleDamage) {
|
||||||
switch(damage) {
|
switch(damage) {
|
||||||
case VehicleDamage.WindshieldOneChip:
|
case VehicleDamage.WindshieldOneChip:
|
||||||
await this.windshieldChkBox.check();
|
await this.windshieldButton.check();
|
||||||
await this.selectChips('1');
|
await this.selectChips('1');
|
||||||
break;
|
break;
|
||||||
case VehicleDamage.WindshieldTwoChips:
|
case VehicleDamage.WindshieldTwoChips:
|
||||||
await this.windshieldChkBox.check();
|
await this.windshieldButton.check();
|
||||||
await this.selectChips('2');
|
await this.selectChips('2');
|
||||||
break;
|
break;
|
||||||
case VehicleDamage.WindshieldThreeChips:
|
case VehicleDamage.WindshieldThreeChips:
|
||||||
await this.windshieldChkBox.check();
|
await this.windshieldButton.check();
|
||||||
await this.selectChips('3');
|
await this.selectChips('3');
|
||||||
break;
|
break;
|
||||||
case VehicleDamage.WindshieldCrack:
|
case VehicleDamage.WindshieldCrack:
|
||||||
await this.windshieldChkBox.check();
|
await this.windshieldButton.check();
|
||||||
await this.selectCrack();
|
await this.selectCrack();
|
||||||
break;
|
break;
|
||||||
case VehicleDamage.WindshieldCrackSingleWindshield:
|
case VehicleDamage.WindshieldCrackSingleWindshield:
|
||||||
await this.windshieldChkBox.check();
|
await this.windshieldButton.check();
|
||||||
await this.selectCrack();
|
await this.selectCrack();
|
||||||
await this.singleWindshieldButton.check();
|
await this.singleWindshieldButton.check();
|
||||||
break;
|
break;
|
||||||
case VehicleDamage.WindshieldCrackDriverSide:
|
case VehicleDamage.WindshieldCrackDriverSide:
|
||||||
await this.windshieldChkBox.check();
|
await this.windshieldButton.check();
|
||||||
await this.selectCrack();
|
await this.selectCrack();
|
||||||
await this.splitWindshieldDriverSideButton.check();
|
await this.splitWindshieldDriverSideButton.check();
|
||||||
break;
|
break;
|
||||||
case VehicleDamage.WindshieldCrackPassengerSide:
|
case VehicleDamage.WindshieldCrackPassengerSide:
|
||||||
await this.windshieldChkBox.check();
|
await this.windshieldButton.check();
|
||||||
await this.selectCrack();
|
await this.selectCrack();
|
||||||
await this.splitWindshieldPassengerSideButton.check();
|
await this.splitWindshieldPassengerSideButton.check();
|
||||||
break;
|
break;
|
||||||
|
|
@ -156,12 +158,12 @@ export class VehicleDamagePage extends BasePage {
|
||||||
}
|
}
|
||||||
|
|
||||||
async selectCrack(){
|
async selectCrack(){
|
||||||
await this.crackButton.check();
|
await this.replaceButton.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
async selectChips(numChips: string){
|
async selectChips(numChips: string){
|
||||||
const numChipsButton = this.page.getByText(numChips, {exact: true});
|
const numChipsButton = this.page.getByText(numChips, {exact: true});
|
||||||
await this.chipButton.check();
|
await this.repairButton.check();
|
||||||
await numChipsButton.check();
|
await numChipsButton.check();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue