一键导入
rstudio-migrate-tests-selenium-to-playwright
// 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/.
// 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/.
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.
Patterns and gotchas for authoring RStudio Playwright tests in TypeScript. Use when writing, reviewing, or migrating tests under e2e/rstudio/.
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.
| name | rstudio-migrate-tests-selenium-to-playwright |
| description | 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/. |
Converts Python test files from rstudio-ide-automation/rstudio_server_pro/electron-tests/ to TypeScript/Playwright tests in rstudio/e2e/rstudio/tests/.
The user provides one or more targets:
/rstudio-migrate-tests-selenium-to-playwright test_desktop_console.py/rstudio-migrate-tests-selenium-to-playwright GlobalPrefs//rstudio-migrate-tests-selenium-to-playwright citationsrstudio-create-playwright-tests before doing any conversion work.e2e/rstudio/docs/MIGRATION_FROM_SELENIUM_PROGRESS.md.@fixtures/rstudio.fixture). Don't hardcode Desktop-only patterns.test.fixme() with a blocker note and track it as Fixme in MIGRATION_FROM_SELENIUM_PROGRESS.md. Do not list a fixme test as migrated in summaries, PR descriptions, or progress tracking.electron-tests/e2e/rstudio/docs/MIGRATION_FROM_SELENIUM_PROGRESS.md for current statusrstudio-create-playwright-tests skillrstudio-ide-automation/rstudio_server_pro/electron-tests/ for other Selenium/Selene electron tests covering the same functionality — useful for test logic, assertions, and expected valuesrstudio-ide-automation/rstudio_server_pro/tests/ for Selenium/Selene server tests covering the same functionality — useful for test logic, assertions, and expected valuesrstudio-pro/e2e/ for Workbench e2e patterns (examples include .or() locator chaining, clickIfVisible() helpers, input fill with retry, reload-on-hang recovery) -- look for anything else reusablee2e/rstudio/pages/e2e/rstudio/actions/For large files or batch migrations: if the source has many methods (say 10+) or you're migrating a directory, consider launching a general-purpose subagent to analyze the Python source(s) and return a brief covering: test methods to convert, pytest markers / skip reasons, fixtures used, page objects referenced, parallel safety hints, and any unusual patterns. This keeps the main context lean for the writing and running phases. For typical single-file migrations with a handful of methods, do the analysis inline.
Map the electron-test to the Playwright directory structure:
| Electron Location | Playwright Location |
|---|---|
| Root-level console/terminal tests | tests/panes/console/ |
| EditorPane/ tests | tests/panes/editor/ |
| GlobalPrefs/ tests | tests/panes/preferences/ |
| Licensing/ tests | tests/licensing/ |
| Projects/ tests | tests/projects/ |
| Cross-pane tests (autocomplete, etc.) | tests/panes/misc/ |
Use judgment — the Playwright structure is organized by function, not by the electron-tests layout.
Follow the rules in the rstudio-create-playwright-tests skill (already loaded per Hard Rule 1). That skill covers imports, selector hierarchy, idiomatic patterns, parallel safety, package dependencies, cross-platform considerations, Ace/NES patterns, and CDP setup.
Migration-specific guidance:
Use test.fixme() for tests that can't pass yet -- never comment out or omit.
If the Selenium source has multiple near-identical methods, consider data-driven restructuring (one forEach loop) in the Playwright version.
When the Python source has @pytest.mark.skip or pytest.skip():
test.fixme() with the reason / URL preserved as a comment directly above:
// @skip: https://github.com/rstudio/rstudio/issues/12345
test.fixme("test name", async () => {});
If the Python skip has only a reason string (no URL), preserve the string verbatim. If the Python source has bare @skip with no reason, write // @skip: no reason given in Python source.Don't auto-fixme based on the marker alone.
If the test needs locators or methods not yet available:
pages/actions/Hard gate (Hard Rule 6): a test doesn't count as migrated until it passes here.
Defer to the rstudio-run-playwright-tests skill for the canonical run commands (Desktop and Server). Present the command and wait for user approval before executing.
Quick reference for Desktop:
cd e2e/rstudio && npx playwright test tests/<path>/<file>.test.ts
If the test fails:
test.fixme() for the failing test and note the blockerAfter the test passes, review for:
Present proposed improvements to the user. Only apply if approved. Re-run after changes.
Edit e2e/rstudio/docs/MIGRATION_FROM_SELENIUM_PROGRESS.md:
Each substep requires explicit approval before proceeding. Ron may stop at any point -- not every migration goes all the way to merge.
9.1 Check branch. Run git branch --show-current, report the branch, ask Ron to confirm. Branch prefix for Playwright migration work: test/ron/ (e.g., test/ron/migrate-debugger). Kebab-case for the descriptive part. Never commit directly to main.
9.2 Review changes. Run git fetch origin. Determine the base branch -- never assume main. Check git log --oneline or ask. For short-lived solo test/ron/... branches, defer the base-branch merge to 9.5. Run git status (never -uall), git diff, git log --oneline -5. Summarize what changed. Flag anything that shouldn't be committed (secrets, scratch files, unrelated changes).
9.3 Stage and commit. Stage specific files by name (never git add -A). Draft a commit message focused on the "why" -- concise, single line preferred, uppercase first letter, no Co-Authored-By. Show the message, wait for approval. Commit, then git status.
9.4 Push. Show the push command, wait for approval, push with -u. Never push to main directly.
9.5 Create PR. If origin/<base> has moved since the last sync, propose git merge origin/<base> and wait for approval before running; then push the merge commit. Draft PR title (under 70 chars) and summary. Summary only -- no "Test plan" section, no AI attribution. Ask about reviewers; aliases: Kevin → kevinushey, Gary → gtritchie, JonV → jonvanausdeln, AT → astayleraz. Show full PR details, wait for approval. Create with gh pr create (use --reviewer if specified). Add the automation label. Return the PR URL.
9.6 Merge (only if Ron asks to merge this session). Check and report source + target branches, confirm both, wait for approval, merge.
9.7 Branch cleanup (only after merge). Offer to delete the local branch, wait for explicit approval.
Style throughout: never - (space-hyphen-space) -- use -- or em dash, no spaces. Never use #N numbering in GitHub comments (auto-links to wrong issues) -- use 1., (1), or Finding 1.
Invoke the roborev-review skill on the commit to request a code review.
When findings come back, assess them before presenting to Ron:
Present the assessed findings with recommendations. Wait for approval before editing any files. Severity policy:
Apply fixes manually. Do not invoke roborev-fix -- Ron prefers manual fixes through the migration flow. Re-run the test (Hard Rule 6 still applies). Commit per Step 9. Re-run roborev-review on the new commit. Repeat until no actionable findings remain.
Close reviewed findings via the roborev-respond skill once they're addressed.
If context compacts mid-migration, preserve:
test.fixme() and whyIf a step has been completed, that fact also survives -- don't redo work Ron has already approved.
Tests can run against multiple RStudio Server instances in parallel. This works from terminal, CI, or Claude subagents.
Targeting a server:
PW_RSTUDIO_SERVER_URL=https://server1:80 \
npx playwright test tests/panes/misc/autocomplete.test.ts --project=server
Parallel execution (5 servers):
Each process gets its own PW_RSTUDIO_SERVER_URL — no shared config files, no conflicts:
# Terminal / CI / shell script
PW_RSTUDIO_SERVER_URL=https://server1:80 npx playwright test tests/file1.test.ts --project=server &
PW_RSTUDIO_SERVER_URL=https://server2:80 npx playwright test tests/file2.test.ts --project=server &
PW_RSTUDIO_SERVER_URL=https://server3:80 npx playwright test tests/file3.test.ts --project=server &
wait
Claude subagent execution:
Same commands, but each Agent tool call targets a different server with run_in_background: true. Results are collected and aggregated by the parent agent.
Desktop mode is unaffected — it doesn't use PW_RSTUDIO_SERVER_URL. The env var is only read by the server fixture path.
After conversion, summarize: