Merge pull request #2979 from Safelite/feature/CASH-2032
fixed alert validation playwright tests
This commit is contained in:
commit
88dce0e67e
7 changed files with 19 additions and 19 deletions
|
|
@ -81,9 +81,9 @@ export class LookupPage extends BasePage {
|
|||
|
||||
// Map of expected messages by lookup type
|
||||
const expectedMessages = {
|
||||
'address': "Your address didn't return a VIN match.Please re-enter the information below or provide your VIN in a different way.",
|
||||
'license plate': "Your license plate didn’t return a VIN match.Please re-enter the information above or provide your VIN in a different way.",
|
||||
'VIN': "Your VIN didn’t return a vehicle matchPlease re-enter your VIN or we can look up your VIN for you.",
|
||||
'address': "Your address didn't return a VIN match.Please re-enter the information below or provide your VIN in a different way.",
|
||||
'license plate': "Your license plate didn’t return a VIN match.Please re-enter the information above or provide your VIN in a different way.",
|
||||
'VIN': "Your VIN didn’t return a vehicle matchPlease re-enter your VIN or we can look up your VIN for you.",
|
||||
'ZIP code': "Your ZIP code didn't return a match.Please re-enter the information above or provide your VIN in a different way."
|
||||
};
|
||||
|
||||
|
|
@ -106,19 +106,19 @@ export class LookupPage extends BasePage {
|
|||
}
|
||||
}
|
||||
|
||||
async handleZipValidation(testData: Partial<ITestData>, zip: string, lookupType: VehicleLookupType, alertFlags?: IAlertFlags): Promise<boolean> {
|
||||
async handleZipValidation(testData: Partial<ITestData>): Promise<boolean> {
|
||||
|
||||
let { vehicleDamage } = testData;
|
||||
let { customerDetails,vehicleDamage, vehicleDetails, alertFlags } = testData;
|
||||
// Only proceed with validation if alertFlags is provided
|
||||
if (alertFlags) {
|
||||
if (alertFlags.isUnserviceableZip) {
|
||||
await this.checkForUnserviceableZipAlertMessage(zip);
|
||||
await this.checkForUnserviceableZipAlertMessage(customerDetails!.address.postalCode!);
|
||||
throw new TestSuccessAlert('Unserviceable ZIP validation successful.');
|
||||
} else if (alertFlags.isInvalidZip) {
|
||||
await this.checkForInvalidZipAlertMessage();
|
||||
throw new TestSuccessAlert('Invalid ZIP validation successful.');
|
||||
} else if (alertFlags.isVinNotFound) {
|
||||
await this.checkForVinNotFoundAlertMessage(lookupType);
|
||||
await this.checkForVinNotFoundAlertMessage(vehicleDetails!.vehicleLookupType!);
|
||||
throw new TestSuccessAlert('Vin not found validation successful.');
|
||||
} else {
|
||||
|
||||
|
|
|
|||
|
|
@ -12,9 +12,9 @@ export class ServiceZipPage extends LookupPage {
|
|||
|
||||
@step("ZipLookupPage >> Lookup by service ZIP: ")
|
||||
async handleServiceZipPage(testData: Partial<ITestData>) {
|
||||
const { customerDetails, vehicleDetails, alertFlags } = testData;
|
||||
const { customerDetails } = testData;
|
||||
await this.validateProgressBar(ProgressBarPercentages.ServiceZipPage);
|
||||
await this.enterZip(customerDetails!.address.postalCode!);
|
||||
await this.handleZipValidation(testData, customerDetails!.address.postalCode!, vehicleDetails!.vehicleLookupType!, alertFlags!);
|
||||
await this.handleZipValidation(testData);
|
||||
}
|
||||
}
|
||||
|
|
@ -29,10 +29,10 @@ export class VehicleLookupAddressPage extends LookupPage {
|
|||
|
||||
@step("VehicleLookupAddressPage >> Lookup by address: ")
|
||||
async handleVehicleLookupAddressPage(testData: Partial<ITestData>) {
|
||||
const { customerDetails, vehicleDetails, alertFlags } = testData;
|
||||
const { customerDetails, vehicleDetails } = testData;
|
||||
|
||||
await this.validateProgressBar(ProgressBarPercentages.VehicleLookupAddressPage);
|
||||
await this.lookupVehicleByAddress(customerDetails!, vehicleDetails!);
|
||||
await this.handleZipValidation(customerDetails!.address.postalCode!, vehicleDetails!.vehicleLookupType!, alertFlags!);
|
||||
await this.handleZipValidation(testData);
|
||||
}
|
||||
}
|
||||
|
|
@ -34,11 +34,11 @@ export class VehicleLookupLicensePage extends LookupPage {
|
|||
|
||||
@step("VehicleLookupLicensePage >> Lookup by license plate: ")
|
||||
async handleVehicleLookupLicensePage(testData: Partial<ITestData>) {
|
||||
const { customerDetails, vehicleDetails, alertFlags } = testData;
|
||||
const { customerDetails, vehicleDetails } = testData;
|
||||
|
||||
await this.validateProgressBar(ProgressBarPercentages.VehicleLookupLicensePage);
|
||||
await this.enterPlateDetails(vehicleDetails!);
|
||||
await this.enterZip(customerDetails!.address.postalCode!);
|
||||
await this.handleZipValidation(customerDetails!.address.postalCode!, vehicleDetails!.vehicleLookupType!, alertFlags!);
|
||||
await this.handleZipValidation(testData);
|
||||
}
|
||||
}
|
||||
|
|
@ -24,11 +24,11 @@ export class VinLookupPage extends LookupPage {
|
|||
|
||||
@step("VinLookupPage >> Lookup by VIN: ")
|
||||
async handleVehicleLookupVinPage(testData: Partial<ITestData>) {
|
||||
const { customerDetails, vehicleDetails, alertFlags } = testData;
|
||||
const { customerDetails, vehicleDetails } = testData;
|
||||
let vin: string;
|
||||
|
||||
if (Array.isArray(vehicleDetails?.vin)) {
|
||||
vin = vehicleDetails.vin[0];
|
||||
vin = vehicleDetails!.vin[0];
|
||||
} else {
|
||||
vin = vehicleDetails?.vin || '';
|
||||
}
|
||||
|
|
@ -36,6 +36,6 @@ export class VinLookupPage extends LookupPage {
|
|||
await this.validateProgressBar(ProgressBarPercentages.VinLookupPage);
|
||||
await this.enterVin(vin);
|
||||
await this.enterZip(customerDetails!.address.postalCode!);
|
||||
await this.handleZipValidation(customerDetails!.address.postalCode!, vehicleDetails!.vehicleLookupType!, alertFlags!);
|
||||
await this.handleZipValidation(testData);
|
||||
}
|
||||
}
|
||||
|
|
@ -57,7 +57,7 @@ export class AddressForm extends BasePage {
|
|||
);
|
||||
});
|
||||
|
||||
await this.page.hover(".pac-container .pac-item");
|
||||
await this.addressSuggestionList.hover();
|
||||
await new Promise(resolve => setTimeout(resolve, 1000));
|
||||
await this.addressSuggestionList.click(); // Select the first suggestion
|
||||
//await this.streetAddressTextBox.press('Tab'); // Move focus to ZIP code field
|
||||
|
|
|
|||
|
|
@ -75,10 +75,10 @@ const lookupTypesToTest: LookupTestCase[] = [
|
|||
},
|
||||
customerDetails: {
|
||||
address: {
|
||||
street: '4076 Spectacle Drive',
|
||||
street: '4219 Turpin Ln',
|
||||
city: 'Columbus',
|
||||
state: 'OH',
|
||||
postalCode: '59261',
|
||||
postalCode: '43230',
|
||||
country: 'United States'
|
||||
}
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue