Skip to content

e2e: fix split-editor reload and terminal listing flakes - #18509

Merged
kevinushey merged 3 commits into
mainfrom
test/fix-e2e-split-reload-and-terminal-flakes
Aug 12, 2026
Merged

kevinushey merged 3 commits into
mainfrom
test/fix-e2e-split-reload-and-terminal-flakes

Conversation

@kevinushey

Copy link
Copy Markdown
Collaborator

Fixes the two flaky tests from the pr-18508 all-platforms e2e run (5 flaky results total, no hard failures). Neither flake is caused by #18508; both are test-side races.

split_editor.test.ts > the split is restored when the IDE reloads (flaked on all 4 platforms)

The failure trace shows the reload's client_init landing ~2s after open_document, with no set_client_state push in between. The active tab is persisted as the activeTabDocId client state value on a passive ~5s timer, so the reload restored a stale value: the failure screenshot shows split_editor.R restored but sitting behind Untitled1. A background tab is never laid out, so neither its text nor the split (applied on the deferred-layout path) ever renders, and the marker locator matched 0 views for the full 20s budget.

Fix: wait for the set_client_state push carrying the active doc id before reloading, exactly as active_tab_restore.test.ts already does for #17944. The helper moves to utils/client-state.ts so both tests share one implementation.

terminal.test.ts > a file created in the terminal appears in a directory listing (flaked on desktop-macos)

The test required ztestfile.txt to appear at least twice in rstudioapi::terminalBuffer(): once from the echoed touch command and once from the ls output. terminalBuffer() returns one entry per physical line, and the screencast frames show the echoed command wrapping mid-filename (touch ztest / file.txt) -- the macOS runner's GUID hostname makes the prompt very long, and the terminal pane is narrow. Whether the wrap tears the filename depends on the random sandbox path length, hence the flake.

Fix: type the touch argument with a quote split (touch "ztest""file.txt", the same trick expectTerminalRenders already uses), so the echoed command can never contain the contiguous filename. A single intact match is then required, and can only come from the ls output, which starts at column 0 and cannot wrap -- so the assertion still proves the file was created and listed.

Verification

Ran split_editor.test.ts, active_tab_restore.test.ts, and terminal.test.ts locally against a desktop dev build: 16 passed / 0 failed.

Two flakes seen in the pr-18508 all-platforms run; neither is caused by
that PR.

The split-editor reload test raced the ~5s client state push timer: a
reload before the activeTabDocId push restores a stale active tab, so
the document comes back as a background tab that is never laid out, and
neither its text nor the split ever renders (flaked on all four
platforms). Reuse the #17944 fix: wait for the set_client_state push
carrying the active doc id before reloading. The helper moves from
active_tab_restore.test.ts into utils/client-state.ts so both tests
share it.

The terminal listing test required the created filename to appear twice
in terminalBuffer(), once from the echoed touch command and once from
the ls output. terminalBuffer() returns physical lines, and on macOS CI
the runner's GUID hostname makes the prompt long enough that the echoed
command wraps mid-filename, dropping one match. Type the touch argument
with a quote split so the echo can never contain the contiguous
filename, and require a single intact match, which can then only come
from the ls output (which starts at column 0 and cannot wrap).
@kevinushey kevinushey added this to the 2026.09 (Autumn Hawkbit) milestone Aug 11, 2026
@github-actions

github-actions Bot commented Aug 11, 2026 •

Copy link
Copy Markdown

RStudio E2E - all platforms

All tests passed!

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

Passed Failed Skipped Flaky
2090 0 376 1
Platform ✅ Passed ❌ Failed ⚠️ Skipped 🔁 Flaky
✅ auth-teardown 2 0 8 0
✅ desktop-linux 516 0 90 1
✅ desktop-macos 522 0 86 0
✅ desktop-windows 523 0 90 0
✅ server-linux 505 0 94 0
✅ setup 22 0 8 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 cff0e7b3e055fa65f9d6902ce19f175c982a967e - Run #550

@kevinushey
kevinushey merged commit c2289cd into main Aug 12, 2026
27 checks passed
@kevinushey
kevinushey deleted the test/fix-e2e-split-reload-and-terminal-flakes branch August 12, 2026 17:25
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.

1 participant