-
Notifications
You must be signed in to change notification settings - Fork 542
Description
Related PR
#745 (fix(docker): Pre-install Playwright Chromium browsers for automated testing)
Problem
When Automaker runs verification tests using npx playwright test, the test execution incorrectly uses the project's @playwright/test package instead of Automaker's bundled Playwright.
Current behavior:
- Automaker's Docker image bundles Playwright 1.57.0 with chromium-1200
- Test command
npx playwright testruns from the project's worktree directory npxresolves to the project'snode_modules/.bin/playwright- Test file imports (
import { test, expect } from "@playwright/test") resolve to the project's@playwright/test - If the project has a different Playwright version (e.g., 1.58.1 needing chromium-1208), tests fail with "browser not found"
Expected behavior:
Automaker's test execution should use Automaker's bundled Playwright and Chromium, regardless of what Playwright version (if any) the project has installed.
Root Cause
The test runner in apps/server/src/services/test-runner-service.ts spawns tests with:
spawn(finalCommand, [], {
cwd: worktreePath, // Project's directory
...
});When npx playwright test runs from the project directory, Node's module resolution finds the project's @playwright/test first.
Architectural Constraint
- Automaker writes verification tests to the project's
tests/directory - Test files contain
import { test, expect } from "@playwright/test" - Node resolves imports relative to the file location, not the CLI binary location
- Even using
/app/node_modules/.bin/playwrightdirectly doesn't fix imports in test files
Desired Solution
Automaker's test infrastructure should be completely decoupled from the project's dependencies:
- Automaker's Playwright binary should be used for execution
- Automaker's
@playwright/testshould be used for test file imports - The project's own Playwright installation (if any) should be irrelevant to Automaker's testing
Possible Approaches
- Module resolution override: Configure Node to resolve
@playwright/testfrom Automaker's node_modules when running tests - Test isolation: Store/execute Automaker's tests in a way that doesn't interact with project's node_modules
- Import rewriting: Generate test files with absolute imports to Automaker's Playwright
- Environment manipulation: Use NODE_PATH or similar to prioritize Automaker's modules
Need to determine the cleanest approach that doesn't invasively modify the project's files.