DigitalConsumer.ISS/playwright-tests/pages/VehicleLookupLicensePage.ts
Siraj Shaik 6d5a0524e3 latest updates from QA repo
21 and 22 scenarios were added
Mock responses refactored.
2025-02-18 14:41:05 -05:00

39 lines
No EOL
2 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { expect, type Locator, type Page } from '@playwright/test';
import { BasePage } from './BasePage';
import { IVehicleDetails } from '@business-logic/types/CustomerDetails';
export class VehicleLookupLicensePage extends BasePage {
readonly page: Page;
readonly licensePlateNumTextBox: Locator;
readonly licensePlateStateDrpDwn: Locator;
readonly plateNoMatchError: Locator;
readonly plateMismatchAlert: Locator;
url = process.env['BASE_URL']! + '/?issPage='; // TODO: Input correct URL
constructor(page: Page) {
super(page);
this.page = page;
this.licensePlateNumTextBox = page.getByRole('textbox', { name: 'License plate number' });
this.licensePlateStateDrpDwn = page.getByRole('combobox', { name: 'License plate state' });
this.plateNoMatchError = page.getByText('Your license plate didnt return a VIN match.Please re-enter the information');
this.plateMismatchAlert = page.getByRole('alert').locator('div');
}
async enterPlateDetails(vehicleDetails: IVehicleDetails, isVehicleLookupValidations = false) {
if (Array.isArray(vehicleDetails.licensePlateNumber)) {
if (isVehicleLookupValidations) {
await this.licensePlateNumTextBox.fill(vehicleDetails.licensePlateNumber[0]);
await this.continueButton.click({ timeout: 1000 });
await expect(this.plateNoMatchError).toBeVisible();
await this.licensePlateNumTextBox.fill(vehicleDetails.licensePlateNumber[1]);
await this.continueButton.click({ timeout: 1000 });
await expect(this.plateMismatchAlert).toBeVisible();
await this.licensePlateNumTextBox.fill(vehicleDetails.licensePlateNumber[2]);
}
} else {
await this.licensePlateNumTextBox.fill(vehicleDetails.licensePlateNumber || '');
}
await this.licensePlateStateDrpDwn.selectOption(vehicleDetails.licensePlateState!);
}
}