Skip to content

test: Add E2E tests for seated attendee rescheduling or cancelling bookings#9422

Merged
roae merged 12 commits intocalcom:mainfrom
rjackson:attendee-reschedule-cancel-tests
Jun 10, 2023
Merged

test: Add E2E tests for seated attendee rescheduling or cancelling bookings#9422
roae merged 12 commits intocalcom:mainfrom
rjackson:attendee-reschedule-cancel-tests

Conversation

@rjackson
Copy link
Copy Markdown
Contributor

@rjackson rjackson commented Jun 8, 2023

What does this PR do?

This PR adds or expands end-to-end tests to cover cancellation or reschedule actions taken by the attendees or seated events:

  • booking-seats.e2e.ts
    • Attendees can cancel a seated event time slot
      • Attendee no. 1 should be able to cancel their booking
      • All attendees cancelling should delete the booking for the user
    • Should reschedule booking with seats (updated to make sure the new booking is set up correctly)
  • reschedule.e2e.ts
    • Attendee should be able to reschedule a booking
  • booking-pages.e2e.ts
    • Can cancel the recently created booking and rebook the same timeslot (updated to remove dependence on localised text)
  • dynamic-booking-pages.e2e.ts
    • Can cancel the recently created booking (updated to remove dependence on localised text)

There are a few other small changes and fixes alongside this PR:

  • Updated test utils and new booking UI to avoid getting stuck on disabled time slots
    This was a problem whilst I was exploring non-seated event tests, as I had misunderstood the scope of these issues. Whilst it caused no breakages at present, the test utils should be able to skip disabled time slots in the new booking UI
  • Add explicit test IDs for cancel inputs
    The same testid was in-use by two cancel buttons: One which opens the form with "Cancellation reason", and the other that actually submits the cancel. For clarity and to ease future test writing, I've given these separate IDs. I also added a testid for the "Cancellation reason" field
  • Fixed backward-compatibility logic for bookingFields to avoid loading attendees as "guests" for event types with guests disabled (which is the case for seated bookings)
    This caused a lot of trouble when I was expanding the "reschedule" test to ensure the rescheduled attendee's booking was created correctly. According to my expanded test it was not, but when manually testing it was – with this backward-compatibility logic being responsible for that difference.
  • Updated some existing tests to remove their dependence on localised text

(Following section struck out as it relates to unused functionality)

And there remains one major issue, left unaddressed by this PR: Cancelling a booking from the `/booking/${seatRef}` endpoint doesn't work correctly, it:
  1. Cancels the whole booking for all attendees (very unpleasant!)
    2.~Shows a 404 page to the user instead of the "You are no longer attending this event" messaging ([CAL-1482] Booking not found error on cancel link for user with seat #8244)

I have written the cancellation-related tests to cover both the /booking/${bookingRef}?seatReferenceUid=${seatRef} URL and the seatRef URL, but left the seatRef tests being skipped default.

The seatRef tests can be enabled by running the tests with E2E_TEST_SEATED_CANCELLATIONS=1, for example to run just those tests:

E2E_TEST_SEATED_CANCELLATIONS=1 yarn e2e booking-seats.e2e.ts -g "Attendees can cancel a seated event time slot"

Fixes #9362 #9363 #9364
/claim #9362
/claim #9363
/claim #9364

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • Chore (refactoring code, technical debt, workflow improvements)

How should this be tested?

  • Run automated e2e tests
    • I did have some failures locally, but these were timeouts in unrelated and unchanged files. Hopefully all will run smoothly in CI

Mandatory Tasks

  • Make sure you have self-reviewed the code. A decent size PR without self-review might be rejected.

Checklist

(all complete)

@vercel
Copy link
Copy Markdown

vercel bot commented Jun 8, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
ui ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 10, 2023 2:48am

@vercel
Copy link
Copy Markdown

vercel bot commented Jun 8, 2023

@rjackson is attempting to deploy a commit to the cal Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions bot added 🐛 bug Something isn't working 💎 Bounty A bounty on Algora.io automated-tests area: unit tests, e2e tests, playwright labels Jun 8, 2023
@rjackson rjackson changed the title Add E2E tests for seated attendee rescheduling or cancelling bookings test: Add E2E tests for seated attendee rescheduling or cancelling bookings Jun 8, 2023
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jun 8, 2023

📦 Next.js Bundle Analysis for @calcom/web

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

// TODO: Find out why the first day is always booked on tests
await page.locator('[data-testid="day"][data-disabled="false"]').nth(1).click();
await page.locator('[data-testid="time"]').nth(0).click();
await page.locator('[data-testid="time"][data-disabled="false"]').nth(0).click();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice catch!

@roae
Copy link
Copy Markdown
Contributor

roae commented Jun 9, 2023

@rjackson I'm trying to replicate the issue canceling the booking with the endpoint /booking/${seatRef} but, I can find where that endpoint is used.

@rjackson
Copy link
Copy Markdown
Contributor Author

rjackson commented Jun 9, 2023

@rjackson I'm trying to replicate the issue canceling the booking with the endpoint /booking/${seatRef} but, I can find where that endpoint is used.

Hmm, I thought I got that link from the emails that go out – but looking at it again, I can see that emails use /reschedule/${seatUid} for reschedules, but /booking/${bookingUid}?seatReferenceUid=${seatUid} for cancellations:

return `${WEBAPP_URL}/reschedule/${seatUid ? seatUid : Uid}`;

I can't find anywhere else that might cause it, unless it somehow ever ends up as calEvent.uid? I can't spot that happening either.

Maybe the reschedule usage is where I originally saw this type of URL structure and then later noticed that /booking/ also supports it when accessed directly in the browser? Apologies for misleading us if that's the case!

I'd say that lowers the priority of the "bug", but I would point out that /booking/${seatUid} does appear to be supported by the codebase so it would be nice if we can make it work end-to-end, or we redirect that back to the canonical booking URL? (I have a separate issue that I've reported privately that might warrant making /booking/${seatUid} the primary link for seated participants, but that's beyond the scope of this issue).

Whatever we decide, as this URL appears to be an unexposed "feature"/"bug" I don't think we ought to have it represented in these tests. That can change if we ever do decide to formally support it, of course.

Copy link
Copy Markdown
Contributor

@roae roae left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job @rjackson, thanks for the contribution! 🙏

@roae roae added this pull request to the merge queue Jun 10, 2023
Merged via the queue into calcom:main with commit 0d01d32 Jun 10, 2023
@rjackson rjackson deleted the attendee-reschedule-cancel-tests branch June 12, 2023 09:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automated-tests area: unit tests, e2e tests, playwright 💎 Bounty A bounty on Algora.io 🐛 bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CAL-1876] Make E2E test: Attendee #1 Should be able to cancel his booking

3 participants