Added locator and logic for sms opt in box on contact details page

This commit is contained in:
JennyNou 2025-09-15 10:23:08 -04:00
parent cfda5a92d7
commit 62bae320ea

View file

@ -14,7 +14,7 @@ export class ContactDetailsPage extends BasePage {
readonly lastNameTextBox: Locator;
readonly emailAddressTextBox: Locator;
readonly phoneNumberTextBox: Locator;
readonly notesTextBox: Locator;
readonly textOptInBox: Locator;
constructor(page: Page) {
super(page);
@ -25,7 +25,7 @@ export class ContactDetailsPage extends BasePage {
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.textOptInBox = this.page.getByRole('checkbox', { name: 'Text me updates about my appointment*' });
}
@ -36,10 +36,8 @@ export class ContactDetailsPage extends BasePage {
await this.phoneNumberTextBox.fill(customerDetails.phoneNumber);
}
async fillNotes(notes?: string) {
if (notes) {
await this.notesTextBox.fill(notes);
}
async checkTextMeUpdates(customerDetails: ICustomerDetails) {
await this.textOptInBox.check();
}
@step("ContactDetailsPage >> Enter contact details: ")
@ -48,6 +46,11 @@ export class ContactDetailsPage extends BasePage {
await this.validateProgressBar(ProgressBarPercentages.ContactDetailsPage);
await this.enterContactDetails(customerDetails!);
if (testData.isOptedInForTextMessages) {
await this.checkTextMeUpdates(customerDetails!);
}
await this.nextPage();
}
}