- Action tests (
test:action) - All passing ✓ - Sidebar tests (
test:sidebar) - All passing ✓
Status: Content scripts are not injecting in headless mode
Failure Pattern:
- Tests timeout waiting for
#extension-rootor[data-extension-root="true"]elements - Content scripts never appear on the page
- Error:
div with class content_script not found in Shadow DOM
Root Cause: Content scripts are not being injected at all in headless Chrome, even after:
- Increased wait times (5 seconds after context creation)
- Increased timeouts for Shadow DOM queries (60s in CI)
- Added delays before page navigation
Affected Tests:
- All content script tests that check for Shadow DOM elements
- Tests using
getShadowRootElementhelper - Tests that directly query for extension root elements
Possible Solutions:
- Verify extension is actually loaded - Check extension list via CDP
- Wait for content script registration - Poll for
chrome.runtimeavailability - Use different navigation strategy - Navigate to a test page first, then check
- Check Chrome flags - May need additional flags for content script injection in headless
- Consider non-headless mode - Some CI systems support headed Chrome
Status: Extension ID detection and navigation issues
Failure Pattern:
- Some tests fail with
ERR_INVALID_URLwhen navigating tochrome://newtab/ - Extension ID may not be detected in time
- Tests that use extension URL pattern (
chrome-extension://${extensionId}/...) work better
Root Cause:
chrome://newtab/navigation doesn't work reliably in headless Playwright- Some tests don't use
extensionIdfixture properly - Extension override may not be active when tests run
Affected Tests:
- All new tab example tests except
new/template.spec.ts(which uses extension URL)
Recommended Fix:
Update all new tab tests to use extension URL pattern like new/template.spec.ts:
await page.goto(
`chrome-extension://${extensionId}/chrome_url_overrides/newtab.html`
)- Shadow DOM queries: 60s timeout in CI (was 30s)
- Extension ID detection: Increased wait times
- Context creation: Added 3s wait + 2s verification in headless mode
- Page fixture: Added 5s wait before page use in headless mode
- Added delays after context creation
- Added verification steps for extension readiness
- Increased retry counts for extension ID detection
- Made
xvfb-runoptional for macOS compatibility
Content scripts are not injecting in headless Chrome. This appears to be a fundamental issue with how Chrome handles content scripts in headless mode, not just a timing problem.
Investigation Needed:
- Verify extension is actually loaded (check
chrome://extensionsvia CDP) - Check if content scripts are registered in manifest
- Test if content scripts work in non-headless mode
- Research Chrome flags needed for content script injection in headless
Some new tab tests use chrome://newtab/ which doesn't work reliably. Should update to use extension URL pattern.
-
Investigate content script injection
- Check Chrome DevTools Protocol for extension loading status
- Verify manifest content_scripts configuration
- Test in non-headless mode to confirm scripts work
-
Fix new tab tests
- Update all tests to use extension URL pattern
- Ensure
extensionIdfixture is used correctly
-
Consider alternative approaches
- Use
--disable-web-securityflag if needed - Try different Chrome launch options
- Consider using
--headless=newif available
- Use
# Run content tests
export CI=true
export SKIP_BUILD=true
pnpm run test:content
# Run new tab tests
pnpm run test:newtab
# Run action tests (passing)
pnpm run test:action
# Run sidebar tests (passing)
pnpm run test:sidebarexamples/extension-fixtures.ts- Increased timeouts and waitsrun-ci-local.sh- macOS compatibilityCI_TEST_FAILURES_REPORT.md- Initial analysisTESTING_RESULTS.md- This file