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

This commit is contained in:
Hariom Balhara 2022-04-07 13:04:19 +05:30 committed by GitHub
parent 652b15c9e7
commit 31a8f25bb6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 11 additions and 8 deletions

View File

@ -141,7 +141,7 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) =>
},
});
if (!users) {
if (!users || !users.length) {
return {
notFound: true,
};

View File

@ -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 {

View File

@ -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"]

View File

@ -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");
});

View File

@ -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");
});

View File

@ -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();

0
test Normal file
View File