Skip to content

Scheduling infrastructure for absolutely everyone.

feat: Added e2e test paid booking should be able to be rescheduled (#10069)

Jaideep Guntupalli0093b6faa538
diff --git a/apps/web/playwright/fixtures/users.ts b/apps/web/playwright/fixtures/users.ts
index 8047305f427..a7a8262e3c6 100644
--- a/apps/web/playwright/fixtures/users.ts
+++ b/apps/web/playwright/fixtures/users.ts
@@ -284,6 +284,7 @@ const createUserFixture = (user: UserWithIncludes, page: Page) => {
setupEventWithPrice(eventType, store.page),
bookAndPaidEvent: async (eventType: Pick<Prisma.EventType, "slug">) =>
bookAndPaidEvent(user, eventType, store.page),
+ makePaymentUsingStripe: async () => makePaymentUsingStripe(store.page),
// ths is for developemnt only aimed to inject debugging messages in the metadata field of the user
debug: async (message: string | Record<string, JSONValue>) => {
await prisma.user.update({
@@ -398,7 +399,12 @@ export async function bookAndPaidEvent(
await Promise.all([page.waitForURL("/payment/*"), page.press('[name="email"]', "Enter")]);
- const stripeFrame = page.frameLocator("iframe").first();
+ await makePaymentUsingStripe(page);
+}
+
+export async function makePaymentUsingStripe(page: Page) {
+ const stripeElement = await page.locator(".StripeElement").first();
+ const stripeFrame = stripeElement.frameLocator("iframe").first();
await stripeFrame.locator('[name="number"]').fill("4242 4242 4242 4242");
const now = new Date();
await stripeFrame.locator('[name="expiry"]').fill(`${now.getMonth()} / ${now.getFullYear() + 1}`);
diff --git a/apps/web/playwright/integrations-stripe.e2e.ts b/apps/web/playwright/integrations-stripe.e2e.ts
index e1ebbac30b8..52a4e9e81e0 100644
--- a/apps/web/playwright/integrations-stripe.e2e.ts
+++ b/apps/web/playwright/integrations-stripe.e2e.ts
@@ -69,9 +69,31 @@ test.describe("Stripe integration", () => {
await expect(page.getByText("Unconfirmed")).toBeVisible();
await expect(page.getByText("Pending payment").last()).toBeVisible();
});
+
+ test("Paid booking should be able to be rescheduled", async ({ page, users }) => {
+ const user = await users.create();
+ const eventType = user.eventTypes.find((e) => e.slug === "paid") as Prisma.EventType;
+ await user.apiLogin();
+ await page.goto("/apps/installed");
+
+ await user.getPaymentCredential();
+ await user.setupEventWithPrice(eventType);
+ await user.bookAndPaidEvent(eventType);
+
+ // Rescheduling the event
+ await Promise.all([page.waitForURL("/booking/*"), page.click('[data-testid="reschedule-link"]')]);
+
+ await selectFirstAvailableTimeSlotNextMonth(page);
+
+ await Promise.all([
+ page.waitForURL("/payment/*"),
+ page.click('[data-testid="confirm-reschedule-button"]'),
+ ]);
+
+ await user.makePaymentUsingStripe();
+ });
todo("Payment should confirm pending payment booking");
todo("Payment should trigger a BOOKING_PAID webhook");
- todo("Paid booking should be able to be rescheduled");
todo("Paid booking should be able to be cancelled");
todo("Cancelled paid booking should be refunded");
});