Skip to content

Conversation

@emyjamalian
Copy link
Contributor

Fixes #37287

…d PW_UI_DISABLE_GPU=1 to force --disable-gpu\n- Add PW_UI_USE_SWIFTSHADER=1 to force --use-gl=swiftshader\n- Default to SwiftShader on WSL to avoid transparent window\n\nFixes: microsoft#37287
Add environment variable controls and automatic WSL detection to resolve
transparent window issues in Playwright UI mode when running under WSL
with Intel iGPU and discrete GPU configurations.

Environment variables (in order of precedence):
- PW_UI_DISABLE_GPU=1: Force disable GPU entirely
- PW_UI_USE_SWIFTSHADER=1: Force SwiftShader software rendering
- PW_UI_USE_DISCRETE_GPU=1: Force discrete GPU selection
- Auto-detect WSL and use SwiftShader as fallback

This addresses the issue where Playwright UI mode opens with a
completely transparent window in WSL environments with mixed GPU
configurations, making the UI unusable.

Fixes microsoft#37287
- Update tests to verify Playwright UI loads correctly instead of test page content
- Check for [data-testid="test-tree"] element which indicates UI mode is working
- Tests now properly validate that UI mode launches with different rendering options
- Fixes test failures where tests were looking for test page content in UI mode
- Extract WSL rendering logic into dedicated helper functions
- Add comprehensive JSDoc documentation for better maintainability
- Simplify test code with reusable helper functions
- Reduce code duplication and improve readability
- Maintain all existing functionality while making code more maintainable

The refactored code is cleaner, more testable, and easier to understand
while preserving all the original WSL rendering workaround functionality.
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@yury-s yury-s requested a review from mxschmitt September 19, 2025 00:25
- Remove temporary file creation that caused Windows compatibility issues
- Mock fs.existsSync directly instead of creating /tmp/WSLInterop file
- Test now works cross-platform including Windows
@github-actions
Copy link
Contributor

Test results for "tests 1"

5 flaky ⚠️ [firefox-library] › library/inspector/cli-codegen-1.spec.ts:1079 › cli codegen › should not throw csp directive violation errors `@firefox-ubuntu-22.04-node18`
⚠️ [firefox-library] › library/inspector/cli-codegen-pick-locator.spec.ts:35 › should update locator highlight `@firefox-ubuntu-22.04-node18`
⚠️ [firefox-page] › page/page-event-request.spec.ts:182 › should return response body when Cross-Origin-Opener-Policy is set `@firefox-ubuntu-22.04-node18`
⚠️ [playwright-test] › ui-mode-test-output.spec.ts:117 › should collapse repeated console messages for test `@macos-latest-node18-1`
⚠️ [playwright-test] › ui-mode-test-output.spec.ts:80 › should show console messages for test `@ubuntu-latest-node18-1`

46955 passed, 821 skipped


Merge workflow run.

@dgozman
Copy link
Contributor

dgozman commented Sep 29, 2025

Thank you for the PR! We've decided fixing this is not worth the complexity. See this comment. Again, thank you for contributing!

@dgozman dgozman closed this Sep 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Playwright UI does not open in WSL with iGPU & Discrete GPU

2 participants