diff --git a/client/.env.development.imex b/client/.env.development.imex index ef94b0621..d1383e6ef 100644 --- a/client/.env.development.imex +++ b/client/.env.development.imex @@ -12,3 +12,5 @@ VITE_APP_AXIOS_BASE_API_URL=/api/ VITE_APP_REPORTS_SERVER_URL=https://reports.test.imex.online VITE_APP_SPLIT_API=ts615lqgnmk84thn72uk18uu5pgce6e0l4rc VITE_APP_INSTANCE=IMEX +TEST_USERNAME="test@imex.dev" +TEST_PASSWORD="test123" diff --git a/client/.env.development.rome b/client/.env.development.rome index 5d0c366fa..15408c90b 100644 --- a/client/.env.development.rome +++ b/client/.env.development.rome @@ -14,3 +14,5 @@ VITE_APP_REPORTS_SERVER_URL=https://reports.test.romeonline.io VITE_APP_SPLIT_API=ts615lqgnmk84thn72uk18uu5pgce6e0l4rc VITE_APP_COUNTRY=USA VITE_APP_INSTANCE=ROME +TEST_USERNAME="test@imex.dev" +TEST_PASSWORD="test123" diff --git a/client/package.json b/client/package.json index 4f595d18c..db79ba1eb 100644 --- a/client/package.json +++ b/client/package.json @@ -102,7 +102,11 @@ "eulaize": "node src/utils/eulaize.js", "test:unit": "vitest run", "test:watch": "vitest", - "test:e2e": "playwright test" + "test:e2e:imex": "playwright test --config playwright.config.js", + "test:e2e:rome": "playwright test --config playwright.rome.config.js", + "test:e2e:imex:headed": "playwright test --config playwright.config.js --headed", + "test:e2e:rome:headed": "playwright test --config playwright.rome.config.js --headed", + "test:e2e:report": "playwright show-report" }, "browserslist": { "production": [ diff --git a/client/playwright.config.js b/client/playwright.config.js index 5f1d1ec3b..1ffc0d207 100644 --- a/client/playwright.config.js +++ b/client/playwright.config.js @@ -1,8 +1,16 @@ import { defineConfig } from "@playwright/test"; +import dotenv from "dotenv"; + +dotenv.config({ + path: "./.env.development.imex", + prefix: "TEST_" +}); export default defineConfig({ testDir: "./tests/e2e", testMatch: "*.e2e.js", + timeout: 60 * 1000, + reporter: [["list"], ["html"]], use: { baseURL: "https://localhost:3000", browser: "chromium", @@ -10,7 +18,8 @@ export default defineConfig({ }, webServer: { command: "npm run start:imex", - port: 3000, + ignoreHTTPSErrors: true, + url: "https://localhost:3000/health", // Health check endpoint will tell us when the server is ready reuseExistingServer: !process.env.CI // Reuse server locally, not in CI } }); diff --git a/client/playwright.rome.config.js b/client/playwright.rome.config.js new file mode 100644 index 000000000..8378df05c --- /dev/null +++ b/client/playwright.rome.config.js @@ -0,0 +1,25 @@ +import { defineConfig } from "@playwright/test"; +import dotenv from "dotenv"; + +dotenv.config({ + path: "./.env.development.rome", + prefix: "TEST_" +}); + +export default defineConfig({ + testDir: "./tests/e2e", + testMatch: "*.e2e.js", + timeout: 60 * 1000, + reporter: [["list"], ["html"]], + use: { + baseURL: "https://localhost:3000", + browser: "chromium", + ignoreHTTPSErrors: true + }, + webServer: { + command: "npm run start:rome", + ignoreHTTPSErrors: true, + url: "https://localhost:3000/health", // Health check endpoint will tell us when the server is ready + reuseExistingServer: !process.env.CI // Reuse server locally, not in CI + } +}); diff --git a/client/tests/e2e/signin.e2e.js b/client/tests/e2e/signin.e2e.js index 4213c82ce..3ad1f874b 100644 --- a/client/tests/e2e/signin.e2e.js +++ b/client/tests/e2e/signin.e2e.js @@ -3,8 +3,8 @@ import { login } from "./utils/login"; test.describe("SignInComponent", () => { test("successfully logs in with valid credentials", async ({ page }) => { - const email = "dave@imex.dev"; - const password = "dave123"; + const email = process.env.TEST_USERNAME; + const password = process.env.TEST_PASSWORD; await login(page, { email, password });