Skip to content

Free & Open-Source Invoice Generator - No Sign-Up, No Ads, Instant PDF Export, 100% In-Browser, and Fully Customizable Templates.

chore: adjust Playwright configuration and e2e test settings for stability (#177)

Vlad Sazonaude6d25da714f
diff --git a/e2e/default-invoice-template/default-invoice-template.test.ts b/e2e/default-invoice-template/default-invoice-template.test.ts
index 923c6ec..06dbd0c 100644
--- a/e2e/default-invoice-template/default-invoice-template.test.ts
+++ b/e2e/default-invoice-template/default-invoice-template.test.ts
@@ -10,9 +10,6 @@ import {
renderMultiPagePdfOnCanvas,
} from "../utils/render-pdf-on-canvas";
-// IMPORTANT: we want to run tests in serial mode for enhanced stability
-test.describe.configure({ mode: "serial" });
-
test.describe("Default Invoice Template", () => {
test.beforeEach(async ({ page }) => {
// we set the system time to a fixed date, so that the invoice number and other dates are consistent across tests
diff --git a/e2e/stripe-invoice-template/share-logic.test.ts b/e2e/stripe-invoice-template/share-logic.test.ts
index 260eb26..aecabfc 100644
--- a/e2e/stripe-invoice-template/share-logic.test.ts
+++ b/e2e/stripe-invoice-template/share-logic.test.ts
@@ -2,9 +2,6 @@ import { PDF_DATA_LOCAL_STORAGE_KEY, type InvoiceData } from "@/app/schema";
import { expect, test } from "@playwright/test";
import { SMALL_TEST_IMAGE_BASE64, uploadBase64LogoAsFile } from "./utils";
-// IMPORTANT: we want to run tests in serial mode for enhanced stability
-test.describe.configure({ mode: "serial" });
-
test.describe("Stripe Invoice Sharing Logic", () => {
test.beforeEach(async ({ page }) => {
await page.goto("/");
diff --git a/e2e/stripe-invoice-template/stripe-invoice-template.test.ts b/e2e/stripe-invoice-template/stripe-invoice-template.test.ts
index e123043..ddf5904 100644
--- a/e2e/stripe-invoice-template/stripe-invoice-template.test.ts
+++ b/e2e/stripe-invoice-template/stripe-invoice-template.test.ts
@@ -16,9 +16,6 @@ import {
} from "../utils/render-pdf-on-canvas";
import { STATIC_ASSETS_URL } from "@/config";
-// IMPORTANT: we want to run tests in serial mode for enhanced stability
-test.describe.configure({ mode: "serial" });
-
test.describe("Stripe Invoice Template", () => {
test.beforeEach(async ({ page }) => {
// we set the system time to a fixed date, so that the invoice number and other dates are consistent across tests
diff --git a/playwright.config.ts b/playwright.config.ts
index a011d8d..b532bce 100644
--- a/playwright.config.ts
+++ b/playwright.config.ts
@@ -18,8 +18,6 @@ const BASE_URL = process.env.BASE_URL ?? `http://localhost:${PORT}`;
// @ts-expect-error - NODE_ENV is not defined in the environment variables
const isLocal = process.env.NODE_ENV === "local";
-const TIMEOUT = isLocal ? 50_000 : 80_000; // i.e. 80 seconds
-
/**
* See https://playwright.dev/docs/test-configuration.
*/
@@ -32,14 +30,14 @@ export default defineConfig({
/* Retry on CI only */
retries: process.env.CI ? 2 : 0,
/* Opt out of parallel tests on CI. */
- workers: process.env.CI ? 2 : undefined, // IMPORTANT: if tests are flaky locally, make `workers: 1` or `workers: 2`
+ workers: process.env.CI ? 1 : undefined, // IMPORTANT: if tests are flaky locally, make `workers: 1` or `workers: 2`
/* timeout for expect assertions */
expect: {
- timeout: isLocal ? 40_000 : 60_000,
+ timeout: isLocal ? 10_000 : 15_000,
},
// /* timeout for test execution */
- timeout: TIMEOUT,
+ timeout: isLocal ? 40_000 : 60_000, // i.e. 60 seconds,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: [["html", { outputFolder: "playwright-output/report" }]],
@@ -58,6 +56,11 @@ export default defineConfig({
// set timezone to Europe/Warsaw by default for consistent date handling across local machines and CI
timezoneId: "Europe/Warsaw",
+
+ // applies to: page.goto(), redirects, page.waitForURL(), clicking links that trigger navigation, form submits that navigate
+ navigationTimeout: 30_000,
+ // Applies to interactions: locator.click(), fill(), check(), hover(), press(), dragTo()
+ actionTimeout: 15_000,
},
/* Configure projects for major browsers */