Repository navigation
complete BRAT to Playwright migration - #17713
Merged
Merged
Conversation
Adds chat-guardrails-paths.test.ts covering 27 tests from
test-automation-guardrails.R: read denials (~/.aws/credentials, ssh,
.env/.Renviron/.Rprofile variants, etc.), read allows (SSH pubkey,
normal files), write denials (outside project, ~/.ssh, file.create /
file.remove / unlink / file.copy / file.rename), write allows (tempdir),
connection denials (file() to sensitive paths, deferred-open variant),
error-message structure (Action/Path/Reason fields), system-file
denials (/etc/passwd, /etc/shadow), and path traversal.
Drives the guardrails directly via .rs.chat.injectBindings() /
.rs.chat.restoreBindings() through a one-shot .rs.test.guardrails(quote(...))
helper installed in beforeAll. Each test runs `pre; helper(...); post` as
one console submission, batching plant/guard/cleanup, and polls for an
R-runtime-generated marker (won't match the input echo) instead of
sleeping. Run time is ~1.3 min for the 27 tests vs ~3.2 min with the
naive blind-sleep design.
Trimmed test-automation-guardrails.R to the 4 binding-lifecycle tests
that stay in BRAT: .rs.chat.safeEval returns errors as conditions rather
than printing them to the console, so the "blocked in console" pattern
the Playwright tests rely on doesn't apply to safeEval/double-inject
coverage. Tracking note added inline.
Side fix: rstudio.fixture.ts:beforeEach was calling
`page.locator(DONT_SAVE_BTN).click({ timeout: 2000 })`, which polls for
the full 2s in the (overwhelmingly common) no-dialog case, adding ~2s
of dead wait to every test. Replaced with `isVisible()` + `waitFor({
state: 'hidden' })` -- no implicit wait when nothing is there, positive
signal when there is.
Migration doc updates: corrects the console.R and data-viewer.R rows
that earlier PRs reverted back to "Partial" via bad merge conflict
resolution; refreshes the summary stats and the "remaining waves"
section to reflect the current state (24 Complete / 4 Partial / 3
Dropped / 1 Fixme).
rmarkdown_chunks.test.ts: 7 tests (1 test.skip) covering the non-skip_on_ci subset of test-automation-rmarkdown.R -- warn-option round-trip, chunk-widget visibility, error-halt, command-history-after- error (#16006), patchwork S3-method dump (#13470), paged-table auto vs explicit (#16483). nb.html-on-save is `test.skip`'d -- `saveSourceDoc` via the `executeCommand` bridge doesn't trigger nb.html generation; needs follow-up to understand whether the console path is doing something the bridge isn't. quarto_chunks.test.ts: 4 tests covering the non-skip_on_ci subset of test-automation-quarto.R -- warn-option round-trip on .qmd, chunk- widget visibility (#11745), variable-width nested-chunk folding (#15191) via the existing AceEditor wrapper, empty-quarto-block highlight regression (#16463). Both new files use the `executeCommand` rstudioCallbacks bridge for chunk runs instead of `typeInConsole(".rs.api.executeCommand(...)")` -- the latter pollutes console history, which breaks the history-after-error test (Up-arrow walks back through the typed command strings instead of the chunk code). The 10 skip_on_ci rmarkdown tests (visual-mode round-trips, chunk- options popup UI) and 7 skip_on_ci quarto tests (visual-mode + chunk-options popup + doc outline) are dropped along with their BRAT files. Porting them would need a chunk-options modal helper and a visual-mode round-trip helper. Migration doc updated: rmarkdown and quarto now Complete; summary stats refreshed; remaining-work section rewritten.
The helper was sourced by test-automation-tabs.R and test-automation-chat-satellite.R, both of which were deleted in earlier migration PRs. No remaining BRAT file references it, so the helper is unused -- removing.
…cases The last three BRAT files (debugger, edit-suggestions, guardrails) had 2-4 tests each retained because they didn't fit the existing Playwright porting patterns. Rather than keep BRAT alive for those, drop the files and convert each retained case into a test.fixme placeholder in the Playwright file that would naturally host it: - chat-guardrails-paths.test.ts: 4 fixmes for the binding-lifecycle tests (.rs.chat.safeEval auto-restore, double-inject reentrancy guard, safeEval blocks writes outside project, safeEval restores on user error). These ARE portable -- the natural form checks file.exists() or a follow-up write succeeding rather than the "blocked in console" pattern -- but they were left as TODOs so the next person can verify them end-to-end before un-fixme-ing. - debugger_extras.test.ts: 2 fixmes for the package-build cycle tests (#15201 and the #9450 package-rebuild half). Each needs a full `devtools::build()` invocation, which takes ~minutes and doesn't fit the current fixture model. The BRAT comments are preserved so the next port has a starting point. - edit_suggestions.test.ts: already had its test.fixme since #17705 (`ghost text suggestions survive document mutations`); the BRAT counterpart is now removed. Migration doc updated: BRAT files remaining = 0; the per-file table flips debugger / edit-suggestions / guardrails to Complete (with the fixme counts called out explicitly); the "Remaining" section is now an inventory of the Playwright TODOs rather than BRAT TODOs. The Wave 6 decommissioning checklist items (CLI flags, R helpers, `.claude/CLAUDE.md` BRAT references, the `reference_brat_automation.md` user memory) are not in this commit -- those land in a follow-up.
Contributor
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
5 tasks
kevinushey
added a commit
that referenced
this pull request
May 21, 2026
The BRAT tests have been ported to Playwright (#17713), so the BRAT framework and its CLI plumbing are no longer needed. The `--automation-agent` flag is preserved -- Playwright uses it to expose `window.rstudioCallbacks`.
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.
Summary
Finishes the BRAT-to-Playwright migration: the
src/cpp/tests/automation/testthat/directory is now empty. 37 new passing Playwright tests + 7test.fixmeplaceholders + 1test.skipcover what used to live there, and a fixture optimization shaves ~2s off every Playwright test we run.Commits
chat-guardrails-paths.test.tsdriving.rs.chat.injectBindings()/restoreBindings()directly via a.rs.test.guardrails(quote(...))helper installed inbeforeAll. Each test batchespre; helper; postinto one console submission and polls for an R-runtime-generated marker instead of sleeping. Also drops theclick({ timeout: 2000 })blind wait inrstudio.fixture.ts:beforeEach-- it was adding ~2 seconds to every test in the no-dialog case.rmarkdown_chunks.test.ts(6 + 1 skip) +quarto_chunks.test.ts(4). Uses theexecuteCommandrstudioCallbacks bridge for chunk runs (no console-history pollution), waits on chunk-specific signals in console output. Deletes the BRAT rmarkdown.R and quarto.R; the 17skip_on_ciBRAT tests they contained (visual-mode round-trips, chunk-options popup UI) were dropped, not ported -- noted in the migration doc for follow-up.helper-pane-layout.R-- both its callers were already deleted in earlier migration PRs.test.fixmestubs for the tests that couldn't be ported as-is (4 guardrails binding-lifecycle, 2 debugger package-build cycle; the 1 edit-suggestions ghost-text focus bug already had its fixme since port edit-suggestions BRAT tests to Playwright (4 of 5) #17705).Stats
test.fixmeplaceholderstest.skipplaceholdersOpen follow-ups (not in this PR)
saveSourceDocvia theexecuteCommandrstudioCallbacks bridge doesn't trigger nb.html generation. The same call viatypeInConsole(".rs.api.executeCommand('saveSourceDoc')")worked in BRAT. Probably a missing step somewhere in the bridge path.ChunkOptionsPopuppage object: would unblock porting the 17skip_on_cirmarkdown/quarto tests that were dropped with the BRAT files.MIGRATION_FROM_BRAT_PROGRESS.md): CLI flags (--run-automation,--automation-filter,--automation-markers), R helpers (.rs.automation.*,.rs.test,.rs.markers),.claude/CLAUDE.mdBRAT references, thereference_brat_automation.mduser memory.Test plan
npx playwright test tests/panes/posit-assistant-chat/chat-guardrails-paths.test.ts-- 27 pass, 4 fixme (1.3m total)npx playwright test tests/panes/editor/rmarkdown_chunks.test.ts-- 6 pass, 1 skip (1.6m total)npx playwright test tests/panes/editor/quarto_chunks.test.ts-- 4 pass (1.0m total)npx playwright test(full suite, Desktop + Server) -- not run locally; CI to confirm