mirror of
https://seed.radicle.dev/rad:z4D5UCArafTzTQpDZNQRuqswh3ury.git
synced 2026-10-18 19:10:45 +08:00
Run e2e tests against a production build
The dev server's unbundled modules made each page load take seconds, which is most of the time a test spends; E2E_DEV_SERVER=1 keeps the dev server. Each run writes a JSON report, and CI uses two workers now that the dropped keep-alive connections behind the flakiness are fixed.
This commit is contained in:
@@ -45,4 +45,4 @@ jobs:
|
||||
- run: mkdir -p tests/artifacts
|
||||
|
||||
- name: Run e2e tests
|
||||
run: npm run test:e2e -- --project webkit
|
||||
run: npm run test:e2e
|
||||
|
||||
@@ -44,8 +44,8 @@ npm run test:unit
|
||||
### E2E tests
|
||||
|
||||
```sh
|
||||
npm run test:e2e -- --project webkit
|
||||
npm run test:e2e -- tests/e2e/<file>.spec.ts --project webkit
|
||||
npm run test:e2e
|
||||
npm run test:e2e -- tests/e2e/<file>.spec.ts
|
||||
```
|
||||
|
||||
`SKIP_SETUP=true` skips fixture creation for faster iteration.
|
||||
@@ -93,7 +93,7 @@ These mirror what CI runs on every PR. Run them all before shipping a feature.
|
||||
npm run check # tsc, svelte-check, eslint, prettier,
|
||||
# cargo fmt, cargo clippy, cargo test
|
||||
npm run test:unit
|
||||
npm run test:e2e -- --project webkit
|
||||
npm run test:e2e
|
||||
```
|
||||
|
||||
If backend types changed, regenerate and commit the bindings first:
|
||||
|
||||
@@ -161,6 +161,7 @@ export default [
|
||||
{
|
||||
ignores: [
|
||||
"build/*",
|
||||
"tests/tmp/**/*",
|
||||
"isolation/*",
|
||||
"node_modules/**/*",
|
||||
"target/*",
|
||||
|
||||
+12
-3
@@ -24,6 +24,12 @@ const userAgent =
|
||||
const testHttpApiPort = await getFreePort();
|
||||
process.env.VITE_TEST_HTTP_API_PORT = String(testHttpApiPort);
|
||||
|
||||
// A separate build directory keeps test settings out of the app bundle.
|
||||
const testBuildDir = "tests/tmp/build";
|
||||
const appServerCommand = process.env.E2E_DEV_SERVER
|
||||
? "npm run start -- --strictPort --port 3001"
|
||||
: `npx vite build --outDir ${testBuildDir} --emptyOutDir && npx vite preview --outDir ${testBuildDir} --strictPort --port 3001`;
|
||||
|
||||
const config: PlaywrightTestConfig = {
|
||||
outputDir: "./tests/artifacts",
|
||||
testDir: "./tests/e2e",
|
||||
@@ -33,10 +39,13 @@ const config: PlaywrightTestConfig = {
|
||||
timeout: 8000,
|
||||
},
|
||||
fullyParallel: true,
|
||||
workers: process.env.CI ? 1 : undefined,
|
||||
workers: process.env.CI ? 2 : undefined,
|
||||
forbidOnly: !!process.env.CI,
|
||||
retries: process.env.CI ? 2 : 0,
|
||||
reporter: "list",
|
||||
reporter: [
|
||||
["list"],
|
||||
["json", { outputFile: "tests/artifacts/results.json" }],
|
||||
],
|
||||
use: {
|
||||
colorScheme: "dark",
|
||||
actionTimeout: 5000,
|
||||
@@ -56,7 +65,7 @@ const config: PlaywrightTestConfig = {
|
||||
|
||||
webServer: [
|
||||
{
|
||||
command: `VITE_AUTH_LONG_DELAY=1000 VITE_TEST_HTTP_API_PORT=${testHttpApiPort} npm run start -- --strictPort --port 3001`,
|
||||
command: `VITE_AUTH_LONG_DELAY=1000 VITE_TEST_HTTP_API_PORT=${testHttpApiPort} ${appServerCommand}`,
|
||||
port: 3001,
|
||||
},
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user