Skip to content

Migrate multiple Selenium electron tests to Playwright - #17946

Merged
ronblum merged 7 commits into
mainfrom
test/ron/migrate-selenium-to-playwright
Jun 11, 2026
Merged

ronblum merged 7 commits into
mainfrom
test/ron/migrate-selenium-to-playwright

Conversation

@ronblum

@ronblum ronblum commented Jun 11, 2026 •

Copy link
Copy Markdown
Contributor

Migrates multiple Selenium electron tests into the Playwright suite:

  • panes/editor/rnotebook.test.ts (1): create an R Notebook and preview it to the Viewer pane, both before and after running its chunk
  • panes/editor/markdown.test.ts (2): create a Markdown document, and preview a .md to HTML in the Viewer pane
  • panes/viewer/htmlwidgets.test.ts (1): send a plotly htmlwidget to the Viewer pane and verify it renders
  • panes/misc/find_in_files_replace.test.ts (2 added): the Find in Files search-options dialog, and a multi-file search with the search/replace toolbar toggle (folded in alongside the existing Replace All test)
  • panes/misc/command-palette.test.ts (2): open, filter, and run a command from the palette, and toggle the native pipe operator pref inline
  • preferences/global_prefs_accessibility.test.ts (6): keyboard accessibility of the Global Options dialog -- initial focus, Arrow-key section navigation, and Tab/Shift+Tab focus wrapping (including wrap-to-current-section after changing panes)

Supporting pages/source_pane.page.ts changes: chunkImage and previewBtn were stale Selenium-era locators that no passing test had exercised. Both are rescoped to the visible tabpanel (and previewBtn now excludes the aria-hidden JS/SQL preview buttons) so they resolve correctly.

Also updates MIGRATION_FROM_SELENIUM_PROGRESS.md to mark Find in Files, Command Palette, and Global Options accessibility Complete (Create_File_Types remains Not started).

@ronblum ronblum added this to the Blue Plumbago milestone Jun 11, 2026
@ronblum

ronblum commented Jun 11, 2026

Copy link
Copy Markdown
Contributor Author

Review

A review of the migrated specs flagged five Low-severity items:

  1. MAIN_CONTAINER viewer assertions in rnotebook.test.ts lack .first(), unlike the CONTAINER usages: a strict-mode risk if more than one .main-container is ever rendered.
  2. markdown.test.ts drives the R Markdown formatOptions/viewerPaneOption controls on a plain .md; if that control's label differs for .md, the click would silently time out instead of failing fast.
  3. markdown.test.ts cleanup unlink("<base>.html") assumes previewHTML writes a sibling HTML file; plain-markdown preview renders to a tempfile, so it matches nothing.
  4. rnotebook.test.ts's second preview relies on chunk execution refreshing the .nb.html without an explicit save.
  5. htmlwidgets.test.ts omits the useSuiteSandbox()/resetSourcePane() warm-up the sibling specs have, leaving its isolation implicit.

Assessment

  1. Valid, but scoped to rnotebook.test.ts only (markdown.test.ts already chains .first()). Trivial, safe parity fix. Take.
  2. Empirically disproven: the markdown test passes, so the gear with that label is present on .md. If RStudio ever changed it, the test would fail with a clear locator timeout. Skip.
  3. Correct: previewHTML renders to a session tempfile, so the unlink matched nothing and the comment overstated it. Take.
  4. Empirically disproven, and a misread: the plot appears on re-preview because the second Preview click re-renders the sidecar from the chunk's cached output (the first preview needed the save only because no sidecar existed yet). The retry loop covers transient misses. Skip.
  5. Valid: the spec is console-only, so no sandbox is needed and adding one would be unnecessary. Take (comment).

Actions Taken

  1. Added .first() to the four rnotebook.test.ts viewer-iframe assertions (finding 1).
  2. Removed the no-op .html unlink in markdown.test.ts and corrected the comment (finding 3).
  3. Added a comment in htmlwidgets.test.ts explaining why no sandbox/reset is needed (finding 5).
  4. Skipped findings 2 and 4 as verified-working this session.
  5. Re-ran all four tests green after the changes (commit 8d83e7d267).

