Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from Apr 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/web/pages/[user]/[type].tsx
Expand Up @@ -141,7 +141,7 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) =>
},
});

if (!users) {
if (!users || !users.length) {
return {
notFound: true,
};
Expand Down
6 changes: 3 additions & 3 deletions apps/web/pages/success.tsx
Expand Up @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions 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"]
Expand Down
4 changes: 2 additions & 2 deletions apps/web/playwright/booking-pages.test.ts
Expand Up @@ -77,11 +77,11 @@ test.describe("pro user", () => {
test.use({ storageState: "playwright/artifacts/proStorageState.json" });

test.beforeEach(async ({ page }) => {
await deleteAllBookingsByEmail("pro@example.com");
await page.goto("/pro");
});

test.afterAll(async () => {
// delete test bookings
test.afterEach(async () => {
await deleteAllBookingsByEmail("pro@example.com");
});

Expand Down
2 changes: 2 additions & 0 deletions apps/web/playwright/dynamic-booking-pages.test.ts
Expand Up @@ -12,6 +12,8 @@ test.describe("dynamic booking", () => {
test.use({ storageState: "playwright/artifacts/proStorageState.json" });

test.beforeEach(async ({ page }) => {
await deleteAllBookingsByEmail("pro@example.com");
await deleteAllBookingsByEmail("free@example.com");
await page.goto("/pro+free");
});

Expand Down
4 changes: 2 additions & 2 deletions apps/web/playwright/lib/testUtils.ts
Expand Up @@ -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"]');
Expand All @@ -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();
Expand Down
Empty file added test
Empty file.