test(e2e): run Playwright against an isolated Compose stand
This commit is contained in:
1 parent
7a5105acc7
commit
4cd7d060bd
23 files changed
+431
-41
No files matched your search
@@ -0,0 +1,34 @@
|
||||
import { defineConfig, devices } from "@playwright/test";
|
||||
|
||||
// deploy/scripts/e2e.sh starts an isolated Compose stand and runs this suite
|
||||
// in the Playwright image that shares the frontend container's network
|
||||
// namespace, so the browser reaches the stand at http://localhost:8080.
|
||||
const baseURL = process.env.E2E_BASE_URL;
|
||||
if (!baseURL) {
|
||||
throw new Error("Set E2E_BASE_URL or run the suite with `make -C deploy test-e2e`.");
|
||||
}
|
||||
|
||||
// The suite creates synthetic data as it grows. Refuse any origin other than
|
||||
// a local stand so a misconfigured run cannot reach a shared environment.
|
||||
const allowedHosts = new Set(["localhost", "127.0.0.1", "[::1]"]);
|
||||
if (!allowedHosts.has(new URL(baseURL).hostname)) {
|
||||
throw new Error(`E2E_BASE_URL must point to a local stand, got ${baseURL}.`);
|
||||
}
|
||||
|
||||
const artifactsDir = process.env.E2E_ARTIFACTS_DIR ?? "test-results/e2e";
|
||||
|
||||
export default defineConfig({
|
||||
testDir: "./e2e",
|
||||
outputDir: `${artifactsDir}/results`,
|
||||
forbidOnly: Boolean(process.env.CI),
|
||||
retries: 0,
|
||||
reporter: [["list"], ["html", { outputFolder: `${artifactsDir}/report`, open: "never" }]],
|
||||
use: {
|
||||
baseURL,
|
||||
locale: "ru-RU",
|
||||
trace: "retain-on-failure",
|
||||
screenshot: "only-on-failure",
|
||||
video: "off",
|
||||
},
|
||||
projects: [{ name: "chromium", use: { ...devices["Desktop Chrome"] } }],
|
||||
});
|
||||
Reference in new issue
Block a user