Skip to content

e2e: add more cross-browser tests#12348

Merged
midleman merged 16 commits intomainfrom
mi/cross-browser-e2e-fixes
Mar 11, 2026
Merged

e2e: add more cross-browser tests#12348
midleman merged 16 commits intomainfrom
mi/cross-browser-e2e-fixes

Conversation

@midleman
Copy link
Copy Markdown
Contributor

@midleman midleman commented Mar 6, 2026

Summary

Fixes several issues preventing e2e tests from running on Firefox and WebKit browsers:

  • Command palette shortcut conflict: Firefox intercepts Ctrl+Shift+P for private browsing. Added custom keybinding Cmd+J E that browsers won't capture.
  • Clipboard permissions: grantPermissions('clipboard-read') is Chromium-only. Made the Clipboard POM handle non-Chromium browsers gracefully.
  • Clipboard API restrictions: navigator.clipboard.readText() requires user gesture on Firefox/WebKit. Context menu clipboard tests now skip on these browsers.
  • Test refactoring: Cleaned up console-clipboard.test.ts to be parameterized/DRY.

Tests Added to Cross-Browser

Area Tests
Console console-clipboard
Extensions bootstrap-extensions
Layouts layouts
Notebooks notebook-cell-action-bar*, notebook-copy-paste, notebook-edit-mode*, notebook-focus-and-selection*, notebook-undo-redo
Search search
Variables variables-expanded, variables-filter, variables-sessions
Viewer viewer (3 tests)

*Indicates test excluded on Webkit using grepInvert in YML

QA Notes

@:web @:console @:variables @:layouts

Example run: https://github.com/posit-dev/positron/actions/runs/22950739625

- Add custom keybinding (Cmd+J E) for command palette to avoid Firefox's
  Ctrl+Shift+P private browsing shortcut conflict
- Make clipboard permissions Chromium-only in Clipboard POM (Firefox/WebKit
  don't support programmatic clipboard permission grants)
- Skip context menu clipboard tests on Firefox/WebKit (navigator.clipboard
  API requires user gesture on non-Chromium browsers)
- Refactor console-clipboard.test.ts to be parameterized and DRY
- Expand cross-browser workflow to test: search, layouts, console-clipboard,
  and notebook-copy-paste

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 6, 2026

E2E Tests 🚀
This PR will run tests tagged with: @:critical @:web @:console @:variables @:layouts

readme  valid tags

@midleman midleman changed the title e2e: fix cross-browser compatibility for Firefox/WebKit e2e: add more cross-browser tests Mar 6, 2026
midleman and others added 4 commits March 9, 2026 10:19
- Add viewer, variables, and notebook tests to cross-browser workflow
- Add synthetic paste workaround for Edge/WebKit clipboard API restrictions
- Simplify tracing by removing tracingInitialized flag (rely on try/catch)
- Fix viewer tests for web mode with iframe locator conditionals
- Use clipboard.paste(text) API for reliable cross-browser paste

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@midleman midleman force-pushed the mi/cross-browser-e2e-fixes branch from 380f3f0 to f7bac20 Compare March 10, 2026 00:17
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@midleman midleman force-pushed the mi/cross-browser-e2e-fixes branch from f7bac20 to e1e0bd9 Compare March 10, 2026 01:33
midleman and others added 7 commits March 10, 2026 09:23
Remove redundant screenshot from stopTracing that ran unconditionally.
Now only the on-test-end screenshot is captured, and only when test fails.
Added try-catch to handle cases where page isn't available.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

await measureAndLog(() => this.context.tracing.stopChunk({ path: persistPath }), `stopTracing${name ? ` for ${name}` : ''}`, this.options.logger);

// To ensure we have a screenshot at the end where
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are getting duplicate screenshots. This is already handled in the reporting fixture.

Comment thread scripts/code-server.sh
pushd $ROOT

# Required for Node 22+ to run TypeScript files directly
export NODE_OPTIONS="--experimental-strip-types"
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Node 22+ requires the --experimental-strip-types flag to run TypeScript files directly. Without this, launching the code server for web-based e2e tests fails because
build/lib/preLaunch.ts can't be executed. This aligns with how the precommit hook already handles Node 22+ TypeScript execution.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just FYI, Tim signed off on this change. Basically I was unable to run web-based tests with the Playwright VSCode extension. They worked fine via CLI, just via UI was the problem. Super annoying.

@midleman midleman marked this pull request as ready for review March 11, 2026 14:03
jonvanausdeln
jonvanausdeln previously approved these changes Mar 11, 2026
Copy link
Copy Markdown
Contributor

@jonvanausdeln jonvanausdeln left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

required: false
description: "Exclude tests matching this regex pattern (passed to --grep-invert)"
type: string
default: ""
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh no, its back! ;)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

haha, well, it's only in cross browser tests yml! not all browsers play nicely. :)

testlabauto
testlabauto previously approved these changes Mar 11, 2026
@midleman midleman dismissed stale reviews from testlabauto and jonvanausdeln via a4918a5 March 11, 2026 15:18
@midleman
Copy link
Copy Markdown
Contributor Author

The 1 failure is unrelated, going ahead and merging.

@midleman midleman merged commit 75aa22a into main Mar 11, 2026
20 of 21 checks passed
@midleman midleman deleted the mi/cross-browser-e2e-fixes branch March 11, 2026 16:04
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 11, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants