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 lastNameTextBox: Locator;
readonly emailAddressTextBox: Locator; readonly emailAddressTextBox: Locator;
readonly phoneNumberTextBox: Locator; readonly phoneNumberTextBox: Locator;
readonly notesTextBox: Locator; readonly textOptInBox: Locator;
constructor(page: Page) { constructor(page: Page) {
super(page); super(page);
@ -25,7 +25,7 @@ export class ContactDetailsPage extends BasePage {
this.lastNameTextBox = this.page.getByRole('textbox', { name: 'Last name' }); this.lastNameTextBox = this.page.getByRole('textbox', { name: 'Last name' });
this.emailAddressTextBox = this.page.getByRole('textbox', { name: 'Email address' }); this.emailAddressTextBox = this.page.getByRole('textbox', { name: 'Email address' });
this.phoneNumberTextBox = this.page.getByRole('textbox', { name: 'Phone number' }); 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); await this.phoneNumberTextBox.fill(customerDetails.phoneNumber);
} }
async fillNotes(notes?: string) { async checkTextMeUpdates(customerDetails: ICustomerDetails) {
if (notes) { await this.textOptInBox.check();
await this.notesTextBox.fill(notes);
}
} }
@step("ContactDetailsPage >> Enter contact details: ") @step("ContactDetailsPage >> Enter contact details: ")
@ -48,6 +46,11 @@ export class ContactDetailsPage extends BasePage {
await this.validateProgressBar(ProgressBarPercentages.ContactDetailsPage); await this.validateProgressBar(ProgressBarPercentages.ContactDetailsPage);
await this.enterContactDetails(customerDetails!); await this.enterContactDetails(customerDetails!);
if (testData.isOptedInForTextMessages) {
await this.checkTextMeUpdates(customerDetails!);
}
await this.nextPage(); await this.nextPage();
} }
} }