Removes the explicit URL declaration from the page classes. The URL validation and navigation are now handled directly within the tests, providing greater flexibility and control over test execution and removing the need to manage URLs within each page object.
38 lines
No EOL
1.8 KiB
TypeScript
38 lines
No EOL
1.8 KiB
TypeScript
import { type Page, Locator } from '@playwright/test';
|
|
import { LookupPage } from './LookupPage';
|
|
import { AddressForm } from './forms/AddressForm';
|
|
import { VehicleSelectionForm } from './forms/VehicleSelectionForm';
|
|
import { ICustomerDetails, IVehicleDetails } from 'safelite-playwright-core';
|
|
import { step } from 'framework/localTypes/Step';
|
|
import { ITestData } from 'framework/TestData';
|
|
import { ProgressBarPercentages } from 'framework/localTypes/Enums';
|
|
|
|
export class VehicleLookupAddressPage extends LookupPage {
|
|
readonly addressForm: AddressForm;
|
|
readonly vehicleSelectionForm: VehicleSelectionForm;
|
|
|
|
constructor(page: Page) {
|
|
super(page);
|
|
this.addressForm = new AddressForm(page);
|
|
this.vehicleSelectionForm = new VehicleSelectionForm(page);
|
|
|
|
// Override the unserviceableZipAlertMessage for address-specific message
|
|
this.unserviceableZipAlertMessage = this.page.locator('div.alert-danger.widget-name-AlertVinNotFoundWidget',
|
|
{ hasText: "Your address didn't return a VIN match." });
|
|
}
|
|
|
|
async lookupVehicleByAddress(customerDetails: ICustomerDetails, vehicleDetails: IVehicleDetails) {
|
|
await this.addressForm.populateAddress(customerDetails);
|
|
//await this.nextPage();
|
|
//await this.vehicleSelectionForm.selectVehicle(vehicleDetails);
|
|
}
|
|
|
|
@step("VehicleLookupAddressPage >> Lookup by address: ")
|
|
async handleVehicleLookupAddressPage(testData: Partial<ITestData>) {
|
|
const { customerDetails, vehicleDetails, alertFlags } = testData;
|
|
|
|
await this.validateProgressBar(ProgressBarPercentages.VehicleLookupAddressPage);
|
|
await this.lookupVehicleByAddress(customerDetails!, vehicleDetails!);
|
|
await this.handleZipValidation(customerDetails!.address.postalCode!, vehicleDetails!.vehicleLookupType!, alertFlags!);
|
|
}
|
|
} |