Repository navigation
fix e2e test failures, support parallel workers, and harden the test harness - #18013
Conversation
The "pinned column stays pinned across column pagination" test looked for the pinned body cell in #gridBody, but #17977 moved pinned cells into the frozen pane's own table (#pinnedBody). Point the selector at #pinnedBody. Lower the global per-test timeout from 5 min to 2 min so a hung test fails fast, and shift the slow-path budget to where it's actually needed: - drop redundant (== global) and tighten-only (< global) test.setTimeout overrides, letting the global govern - add test.setTimeout() to package-installing beforeAll hooks (and one in-test install) whose budgets exceed the new global, since a hook's timeout inherits the global and a cold-cache install would otherwise be killed mid-install
…ries Running the Desktop suite with more than one worker previously clobbered shared state. Partition the two remaining shared writers per worker, activated only when workers > 1 (resolved into PW_TOTAL_WORKERS by globalSetup) so the default single-worker run is unchanged: - HOME / USERPROFILE: each worker copies the seeded template home into a per-parallel-index subtree, so RStudio user state, command history, and seeded AI credentials don't collide. - R_LIBS_USER: each worker gets a hermetic hardlink clone of the prebuilt template library (not layered with it), so a test can install or remove packages -- including the uninstall/reinstall tests -- without racing on a shared library or leaking across workers. The clone uses fs.linkSync (portable to Windows/NTFS, no elevation), stays on the same volume as the template, and is built via a temp dir + atomic rename. Validated with --workers=2: two workers ran concurrently with separate homes and clones, and the DBI/praise uninstall tests passed alongside the console tests.
…aced executeCommand now waits for the target AppCommand to be enabled (not just present) before dispatching, and on timeout throws an error naming the command. Executing a disabled command otherwise trips a dev-build assertion in AppCommand.execute() -- the handler never runs, surfacing as an opaque "AppCommand executed when it was not enabled" client exception plus a downstream hang. Gating here absorbs brief command-state lag and makes the failure self-explanatory. This surfaced that saveDocument unconditionally issued Save even when the active document was already clean (createAndOpenFile writes the file to disk then opens it, so Save is correctly disabled). Save only when the document is dirty; the clean-state wait covers both branches. Fixes the multiline- chunk, notebook-save, rmarkdown empty-chunk, and missing-packages-banner tests. Also: the dev run scripts now accept --timeout durations with units (30s / 1m / 2000ms / bare ms), so a capped-timeout iteration loop reads naturally instead of requiring raw milliseconds. Separately, the data-viewer sidebar pin/unpin test asserted unpin by reading column 2's header, but once unpinned the column returns to its far-left position, scrolled out of the virtualized column window with no rendered <th>; assert via the always-present sidebar pin icon instead.
The SuperDevMode-gated dark-theme toggle button (#17242) was injected into the dialog caption, which sits before the dialog body in DOM order. As a focusable <button> it became the first element returned by getFocusableElements(), displacing the real first/last controls the modal focus trap relies on. In dev/draft builds this broke initial keyboard focus and Tab/Shift+Tab wrapping -- the Global Options keyboard-accessibility tests failed in test:desktop-dev while passing in production builds (where the button is never added). It was an interim affordance for manually checking dark dialogs; the actual dark-theme-modal support (the useDarkThemeModalDialogs pref and syncDarkThemeClass) stays. Removing the button restores the focus order.
The CDP port was random per worker (9231 + random 0..68). With a few parallel workers there was a real chance two drew the same port, and since each launch reclaims its port with `lsof :PORT | kill -9`, the second worker would kill the first worker's live RStudio -- a likely source of SIGKILL / "target page closed" flakiness under --workers > 1. Derive the port deterministically from the parallel index (base + index) so workers never share one; the dev/logger ports (+1000/+2000) follow and stay disjoint. PW_CDP_PORT still overrides.
🍎 macOS Desktop E2E · ARM64✅ All tests passed!
📥 Download Playwright report⬇️ playwright-report.zip — extract and open
2 shards · macos-26 ARM64 · commit |
executeCommand gated on AppCommand.isEnabled(), which is enabled_ && isVisible(). doExecute() only requires enabled_, so an invisible programmatic command (visible="false", e.g. restoreDefaultPaneAndTabLayoutNoPrompt) always reports disabled yet dispatches fine -- the gate blocked it forever (10s "did not become enabled"). This broke pane_layout.test.ts's afterAll resetUILayout when the test ran in isolation. Expose isVisible() on the automation bridge and pass the gate when isEnabled() || !isVisible(); visible commands keep the fail-fast behavior. Also make the @smoke startup test opt-in. It idles 30s against a 30s timeout (full runs cap it lower), so it is the first casualty under parallel load and is redundant alongside the full suite. Exclude it from both projects by default via grepInvert; opt in with PW_RUN_SMOKE=1. Give it its own 60s timeout so it is usable when run.
Code review findingsActionable items from an automated multi-agent review (general code quality, silent failures, comments, test coverage). Strengths, verified-correct items, and ratings are omitted. No critical issues were found. Important
Suggestions
|
…rent launch The Electron app chose the rsession backend www-port with generateRandomPort() -- an unverified random number in [8080, 48080) -- and never re-picked it if the bind failed. Two RStudio instances starting at the same time (e.g. parallel E2E workers, or a user opening several projects at once) could draw the same port; the second rsession then fails to bind with EADDRINUSE and the IDE never loads. The existing EADDRINUSE retry in SessionHttpMethods only covers the same-port restart race within one session, not initial cross-instance collisions, so nothing recovered. Add findFreePort(), which probes random candidates with a real bind on 127.0.0.1 and returns one that is actually free (falling back to an unverified random port if probing fails). Allocate the port through it: - generateNewPort() is now async and awaits findFreePort(). - launchFirst() now probes a fresh free port instead of reusing the unverified random port assigned at construction. - buildLaunchContext()/launchNextSession() and the two call sites in main-window/session-launcher are threaded through the now-async port allocation; the session-exit and main-window launch paths handle the returned promise. A narrow time-of-check/time-of-use window remains, but it is far smaller than trusting an unverified random number, which was the dominant collision source under parallel launches. Companion to the parallel-worker E2E support in this branch.
🪟 Windows Desktop E2E · Server 2025 x64✅ All tests passed!
📥 Download Playwright report⬇️ playwright-report.zip — extract and open
2 shards · Windows Server 2025 x64 · commit |
GrepOperation::onStdout processed grep output against the shared findResults() singleton without checking that the output belonged to the current operation. When a Replace All superseded a still-draining find or replace preview, the stopped operation's buffered stdout was processed under the new operation's configuration -- corrupting its results and, in replace mode, writing files under the wrong config. This surfaced as a Replace All that modified the file on disk but reported "(No results found)". Mirror the guard onContinue already applies: drop output once the operation is no longer current. Also keep the Replace All action disabled while a find or replace is in flight (re-enabled when it ends or is stopped) so a replace cannot be started over a running operation, and mirror the button's disabled state to aria-disabled so it is observable. Wait for the find to finish in the Replace All e2e tests.
Entering replace mode before the find finished built the replace preview from incomplete search results, so a non-regex replacement showed no matches. Gate the Find->Replace toggle on the find completing (greyed out, pointer input blocked, aria-disabled set) by folding it into the existing disableReplace/enableReplace, which already run at find begin/end. The Replace->Find toggle stays usable. The replace e2e tests now wait for the find to finish before toggling.
Summary
Began as an investigation into a failing data-viewer E2E test and grew into a
broader pass over the non-AI E2E suite: fixing the failures it surfaced and
hardening the harness so failures are fast and self-explanatory.
Of the 13 full-suite failures, 11 are fixed here; the other 2 (autocomplete)
were a transient Electron crash during the 1+ hour run and pass reliably in
isolation and full-file, so they need no code change.
Test fixes
unpin assertion read elements that now live in a separate frozen pane or are
virtualized out of the column window since the continuous-column-scroll change
(Data viewer: scroll continuously through columns instead of paginating #17977). Assert via stable elements (
#pinnedBody, the sidebar pin icon).saveDocumenton clean documents: it unconditionally issued Save, butcreateAndOpenFilewrites-then-opens so the document is already clean (Savedisabled). Save only when dirty. Fixes the multiline-chunk, notebook-save,
rmarkdown empty-chunk, and missing-packages-banner tests.
dev-only (
SuperDevMode) dark-theme toggle button (dark theme support for modal dialogs #17242) injected into thedialog caption -- as a focusable button before the body in DOM order it
displaced the modal focus trap's first/last controls, breaking initial focus
and Tab/Shift+Tab wrapping in dev/draft builds only. The dark-theme-modal
support itself (the pref +
syncDarkThemeClass) stays.Harness / iteration improvements
executeCommandnow waits for the target AppCommand to be enabled (notjust present) and, on timeout, throws an error naming the command. Executing a
disabled command otherwise tripped an opaque dev-build assertion
(
AppCommand executed when it was not enabled) and hung the test.budgets on the package-installing hooks/tests that need them, and dropped
redundant/sub-global per-test overrides.
--timeoutduration units (30s/1m/2000ms) in the dev run scripts.Parallel workers
--workers > 1: per-workerHOME/USERPROFILEand hermetic hardlink-cloned R libraries, activated onlywhen
workers > 1(resolved intoPW_TOTAL_WORKERSbyglobalSetup) so thedefault single-worker run is byte-for-byte unchanged. Validated with
--workers=2.Notes
product change (the modal toggle-button removal); not tied to a single
tracking issue.