Repository navigation
e2e: harden five flaky specs from the cross-platform run - #18789
Merged
Merged
Conversation
Five of the six flaky files in a recent all-platforms run traced to specific races rather than general slowness: - resetToUntitled kept a DIRTY untitled placeholder. The placeholder is shared across specs, so text a previous spec left in it (ggplot_pipe_insert sets editor content directly) survived the reset; the next saveAllSourceDocs then raised a modal Save File prompt for the pathless doc, and its glass panel blocked the console. That is what failed the markdown HTML-preview spec on all four platforms, reported as "console input did not hold focus". SourceColumnManager now only reuses a clean untitled doc, waitForSourcePaneReset requires one, and closeSourceAndDeleteFile drops the saveAllSourceDocs it never needed (the file is deleted on the next line). - closeProjectIfOpen could sit behind "Save workspace image?". The sessions run with save_workspace: never, but ApplicationQuit's saveAction_ holds its saveAsk() default until the backend's SaveActionChangedEvent lands, so a project closed seconds after it opened prompts anyway. Dismiss it. - The console-keybindings startup spec pressed the rebound shortcut as soon as window.rstudio.ready went true; EditorCommandManager applies editor_bindings.json on a separate async read, so the press could precede the binding. Retry the block. - The vimrc mid-session spec clicked the editor straight after newSourceDoc, which only dispatches the command -- the click landed on the outgoing document's unrendered ace_content. Wait for the new editor. - The ghost-text specs treated "No completions available" as something to wait out. It is terminal: nothing re-asks, so a declined suggestion cost the full 30s budget and, since the model tends to decline the same context everywhere, showed up as four flaky rows at once. Re-request instead. Adds source_pane_reset.test.ts, which fails without the SourceColumnManager change. The sixth (rmarkdown restart-run-all-chunks on server-linux) is not a test bug: the trace shows the event listener stopping and the session staying unreachable for over a minute after the restart. Left alone so it keeps reporting. Claude-Session: https://claude.ai/code/session_0142QsQiftXXnEQzetogGZbt
kevinushey
temporarily deployed
to
e2e-playwright
September 11, 2026 19:32 — with
GitHub Actions
Inactive
kevinushey
temporarily deployed
to
e2e-playwright
September 11, 2026 19:32 — with
GitHub Actions
Inactive
kevinushey
temporarily deployed
to
e2e-playwright
September 11, 2026 19:37 — with
GitHub Actions
Inactive
kevinushey
temporarily deployed
to
e2e-playwright
September 11, 2026 19:37 — with
GitHub Actions
Inactive
kevinushey
temporarily deployed
to
e2e-playwright
September 11, 2026 19:37 — with
GitHub Actions
Inactive
kevinushey
temporarily deployed
to
e2e-playwright
September 11, 2026 19:37 — with
GitHub Actions
Inactive
kevinushey
temporarily deployed
to
e2e-playwright
September 11, 2026 19:49 — with
GitHub Actions
Inactive
kevinushey
temporarily deployed
to
e2e-playwright
September 11, 2026 19:49 — with
GitHub Actions
Inactive
kevinushey
temporarily deployed
to
e2e-playwright
September 11, 2026 19:49 — with
GitHub Actions
Inactive
kevinushey
temporarily deployed
to
e2e-playwright
September 11, 2026 19:49 — with
GitHub Actions
Inactive
kevinushey
temporarily deployed
to
e2e-playwright
September 11, 2026 19:49 — with
GitHub Actions
Inactive
kevinushey
temporarily deployed
to
e2e-playwright
September 11, 2026 19:49 — with
GitHub Actions
Inactive
RStudio E2E - all platformsAll tests passed!
View / download the full reportView report online -- opens in the browser, no download needed. Available for 14 days. Download playwright-report.zip -- extract and open
All platforms - commit |
gtritchie
added a commit
that referenced
this pull request
Sep 12, 2026
Cherry-picked from af7ab6b (#18789) on main. That commit hardened five specs; the console-keybindings one is dropped here because its feature (#18761, custom editor keybindings in the console) is not on this branch, so neither is the spec. - resetToUntitled kept a DIRTY untitled placeholder. The placeholder is shared across specs, so text a previous spec left in it survived the reset; the next saveAllSourceDocs then raised a modal Save File prompt for the pathless doc, and its glass panel blocked the console. SourceColumnManager now only reuses a clean untitled doc, waitForSourcePaneReset requires one, and closeSourceAndDeleteFile drops the saveAllSourceDocs it never needed. - closeProjectIfOpen could sit behind "Save workspace image?". ApplicationQuit's saveAction_ holds its saveAsk() default until the backend's SaveActionChangedEvent lands, so a project closed seconds after it opened prompts anyway. Dismiss it. - The vimrc mid-session spec clicked the editor straight after newSourceDoc, so the click landed on the outgoing document's unrendered ace_content. Wait for the new editor. - The ghost-text specs treated "No completions available" as something to wait out. It is terminal, so a declined suggestion cost the full 30s budget. Re-request instead. Adds source_pane_reset.test.ts, which fails without the SourceColumnManager change.
gtritchie
added a commit
that referenced
this pull request
Sep 17, 2026
* e2e: name the dialog blocking a project close Cherry-picked from the e2e half of f54aaf2 (#18785) on main; the product fix in that PR (shipping the save action in SessionInfo) is not backported, so the "Save workspace image?" prompt this branch's sessions can still raise stays a real possibility here. closeProjectIfOpen waits on project.isActive() === false, and every wait before it is satisfiable by the still-open project's console -- so a modal the close itself raised lands there as a bare 30s waitForFunction timeout with nothing naming the dialog. Read the visible dialog's text on timeout and report it, carrying the original error as `cause`. closeProjectIfOpen now returns whether dismissSaveWorkspacePrompt fired, so a caller can assert on the prompt rather than have the sweep hide it. * e2e: skip ai suites when the provider service is unreachable Cherry-picked from c0f6bd8 (#18806) on main. Test-side only. The AI gate proved the sandbox held credentials but never that the provider could be reached, so an outage or blocked egress on the runner failed inside the feature's own timeout instead of skipping. Probe each provider's services from Node (utils/network.ts) as part of requireAiCredentials, with the host list next to the provider table so the gate, the beforeAll guard and the external-server check cannot disagree. Under PW_AI_AUTH_STRICT an unreachable service fails instead. For a network that degrades after the gate passed, aiServiceOutageReason re-probes: code_suggestions turns a ghost-text or NES timeout into a retroactive skip only when a host has since stopped answering, and rethrows untouched otherwise. The Posit AI list includes the install manifest on cdn.posit.co, since a timed-out manifest download leaves the agent NotSignedIn and reads as a completion timeout. beforeAll returns early without credentials, so the assistant setup does not spend a minute on install prompts for tests beforeEach then skips. * e2e: share the suggestion re-request and recover a lost bridge on open Cherry-picked from the test-side half of 65abf11 (#18797) on main. The two product fixes in that PR (EditorCommandManager binding load, bounded Python discovery) are not backported, nor is the dev-launcher GWT gating, which only affects local runs. The re-requesting wait that #18789 gave ghost text is now SourcePaneActions.waitForSuggestion, shared with the next-edit sites and acceptNesRename: they still waited blindly on a provider that had already answered "No completions available", which is terminal, so a declined context burned the whole budget and reported as flake on every platform at once. The re-request command has to match the kind of suggestion -- assistantRequestCompletions only asks for an at-cursor completion and its fallback to a next-edit request is Copilot-only -- so the NES sites re-ask through assistantAcceptNextEditSuggestion. SourcePane.nesIndicator gives the four NES presentations one definition in place of the or()-chain the specs each repeated. openProject reloads once when the switched-to session never installs the automation bridge. GWT's bootstrap has no retry, so a failed fetch of the main cache.js leaves the window blank forever; a session that is merely slow (bridge installed, ready still false) is left alone. * e2e: wait for project session readiness before continuing Cherry-picked from ff7bc1c (#18837) on main. Test-side only. openProject's ready wait can be satisfied by the outgoing session, whose deferred initialization completes during the switch; the incoming session then publishes its project path before its own deferred initialization has finished, so a helper that polls ready and the path separately can return into a session that is still initializing. Observe both in one predicate. closeProjectIfOpen has the mirror problem: the project can already be inactive while ready is still false, and returning in that interval lets the next open race the previous session's initialization. Gate on ready too, and move the console-idle check after it -- the earlier checks can observe the outgoing session's console. project-readiness.test.ts drives both helpers against a stubbed workbench that separates project identity from deferred initialization the way a desktop session switch does; both tests fail without the changes above.
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The all-platforms Playwright run on #18786 (report) reported 13 flaky tests across 6 files, with no hard failures. Five of the six files had a specific, identifiable race; this addresses those.
Several of them failed on all four platforms at once, which is the tell that they aren't timing noise -- they are state or protocol races that resolve the same way everywhere.
1.
resetToUntitledkept a dirty Untitled placeholder (markdown.test.ts, all 4 platforms)The failure surfaced as
focusConsole: console input did not hold focus ... something is stealing focus. The screenshot shows why: a modal Save File - Untitled1 dialog, holdingggplot(mtcars, aes(wt, mpg)) + geom_point()-- the last fixture fromggplot_pipe_insert.test.ts, which ran earlier in the same worker.resetSourcePaneStatekeeps one Untitled tab open so the source pane never transits the zero-tab HIDE state (#17738), and it reuses whichever untitled doc is already open.revertUnsavedTargetsonly reverts file-backed editors, so a dirty placeholder carried the previous spec's text across. The nextsaveAllSourceDocsthen prompted Save As for that pathless doc, and its glass panel blocked every later click.SourceColumnManager.onDocumentResetToUntitlednow only reuses a clean untitled doc; a dirty one is closed with the rest and replaced (the existing create-then-close path already avoids the zero-tab gap). This event is only dispatched by the automation bridge, so it is test-facing only.waitForSourcePaneResetrequires the settled doc to be clean, so a reuse regression fails loudly instead of silently.closeSourceAndDeleteFiledrops itssaveAllSourceDocs+sleep(1000). The file is deleted on the next line, so the save changed nothing -- it was purely the thing that could raise a modal.New spec
source_pane_reset.test.tscovers the invariant; verified it fails (dirty: true) with theSourceColumnManagerchange reverted and passes with it.2.
closeProjectIfOpenwaited behind "Save workspace image?" (restart-under-agent.test.ts, macOS + Windows)page.waitForFunction(() => project.isActive() === false)timed out at 30s. The screenshot shows a Close Project / Save workspace image to .../.RData? prompt.The sessions all run with
save_workspace: never, so this looks impossible -- butApplicationQuit.saveAction_is initialized toSaveAction.saveAsk()and only reaches the real value when the backend pushesSaveActionChangedEvent. A project closed seconds after it opened decides the quit inside that window and prompts. This spec closes projects in a tight open/close loop, so it lands there.dismissSaveWorkspacePrompt(inmodals.page.ts) clears it. It polls rather than waiting a fixed interval: in the common no-prompt case the quit proceeds instead, which flipswindow.rstudio.readyfalse or tears the context down, so a session that isn't going to prompt costs one poll.openProjectneeds no equivalent -- the bridge firesSwitchToProjectEventwithforceSaveAll=true, which short-circuits before the prompt.3. Editor keybindings load after
ready(console_editor_keybindings.test.ts, Linux)The startup spec reloads, waits for
window.rstudio.ready, and presses the rebound shortcut.readymeans R's deferred init finished; it says nothing aboutEditorCommandManager, which loadseditor_bindings.jsononEditorLoadedEventthrough a separate async file read. The press can land before the rebinding exists and is swallowed (the console heldgamma delta). Now the set/press/assert block is wrapped intoPass(), so the retry is the wait -- and a binding that never arrives still fails.4. Clicking the editor before
newSourceDocproduced one (vimrc_keybindings.test.ts, Windows)locator.click: Element is not visibleon.ace_content, withforce: true.forceskips the actionability checks, not the scroll-into-view that a zero-box element fails -- the click landed on the outgoing document'sace_content, still in the DOM but no longer rendered.executeCommand(page, 'newSourceDoc')only dispatches; the document is created over an RPC. Both tests now wait for the new editor to be active and painted. (The first test only passed because a polling assertion sat between the two steps.)5. "No completions available" is terminal, not slow (
code_suggestions.test.ts, all 4 platforms)The status bar in the failure snapshot reads "Posit AI Pass: No completions available." -- the request completed with nothing. Nothing re-asks from there, so
toBeVisible({ timeout: 30s })waited out the full budget for a suggestion that was never coming. That is a live model declining a context, and it declines the same context on every platform, which is how one empty answer became four flaky rows.expectGhostTextnow re-issuesassistantRequestCompletionswhen the status bar reports an empty response, and still fails if nothing ever arrives.Not changed:
rmarkdown.test.ts"empty chunk does not define variables" (server-linux)This one is not a test bug. The trace shows, right after
restartRRunAllChunks:The session stayed unreachable for the whole 60s budget (revival cadence is 5s, so ~12 failed attempts), the console never got past
Restarting R session..., and the toolbar was still showing the Session Suspended icon. The test's comment says its tight budget is deliberate -- it is the canary for #18340 -- so loosening it would hide exactly what it exists to catch. Leaving it to keep reporting.Verification
npm run test:desktop-devon macOS, against a worktreeant draftbuild:source_pane_reset.test.ts-- passes; fails with theSourceColumnManagerchange revertedggplot_pipe_insert.test.ts+markdown.test.ts+source_pane_reset.test.tsin order (the sequence that produced the flake),--workers=1-- 20 passedvimrc_keybindings.test.ts+console_editor_keybindings.test.ts-- 8 passedprojects/ignorefiles.test.ts+projects/project_editor_theme.test.ts(close-project path) -- 7 passedmath_preview+rnotebook+notebook_inline_chunks+multiline_chunk_execution(a sample ofcloseSourceAndDeleteFilecallers) -- 11 passedcode_suggestions.test.tsneeds AI credentials and can only be exercised in CI.https://claude.ai/code/session_0142QsQiftXXnEQzetogGZbt