@github-actions

github-actions Bot commented Jun 11, 2026 •

Copy link
Copy Markdown

🍎 macOS Desktop E2E · ARM64

❌ 5 test(s) failed

███████████████████░ 98% pass rate

✅ Passed ❌ Failed ⚠️ Skipped 🔁 Flaky
360 5 9 2
📥 Download Playwright report

⬇️ playwright-report.zip — extract and open index.html

Includes screenshots, traces, and step-by-step details for every test. Expires in 15 days.


2 shards · macos-26 ARM64 · commit 0b89a9945916d025ad8fb4ec0bd9e22816cc7b8a · Run #226

@ronblum ronblum changed the title Migrate RNotebook, Markdown, and Viewer tests to Playwright Migrate multiple Selenium electron tests to Playwright Jun 11, 2026
@ronblum

ronblum commented Jun 11, 2026

Copy link
Copy Markdown
Contributor Author

Review

Two Low findings on command-palette.test.ts:

  1. The spec omits a per-spec sandbox but carries no comment explaining the deliberate choice (unlike the sibling viewer spec, which documents the same omission).
  2. Pressing Enter runs the highlighted palette row, relying on the front-loading of the New R Script command; the highlighted row isn't explicitly verified before Enter.

Assessment

  1. Agreed and addressed -- a one-line comment matches the precedent already set in the sibling spec and documents the deliberate omission.
  2. Agreed it's a fair note, but skipped: the post-Enter checks (tab count of 2, selected tab "Untitled", footer "R Script") already catch a wrong command, and asserting the highlighted row would require a GWT-hashed selected-row class -- trading a brittle selector for a marginal fail-fast gain.

Actions Taken

  • Added a comment to the Command Palette spec explaining no sandbox is needed (it writes nothing to disk; resetSourcePane() in beforeEach handles isolation). Commit fa89a17647.
  • Re-ran the spec on Desktop: 2 passed.

@ronblum

ronblum commented Jun 11, 2026

Copy link
Copy Markdown
Contributor Author

Review

Two Low findings on the Global Options accessibility migration:

  1. CONSOLE_PANEL was added to the page object but never used (the spec imports only CONSOLE_TAB), making it a dead constant.
  2. The spec omits a per-spec sandbox without a comment explaining the deliberate choice (unlike the sibling Command Palette spec).

Assessment

  1. Agreed and addressed by removing the constant. Adding a Console-panel visibility assertion just to exercise it would have been redundant with the existing General -> Code panel-activation check.
  2. Agreed and addressed -- matches the comment precedent in the sibling spec. The dialog is driven by keyboard only and Apply is never triggered, so nothing persists to disk.

Actions Taken

  • Removed the unused CONSOLE_PANEL constant from global_options.page.ts (kept CONSOLE_TAB). Commit d3c7cf5df5.
  • Added a no-sandbox note to the spec's header comment.
  • Re-ran the spec on Desktop: 6 passed.

test.beforeAll(async ({ rstudioPage: page }) => {
consoleActions = new ConsolePaneActions(page);
// plotly pulls a large dependency tree; allow plenty of install time.
missingPackages = await consoleActions.ensurePackages(['plotly'], 600_000);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

playwright.config.ts sets timeout: 300000, and beforeAll hooks inherit that limit -- so this 600s install budget can't actually be spent. On the cold-runner case it's meant for, the hook times out at 300s with an opaque failure instead of reaching the clean skip path.

package_installation.test.ts handles the same situation with test.setTimeout(600000); calling that at the top of this beforeAll would extend the hook deadline to match the budget.

@ronblum
ronblum merged commit 70a781f into main Jun 11, 2026
3 of 7 checks passed
@ronblum
ronblum deleted the test/ron/migrate-selenium-to-playwright branch June 11, 2026 21:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants