fixed alert validation playwright tests
This commit is contained in:
parent
d3a4c10b9e
commit
7c2fb6eee0
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
|
// Map of expected messages by lookup type
|
||||||
const expectedMessages = {
|
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.",
|
'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.",
|
'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.",
|
'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."
|
'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
|
// Only proceed with validation if alertFlags is provided
|
||||||
if (alertFlags) {
|
if (alertFlags) {
|
||||||
if (alertFlags.isUnserviceableZip) {
|
if (alertFlags.isUnserviceableZip) {
|
||||||
await this.checkForUnserviceableZipAlertMessage(zip);
|
await this.checkForUnserviceableZipAlertMessage(customerDetails!.address.postalCode!);
|
||||||
throw new TestSuccessAlert('Unserviceable ZIP validation successful.');
|
throw new TestSuccessAlert('Unserviceable ZIP validation successful.');
|
||||||
} else if (alertFlags.isInvalidZip) {
|
} else if (alertFlags.isInvalidZip) {
|
||||||
await this.checkForInvalidZipAlertMessage();
|
await this.checkForInvalidZipAlertMessage();
|
||||||
throw new TestSuccessAlert('Invalid ZIP validation successful.');
|
throw new TestSuccessAlert('Invalid ZIP validation successful.');
|
||||||
} else if (alertFlags.isVinNotFound) {
|
} else if (alertFlags.isVinNotFound) {
|
||||||
await this.checkForVinNotFoundAlertMessage(lookupType);
|
await this.checkForVinNotFoundAlertMessage(vehicleDetails!.vehicleLookupType!);
|
||||||
throw new TestSuccessAlert('Vin not found validation successful.');
|
throw new TestSuccessAlert('Vin not found validation successful.');
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,9 +12,9 @@ export class ServiceZipPage extends LookupPage {
|
||||||
|
|
||||||
@step("ZipLookupPage >> Lookup by service ZIP: ")
|
@step("ZipLookupPage >> Lookup by service ZIP: ")
|
||||||
async handleServiceZipPage(testData: Partial<ITestData>) {
|
async handleServiceZipPage(testData: Partial<ITestData>) {
|
||||||
const { customerDetails, vehicleDetails, alertFlags } = testData;
|
const { customerDetails } = testData;
|
||||||
await this.validateProgressBar(ProgressBarPercentages.ServiceZipPage);
|
await this.validateProgressBar(ProgressBarPercentages.ServiceZipPage);
|
||||||
await this.enterZip(customerDetails!.address.postalCode!);
|
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: ")
|
@step("VehicleLookupAddressPage >> Lookup by address: ")
|
||||||
async handleVehicleLookupAddressPage(testData: Partial<ITestData>) {
|
async handleVehicleLookupAddressPage(testData: Partial<ITestData>) {
|
||||||
const { customerDetails, vehicleDetails, alertFlags } = testData;
|
const { customerDetails, vehicleDetails } = testData;
|
||||||
|
|
||||||
await this.validateProgressBar(ProgressBarPercentages.VehicleLookupAddressPage);
|
await this.validateProgressBar(ProgressBarPercentages.VehicleLookupAddressPage);
|
||||||
await this.lookupVehicleByAddress(customerDetails!, vehicleDetails!);
|
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: ")
|
@step("VehicleLookupLicensePage >> Lookup by license plate: ")
|
||||||
async handleVehicleLookupLicensePage(testData: Partial<ITestData>) {
|
async handleVehicleLookupLicensePage(testData: Partial<ITestData>) {
|
||||||
const { customerDetails, vehicleDetails, alertFlags } = testData;
|
const { customerDetails, vehicleDetails } = testData;
|
||||||
|
|
||||||
await this.validateProgressBar(ProgressBarPercentages.VehicleLookupLicensePage);
|
await this.validateProgressBar(ProgressBarPercentages.VehicleLookupLicensePage);
|
||||||
await this.enterPlateDetails(vehicleDetails!);
|
await this.enterPlateDetails(vehicleDetails!);
|
||||||
await this.enterZip(customerDetails!.address.postalCode!);
|
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: ")
|
@step("VinLookupPage >> Lookup by VIN: ")
|
||||||
async handleVehicleLookupVinPage(testData: Partial<ITestData>) {
|
async handleVehicleLookupVinPage(testData: Partial<ITestData>) {
|
||||||
const { customerDetails, vehicleDetails, alertFlags } = testData;
|
const { customerDetails, vehicleDetails } = testData;
|
||||||
let vin: string;
|
let vin: string;
|
||||||
|
|
||||||
if (Array.isArray(vehicleDetails?.vin)) {
|
if (Array.isArray(vehicleDetails?.vin)) {
|
||||||
vin = vehicleDetails.vin[0];
|
vin = vehicleDetails!.vin[0];
|
||||||
} else {
|
} else {
|
||||||
vin = vehicleDetails?.vin || '';
|
vin = vehicleDetails?.vin || '';
|
||||||
}
|
}
|
||||||
|
|
@ -36,6 +36,6 @@ export class VinLookupPage extends LookupPage {
|
||||||
await this.validateProgressBar(ProgressBarPercentages.VinLookupPage);
|
await this.validateProgressBar(ProgressBarPercentages.VinLookupPage);
|
||||||
await this.enterVin(vin);
|
await this.enterVin(vin);
|
||||||
await this.enterZip(customerDetails!.address.postalCode!);
|
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 new Promise(resolve => setTimeout(resolve, 1000));
|
||||||
await this.addressSuggestionList.click(); // Select the first suggestion
|
await this.addressSuggestionList.click(); // Select the first suggestion
|
||||||
//await this.streetAddressTextBox.press('Tab'); // Move focus to ZIP code field
|
//await this.streetAddressTextBox.press('Tab'); // Move focus to ZIP code field
|
||||||
|
|
|
||||||
|
|
@ -75,10 +75,10 @@ const lookupTypesToTest: LookupTestCase[] = [
|
||||||
},
|
},
|
||||||
customerDetails: {
|
customerDetails: {
|
||||||
address: {
|
address: {
|
||||||
street: '4076 Spectacle Drive',
|
street: '4219 Turpin Ln',
|
||||||
city: 'Columbus',
|
city: 'Columbus',
|
||||||
state: 'OH',
|
state: 'OH',
|
||||||
postalCode: '59261',
|
postalCode: '43230',
|
||||||
country: 'United States'
|
country: 'United States'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue