Skip to content

playwright: replace blind sleeps with polled waits - #17739

Merged
kevinushey merged 1 commit into
mainfrom
developer/e2e-blind-sleep-cleanup
May 22, 2026
Merged

kevinushey merged 1 commit into
mainfrom
developer/e2e-blind-sleep-cleanup

Conversation

@kevinushey

Copy link
Copy Markdown
Collaborator

Summary

  • Add { wait, timeout } option to executeInConsole (free function and class method). With wait: true it polls the rstudio-console-busy class instead of having callers blind-sleep after every R command.
  • Add .rs.ensurePackageInstalled (R) and ensurePackageInstalled (TS) so test setup can no-op when a package is already on disk -- replaces ~30 s of blind install.packages waits in s4_unloaded_package.
  • Sweep blind sleeps in source_pane.actions.ts, chat_pane.actions.ts, rmarkdown.test.ts, s4_unloaded_package.test.ts. s4_unloaded_package drops from ~5 min to 1.3 min; rmarkdown.test.ts from 2.1 min to 58.6 s; suite-wide blind-sleep budget falls by ~125 s.
  • Harden closeSourceAndDeleteFile to wait on both aceTextInput.toHaveCount(0) and selectedTab.toHaveCount(0) -- workaround for file.edit() can silently fail when invoked during an in-flight closeAllSourceDocs #17738 (file.edit racing closeAllSourceDocs).

Test plan

  • npm run test:desktop-dev -- tests/panes/editor/rmarkdown.test.ts -- 6 passed in 58.6 s
  • npm run test:desktop-dev -- tests/panes/misc/s4_unloaded_package.test.ts -- 4 passed in 1.3 min (covers R restart + RStudio restart paths)
  • npx tsc --noEmit clean
  • Posit Assistant chat suite (uses chat_pane.actions.ts) -- run when AI credentials are set up
  • code_suggestions.test.ts -- not touched here; future follow-up once we settle a story for the stale NES gutter (NES gutter icon persists across file close/open cycles and applies stale suggestion to wrong file #17108)

Filed #17738 for the underlying file.edit / closeAllSourceDocs race; this PR works around it test-side rather than fixing the IDE.

- executeInConsole gains { wait, timeout } -- polls the busy class
  instead of having callers blind-sleep after every R command
- new .rs.ensurePackageInstalled (R) + ensurePackageInstalled (TS)
  helper, skips reinstall when package is already on disk
- harden closeSourceAndDeleteFile to wait on both aceTextInput AND
  selectedTab count == 0 (workaround for #17738: file.edit racing
  closeAllSourceDocs)
- sweep blind sleeps in source/chat action helpers and the rmarkdown
  / s4_unloaded_package test files

s4_unloaded_package.test.ts: ~5 min -> 1.3 min
rmarkdown.test.ts: 2.1 min -> 58.6 s
suite-wide blind-sleep budget: -125 s
@kevinushey kevinushey added this to the Blue Plumbago milestone May 22, 2026
@posit-snyk-bot

posit-snyk-bot commented May 22, 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.

@kevinushey
kevinushey merged commit 5a1df6f into main May 22, 2026
1 of 3 checks passed
@kevinushey
kevinushey deleted the developer/e2e-blind-sleep-cleanup branch May 22, 2026 05:46
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