Skip to content

Commit 314aaea

Browse files
committed
Update E2E tests for booking page UI overhaul
1 parent a772ee7 commit 314aaea

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

test/e2e/pages/booking-page.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ import { APPT_MY_SHARE_LINK, APPT_SHORT_SHARE_LINK_PREFIX, APPT_LONG_SHARE_LINK_
55
export class BookingPage {
66
readonly page: Page;
77
readonly titleText: Locator;
8-
readonly invitingText: Locator;
9-
readonly confirmBtn: Locator;
8+
readonly bookATimeToMeetText: Locator;
9+
readonly selectTimeSlotText: Locator;
10+
readonly bookApptBtn: Locator;
1011
readonly bookingCalendarHdrSun: Locator;
1112
readonly bookingCalendarHdrMon: Locator;
1213
readonly bookingCalendarHdrTue: Locator;
@@ -19,7 +20,6 @@ export class BookingPage {
1920
readonly availableBookingSlot: Locator;
2021
readonly bookSelectionNameInput: Locator;
2122
readonly bookSelectionEmailInput: Locator;
22-
readonly bookSelectionBookBtn: Locator;
2323
readonly bookingConfirmedTitleText: Locator;
2424
readonly requestSentAvailabilityText: Locator;
2525
readonly requestSentCloseBtn: Locator;
@@ -32,7 +32,8 @@ export class BookingPage {
3232
constructor(page: Page) {
3333
this.page = page;
3434
this.titleText = this.page.getByTestId('booking-view-title-text');
35-
this.invitingText = this.page.getByTestId('booking-view-inviting-you-text');
35+
this.bookATimeToMeetText = this.page.getByTestId('booking-view-book-a-time-to-meet-with-text');
36+
this.selectTimeSlotText = this.page.getByText('Select an open time slot from the calendar');
3637
this.bookingCalendarHdrSun = this.page.getByText('SUN', { exact: true });
3738
this.bookingCalendarHdrMon = this.page.getByText('MON', { exact: true });
3839
this.bookingCalendarHdrTue = this.page.getByText('TUE', { exact: true });
@@ -41,12 +42,11 @@ export class BookingPage {
4142
this.bookingCalendarHdrFri = this.page.getByText('FRI', { exact: true });
4243
this.bookingCalendarHdrSat = this.page.getByText('SAT', { exact: true });
4344
this.bookingWeekPickerBtn = this.page.locator('.week-picker-button');
44-
this.confirmBtn = this.page.getByTestId('booking-view-confirm-selection-button');
45+
this.bookApptBtn = this.page.getByTestId('booking-view-confirm-selection-button');
4546
this.nextWeekArrow = this.page.getByRole('button', { name: 'Next week' });
4647
this.availableBookingSlot = this.page.locator('.selectable-slot', { hasNotText: 'Busy'});
4748
this.bookSelectionNameInput = this.page.getByPlaceholder('First and last name');
4849
this.bookSelectionEmailInput = this.page.getByPlaceholder('[email protected]');
49-
this.bookSelectionBookBtn = this.page.getByRole('button', { name: 'Book' });
5050
this.bookingConfirmedTitleText = this.page.getByText('Booking confirmed');
5151
this.requestSentAvailabilityText = this.page.getByText("'s Availability");
5252
this.requestSentCloseBtn = this.page.getByRole('button', { name: 'Close' });
@@ -63,7 +63,7 @@ export class BookingPage {
6363
async gotoBookingPageShortUrl() {
6464
// the default share link is a short URL
6565
await this.page.goto(APPT_MY_SHARE_LINK);
66-
await expect(this.confirmBtn).toBeVisible({ timeout: TIMEOUT_30_SECONDS });
66+
await expect(this.selectTimeSlotText).toBeVisible( { timeout: TIMEOUT_30_SECONDS });
6767
}
6868

6969
/**
@@ -74,7 +74,7 @@ export class BookingPage {
7474
const prodShareLinkUser: string = APPT_MY_SHARE_LINK.split(APPT_SHORT_SHARE_LINK_PREFIX)[1];
7575
const longLink: string = `${APPT_LONG_SHARE_LINK_PREFIX}${prodShareLinkUser}`;
7676
await this.page.goto(longLink);
77-
await expect(this.confirmBtn).toBeVisible({ timeout: TIMEOUT_30_SECONDS });
77+
await expect(this.selectTimeSlotText).toBeVisible( { timeout: TIMEOUT_30_SECONDS });
7878
}
7979

8080
/**
@@ -83,15 +83,15 @@ export class BookingPage {
8383
async gotoBookingPageWeekView() {
8484
const weekLink: string = `${APPT_MY_SHARE_LINK}#week`;
8585
await this.page.goto(weekLink);
86-
await expect(this.confirmBtn).toBeVisible({ timeout: TIMEOUT_30_SECONDS });
86+
await expect(this.selectTimeSlotText).toBeVisible( { timeout: TIMEOUT_30_SECONDS });
8787
}
8888

8989
/**
9090
* With the booking page week view already displayed, go forward to the next week.
9191
*/
9292
async goForwardOneWeek() {
9393
await this.nextWeekArrow.click();
94-
await expect(this.confirmBtn).toBeVisible({ timeout: TIMEOUT_30_SECONDS });
94+
await expect(this.selectTimeSlotText).toBeVisible( { timeout: TIMEOUT_30_SECONDS });
9595
}
9696

9797
/**
@@ -141,7 +141,7 @@ export class BookingPage {
141141
async finishBooking(bookerName: string, bookerEmail: string) {
142142
await this.bookSelectionNameInput.fill(bookerName);
143143
await this.bookSelectionEmailInput.fill(bookerEmail);
144-
await this.bookSelectionBookBtn.click();
144+
await this.bookApptBtn.click();
145145
}
146146

147147
/**

test/e2e/tests/desktop/access-booking-page.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ var dashboardPage: DashboardPage;
1818
const verifyBookingPageLoaded = async (page: Page) => {
1919
await expect(bookingPage.titleText).toBeVisible({ timeout: TIMEOUT_60_SECONDS });
2020
await expect(bookingPage.titleText).toContainText(APPT_DISPLAY_NAME);
21-
await expect(bookingPage.invitingText).toBeVisible();
22-
await expect(bookingPage.invitingText).toContainText(APPT_DISPLAY_NAME);
21+
await expect(bookingPage.bookATimeToMeetText).toBeVisible();
22+
await expect(bookingPage.bookATimeToMeetText).toContainText(APPT_DISPLAY_NAME);
2323
await expect(bookingPage.bookingCalendarHdrSun).toBeVisible();
2424
await expect(bookingPage.bookingCalendarHdrMon).toBeVisible();
2525
await expect(bookingPage.bookingCalendarHdrTue).toBeVisible();
@@ -39,9 +39,9 @@ const verifyBookingPageLoaded = async (page: Page) => {
3939
const monthName = currentDate.toLocaleString('default', { month: 'long' });
4040
expect(await bookingPage.bookingWeekPickerBtn.textContent()).toContain(monthName);
4141

42-
// also the confirm button is disabled by default until a slot is selected
42+
// also the book appt button is hidden by default (since a slot is not yet selected)
4343
await page.waitForTimeout(TIMEOUT_1_SECOND);
44-
await expect(bookingPage.confirmBtn).toBeDisabled();
44+
await expect(bookingPage.bookApptBtn).toBeHidden();
4545
}
4646

4747
test.beforeEach(async ({ page }) => {

test/e2e/tests/desktop/book-appointment.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ test.describe('book an appointment on desktop browser', () => {
4545
console.log(`selected appointment time slot: ${selectedSlot}`);
4646

4747
// now we have an availble booking time slot selected, click confirm button
48-
await bookingPage.confirmBtn.click();
48+
await bookingPage.bookApptBtn.click();
4949

5050
// verify booking request sent pop-up
5151
await expect(bookingPage.bookingConfirmedTitleText.first()).toBeVisible({ timeout: TIMEOUT_60_SECONDS });

0 commit comments

Comments
 (0)