Unverified 提交 a3ec27fc authored 作者: Will Chen's avatar Will Chen 提交者: GitHub

serialize e2e tests due to flakiness (#3183)

<!-- devin-review-badge-begin --> --- <a href="https://app.devin.ai/review/dyad-sh/dyad/pull/3183" target="_blank"> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://static.devin.ai/assets/gh-open-in-devin-review-dark.svg?v=1"> <img src="https://static.devin.ai/assets/gh-open-in-devin-review-light.svg?v=1" alt="Open with Devin"> </picture> </a> <!-- devin-review-badge-end -->
上级 aa269aab
...@@ -271,8 +271,6 @@ jobs: ...@@ -271,8 +271,6 @@ jobs:
- name: E2E tests (Shard ${{ matrix.shard }}/${{ matrix.shardTotal }}) - name: E2E tests (Shard ${{ matrix.shard }}/${{ matrix.shardTotal }})
env: env:
FLAKINESS_ACCESS_TOKEN: ${{ secrets.FLAKINESS_ACCESS_TOKEN }} FLAKINESS_ACCESS_TOKEN: ${{ secrets.FLAKINESS_ACCESS_TOKEN }}
# Self-hosted macOS runners can handle more parallelism
PLAYWRIGHT_PARALLELISM: ${{ contains(matrix.os.image, 'self-hosted') && '3' || '1' }}
# Self-hosted macOS runners use fewer retries (1) vs GitHub-hosted CI (2) # Self-hosted macOS runners use fewer retries (1) vs GitHub-hosted CI (2)
PLAYWRIGHT_RETRIES: ${{ contains(matrix.os.image, 'self-hosted') && '1' || '2' }} PLAYWRIGHT_RETRIES: ${{ contains(matrix.os.image, 'self-hosted') && '1' || '2' }}
# You can add debug logging to make it easier to see what's failing # You can add debug logging to make it easier to see what's failing
......
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
"build": "npm run pre:e2e", "build": "npm run pre:e2e",
"pre:e2e": "cross-env E2E_TEST_BUILD=true npm run package", "pre:e2e": "cross-env E2E_TEST_BUILD=true npm run package",
"e2e": "playwright test", "e2e": "playwright test",
"e2e:p3": "PLAYWRIGHT_RETRIES=1 PLAYWRIGHT_PARALLELISM=3 playwright test", "e2e:fast": "PLAYWRIGHT_RETRIES=1 playwright test",
"e2e:shard": "playwright test --shard", "e2e:shard": "playwright test --shard",
"storybook": "storybook dev -p 6006", "storybook": "storybook dev -p 6006",
"build-storybook": "storybook build" "build-storybook": "storybook build"
......
...@@ -5,33 +5,21 @@ import { FAKE_LLM_BASE_PORT } from "./e2e-tests/helpers/test-ports"; ...@@ -5,33 +5,21 @@ import { FAKE_LLM_BASE_PORT } from "./e2e-tests/helpers/test-ports";
export { FAKE_LLM_BASE_PORT }; export { FAKE_LLM_BASE_PORT };
const timestamp = new Date().toISOString().replace(/[:.]/g, "-"); const timestamp = new Date().toISOString().replace(/[:.]/g, "-");
const parallelism = parseInt(process.env.PLAYWRIGHT_PARALLELISM || "1", 10);
// Generate webServer configurations for each parallel worker // Single worker + one fake LLM server: parallel workers were flaky (shared state / timing).
// Each worker needs its own fake LLM server to avoid test interference
function generateWebServerConfigs(): PlaywrightTestConfig["webServer"] { function generateWebServerConfigs(): PlaywrightTestConfig["webServer"] {
const configs: NonNullable<PlaywrightTestConfig["webServer"]> = []; return {
// Server runs build to avoid race conditions with concurrent webServer starts
for (let i = 0; i < parallelism; i++) { command: `cd testing/fake-llm-server && npm run build && npm start -- --port=${FAKE_LLM_BASE_PORT}`,
const port = FAKE_LLM_BASE_PORT + i; url: `http://localhost:${FAKE_LLM_BASE_PORT}/health`,
configs.push({ // In CI, always start a fresh server; locally, reuse if one is already running
// All servers run build to avoid race conditions since Playwright reuseExistingServer: !process.env.CI,
// starts all webServer entries concurrently };
command: `cd testing/fake-llm-server && npm run build && npm start -- --port=${port}`,
url: `http://localhost:${port}/health`,
// In CI, always start a fresh server; locally, reuse if one is already running
reuseExistingServer: !process.env.CI,
});
}
return configs;
} }
const config: PlaywrightTestConfig = { const config: PlaywrightTestConfig = {
testDir: "./e2e-tests", testDir: "./e2e-tests",
// Enable parallel test execution - E2E test builds skip the singleton lock workers: 1,
// Read parallelism from env var, default to 1 if not set
workers: parallelism,
retries: parseInt( retries: parseInt(
process.env.PLAYWRIGHT_RETRIES ?? (process.env.CI ? "2" : "0"), process.env.PLAYWRIGHT_RETRIES ?? (process.env.CI ? "2" : "0"),
10, 10,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论