Skip to content

Commit 11af86d

Browse files
committed
WIP: Attempt to get playwright working in CI
1 parent 5590d0b commit 11af86d

File tree

4 files changed

+34
-3
lines changed

4 files changed

+34
-3
lines changed

apps/playwright-e2e/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
"lint": "eslint tests --ext=ts --max-warnings=0",
66
"check-types": "tsc --noEmit",
77
"format": "prettier --write tests",
8-
"test": "playwright test",
8+
"test:run": "npx dotenvx run -f .env.local -- playwright test",
9+
"test:ci": "pnpm -w bundle && pnpm --filter @roo-code/vscode-webview build && playwright test",
910
"playwright": "playwright",
1011
"clean": "rimraf test-results .turbo"
1112
},

apps/playwright-e2e/playwright.config.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,15 @@ export default defineConfig<void, TestOptions>({
2222
{ name: "VSCode stable", use: { vscodeVersion: "stable" } },
2323
],
2424
use: {
25+
// Keep headless true for Playwright, but don't pass --headless to VS Code
2526
headless: true,
2627
trace: "on-first-retry",
2728
screenshot: "only-on-failure",
2829
video: "retain-on-failure",
30+
// Add longer timeouts for CI environment
31+
...(process.env.CI && {
32+
actionTimeout: 60_000,
33+
navigationTimeout: 60_000,
34+
}),
2935
},
3036
})

apps/playwright-e2e/tests/playwright-base-test.ts

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,10 @@ export const test = base.extend<TestFixtures>({
3535
"--disable-workspace-trust",
3636
"--disable-telemetry",
3737
"--disable-crash-reporter",
38-
"--headless",
3938
"--disable-gpu",
4039
"--disable-dev-shm-usage",
40+
// Add CI-specific args for better Docker compatibility
41+
...(process.env.CI ? ["--no-sandbox", "--disable-setuid-sandbox"] : []),
4142
`--extensionDevelopmentPath=${path.resolve(__dirname, "..", "..", "..", "src")}`,
4243
`--extensions-dir=${path.join(defaultCachePath, "extensions")}`,
4344
`--user-data-dir=${path.join(defaultCachePath, "user-data")}`,
@@ -46,7 +47,26 @@ export const test = base.extend<TestFixtures>({
4647
],
4748
})
4849

49-
const workbox = await electronApp.firstWindow()
50+
// Add better error handling and logging for firstWindow()
51+
console.log("🔄 Attempting to get VS Code first window...")
52+
let workbox: Page
53+
try {
54+
workbox = await electronApp.firstWindow()
55+
console.log("✅ Successfully got VS Code first window")
56+
} catch (error) {
57+
console.error("❌ Failed to get VS Code first window:", error)
58+
console.log("📊 Electron app context info:")
59+
console.log(" - Process count:", electronApp.context().pages().length)
60+
61+
// Try to get any available window
62+
const pages = electronApp.context().pages()
63+
if (pages.length > 0) {
64+
console.log("🔄 Using first available page instead...")
65+
workbox = pages[0]
66+
} else {
67+
throw new Error(`No VS Code window available. Original error: ${error}`)
68+
}
69+
}
5070
await workbox.waitForLoadState("domcontentloaded")
5171

5272
try {

knip.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@
2020
},
2121
"packages/{build,cloud,evals,ipc,telemetry,types}": {
2222
"project": ["src/**/*.ts"]
23+
},
24+
"apps/playwright-e2e": {
25+
"entry": ["playwright.globalSetup.ts", "tests/**/*.ts"],
26+
"project": ["**/*.{ts,mts,mjs}"]
2327
}
2428
}
2529
}

0 commit comments

Comments
 (0)