원클릭으로
rstudio-create-playwright-tests
// Patterns and gotchas for authoring RStudio Playwright tests in TypeScript. Use when writing, reviewing, or migrating tests under e2e/rstudio/.
// Patterns and gotchas for authoring RStudio Playwright tests in TypeScript. Use when writing, reviewing, or migrating tests under e2e/rstudio/.
| name | rstudio-create-playwright-tests |
| description | Patterns and gotchas for authoring RStudio Playwright tests in TypeScript. Use when writing, reviewing, or migrating tests under e2e/rstudio/. |
Most of what you need is in e2e/rstudio/README.md (basic structure,
conventions, selector hierarchy, Ace interactions, cross-platform shortcuts,
sandbox, tags, package deps) and in the existing tests under
e2e/rstudio/tests/. The fixture (@fixtures/rstudio.fixture) handles
RStudio launch/shutdown, save-dialog dismissal, and buffer cleanup -- author
tests as if the IDE starts clean.
This file covers RStudio-specific gotchas that aren't in the README.
e2e/rstudio/tests/ for an existing similar test.e2e/rstudio/pages/, actions/, and utils/ for existing helpers.pressSequentially() for GWT text inputs whose handlers fire per
keystroke -- console, editor, and most input.gwt-TextBox fields in
dialogs/wizards (where typing a character enables OK, triggers
autocomplete, etc.). fill() doesn't fire GWT key events in those cases.
Inputs driven by a discrete trigger like press('Enter') or a button click
(e.g., the console Find bar) work fine with fill(), which has the bonus
of replacing text instead of appending. Start with fill(); switch to
pressSequentially() only if the handler doesn't fire.
Force-click Ace textareas: await locator.click({ force: true }). An
ace_content div overlays the hidden textarea and intercepts normal
clicks. focus() is also unreliable -- keystrokes can land in the wrong
pane.
Derive selectors from source, never use gwt-uid-XXXX (those change
every restart):
src/gwt/.../commands/Commands.cmd.xml -- command IDs map to menu
items at #rstudio_label_<sanitized_id> and toolbar buttons at
#rstudio_tb_<sanitized_id> (see ElementIds.java for the sanitizer).src/gwt/.../core/client/theme/DocTabLayoutPanel.java -- tab structure
(.gwt-TabLayoutPanelTab, .gwt-TabLayoutPanelTab-selected, etc.).Invoke RStudio commands and prefs via the window.rstudio bridge --
import helpers from @utils/commands (executeCommand, setPref, etc.).
Don't use .rs.api.executeCommand(...) (slow console roundtrip) or
window.desktopHooks.invokeCommand(...) (Electron-only, crashes on Server).
Decision order for triggering an action: GUI button/menu/shortcut, then
executeCommand(page, id), then page.evaluate() as a last resort.
Clicking a button tests the real user path; the helper is for
setup/teardown or when the UI path is slow/flaky/tangential to what's
being tested.
RStudio binds some shortcuts to plain Ctrl on every platform
(including macOS) -- e.g., Ctrl+Enter Run Line, Ctrl+L Clear Console,
Ctrl+Space Autocomplete. Use Playwright's plain Control for those, not
ControlOrMeta. If you're unsure, check what RStudio's keyboard-shortcut
UI shows for the binding.
Tests must work on Desktop and Server. Prefer stable IDs over wrapper
selectors. Tag mode-specific tests @desktop_only or @server_only
rather than runtime-branching on testInfo.project.name.
When working in these areas, also read the corresponding file:
tests/panes/editor/code_suggestions.test.ts,
edit_suggestions.test.ts): see code-suggestions.md.tests/panes/posit-assistant-chat/): see chat-pane.md.How to run RStudio Playwright tests in Desktop and Server modes. Use this skill whenever the user asks to run, execute, or launch Playwright tests against RStudio - whether on Desktop (local) or Server (remote). Also use when the user asks about the test command, environment variables, or how to point tests at a server URL. Trigger on phrases like "run the test", "execute on server", "run it on desktop", "run against <IP>", or any request involving npx playwright test for the RStudio test suite.
Migrate Python Selenium/Selene electron tests to TypeScript/Playwright. Use when converting tests from rstudio-ide-automation/rstudio_server_pro/electron-tests/ to rstudio/e2e/rstudio/tests/.
Use when updating the Quarto version in the RStudio repository, e.g. bumping to a new release. This skill is for macOS and Linux only.
Use when updating the copilot-language-server version in the RStudio repository, e.g. bumping to a new release. This skill is for macOS and Linux only.
Use when updating the Electron version in the RStudio repository, e.g. bumping to a new release
Use when updating Node.js versions in the RStudio repository, e.g. bumping to a new release. Handles both build-time Node (RSTUDIO_NODE_VERSION, used for building Electron/GWT) and installed Node (RSTUDIO_INSTALLED_NODE_VERSION, shipped with the product). This skill is for macOS and Linux only.