Skip to content

e2e: fix four flakes from the pr-18229 all-platforms report - #18234

Merged
kevinushey merged 1 commit into
mainfrom
test/e2e-close-project-flakes
Jul 15, 2026
Merged

kevinushey merged 1 commit into
mainfrom
test/e2e-close-project-flakes

Conversation

@kevinushey

Copy link
Copy Markdown
Collaborator

Root-causes and fixes the four flaky (pass-on-retry) tests from the pr-18229 all-platforms e2e report. All four are pre-existing harness races, unrelated to that PR.

Close-project reload race (2 flakes, server-linux)

shinytest2.test.ts and build_pane_testthat.test.ts carried local copies of closeProjectIfOpen whose waits (waitForLoadState + console visible + console idle) can all be satisfied against the old page before the Server close-project reload actually navigates. The delayed reload then lands during the next test's reset or suite fixture:

  • shinytest2 "shinyCompareTest..." failed in perTestReset with "Execution context was destroyed, most likely because of a navigation".
  • sandbox.test.ts failed in createSandbox: the trace shows Enter pressed 13ms after the reload's GET /; the reload reset window.rstudio.console.promptCount, so the count > before wait could never satisfy and timed out at 30s.

Both files now use the shared utils/project.ts helper, which blocks on window.rstudio.project.isActive() === false -- a signal only the post-reload page can produce.

Terminal send-to-editor wrap (1 flake, server-linux)

terminal.test.ts located the send-to-editor tab by the contiguous substring expr 1 + 1, but with a long shell prompt xterm hard-wraps the echoed command at an arbitrary column, even mid-word (the failure snapshot shows ...$ exp / r 1 + 1 -- the terminal cwd was a long leftover sandbox path). The test now resolves the editor as the active tab (which sendTerminalToEditor activates) and compares with all whitespace and wrap markers stripped, which is invariant under any wrap position.

Python interpreters modal timeout (1 flake, desktop-linux)

global_prefs_panels.test.ts waited a flat 15s for the Python interpreters modal, which only opens once python_find_interpreters finishes scanning the machine; the failure snapshot shows the "Finding interpreters..." progress box still up at timeout, and the retry passed in under 4s. The wait now gets a discovery-sized 60s timeout. Since this same slow scan matches the Server failure mode recorded in #18064 (Group 3), the @desktop_only tag is removed so this PR's e2e run verifies the test on Server again.

Addresses #18064.

Verification

All four modified specs pass locally on macOS desktop (27/27, including the previously flaky tests); npm run typecheck is clean. The server-linux behavior is exercised by this PR's all-platforms e2e run.

Root-caused from the traces of the four flaky (pass-on-retry) tests in
the pr-18229 report:

- shinytest2.test.ts and build_pane_testthat.test.ts carried local
  closeProjectIfOpen copies whose waits can all be satisfied against the
  old page before the Server close-project reload navigates; the delayed
  reload then lands during the next test's reset or suite fixture
  (destroyed execution context; promptCount reset breaking
  `count > before` waits). Use the shared utils/project.ts helper, which
  blocks on window.rstudio.project.isActive() === false -- a signal only
  the post-reload page can produce.

- terminal.test.ts located the send-to-editor tab by the contiguous
  substring "expr 1 + 1", but with a long shell prompt xterm hard-wraps
  the echoed command at an arbitrary column, even mid-word
  ("...$ exp" / "r 1 + 1" observed). Resolve the editor as the active
  tab instead and compare with all whitespace and wrap markers stripped.

- global_prefs_panels.test.ts waited 15s for the Python interpreters
  modal, which only opens after python_find_interpreters finishes
  scanning; a cold runner can exceed that (the failure snapshot shows
  the "Finding interpreters..." progress box still up). Give the wait a
  discovery-sized timeout and drop the @desktop_only tag, since the
  Server failure mode in #18064 matches this same slow scan.

Addresses #18064.
@kevinushey kevinushey added this to the 2026.08 (Yellow Yarrow) milestone Jul 15, 2026
@posit-snyk-bot

posit-snyk-bot commented Jul 15, 2026 •

Copy link
Copy Markdown
Contributor

✅ Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
✅ Open Source Security 0 0 0 0 0 issues
✅ Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@github-actions

Copy link
Copy Markdown

RStudio E2E - all platforms

All tests passed!

#################### 100% pass rate

Passed Failed Skipped Flaky
1824 0 76 0
Platform ✅ Passed ❌ Failed ⚠️ Skipped 🔁 Flaky
✅ desktop-linux 461 0 14 0
✅ desktop-macos 456 0 19 0
✅ desktop-windows 461 0 16 0
✅ server-linux 446 0 27 0
View / download the full report

View report online -- opens in the browser, no download needed. Available for 14 days.

Download playwright-report.zip -- extract and open index.html

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


All platforms - commit ede847d987c3b0c28daee9de070e07a649ec003e - Run #189

@kevinushey
kevinushey merged commit 99247dc into main Jul 15, 2026
24 checks passed
@kevinushey
kevinushey deleted the test/e2e-close-project-flakes branch July 15, 2026 06:21
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.

2 participants