Update locators and flow for contact details page
This commit is contained in:
parent
31d2d7d5f5
commit
fb6c3ee7fb
1 changed files with 36 additions and 19 deletions
|
|
@ -6,35 +6,52 @@ export class ContactDetailsPage extends BasePage {
|
||||||
readonly page: Page;
|
readonly page: Page;
|
||||||
issPageValue = 'contact-details';
|
issPageValue = 'contact-details';
|
||||||
|
|
||||||
// Contact details form
|
readonly appointmentInformationAlert: Locator;
|
||||||
// TODO: Check if we can consolidate
|
readonly changeZipCodeAlert: Locator;
|
||||||
readonly firstNameTextBox: Locator;
|
|
||||||
readonly lastNameTextBox: Locator;
|
readonly streetAddressTextBox: Locator;
|
||||||
readonly emailAddressTextBox: Locator;
|
readonly apartmentNumberTextBox: Locator;
|
||||||
readonly phoneNumberTextBox: Locator;
|
readonly cityTextBox: Locator;
|
||||||
|
readonly stateTextBox: Locator;
|
||||||
|
readonly zipCodeTextBox: Locator;
|
||||||
|
readonly coveredLocationYesButton: Locator;
|
||||||
|
readonly coveredLocationNoButton: Locator
|
||||||
readonly notesTextBox: Locator;
|
readonly notesTextBox: Locator;
|
||||||
|
|
||||||
constructor(page: Page) {
|
constructor(page: Page) {
|
||||||
super(page);
|
super(page);
|
||||||
this.page = 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
|
// Contact details form
|
||||||
this.firstNameTextBox = this.page.getByRole('textbox', { name: 'First name' });
|
this.streetAddressTextBox = this.page.getByRole('textbox', { name: 'Street address' });
|
||||||
this.lastNameTextBox = this.page.getByRole('textbox', { name: 'Last name' });
|
this.apartmentNumberTextBox = this.page.getByRole('textbox', { name: 'Apartment number or letter (Optional)' });
|
||||||
this.emailAddressTextBox = this.page.getByRole('textbox', { name: 'Email address' });
|
this.cityTextBox = this.page.getByRole('textbox', { name: 'City' });
|
||||||
this.phoneNumberTextBox = this.page.getByRole('textbox', { name: 'Phone number' });
|
this.stateTextBox = this.page.getByRole('textbox', { name: 'state' });
|
||||||
this.notesTextBox = this.page.getByRole('textbox', { name: 'Notes' });
|
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 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.');
|
||||||
|
|
||||||
async getContactDetails() {
|
await expect(this.changeZipCodeAlert).toBeVisible();
|
||||||
const customerDetails: Partial<ICustomerDetails> = {};
|
await this.changeZipCodeAlert.click();
|
||||||
customerDetails.firstName = await this.firstNameTextBox.inputValue();
|
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.');
|
||||||
customerDetails.lastName = await this.lastNameTextBox.inputValue();
|
}
|
||||||
customerDetails.email = await this.emailAddressTextBox.inputValue();
|
|
||||||
customerDetails.phoneNumber = await this.phoneNumberTextBox.inputValue();
|
|
||||||
|
|
||||||
return customerDetails;
|
// 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) {
|
async fillNotes(notes?: string) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue