From fb6c3ee7fb8bf3bb3bc25db632a06c14e911b98d Mon Sep 17 00:00:00 2001 From: JennyNou <167806377+JennyNou@users.noreply.github.com> Date: Tue, 10 Mar 2026 13:34:42 -0400 Subject: [PATCH] Update locators and flow for contact details page --- playwright-tests/pages/ContactDetailsPage.ts | 55 +++++++++++++------- 1 file changed, 36 insertions(+), 19 deletions(-) diff --git a/playwright-tests/pages/ContactDetailsPage.ts b/playwright-tests/pages/ContactDetailsPage.ts index a942a12e..2f030149 100644 --- a/playwright-tests/pages/ContactDetailsPage.ts +++ b/playwright-tests/pages/ContactDetailsPage.ts @@ -6,35 +6,52 @@ export class ContactDetailsPage extends BasePage { readonly page: Page; issPageValue = 'contact-details'; - // Contact details form - // TODO: Check if we can consolidate - readonly firstNameTextBox: Locator; - readonly lastNameTextBox: Locator; - readonly emailAddressTextBox: Locator; - readonly phoneNumberTextBox: Locator; + readonly appointmentInformationAlert: Locator; + readonly changeZipCodeAlert: Locator; + + readonly streetAddressTextBox: Locator; + readonly apartmentNumberTextBox: Locator; + readonly cityTextBox: Locator; + readonly stateTextBox: Locator; + readonly zipCodeTextBox: Locator; + readonly coveredLocationYesButton: Locator; + readonly coveredLocationNoButton: Locator readonly notesTextBox: Locator; constructor(page: Page) { super(page); this.page = page; + // Alerts + this.appointmentInformationAlert = this.page.locator('[class*="widget-name-AppointmentInformationAlertWidget"]'); + this.changeZipCodeAlert = this.page.locator('[class*="widget-name-ChangeZipCodeAlertWidget"]'); + // Contact details form - this.firstNameTextBox = this.page.getByRole('textbox', { name: 'First name' }); - this.lastNameTextBox = this.page.getByRole('textbox', { name: 'Last name' }); - this.emailAddressTextBox = this.page.getByRole('textbox', { name: 'Email address' }); - this.phoneNumberTextBox = this.page.getByRole('textbox', { name: 'Phone number' }); - this.notesTextBox = this.page.getByRole('textbox', { name: 'Notes' }); + this.streetAddressTextBox = this.page.getByRole('textbox', { name: 'Street address' }); + this.apartmentNumberTextBox = this.page.getByRole('textbox', { name: 'Apartment number or letter (Optional)' }); + this.cityTextBox = this.page.getByRole('textbox', { name: 'City' }); + this.stateTextBox = this.page.getByRole('textbox', { name: 'state' }); + this.zipCodeTextBox = this.page.getByRole('textbox', { name: 'ZIP' }); + this.coveredLocationYesButton = this.page.locator('#vehicleProtectedQuestion-true'); + this.coveredLocationNoButton = this.page.locator('#vehicleProtectedQuestion-false'); + this.notesTextBox = this.page.getByRole('textbox', { name: 'technicianNotes' }); } - - async getContactDetails() { - const customerDetails: Partial = {}; - customerDetails.firstName = await this.firstNameTextBox.inputValue(); - customerDetails.lastName = await this.lastNameTextBox.inputValue(); - customerDetails.email = await this.emailAddressTextBox.inputValue(); - customerDetails.phoneNumber = await this.phoneNumberTextBox.inputValue(); + async validateAlertsAreVisible() { + await expect(this.appointmentInformationAlert).toBeVisible(); + await this.appointmentInformationAlert.click(); // + await expect(this.appointmentInformationAlert).toContainText('Please have your vehicle keys or key card available, as your technician needs access inside the vehicle and may need to move your vehicle to complete service.'); - return customerDetails; + await expect(this.changeZipCodeAlert).toBeVisible(); + await this.changeZipCodeAlert.click(); + await expect(this.changeZipCodeAlert).toContainText('If your service ZIP code has changed, please go back and update it to ensure we have the correct information for your appointment.'); + } + + // TO-DO add method for when checkbox for same as policy address displays + + async fillContactDetails(customerDetails: ICustomerDetails) { + await this.streetAddressTextBox.fill(customerDetails.address.street!); + await this.cityTextBox.fill(customerDetails.address.city!); } async fillNotes(notes?: string) {