DigitalConsumer.FixMyGlass/playwright-tests/pages/VehicleLookupLicensePage.ts
maguire-arman 404dda6556 Adds Playwright test framework for FMG
Initial commit of the Playwright test framework, including:
- Configuration files for Playwright, Docker, and Sauce Labs
- Test case structure and page object models
- CI/CD pipeline configuration
- Utilities and business logic implementations

This framework will be used for end-to-end testing of the FMG application.
2025-04-07 15:40:31 -04:00

27 lines
No EOL
1.3 KiB
TypeScript

import { type Locator, type Page } from '@playwright/test';
import { LookupPage } from './LookupPage';
import { IVehicleDetails } from '@business-logic/types/CustomerDetails';
export class VehicleLookupLicensePage extends LookupPage {
readonly licensePlateNumTextBox: Locator;
readonly licensePlateStateDrpDwn: Locator;
url = process.env['BASE_URL']! + '/fmg/?fmgPage=license-plate-lookup';
constructor(page: Page) {
super(page);
this.licensePlateNumTextBox = page.getByRole('textbox', { name: 'License plate number'});
this.licensePlateStateDrpDwn = page.getByRole('combobox', { name: 'License plate state'});
// Override the service zip textbox locator for license-specific label
this.serviceZipTextBox = page.getByRole('textbox', { name: 'ZIP code on vehicle' });
// Override the unserviceableZipAlertMessage for license-specific message
this.unserviceableZipAlertMessage = this.page.locator('div.alert-danger.widget-name-AlertVinNotFoundWidget',
{ hasText: "Your license plate didn't return a VIN match." });
}
async enterPlateDetails(vehicleDetails: IVehicleDetails) {
await this.licensePlateNumTextBox.fill(vehicleDetails.licensePlateNumber || '');
}
}