2023-03-14 04:19:05 +00:00
|
|
|
import { expect } from "@playwright/test";
|
|
|
|
import type { Prisma } from "@prisma/client";
|
|
|
|
import { v4 as uuidv4 } from "uuid";
|
|
|
|
|
|
|
|
import prisma from "@calcom/prisma";
|
2023-05-02 11:44:05 +00:00
|
|
|
import { BookingStatus } from "@calcom/prisma/enums";
|
2023-03-14 04:19:05 +00:00
|
|
|
|
|
|
|
import type { Fixtures } from "./lib/fixtures";
|
|
|
|
import { test } from "./lib/fixtures";
|
New Booker Component (preparations for booker atom) (#6792)
* Wip on booker atom
* Wip on booker atom
* Added correct icon imports
* Fixed build
* Responsive improvements
* Removed package lock
* Responsive tweaks
* Animation improvements and cleanup
* Animation improvements and event meta layout improvements.
* Tweaked margins.
* Added more event meta blocks
* Layout tweaks
* Converted booker layout to css grid and implemented multiple layout options
* cleanup
* Fixed build
* Fixed build
* Added temporary api route to enable/disable new booker
* Added sticky behavior
* Reverted yarn.lock and reinstalled new packages to see if this fixes build on vercel.
* Ensure divider lines always have 100% height.
* Improved animation config + initial load
* Ensure to pass eventid to getschedule, otherwise custom availability schedule wont work and wont return any availability
* Fixed divider line heights in booker
* Fixed timezone select positioning
* Added ability to view multiple days of timeslots
* Added icons to booker toggle
* Always show timeslots in timeslots view, also if no date is selected yet. In that case we show upcoming 5 days.
* Fixed timeslots in small calendar view
* Show selected day in calendar
* Fixed booker timeslots view
* Wip in making booking form work
* Moved most of the booker atom stuff to features, since it belongs there. Atom should be a rather small wrapper.
* Added create event functionality to booker form.
* Added guests toggle to booker form and styled input addons in dark mode.
* Added dynamic weekstart to booker
* Added seats limit feature to timeslots.
* Removed todo
* Added correct event avatars
* Added correct event name and icons
* Added correct translation for minutes text in multi duration
* Add rescheduling functionality to new booker.
* Added selected booking time to booking meta in sidebar.
* Abstracted away timeformat to custom hook
* Added correct key props to all components in booker.
* Fix build
* Create some new custom hooks to have a lot less repitition in code.
* Moved bookerform component inside booker directory since it is tied to it.
* Added error messages to booker form, plus fixed bug in recurring events.
* Added some comments <3
* Fixed todos in booker form.
* Added loading state for timeslot selector, and added prefetching of next month, in case of multi day view showing 2 months at the same time.
* Fixed import paths
* Added away view
* Validate uniqueness of event attendees.
* Tweaked comment
* #5798 added correct date format and style for selected date in booker.
* UI improvements
* Enable possibility to add booking values via query params.
* Added functionality to update query params when user selects date/duration etc in booker
* First steps in adding e2e test.
* Fixes after merge with main, and added new form builder.
* Implemented new form types and validation to booker, confirming new form builder. Validation still throwing wrong error keys though.
* Added search to timezone dropdown
* Added e2e test for booker (copy of current booker tests, only enabling cookie), plus fixed reschedule view.
* Updated yarn.lock
* Added new booker for team pages.
* Fixed input addon (hover) styles.
* Added dynamic booking.
* Hide timeformat select for multi day view for now.
* Cleanup and ui tweaks
* removed log
* Mobile improvements
* Cleanup
* Small design tweaks after talking to ciaran.
* Text color and weight tweaks in booker
* Added rainbow gates to new booker.
* Added in default values which fixes form vallidation (???).
* Added empty defaults for name and email
* Added metadata
* Reset yarn.lock
* Fixed booker zod validation after change in main.
* Icon tweak
* Fixed timezone select styles after new classnames have been merged.
* Updated seat availability styles.
* Update yarn.lock
* Added explanation for alchemy key to .env.example
* Added tooltip to booker month/week/multiday toggle
* Fixed timezoneselect styles in booker after select updates.
* Updates bookingfields component by taking changes from current booker component
* Removed remaining booker todos
* Fix bookeventform
* Fix for recurring event meta
* Type fixes
* Typefixes
* Team event fixes
* Avoid hydration errors by only rendering date picker client side. Remove web3 gates since we dont offer them anymore. Prevent timeslot select from staying open when switching to a different month.
* Don't show calendar on mobile booker during booking.
* Always align booker buttons to bottom
* Don't show backend messages in error, rather show a helpful text like the current booker does as well.
* Do invisible next rewrite based on cookie from next.config.js (#7949)
* Do invisible next rewrite based on cookie from next.config.js
* Name embed link instead of bookerPath
* Rewrites only dynamic user pages
---------
Co-authored-by: zomars <zomars@me.com>
* Don't allow change of timezone when bookerform is visible
* Don't add duration to query param if the event is not a multi duration event.
* Update next.config.js
* Added correct timezone formatting to event meta when timeslot is selected.
* removed .env variable that isn't needed anymore.
* Update Gates.tsx
* Type fixes
* Allows to run all tests with the new booker
* Fixed timezone select styles after merge.
* Don't throw error when event doesn't have hosts, rather return no users, which will result in no availability in UI.
* Make booker errors of severity info instead of warning.
* Ensure team avatars are shown, as well as filter on uniqueness of avatars.
* Added all booked today message to timeslots.
* Added cal.com logo to booker.
* Fixed fragment classname error, minor mobile animation tweaks plus make all booked today text smaller for multi day layout.
* Improved timezone select styles, and updated arguments of getbooking function after updates in main.
* Prevent infinite loop in rewriting new booker.
* Prevent infinite loop in rewriting new booker.
* Moved new-booker pages to their own directory to prevent regexes confusing next and thus nut running getserversideprops after rewrite. Also adding clearing of old date in booker store, that could stick around when user immediately navigates back to the same page after booking.
* Fixed cal logo color in darkmode for new booker.
* Implemented new color tokens and theme variables. Also small design tweaks after merge with main.
* Minor style tweaks
* Show multiple locations in tooltip on booker #8222
* Radio button style tweaks
* Fixed build
* Updated calendar imports to new lucide names
* Removed resetting of selected times logic, because otherwise url params wouldnt be taken into account which is actually what we want. So old values sticking around when navigating back is actually the desired behavior.
* Updated tests to instead of always run the new booker in tests, have a utility to run both the new and old booker for specified tests.
* Added comment and eslint disable for if statement in booker test.
* Update packages/features/bookings/components/event-meta/Details.tsx
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* Fix badge types
* Lazy loaded timezone select to save 85kb in bundle size.
* Upgraded framer to latest. Als moved framer and react sticky deps to features instead of atoms.
* Added new pagewrapper logic
* Simplified rescheduling ssr fetches, this now also supports multi seat rescheduling.
* Unset selected time when user is rescheduling directly after a new booking, otherwise it would show the form instead of new time selection.
* Updated form builder logic as per form builder in current booker.
* Updated form builder prefill logic as per logic in current booker.
* Updated getbooking function to fetch correct details when a reschedule uid is used
* Fixed booking questions test by NOT waiting for /book page because the new booker doesnt have this.
* Added former meeting time to reschedule view.
* Fixed types
* Undo playwright config update by mistake.
* Fixed event types test by only waiting for /book page in old booker
* Set new booker cookie to one year in the future instead of 2050
* added reset mockdate to test
* Temporary disabled test to see if this solves the out of memory error.
* Deleted test to see if that fixes the memory error
* Select first day when switching months in booker
---------
Co-authored-by: zomars <zomars@me.com>
Co-authored-by: Alex van Andel <me@alexvanandel.com>
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
Co-authored-by: Sean Brydon <sean@cal.com>
Co-authored-by: Peer Richelsen <peeroke@gmail.com>
2023-04-24 14:32:30 +00:00
|
|
|
import { testBothBookers } from "./lib/new-booker";
|
2023-03-14 04:19:05 +00:00
|
|
|
import {
|
|
|
|
bookTimeSlot,
|
|
|
|
createNewSeatedEventType,
|
|
|
|
selectFirstAvailableTimeSlotNextMonth,
|
|
|
|
} from "./lib/testUtils";
|
|
|
|
|
|
|
|
test.afterEach(({ users }) => users.deleteAll());
|
|
|
|
|
|
|
|
async function createUserWithSeatedEvent(users: Fixtures["users"]) {
|
|
|
|
const slug = "seats";
|
|
|
|
const user = await users.create({
|
|
|
|
eventTypes: [
|
|
|
|
{ title: "Seated event", slug, seatsPerTimeSlot: 10, requiresConfirmation: true, length: 30 },
|
|
|
|
],
|
|
|
|
});
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
|
|
const eventType = user.eventTypes.find((e) => e.slug === slug)!;
|
|
|
|
return { user, eventType };
|
|
|
|
}
|
|
|
|
|
|
|
|
async function createUserWithSeatedEventAndAttendees(
|
|
|
|
fixtures: Pick<Fixtures, "users" | "bookings">,
|
|
|
|
attendees: Prisma.AttendeeCreateManyBookingInput[]
|
|
|
|
) {
|
|
|
|
const { user, eventType } = await createUserWithSeatedEvent(fixtures.users);
|
|
|
|
const booking = await fixtures.bookings.create(user.id, user.username, eventType.id, {
|
|
|
|
status: BookingStatus.ACCEPTED,
|
|
|
|
// startTime with 1 day from now and endTime half hour after
|
|
|
|
startTime: new Date(Date.now() + 24 * 60 * 60 * 1000),
|
|
|
|
endTime: new Date(Date.now() + 24 * 60 * 60 * 1000 + 30 * 60 * 1000),
|
|
|
|
attendees: {
|
|
|
|
createMany: {
|
|
|
|
data: attendees,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|
|
|
|
return { user, eventType, booking };
|
|
|
|
}
|
|
|
|
|
New Booker Component (preparations for booker atom) (#6792)
* Wip on booker atom
* Wip on booker atom
* Added correct icon imports
* Fixed build
* Responsive improvements
* Removed package lock
* Responsive tweaks
* Animation improvements and cleanup
* Animation improvements and event meta layout improvements.
* Tweaked margins.
* Added more event meta blocks
* Layout tweaks
* Converted booker layout to css grid and implemented multiple layout options
* cleanup
* Fixed build
* Fixed build
* Added temporary api route to enable/disable new booker
* Added sticky behavior
* Reverted yarn.lock and reinstalled new packages to see if this fixes build on vercel.
* Ensure divider lines always have 100% height.
* Improved animation config + initial load
* Ensure to pass eventid to getschedule, otherwise custom availability schedule wont work and wont return any availability
* Fixed divider line heights in booker
* Fixed timezone select positioning
* Added ability to view multiple days of timeslots
* Added icons to booker toggle
* Always show timeslots in timeslots view, also if no date is selected yet. In that case we show upcoming 5 days.
* Fixed timeslots in small calendar view
* Show selected day in calendar
* Fixed booker timeslots view
* Wip in making booking form work
* Moved most of the booker atom stuff to features, since it belongs there. Atom should be a rather small wrapper.
* Added create event functionality to booker form.
* Added guests toggle to booker form and styled input addons in dark mode.
* Added dynamic weekstart to booker
* Added seats limit feature to timeslots.
* Removed todo
* Added correct event avatars
* Added correct event name and icons
* Added correct translation for minutes text in multi duration
* Add rescheduling functionality to new booker.
* Added selected booking time to booking meta in sidebar.
* Abstracted away timeformat to custom hook
* Added correct key props to all components in booker.
* Fix build
* Create some new custom hooks to have a lot less repitition in code.
* Moved bookerform component inside booker directory since it is tied to it.
* Added error messages to booker form, plus fixed bug in recurring events.
* Added some comments <3
* Fixed todos in booker form.
* Added loading state for timeslot selector, and added prefetching of next month, in case of multi day view showing 2 months at the same time.
* Fixed import paths
* Added away view
* Validate uniqueness of event attendees.
* Tweaked comment
* #5798 added correct date format and style for selected date in booker.
* UI improvements
* Enable possibility to add booking values via query params.
* Added functionality to update query params when user selects date/duration etc in booker
* First steps in adding e2e test.
* Fixes after merge with main, and added new form builder.
* Implemented new form types and validation to booker, confirming new form builder. Validation still throwing wrong error keys though.
* Added search to timezone dropdown
* Added e2e test for booker (copy of current booker tests, only enabling cookie), plus fixed reschedule view.
* Updated yarn.lock
* Added new booker for team pages.
* Fixed input addon (hover) styles.
* Added dynamic booking.
* Hide timeformat select for multi day view for now.
* Cleanup and ui tweaks
* removed log
* Mobile improvements
* Cleanup
* Small design tweaks after talking to ciaran.
* Text color and weight tweaks in booker
* Added rainbow gates to new booker.
* Added in default values which fixes form vallidation (???).
* Added empty defaults for name and email
* Added metadata
* Reset yarn.lock
* Fixed booker zod validation after change in main.
* Icon tweak
* Fixed timezone select styles after new classnames have been merged.
* Updated seat availability styles.
* Update yarn.lock
* Added explanation for alchemy key to .env.example
* Added tooltip to booker month/week/multiday toggle
* Fixed timezoneselect styles in booker after select updates.
* Updates bookingfields component by taking changes from current booker component
* Removed remaining booker todos
* Fix bookeventform
* Fix for recurring event meta
* Type fixes
* Typefixes
* Team event fixes
* Avoid hydration errors by only rendering date picker client side. Remove web3 gates since we dont offer them anymore. Prevent timeslot select from staying open when switching to a different month.
* Don't show calendar on mobile booker during booking.
* Always align booker buttons to bottom
* Don't show backend messages in error, rather show a helpful text like the current booker does as well.
* Do invisible next rewrite based on cookie from next.config.js (#7949)
* Do invisible next rewrite based on cookie from next.config.js
* Name embed link instead of bookerPath
* Rewrites only dynamic user pages
---------
Co-authored-by: zomars <zomars@me.com>
* Don't allow change of timezone when bookerform is visible
* Don't add duration to query param if the event is not a multi duration event.
* Update next.config.js
* Added correct timezone formatting to event meta when timeslot is selected.
* removed .env variable that isn't needed anymore.
* Update Gates.tsx
* Type fixes
* Allows to run all tests with the new booker
* Fixed timezone select styles after merge.
* Don't throw error when event doesn't have hosts, rather return no users, which will result in no availability in UI.
* Make booker errors of severity info instead of warning.
* Ensure team avatars are shown, as well as filter on uniqueness of avatars.
* Added all booked today message to timeslots.
* Added cal.com logo to booker.
* Fixed fragment classname error, minor mobile animation tweaks plus make all booked today text smaller for multi day layout.
* Improved timezone select styles, and updated arguments of getbooking function after updates in main.
* Prevent infinite loop in rewriting new booker.
* Prevent infinite loop in rewriting new booker.
* Moved new-booker pages to their own directory to prevent regexes confusing next and thus nut running getserversideprops after rewrite. Also adding clearing of old date in booker store, that could stick around when user immediately navigates back to the same page after booking.
* Fixed cal logo color in darkmode for new booker.
* Implemented new color tokens and theme variables. Also small design tweaks after merge with main.
* Minor style tweaks
* Show multiple locations in tooltip on booker #8222
* Radio button style tweaks
* Fixed build
* Updated calendar imports to new lucide names
* Removed resetting of selected times logic, because otherwise url params wouldnt be taken into account which is actually what we want. So old values sticking around when navigating back is actually the desired behavior.
* Updated tests to instead of always run the new booker in tests, have a utility to run both the new and old booker for specified tests.
* Added comment and eslint disable for if statement in booker test.
* Update packages/features/bookings/components/event-meta/Details.tsx
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* Fix badge types
* Lazy loaded timezone select to save 85kb in bundle size.
* Upgraded framer to latest. Als moved framer and react sticky deps to features instead of atoms.
* Added new pagewrapper logic
* Simplified rescheduling ssr fetches, this now also supports multi seat rescheduling.
* Unset selected time when user is rescheduling directly after a new booking, otherwise it would show the form instead of new time selection.
* Updated form builder logic as per form builder in current booker.
* Updated form builder prefill logic as per logic in current booker.
* Updated getbooking function to fetch correct details when a reschedule uid is used
* Fixed booking questions test by NOT waiting for /book page because the new booker doesnt have this.
* Added former meeting time to reschedule view.
* Fixed types
* Undo playwright config update by mistake.
* Fixed event types test by only waiting for /book page in old booker
* Set new booker cookie to one year in the future instead of 2050
* added reset mockdate to test
* Temporary disabled test to see if this solves the out of memory error.
* Deleted test to see if that fixes the memory error
* Select first day when switching months in booker
---------
Co-authored-by: zomars <zomars@me.com>
Co-authored-by: Alex van Andel <me@alexvanandel.com>
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
Co-authored-by: Sean Brydon <sean@cal.com>
Co-authored-by: Peer Richelsen <peeroke@gmail.com>
2023-04-24 14:32:30 +00:00
|
|
|
testBothBookers.describe("Booking with Seats", (bookerVariant) => {
|
2023-03-14 04:19:05 +00:00
|
|
|
test("User can create a seated event (2 seats as example)", async ({ users, page }) => {
|
|
|
|
const user = await users.create({ name: "Seated event" });
|
|
|
|
await user.login();
|
|
|
|
const eventTitle = "My 2-seated event";
|
|
|
|
await createNewSeatedEventType(page, { eventTitle });
|
|
|
|
await expect(page.locator(`text=${eventTitle} event type updated successfully`)).toBeVisible();
|
|
|
|
});
|
|
|
|
test("Multiple Attendees can book a seated event time slot", async ({ users, page }) => {
|
|
|
|
const slug = "my-2-seated-event";
|
|
|
|
const user = await users.create({
|
|
|
|
name: "Seated event user",
|
|
|
|
eventTypes: [
|
|
|
|
{ title: "My 2-seated event", slug, length: 60, seatsPerTimeSlot: 2, seatsShowAttendees: true },
|
|
|
|
],
|
|
|
|
});
|
|
|
|
await page.goto(`/${user.username}/${slug}`);
|
|
|
|
await selectFirstAvailableTimeSlotNextMonth(page);
|
New Booker Component (preparations for booker atom) (#6792)
* Wip on booker atom
* Wip on booker atom
* Added correct icon imports
* Fixed build
* Responsive improvements
* Removed package lock
* Responsive tweaks
* Animation improvements and cleanup
* Animation improvements and event meta layout improvements.
* Tweaked margins.
* Added more event meta blocks
* Layout tweaks
* Converted booker layout to css grid and implemented multiple layout options
* cleanup
* Fixed build
* Fixed build
* Added temporary api route to enable/disable new booker
* Added sticky behavior
* Reverted yarn.lock and reinstalled new packages to see if this fixes build on vercel.
* Ensure divider lines always have 100% height.
* Improved animation config + initial load
* Ensure to pass eventid to getschedule, otherwise custom availability schedule wont work and wont return any availability
* Fixed divider line heights in booker
* Fixed timezone select positioning
* Added ability to view multiple days of timeslots
* Added icons to booker toggle
* Always show timeslots in timeslots view, also if no date is selected yet. In that case we show upcoming 5 days.
* Fixed timeslots in small calendar view
* Show selected day in calendar
* Fixed booker timeslots view
* Wip in making booking form work
* Moved most of the booker atom stuff to features, since it belongs there. Atom should be a rather small wrapper.
* Added create event functionality to booker form.
* Added guests toggle to booker form and styled input addons in dark mode.
* Added dynamic weekstart to booker
* Added seats limit feature to timeslots.
* Removed todo
* Added correct event avatars
* Added correct event name and icons
* Added correct translation for minutes text in multi duration
* Add rescheduling functionality to new booker.
* Added selected booking time to booking meta in sidebar.
* Abstracted away timeformat to custom hook
* Added correct key props to all components in booker.
* Fix build
* Create some new custom hooks to have a lot less repitition in code.
* Moved bookerform component inside booker directory since it is tied to it.
* Added error messages to booker form, plus fixed bug in recurring events.
* Added some comments <3
* Fixed todos in booker form.
* Added loading state for timeslot selector, and added prefetching of next month, in case of multi day view showing 2 months at the same time.
* Fixed import paths
* Added away view
* Validate uniqueness of event attendees.
* Tweaked comment
* #5798 added correct date format and style for selected date in booker.
* UI improvements
* Enable possibility to add booking values via query params.
* Added functionality to update query params when user selects date/duration etc in booker
* First steps in adding e2e test.
* Fixes after merge with main, and added new form builder.
* Implemented new form types and validation to booker, confirming new form builder. Validation still throwing wrong error keys though.
* Added search to timezone dropdown
* Added e2e test for booker (copy of current booker tests, only enabling cookie), plus fixed reschedule view.
* Updated yarn.lock
* Added new booker for team pages.
* Fixed input addon (hover) styles.
* Added dynamic booking.
* Hide timeformat select for multi day view for now.
* Cleanup and ui tweaks
* removed log
* Mobile improvements
* Cleanup
* Small design tweaks after talking to ciaran.
* Text color and weight tweaks in booker
* Added rainbow gates to new booker.
* Added in default values which fixes form vallidation (???).
* Added empty defaults for name and email
* Added metadata
* Reset yarn.lock
* Fixed booker zod validation after change in main.
* Icon tweak
* Fixed timezone select styles after new classnames have been merged.
* Updated seat availability styles.
* Update yarn.lock
* Added explanation for alchemy key to .env.example
* Added tooltip to booker month/week/multiday toggle
* Fixed timezoneselect styles in booker after select updates.
* Updates bookingfields component by taking changes from current booker component
* Removed remaining booker todos
* Fix bookeventform
* Fix for recurring event meta
* Type fixes
* Typefixes
* Team event fixes
* Avoid hydration errors by only rendering date picker client side. Remove web3 gates since we dont offer them anymore. Prevent timeslot select from staying open when switching to a different month.
* Don't show calendar on mobile booker during booking.
* Always align booker buttons to bottom
* Don't show backend messages in error, rather show a helpful text like the current booker does as well.
* Do invisible next rewrite based on cookie from next.config.js (#7949)
* Do invisible next rewrite based on cookie from next.config.js
* Name embed link instead of bookerPath
* Rewrites only dynamic user pages
---------
Co-authored-by: zomars <zomars@me.com>
* Don't allow change of timezone when bookerform is visible
* Don't add duration to query param if the event is not a multi duration event.
* Update next.config.js
* Added correct timezone formatting to event meta when timeslot is selected.
* removed .env variable that isn't needed anymore.
* Update Gates.tsx
* Type fixes
* Allows to run all tests with the new booker
* Fixed timezone select styles after merge.
* Don't throw error when event doesn't have hosts, rather return no users, which will result in no availability in UI.
* Make booker errors of severity info instead of warning.
* Ensure team avatars are shown, as well as filter on uniqueness of avatars.
* Added all booked today message to timeslots.
* Added cal.com logo to booker.
* Fixed fragment classname error, minor mobile animation tweaks plus make all booked today text smaller for multi day layout.
* Improved timezone select styles, and updated arguments of getbooking function after updates in main.
* Prevent infinite loop in rewriting new booker.
* Prevent infinite loop in rewriting new booker.
* Moved new-booker pages to their own directory to prevent regexes confusing next and thus nut running getserversideprops after rewrite. Also adding clearing of old date in booker store, that could stick around when user immediately navigates back to the same page after booking.
* Fixed cal logo color in darkmode for new booker.
* Implemented new color tokens and theme variables. Also small design tweaks after merge with main.
* Minor style tweaks
* Show multiple locations in tooltip on booker #8222
* Radio button style tweaks
* Fixed build
* Updated calendar imports to new lucide names
* Removed resetting of selected times logic, because otherwise url params wouldnt be taken into account which is actually what we want. So old values sticking around when navigating back is actually the desired behavior.
* Updated tests to instead of always run the new booker in tests, have a utility to run both the new and old booker for specified tests.
* Added comment and eslint disable for if statement in booker test.
* Update packages/features/bookings/components/event-meta/Details.tsx
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* Fix badge types
* Lazy loaded timezone select to save 85kb in bundle size.
* Upgraded framer to latest. Als moved framer and react sticky deps to features instead of atoms.
* Added new pagewrapper logic
* Simplified rescheduling ssr fetches, this now also supports multi seat rescheduling.
* Unset selected time when user is rescheduling directly after a new booking, otherwise it would show the form instead of new time selection.
* Updated form builder logic as per form builder in current booker.
* Updated form builder prefill logic as per logic in current booker.
* Updated getbooking function to fetch correct details when a reschedule uid is used
* Fixed booking questions test by NOT waiting for /book page because the new booker doesnt have this.
* Added former meeting time to reschedule view.
* Fixed types
* Undo playwright config update by mistake.
* Fixed event types test by only waiting for /book page in old booker
* Set new booker cookie to one year in the future instead of 2050
* added reset mockdate to test
* Temporary disabled test to see if this solves the out of memory error.
* Deleted test to see if that fixes the memory error
* Select first day when switching months in booker
---------
Co-authored-by: zomars <zomars@me.com>
Co-authored-by: Alex van Andel <me@alexvanandel.com>
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
Co-authored-by: Sean Brydon <sean@cal.com>
Co-authored-by: Peer Richelsen <peeroke@gmail.com>
2023-04-24 14:32:30 +00:00
|
|
|
|
|
|
|
// Kept in if statement here, since it's only temporary
|
|
|
|
// until the old booker isn't used anymore, and I wanted
|
|
|
|
// to change the test as little as possible.
|
|
|
|
// eslint-disable-next-line playwright/no-conditional-in-test
|
|
|
|
if (bookerVariant === "old-booker") {
|
|
|
|
await page.waitForNavigation({
|
|
|
|
url(url) {
|
|
|
|
return url.pathname.endsWith("/book");
|
|
|
|
},
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2023-03-14 04:19:05 +00:00
|
|
|
const bookingUrl = page.url();
|
|
|
|
await test.step("Attendee #1 can book a seated event time slot", async () => {
|
|
|
|
await page.goto(bookingUrl);
|
|
|
|
await bookTimeSlot(page);
|
|
|
|
await expect(page.locator("[data-testid=success-page]")).toBeVisible();
|
|
|
|
});
|
|
|
|
await test.step("Attendee #2 can book the same seated event time slot", async () => {
|
|
|
|
await page.goto(bookingUrl);
|
|
|
|
await bookTimeSlot(page, { email: "jane.doe@example.com", name: "Jane Doe" });
|
|
|
|
await expect(page.locator("[data-testid=success-page]")).toBeVisible();
|
|
|
|
});
|
|
|
|
await test.step("Attendee #3 cannot book the same seated event time slot", async () => {
|
|
|
|
await page.goto(bookingUrl);
|
|
|
|
await bookTimeSlot(page, { email: "rick@example.com", name: "Rick" });
|
|
|
|
await expect(page.locator("[data-testid=success-page]")).toBeHidden();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
// TODO: Make E2E test: Attendee #1 should be able to cancel his booking
|
|
|
|
// todo("Attendee #1 should be able to cancel his booking");
|
|
|
|
// TODO: Make E2E test: Attendee #1 should be able to reschedule his booking
|
|
|
|
// todo("Attendee #1 should be able to reschedule his booking");
|
|
|
|
// TODO: Make E2E test: All attendees canceling should delete the booking for the User
|
|
|
|
// todo("All attendees canceling should delete the booking for the User");
|
|
|
|
|
New Booker Component (preparations for booker atom) (#6792)
* Wip on booker atom
* Wip on booker atom
* Added correct icon imports
* Fixed build
* Responsive improvements
* Removed package lock
* Responsive tweaks
* Animation improvements and cleanup
* Animation improvements and event meta layout improvements.
* Tweaked margins.
* Added more event meta blocks
* Layout tweaks
* Converted booker layout to css grid and implemented multiple layout options
* cleanup
* Fixed build
* Fixed build
* Added temporary api route to enable/disable new booker
* Added sticky behavior
* Reverted yarn.lock and reinstalled new packages to see if this fixes build on vercel.
* Ensure divider lines always have 100% height.
* Improved animation config + initial load
* Ensure to pass eventid to getschedule, otherwise custom availability schedule wont work and wont return any availability
* Fixed divider line heights in booker
* Fixed timezone select positioning
* Added ability to view multiple days of timeslots
* Added icons to booker toggle
* Always show timeslots in timeslots view, also if no date is selected yet. In that case we show upcoming 5 days.
* Fixed timeslots in small calendar view
* Show selected day in calendar
* Fixed booker timeslots view
* Wip in making booking form work
* Moved most of the booker atom stuff to features, since it belongs there. Atom should be a rather small wrapper.
* Added create event functionality to booker form.
* Added guests toggle to booker form and styled input addons in dark mode.
* Added dynamic weekstart to booker
* Added seats limit feature to timeslots.
* Removed todo
* Added correct event avatars
* Added correct event name and icons
* Added correct translation for minutes text in multi duration
* Add rescheduling functionality to new booker.
* Added selected booking time to booking meta in sidebar.
* Abstracted away timeformat to custom hook
* Added correct key props to all components in booker.
* Fix build
* Create some new custom hooks to have a lot less repitition in code.
* Moved bookerform component inside booker directory since it is tied to it.
* Added error messages to booker form, plus fixed bug in recurring events.
* Added some comments <3
* Fixed todos in booker form.
* Added loading state for timeslot selector, and added prefetching of next month, in case of multi day view showing 2 months at the same time.
* Fixed import paths
* Added away view
* Validate uniqueness of event attendees.
* Tweaked comment
* #5798 added correct date format and style for selected date in booker.
* UI improvements
* Enable possibility to add booking values via query params.
* Added functionality to update query params when user selects date/duration etc in booker
* First steps in adding e2e test.
* Fixes after merge with main, and added new form builder.
* Implemented new form types and validation to booker, confirming new form builder. Validation still throwing wrong error keys though.
* Added search to timezone dropdown
* Added e2e test for booker (copy of current booker tests, only enabling cookie), plus fixed reschedule view.
* Updated yarn.lock
* Added new booker for team pages.
* Fixed input addon (hover) styles.
* Added dynamic booking.
* Hide timeformat select for multi day view for now.
* Cleanup and ui tweaks
* removed log
* Mobile improvements
* Cleanup
* Small design tweaks after talking to ciaran.
* Text color and weight tweaks in booker
* Added rainbow gates to new booker.
* Added in default values which fixes form vallidation (???).
* Added empty defaults for name and email
* Added metadata
* Reset yarn.lock
* Fixed booker zod validation after change in main.
* Icon tweak
* Fixed timezone select styles after new classnames have been merged.
* Updated seat availability styles.
* Update yarn.lock
* Added explanation for alchemy key to .env.example
* Added tooltip to booker month/week/multiday toggle
* Fixed timezoneselect styles in booker after select updates.
* Updates bookingfields component by taking changes from current booker component
* Removed remaining booker todos
* Fix bookeventform
* Fix for recurring event meta
* Type fixes
* Typefixes
* Team event fixes
* Avoid hydration errors by only rendering date picker client side. Remove web3 gates since we dont offer them anymore. Prevent timeslot select from staying open when switching to a different month.
* Don't show calendar on mobile booker during booking.
* Always align booker buttons to bottom
* Don't show backend messages in error, rather show a helpful text like the current booker does as well.
* Do invisible next rewrite based on cookie from next.config.js (#7949)
* Do invisible next rewrite based on cookie from next.config.js
* Name embed link instead of bookerPath
* Rewrites only dynamic user pages
---------
Co-authored-by: zomars <zomars@me.com>
* Don't allow change of timezone when bookerform is visible
* Don't add duration to query param if the event is not a multi duration event.
* Update next.config.js
* Added correct timezone formatting to event meta when timeslot is selected.
* removed .env variable that isn't needed anymore.
* Update Gates.tsx
* Type fixes
* Allows to run all tests with the new booker
* Fixed timezone select styles after merge.
* Don't throw error when event doesn't have hosts, rather return no users, which will result in no availability in UI.
* Make booker errors of severity info instead of warning.
* Ensure team avatars are shown, as well as filter on uniqueness of avatars.
* Added all booked today message to timeslots.
* Added cal.com logo to booker.
* Fixed fragment classname error, minor mobile animation tweaks plus make all booked today text smaller for multi day layout.
* Improved timezone select styles, and updated arguments of getbooking function after updates in main.
* Prevent infinite loop in rewriting new booker.
* Prevent infinite loop in rewriting new booker.
* Moved new-booker pages to their own directory to prevent regexes confusing next and thus nut running getserversideprops after rewrite. Also adding clearing of old date in booker store, that could stick around when user immediately navigates back to the same page after booking.
* Fixed cal logo color in darkmode for new booker.
* Implemented new color tokens and theme variables. Also small design tweaks after merge with main.
* Minor style tweaks
* Show multiple locations in tooltip on booker #8222
* Radio button style tweaks
* Fixed build
* Updated calendar imports to new lucide names
* Removed resetting of selected times logic, because otherwise url params wouldnt be taken into account which is actually what we want. So old values sticking around when navigating back is actually the desired behavior.
* Updated tests to instead of always run the new booker in tests, have a utility to run both the new and old booker for specified tests.
* Added comment and eslint disable for if statement in booker test.
* Update packages/features/bookings/components/event-meta/Details.tsx
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* Fix badge types
* Lazy loaded timezone select to save 85kb in bundle size.
* Upgraded framer to latest. Als moved framer and react sticky deps to features instead of atoms.
* Added new pagewrapper logic
* Simplified rescheduling ssr fetches, this now also supports multi seat rescheduling.
* Unset selected time when user is rescheduling directly after a new booking, otherwise it would show the form instead of new time selection.
* Updated form builder logic as per form builder in current booker.
* Updated form builder prefill logic as per logic in current booker.
* Updated getbooking function to fetch correct details when a reschedule uid is used
* Fixed booking questions test by NOT waiting for /book page because the new booker doesnt have this.
* Added former meeting time to reschedule view.
* Fixed types
* Undo playwright config update by mistake.
* Fixed event types test by only waiting for /book page in old booker
* Set new booker cookie to one year in the future instead of 2050
* added reset mockdate to test
* Temporary disabled test to see if this solves the out of memory error.
* Deleted test to see if that fixes the memory error
* Select first day when switching months in booker
---------
Co-authored-by: zomars <zomars@me.com>
Co-authored-by: Alex van Andel <me@alexvanandel.com>
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
Co-authored-by: Sean Brydon <sean@cal.com>
Co-authored-by: Peer Richelsen <peeroke@gmail.com>
2023-04-24 14:32:30 +00:00
|
|
|
testBothBookers.describe("Reschedule for booking with seats", () => {
|
2023-03-14 04:19:05 +00:00
|
|
|
test("Should reschedule booking with seats", async ({ page, users, bookings }) => {
|
|
|
|
const { booking } = await createUserWithSeatedEventAndAttendees({ users, bookings }, [
|
|
|
|
{ name: "John First", email: "first+seats@cal.com", timeZone: "Europe/Berlin" },
|
|
|
|
{ name: "Jane Second", email: "second+seats@cal.com", timeZone: "Europe/Berlin" },
|
|
|
|
{ name: "John Third", email: "third+seats@cal.com", timeZone: "Europe/Berlin" },
|
|
|
|
]);
|
|
|
|
const bookingAttendees = await prisma.attendee.findMany({
|
|
|
|
where: { bookingId: booking.id },
|
|
|
|
select: {
|
|
|
|
id: true,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
const bookingSeats = [
|
|
|
|
{ bookingId: booking.id, attendeeId: bookingAttendees[0].id, referenceUid: uuidv4() },
|
|
|
|
{ bookingId: booking.id, attendeeId: bookingAttendees[1].id, referenceUid: uuidv4() },
|
|
|
|
{ bookingId: booking.id, attendeeId: bookingAttendees[2].id, referenceUid: uuidv4() },
|
|
|
|
];
|
|
|
|
|
|
|
|
await prisma.bookingSeat.createMany({
|
|
|
|
data: bookingSeats,
|
|
|
|
});
|
|
|
|
|
|
|
|
const references = await prisma.bookingSeat.findMany({
|
|
|
|
where: { bookingId: booking.id },
|
|
|
|
});
|
|
|
|
|
|
|
|
await page.goto(`/reschedule/${references[2].referenceUid}`);
|
|
|
|
|
|
|
|
await selectFirstAvailableTimeSlotNextMonth(page);
|
|
|
|
|
|
|
|
// expect input to be filled with attendee number 3 data
|
|
|
|
const thirdAttendeeElement = await page.locator("input[name=name]");
|
|
|
|
const attendeeName = await thirdAttendeeElement.inputValue();
|
|
|
|
expect(attendeeName).toBe("John Third");
|
|
|
|
|
|
|
|
await page.locator('[data-testid="confirm-reschedule-button"]').click();
|
|
|
|
|
|
|
|
await page.waitForLoadState("networkidle");
|
|
|
|
|
|
|
|
await expect(page).toHaveURL(/.*booking/);
|
|
|
|
|
|
|
|
// Should expect old booking to be accepted with two attendees
|
|
|
|
const oldBooking = await prisma.booking.findFirst({
|
|
|
|
where: { uid: booking.uid },
|
|
|
|
include: { seatsReferences: true, attendees: true },
|
|
|
|
});
|
|
|
|
|
|
|
|
expect(oldBooking?.status).toBe(BookingStatus.ACCEPTED);
|
|
|
|
expect(oldBooking?.attendees.length).toBe(2);
|
|
|
|
expect(oldBooking?.seatsReferences.length).toBe(2);
|
|
|
|
});
|
|
|
|
|
|
|
|
test("Should reschedule booking with seats and if everyone rescheduled it should be deleted", async ({
|
|
|
|
page,
|
|
|
|
users,
|
|
|
|
bookings,
|
|
|
|
}) => {
|
|
|
|
const { booking } = await createUserWithSeatedEventAndAttendees({ users, bookings }, [
|
|
|
|
{ name: "John First", email: "first+seats@cal.com", timeZone: "Europe/Berlin" },
|
|
|
|
{ name: "Jane Second", email: "second+seats@cal.com", timeZone: "Europe/Berlin" },
|
|
|
|
]);
|
|
|
|
|
|
|
|
const bookingAttendees = await prisma.attendee.findMany({
|
|
|
|
where: { bookingId: booking.id },
|
|
|
|
select: {
|
|
|
|
id: true,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
const bookingSeats = [
|
|
|
|
{ bookingId: booking.id, attendeeId: bookingAttendees[0].id, referenceUid: uuidv4() },
|
|
|
|
{ bookingId: booking.id, attendeeId: bookingAttendees[1].id, referenceUid: uuidv4() },
|
|
|
|
];
|
|
|
|
|
|
|
|
await prisma.bookingSeat.createMany({
|
|
|
|
data: bookingSeats,
|
|
|
|
});
|
|
|
|
|
|
|
|
const references = await prisma.bookingSeat.findMany({
|
|
|
|
where: { bookingId: booking.id },
|
|
|
|
});
|
|
|
|
|
|
|
|
await page.goto(`/reschedule/${references[0].referenceUid}`);
|
|
|
|
|
|
|
|
await selectFirstAvailableTimeSlotNextMonth(page);
|
|
|
|
|
|
|
|
await page.locator('[data-testid="confirm-reschedule-button"]').click();
|
|
|
|
|
|
|
|
await page.waitForNavigation({ url: /.*booking/ });
|
|
|
|
|
|
|
|
await page.goto(`/reschedule/${references[1].referenceUid}`);
|
|
|
|
|
|
|
|
await selectFirstAvailableTimeSlotNextMonth(page);
|
|
|
|
|
|
|
|
await page.locator('[data-testid="confirm-reschedule-button"]').click();
|
|
|
|
|
|
|
|
await page.waitForNavigation({ url: /.*booking/ });
|
|
|
|
|
|
|
|
// Should expect old booking to be cancelled
|
|
|
|
const oldBooking = await prisma.booking.findFirst({
|
|
|
|
where: { uid: booking.uid },
|
|
|
|
include: {
|
|
|
|
seatsReferences: true,
|
|
|
|
attendees: true,
|
|
|
|
eventType: {
|
|
|
|
include: { users: true, hosts: true },
|
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
2023-04-02 10:09:57 +00:00
|
|
|
expect(oldBooking?.status).toBe(BookingStatus.CANCELLED);
|
2023-03-14 04:19:05 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
test("Should cancel with seats and have no attendees and cancelled", async ({
|
|
|
|
page,
|
|
|
|
users,
|
|
|
|
bookings,
|
|
|
|
}) => {
|
|
|
|
const { user, booking } = await createUserWithSeatedEventAndAttendees({ users, bookings }, [
|
|
|
|
{ name: "John First", email: "first+seats@cal.com", timeZone: "Europe/Berlin" },
|
|
|
|
{ name: "Jane Second", email: "second+seats@cal.com", timeZone: "Europe/Berlin" },
|
|
|
|
]);
|
|
|
|
await user.login();
|
|
|
|
|
|
|
|
const oldBooking = await prisma.booking.findFirst({
|
|
|
|
where: { uid: booking.uid },
|
|
|
|
include: { seatsReferences: true, attendees: true },
|
|
|
|
});
|
|
|
|
|
|
|
|
const bookingAttendees = await prisma.attendee.findMany({
|
|
|
|
where: { bookingId: booking.id },
|
|
|
|
select: {
|
|
|
|
id: true,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
const bookingSeats = [
|
|
|
|
{ bookingId: booking.id, attendeeId: bookingAttendees[0].id, referenceUid: uuidv4() },
|
|
|
|
{ bookingId: booking.id, attendeeId: bookingAttendees[1].id, referenceUid: uuidv4() },
|
|
|
|
];
|
|
|
|
|
|
|
|
await prisma.bookingSeat.createMany({
|
|
|
|
data: bookingSeats,
|
|
|
|
});
|
|
|
|
|
|
|
|
// Now we cancel the booking as the organizer
|
|
|
|
await page.goto(`/booking/${booking.uid}?cancel=true`);
|
|
|
|
|
|
|
|
await page.locator('[data-testid="cancel"]').click();
|
|
|
|
|
|
|
|
await page.waitForLoadState("networkidle");
|
|
|
|
|
|
|
|
await expect(page).toHaveURL(/.*booking/);
|
|
|
|
|
|
|
|
// Should expect old booking to be cancelled
|
|
|
|
const updatedBooking = await prisma.booking.findFirst({
|
|
|
|
where: { uid: booking.uid },
|
|
|
|
include: { seatsReferences: true, attendees: true },
|
|
|
|
});
|
|
|
|
|
|
|
|
expect(oldBooking?.startTime).not.toBe(updatedBooking?.startTime);
|
|
|
|
});
|
|
|
|
|
|
|
|
test("If rescheduled/cancelled booking with seats it should display the correct number of seats", async ({
|
|
|
|
page,
|
|
|
|
users,
|
|
|
|
bookings,
|
|
|
|
}) => {
|
|
|
|
const { booking } = await createUserWithSeatedEventAndAttendees({ users, bookings }, [
|
|
|
|
{ name: "John First", email: "first+seats@cal.com", timeZone: "Europe/Berlin" },
|
|
|
|
{ name: "Jane Second", email: "second+seats@cal.com", timeZone: "Europe/Berlin" },
|
|
|
|
]);
|
|
|
|
|
|
|
|
const bookingAttendees = await prisma.attendee.findMany({
|
|
|
|
where: { bookingId: booking.id },
|
|
|
|
select: {
|
|
|
|
id: true,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
const bookingSeats = [
|
|
|
|
{ bookingId: booking.id, attendeeId: bookingAttendees[0].id, referenceUid: uuidv4() },
|
|
|
|
{ bookingId: booking.id, attendeeId: bookingAttendees[1].id, referenceUid: uuidv4() },
|
|
|
|
];
|
|
|
|
|
|
|
|
await prisma.bookingSeat.createMany({
|
|
|
|
data: bookingSeats,
|
|
|
|
});
|
|
|
|
|
|
|
|
const references = await prisma.bookingSeat.findMany({
|
|
|
|
where: { bookingId: booking.id },
|
|
|
|
});
|
|
|
|
|
|
|
|
await page.goto(
|
|
|
|
`/booking/${references[0].referenceUid}?cancel=true&seatReferenceUid=${references[0].referenceUid}`
|
|
|
|
);
|
|
|
|
|
|
|
|
await page.locator('[data-testid="cancel"]').click();
|
|
|
|
|
|
|
|
const oldBooking = await prisma.booking.findFirst({
|
|
|
|
where: { uid: booking.uid },
|
|
|
|
select: {
|
|
|
|
id: true,
|
|
|
|
status: true,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
expect(oldBooking?.status).toBe(BookingStatus.ACCEPTED);
|
|
|
|
|
|
|
|
await page.goto(`/reschedule/${references[1].referenceUid}`);
|
|
|
|
|
|
|
|
await page.click('[data-testid="incrementMonth"]');
|
|
|
|
|
|
|
|
await page.locator('[data-testid="day"][data-disabled="false"]').nth(1).click();
|
|
|
|
|
|
|
|
// Validate that the number of seats its 10
|
|
|
|
expect(await page.locator("text=9 / 10 Seats available").count()).toEqual(0);
|
|
|
|
});
|
2023-04-21 13:49:53 +00:00
|
|
|
|
|
|
|
test("Should cancel with seats but event should be still accesible and with one less attendee/seat", async ({
|
|
|
|
page,
|
|
|
|
users,
|
|
|
|
bookings,
|
|
|
|
}) => {
|
|
|
|
const { user, booking } = await createUserWithSeatedEventAndAttendees({ users, bookings }, [
|
|
|
|
{ name: "John First", email: "first+seats@cal.com", timeZone: "Europe/Berlin" },
|
|
|
|
{ name: "Jane Second", email: "second+seats@cal.com", timeZone: "Europe/Berlin" },
|
|
|
|
]);
|
|
|
|
await user.login();
|
|
|
|
|
|
|
|
const bookingAttendees = await prisma.attendee.findMany({
|
|
|
|
where: { bookingId: booking.id },
|
|
|
|
select: {
|
|
|
|
id: true,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
const bookingSeats = [
|
|
|
|
{ bookingId: booking.id, attendeeId: bookingAttendees[0].id, referenceUid: uuidv4() },
|
|
|
|
{ bookingId: booking.id, attendeeId: bookingAttendees[1].id, referenceUid: uuidv4() },
|
|
|
|
];
|
|
|
|
|
|
|
|
await prisma.bookingSeat.createMany({
|
|
|
|
data: bookingSeats,
|
|
|
|
});
|
|
|
|
|
|
|
|
// Now we cancel the booking as the first attendee
|
|
|
|
// booking/${bookingUid}?cancel=true&allRemainingBookings=false&seatReferenceUid={bookingSeat.referenceUid}
|
|
|
|
await page.goto(
|
|
|
|
`/booking/${booking.uid}?cancel=true&allRemainingBookings=false&seatReferenceUid=${bookingSeats[0].referenceUid}`
|
|
|
|
);
|
|
|
|
|
|
|
|
await page.locator('[data-testid="cancel"]').click();
|
|
|
|
|
|
|
|
await page.waitForLoadState("networkidle");
|
|
|
|
|
|
|
|
await expect(page).toHaveURL(/.*booking/);
|
|
|
|
|
|
|
|
await page.goto(
|
|
|
|
`/booking/${booking.uid}?cancel=true&allRemainingBookings=false&seatReferenceUid=${bookingSeats[1].referenceUid}`
|
|
|
|
);
|
|
|
|
|
|
|
|
// Page should not be 404
|
|
|
|
await page.locator('[data-testid="cancel"]').click();
|
|
|
|
|
|
|
|
await page.waitForLoadState("networkidle");
|
|
|
|
|
|
|
|
await expect(page).toHaveURL(/.*booking/);
|
|
|
|
});
|
|
|
|
|
|
|
|
test("Should book with seats and hide attendees info from showAttendees true", async ({
|
|
|
|
page,
|
|
|
|
users,
|
|
|
|
bookings,
|
|
|
|
}) => {
|
|
|
|
const { user, booking } = await createUserWithSeatedEventAndAttendees({ users, bookings }, [
|
|
|
|
{ name: "John First", email: "first+seats@cal.com", timeZone: "Europe/Berlin" },
|
|
|
|
{ name: "Jane Second", email: "second+seats@cal.com", timeZone: "Europe/Berlin" },
|
|
|
|
]);
|
|
|
|
await user.login();
|
|
|
|
const bookingWithEventType = await prisma.booking.findFirst({
|
|
|
|
where: { uid: booking.uid },
|
|
|
|
select: {
|
|
|
|
id: true,
|
|
|
|
eventTypeId: true,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
await prisma.eventType.update({
|
|
|
|
data: {
|
|
|
|
seatsShowAttendees: false,
|
|
|
|
},
|
|
|
|
where: {
|
|
|
|
id: bookingWithEventType?.eventTypeId || -1,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
const bookingAttendees = await prisma.attendee.findMany({
|
|
|
|
where: { bookingId: booking.id },
|
|
|
|
select: {
|
|
|
|
id: true,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
const bookingSeats = [
|
|
|
|
{ bookingId: booking.id, attendeeId: bookingAttendees[0].id, referenceUid: uuidv4() },
|
|
|
|
{ bookingId: booking.id, attendeeId: bookingAttendees[1].id, referenceUid: uuidv4() },
|
|
|
|
];
|
|
|
|
|
|
|
|
await prisma.bookingSeat.createMany({
|
|
|
|
data: bookingSeats,
|
|
|
|
});
|
|
|
|
|
|
|
|
// Go to cancel page and see that attendees are listed and myself as I'm owner of the booking
|
|
|
|
await page.goto(`/booking/${booking.uid}?cancel=true&allRemainingBookings=false`);
|
|
|
|
|
|
|
|
const foundFirstAttendeeAsOwner = await page.locator('p[data-testid="attendee-first+seats@cal.com"]');
|
|
|
|
await expect(foundFirstAttendeeAsOwner).toHaveCount(1);
|
|
|
|
const foundSecondAttendeeAsOwner = await page.locator('p[data-testid="attendee-second+seats@cal.com"]');
|
|
|
|
await expect(foundSecondAttendeeAsOwner).toHaveCount(1);
|
|
|
|
await page.pause();
|
|
|
|
await page.goto("auth/logout");
|
|
|
|
|
|
|
|
// Now we cancel the booking as the first attendee
|
|
|
|
// booking/${bookingUid}?cancel=true&allRemainingBookings=false&seatReferenceUid={bookingSeat.referenceUid}
|
|
|
|
await page.goto(
|
|
|
|
`/booking/${booking.uid}?cancel=true&allRemainingBookings=false&seatReferenceUid=${bookingSeats[0].referenceUid}`
|
|
|
|
);
|
|
|
|
|
|
|
|
// No attendees should be displayed only the one that it's cancelling
|
|
|
|
const notFoundSecondAttendee = await page.locator('p[data-testid="attendee-second+seats@cal.com"]');
|
|
|
|
|
|
|
|
await expect(notFoundSecondAttendee).toHaveCount(0);
|
|
|
|
const foundFirstAttendee = await page.locator('p[data-testid="attendee-first+seats@cal.com"]');
|
|
|
|
await expect(foundFirstAttendee).toHaveCount(1);
|
|
|
|
|
|
|
|
await prisma.eventType.update({
|
|
|
|
data: {
|
|
|
|
seatsShowAttendees: true,
|
|
|
|
},
|
|
|
|
where: {
|
|
|
|
id: bookingWithEventType?.eventTypeId || -1,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
await page.goto(
|
|
|
|
`/booking/${booking.uid}?cancel=true&allRemainingBookings=false&seatReferenceUid=${bookingSeats[1].referenceUid}`
|
|
|
|
);
|
|
|
|
|
|
|
|
// Now attendees should be displayed
|
|
|
|
const foundSecondAttendee = await page.locator('p[data-testid="attendee-second+seats@cal.com"]');
|
|
|
|
|
|
|
|
await expect(foundSecondAttendee).toHaveCount(1);
|
|
|
|
const foundFirstAttendeeAgain = await page
|
|
|
|
.locator('p[data-testid="attendee-first+seats@cal.com"]')
|
|
|
|
.first();
|
|
|
|
await expect(foundFirstAttendeeAgain).toHaveCount(1);
|
|
|
|
});
|
2023-03-14 04:19:05 +00:00
|
|
|
});
|
|
|
|
});
|