Skip to content

Scheduling infrastructure for absolutely everyone.

Fix E2E Tests and Fix broken success page and non existing user URL (#2411)

Hariom Balhara31a8f25bb6a4
diff --git a/apps/web/pages/[user]/[type].tsx b/apps/web/pages/[user]/[type].tsx
index 238a4220fa6..e8ec88bdf40 100644
--- a/apps/web/pages/[user]/[type].tsx
+++ b/apps/web/pages/[user]/[type].tsx
@@ -141,7 +141,7 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) =>
},
});
- if (!users) {
+ if (!users || !users.length) {
return {
notFound: true,
};
diff --git a/apps/web/pages/success.tsx b/apps/web/pages/success.tsx
index d3d63fe836f..974a6597b3a 100644
--- a/apps/web/pages/success.tsx
+++ b/apps/web/pages/success.tsx
@@ -487,10 +487,10 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {
const profile = {
name: eventType.team?.name || eventType.users[0]?.name || null,
- email: eventType.team ? null : eventType.users[0].email,
+ email: eventType.team ? null : eventType.users[0].email || null,
theme: (!eventType.team?.name && eventType.users[0]?.theme) || null,
- brandColor: eventType.team ? null : eventType.users[0].brandColor,
- darkBrandColor: eventType.team ? null : eventType.users[0].darkBrandColor,
+ brandColor: eventType.team ? null : eventType.users[0].brandColor || null,
+ darkBrandColor: eventType.team ? null : eventType.users[0].darkBrandColor || null,
};
return {
diff --git a/apps/web/playwright/auth/delete-account.test.ts b/apps/web/playwright/auth/delete-account.test.ts
index 45f8d5b1a6d..3ba706388d8 100644
--- a/apps/web/playwright/auth/delete-account.test.ts
+++ b/apps/web/playwright/auth/delete-account.test.ts
@@ -1,6 +1,7 @@
import { expect, test } from "@playwright/test";
test("Can delete user account", async ({ page }) => {
+ //FIXME: This test depends on seed.
// Login to account to delete
await page.goto(`/auth/login`);
// Click input[name="email"]
diff --git a/apps/web/playwright/booking-pages.test.ts b/apps/web/playwright/booking-pages.test.ts
index 8e2156e43ac..9ffcf471b2f 100644
--- a/apps/web/playwright/booking-pages.test.ts
+++ b/apps/web/playwright/booking-pages.test.ts
@@ -77,11 +77,11 @@ test.describe("pro user", () => {
test.use({ storageState: "playwright/artifacts/proStorageState.json" });
test.beforeEach(async ({ page }) => {
+ await deleteAllBookingsByEmail("[email protected]");
await page.goto("/pro");
});
- test.afterAll(async () => {
- // delete test bookings
+ test.afterEach(async () => {
await deleteAllBookingsByEmail("[email protected]");
});
diff --git a/apps/web/playwright/dynamic-booking-pages.test.ts b/apps/web/playwright/dynamic-booking-pages.test.ts
index 65510d0c8ef..5eba38df9ea 100644
--- a/apps/web/playwright/dynamic-booking-pages.test.ts
+++ b/apps/web/playwright/dynamic-booking-pages.test.ts
@@ -12,6 +12,8 @@ test.describe("dynamic booking", () => {
test.use({ storageState: "playwright/artifacts/proStorageState.json" });
test.beforeEach(async ({ page }) => {
+ await deleteAllBookingsByEmail("[email protected]");
+ await deleteAllBookingsByEmail("[email protected]");
await page.goto("/pro+free");
});
diff --git a/apps/web/playwright/lib/testUtils.ts b/apps/web/playwright/lib/testUtils.ts
index 5b63c7c761d..88d258170aa 100644
--- a/apps/web/playwright/lib/testUtils.ts
+++ b/apps/web/playwright/lib/testUtils.ts
@@ -72,7 +72,7 @@ export async function selectFirstAvailableTimeSlotNextMonth(page: Page) {
// @TODO: Find a better way to make test wait for full month change render to end
// so it can click up on the right day, also when resolve remove other todos
// Waiting for full month increment
- await page.waitForTimeout(400);
+ await page.waitForTimeout(1000);
// 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.click('[data-testid="time"]');
@@ -83,7 +83,7 @@ export async function selectSecondAvailableTimeSlotNextMonth(page: Page) {
// @TODO: Find a better way to make test wait for full month change render to end
// so it can click up on the right day, also when resolve remove other todos
// Waiting for full month increment
- await page.waitForTimeout(400);
+ await page.waitForTimeout(1000);
// 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(1).click();
diff --git a/test b/test
new file mode 100644
index 00000000000..e69de29bb2d