feat: implement end-to-end testing infrastructure with Playwright and automated containerized database setup

This commit is contained in:
ramvignesh-b
2026-04-15 01:00:51 +05:30
parent 0fb31b9f0b
commit c259d98acb
11 changed files with 389 additions and 7 deletions
+56
View File
@@ -0,0 +1,56 @@
import path from "node:path";
import process from "node:process";
import { defineConfig, devices } from "@playwright/test";
import dotenv from "dotenv";
/**
* Read environment variables from file.
*/
dotenv.config({ path: path.resolve(process.cwd(), "../.env.e2e") });
export default defineConfig({
timeout: 60000,
expect: {
timeout: 10000,
},
testDir: "./e2e",
/* Run tests in files in parallel */
fullyParallel: true,
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: !!process.env.CI,
/* Retry on CI only */
retries: process.env.CI ? 2 : 0,
/* Opt out of parallel tests on CI. */
workers: process.env.CI ? 1 : undefined,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: "html",
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* Base URL to use in actions like `await page.goto('/')`. */
baseURL: process.env.FRONTEND_URL,
/* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */
actionTimeout: 20000,
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: "on-first-retry",
/* Capture screenshot on failure */
screenshot: "only-on-failure",
},
/* Configure projects for major browsers */
projects: [
{
name: "chromium",
use: { ...devices["Desktop Chrome"] },
},
{
name: "firefox",
use: { ...devices["Desktop Firefox"] },
},
],
/* Run your local dev server before starting the tests */
webServer: {
command: "bun run dev",
url: process.env.FRONTEND_URL,
reuseExistingServer: !process.env.CI,
},
});