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;
|
||||
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<ICustomerDetails> = {};
|
||||
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) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue