Browse Source

test: update Playwright test timeouts (#5241)

- Rename isGitHubAction to isCI for broader CI detection
- Adjust timeout logic to use CI or Windows conditions
- Reduce expect timeout from 40s/20s to 5s/2s for faster feedback
- Decrease streaming chunk delay from 50ms to 20ms in server mock
Bee 5 months ago
parent
commit
d653f1cc27
2 changed files with 5 additions and 7 deletions
  1. 4 6
      playwright.config.ts
  2. 1 1
      src/test/e2e/fixtures/server/index.ts

+ 4 - 6
playwright.config.ts

@@ -1,20 +1,18 @@
 import { defineConfig } from "@playwright/test"
 import { defineConfig } from "@playwright/test"
 
 
-const isGitHubAction = !!process?.env?.CI
+const isCI = !!process?.env?.CI
 const isWindow = process?.platform?.startsWith("win")
 const isWindow = process?.platform?.startsWith("win")
 
 
-const DEFAULT_TIMEOUT = isWindow ? 40000 : 20000
-
 export default defineConfig({
 export default defineConfig({
 	workers: 1,
 	workers: 1,
 	retries: 1,
 	retries: 1,
 	testDir: "src/test/e2e",
 	testDir: "src/test/e2e",
-	timeout: DEFAULT_TIMEOUT,
+	timeout: isCI || isWindow ? 40000 : 20000,
 	expect: {
 	expect: {
-		timeout: DEFAULT_TIMEOUT,
+		timeout: isCI || isWindow ? 5000 : 2000,
 	},
 	},
 	fullyParallel: true,
 	fullyParallel: true,
-	reporter: isGitHubAction ? [["github"], ["list"]] : [["list"]],
+	reporter: isCI ? [["github"], ["list"]] : [["list"]],
 	globalSetup: require.resolve("./src/test/e2e/utils/setup"),
 	globalSetup: require.resolve("./src/test/e2e/utils/setup"),
 	globalTeardown: require.resolve("./src/test/e2e/utils/teardown"),
 	globalTeardown: require.resolve("./src/test/e2e/utils/teardown"),
 })
 })

+ 1 - 1
src/test/e2e/fixtures/server/index.ts

@@ -332,7 +332,7 @@ export class ClineApiServerMock {
 									}
 									}
 									res.write(`data: ${JSON.stringify(chunk)}\n\n`)
 									res.write(`data: ${JSON.stringify(chunk)}\n\n`)
 									chunkIndex++
 									chunkIndex++
-									setTimeout(sendChunk, 50)
+									setTimeout(sendChunk, 20)
 								} else {
 								} else {
 									const finalChunk = {
 									const finalChunk = {
 										id: generationId,
 										id: generationId,