From 6f8ea490d0ff1fa4378cc46f367691e152eafd98 Mon Sep 17 00:00:00 2001 From: Hariom Balhara Date: Tue, 7 Mar 2023 23:10:47 +0530 Subject: [PATCH] "Manage Booking Questions" - Add a comprehensive test (#7465) * Add first test * Add test for team event as well --- .../eventtype/EventTypeSingleLayout.tsx | 1 + apps/web/pages/booking/[uid].tsx | 7 +- apps/web/playwright/fixtures/users.ts | 29 +- .../manage-booking-questions.e2e.ts | 409 ++++++++++++++++++ .../features/form-builder/FormBuilder.tsx | 20 +- playwright.config.ts | 18 +- 6 files changed, 471 insertions(+), 13 deletions(-) create mode 100644 apps/web/playwright/manage-booking-questions.e2e.ts diff --git a/apps/web/components/eventtype/EventTypeSingleLayout.tsx b/apps/web/components/eventtype/EventTypeSingleLayout.tsx index 38e22efcc7..ffeb9b4fa9 100644 --- a/apps/web/components/eventtype/EventTypeSingleLayout.tsx +++ b/apps/web/components/eventtype/EventTypeSingleLayout.tsx @@ -220,6 +220,7 @@ function EventTypeSingleLayout({ @@ -405,6 +412,7 @@ export const FormBuilder = function FormBuilder({ }}> Cancel - + @@ -684,9 +694,7 @@ export const FormBuilderField = ({ const { t } = useLocale(); const { control, formState } = useFormContext(); return ( -
+

{t(message)}

diff --git a/playwright.config.ts b/playwright.config.ts index fb03d86ecc..52b74adad4 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -8,7 +8,15 @@ dotEnv.config({ path: ".env" }); const outputDir = path.join(__dirname, "test-results"); -const DEFAULT_NAVIGATION_TIMEOUT = 15000; +// Dev Server on local can be slow to start up and process requests. So, keep timeouts really high on local, so that tests run reliably locally + +// So, if not in CI, keep the timers high, if the test is stuck somewhere and there is unnecessary wait developer can see in browser that it's stuck +const DEFAULT_NAVIGATION_TIMEOUT = process.env.CI ? 15000 : 50000; +const DEFAULT_EXPECT_TIMEOUT = process.env.CI ? 10000 : 50000; + +// Test Timeout can hit due to slow expect, slow navigation. +// So, it should me much higher than sum of expect and navigation timeouts as there can be many async expects and navigations in a single test +const DEFAULT_TEST_TIMEOUT = process.env.CI ? 60000 : 120000; const headless = !!process.env.CI || !!process.env.PLAYWRIGHT_HEADLESS; @@ -36,7 +44,7 @@ const config: PlaywrightTestConfig = { forbidOnly: !!process.env.CI, retries: 2, workers: os.cpus().length, - timeout: 60_000, + timeout: DEFAULT_TEST_TIMEOUT, maxFailures: headless ? 10 : undefined, fullyParallel: true, reporter: [ @@ -58,6 +66,9 @@ const config: PlaywrightTestConfig = { name: "@calcom/web", testDir: "./apps/web/playwright", testMatch: /.*\.e2e\.tsx?/, + expect: { + timeout: DEFAULT_EXPECT_TIMEOUT, + }, use: { ...devices["Desktop Chrome"], /** If navigation takes more than this, then something's wrong, let's fail fast. */ @@ -68,6 +79,9 @@ const config: PlaywrightTestConfig = { name: "@calcom/app-store", testDir: "./packages/app-store/", testMatch: /.*\.e2e\.tsx?/, + expect: { + timeout: DEFAULT_EXPECT_TIMEOUT, + }, use: { ...devices["Desktop Chrome"], /** If navigation takes more than this, then something's wrong, let's fail fast. */