Skip to content

Add per-invocation sandbox for Playwright test isolation - #17631

Merged
ronblum merged 11 commits into
mainfrom
test/ron/updates-to-playwright-sandbox
May 17, 2026
Merged

ronblum merged 11 commits into
mainfrom
test/ron/updates-to-playwright-sandbox

Conversation

@ronblum

@ronblum ronblum commented May 14, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Consolidates Playwright test artifacts under a single per-invocation sandbox directory. Previously the per-spec config trees, R workdir, Posit Assistant install, and PA auth lived in scattered tmp/user locations and cleanup was partial. Now a globalSetup hook (fixtures/sandbox-setup.ts) creates one pw_sandbox_<runid>/ per npx playwright test invocation, and everything routes under it: per-spec config trees, R workdir, Electron --user-data-dir, RSTUDIO_DATA_HOME, and HOME/USERPROFILE. The matching globalTeardown removes the entire subtree at end of run; the sandbox is preserved on failure or with PW_SANDBOX_SKIP_CLEANUP=1.

Directory tree

$PW_SANDBOX/                              <- umbrella: <PW_SANDBOX_ROOT or os.tmpdir()>/pw_sandbox_<rand>/
|
+-- data-home/                            <- RSTUDIO_DATA_HOME (shared across all Desktop spawns)
|
+-- user-home/                            <- HOME / USERPROFILE (shared across all Desktop spawns)
|   |
|   +-- AppData/Roaming/                  <- Windows only; pre-created scaffolding so Electron's
|   +-- AppData/Local/                       app.getPath('appData') resolves under the sandbox
|   |   `-- github-copilot/               <- if PW_SANDBOX_SEED_COPILOT, copied from %LOCALAPPDATA%\github-copilot\
|   +-- .positai/                         <- if PW_SANDBOX_SEED_POSITAI, copied from ~/.positai/
|   `-- .config/github-copilot/           <- POSIX, if PW_SANDBOX_SEED_COPILOT (copied from ~/.config/github-copilot/)
|
+-- config_<rand>/                        <- per Desktop spawn (one per launched Desktop instance)
|   +-- config-home/                      <- RSTUDIO_CONFIG_HOME
|   |   `-- rstudio-prefs.json              (merged: base-prefs.jsonc + PW_RSTUDIO_PREFS_OVERRIDE)
|   +-- config-dir/                       <- RSTUDIO_CONFIG_DIR
|   `-- electron-userdata/                <- --user-data-dir=<this>; Cookies, IndexedDB, GPU cache, devtools state, rstudio.socket
|
+-- workdir_<rand>/                       <- per-spec R cwd (created by useSuiteSandbox / createSandbox)
|   `-- <test files, projects, etc.>
|
`-- .failed                               <- written by sandbox-reporter on first non-pass test;
                                             sandbox-teardown reads it to decide preserve vs. remove

User-controlled env vars

All PW_* vars are optional; defaults apply when unset.

Variable Effect
PW_SANDBOX_ROOT Parent dir under which the per-invocation umbrella is created. Default os.tmpdir().
PW_SANDBOX_ROOT_CREATE "1"/"true" to mkdir PW_SANDBOX_ROOT if missing. Default fails loud on a missing parent so typos surface.
PW_SANDBOX_SKIP_CLEANUP "1"/"true" to preserve the umbrella at end of run regardless of pass/fail (otherwise removed unless a test failed).
PW_SANDBOX_SEED_POSITAI "1"/"true" to copy real ~/.positai/ into user-home/.positai/ so Posit Assistant tests start signed in.
PW_SANDBOX_SEED_COPILOT "1"/"true" to copy real Copilot creds (%LOCALAPPDATA%\github-copilot\ on Windows, ~/.config/github-copilot/ on POSIX) into user-home/ so Copilot tests start authenticated.
PW_RSTUDIO_PREFS_OVERRIDE JSON file object-merged on top of base-prefs.jsonc into config-home/rstudio-prefs.json per spawn.

PW_SANDBOX is internal -- set by the globalSetup hook to the absolute umbrella path. Workers, the R workdir helper, and the globalTeardown all read it. Don't set it manually.

Auto-set on rstudio spawn

Set by desktop.fixture.ts on each Desktop spawn. The user does not need to set these.

Variable / arg Value
RSTUDIO_CONFIG_ROOT $PW_SANDBOX/config_<rand>/
RSTUDIO_CONFIG_HOME $PW_SANDBOX/config_<rand>/config-home
RSTUDIO_CONFIG_DIR $PW_SANDBOX/config_<rand>/config-dir
RSTUDIO_DATA_HOME $PW_SANDBOX/data-home (shared)
HOME (POSIX) $PW_SANDBOX/user-home (shared)
USERPROFILE (Windows) $PW_SANDBOX/user-home (shared)
--user-data-dir=... CLI arg $PW_SANDBOX/config_<rand>/electron-userdata

Notable

  • Windows: globalSetup pre-creates user-home/AppData/Roaming/ and user-home/AppData/Local/ so Electron's app.getPath('appData') succeeds under the redirected USERPROFILE.
  • useSuiteSandbox() no longer registers an afterAll -- workdirs survive until end-of-run.
  • Adds restore_source_documents: false to base-prefs.jsonc to prevent source-tab leakage between specs.
  • Verified: tests/sandbox.test.ts passes Desktop unseeded and seeded; PA install behavior confirmed (unseeded = signed out, seeded = signed in); real ~/.positai/ unchanged in both runs. Server-mode verification deferred; the @server_only group in sandbox.test.ts is ready to run against a dev server.

@posit-snyk-bot

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

@ronblum

ronblum commented May 14, 2026 •

Copy link
Copy Markdown
Contributor Author

Review

Automated review (claude-code, job 80) against c024ed5 surfaced six findings:

  1. Medium -- Server-mode regression for remote R sessions (utils/sandbox.ts:32-37, tests/sandbox.test.ts:42-46). The previous rootExpr() defaulted to dirname(tempdir()), evaluated R-side, so it resolved to a valid path on whichever machine R was running on. The new implementation hardcodes the runner's PW_SANDBOX path into the R expression. When Server mode targets a remote rsession on a separate filesystem (e.g., Linux server vs Windows runner), that path doesn't exist on the server and tempfile / dir.create will fail. The new @server_only sandbox-layout test enshrines this assumption.
  2. Medium -- Shared HOME / RSTUDIO_DATA_HOME with parallel workers (fixtures/desktop.fixture.ts:16-18, :170-174). HOME / USERPROFILE and RSTUDIO_DATA_HOME are now shared across all specs in an invocation. With multiple Playwright workers running Desktop tests in parallel, two RStudio processes can write concurrently to the same ~/.Rhistory, ~/.RData, <HOME>/AppData/Roaming/RStudio, and the shared data-home/ (where Posit Assistant install state lives). The README justifies sharing as "shared across specs in the invocation" but doesn't address parallelism.
  3. Low -- process.exitCode for failure detection in globalTeardown (fixtures/sandbox-teardown.ts:21-22). Playwright sets the exit code before globalTeardown in current versions, but this is undocumented internal behavior. The teardown signature also supports receiving a FullResult argument, which is the documented way to check status.
  4. Low -- Module-level non-null assertion on PW_SANDBOX (fixtures/desktop.fixture.ts:16). Read at module-load time with process.env.PW_SANDBOX!. Anyone who imports this module outside a worker gets undefined silently masked by the ! and then a confusing failure deep inside mkdtempSync(path.join(undefined, ...)). Same pattern in tests/sandbox.test.ts:14.
  5. Low -- SANDBOX_DIR_PREFIX comment claims de-coupling that isn't real (utils/sandbox.ts:6-12). The comment says callers hardcode the literal "to avoid coupling specs to an internal export", but the two callers used to import the old constant and now hardcode the literal. The coupling is identical; only the name has changed. If the prefix changes, the two specs silently misclassify.
  6. Low -- configRoot retained in DesktopSession (fixtures/desktop.fixture.ts:318). configRoot was dropped from the destructure in shutdownRStudio but the DesktopSession interface still declares it as required, and launchRStudio still returns it. The rename/removal of per-spec cleanup means the field name no longer reflects its purpose (the directory it points to is no longer cleaned up by shutdown).

Assessment

  1. Medium, Server-mode regression -- Real behavior shift. PW_SANDBOX is now a runner-side path, so cross-filesystem Server mode (runner on Windows, rsession on remote Linux) isn't supported by this slice. Today's Server tests run against localhost so there's no immediate regression. Underlying concern is valid for a future remote-Server workflow.
  2. Medium, shared HOME with parallel workers -- Overstated. playwright.config.ts pins workers: 1, so no actual race today. Doc clarification is the right response.
  3. Low, process.exitCode -- Push back. Playwright 1.59.1's globalTeardown TypeScript signature is (config: FullConfig) => any | Promise<any> -- the result argument isn't in the types. process.exitCode was chosen deliberately during design and Playwright sets it before globalTeardown runs.
  4. Low, module-level non-null assertion -- Valid defensive-coding gap. Worth tightening.
  5. Low, SANDBOX_DIR_PREFIX duplication -- Fair point. Single source of truth is better.
  6. Low, configRoot in DesktopSession -- Wrong on the facts. configRoot is still used by relaunchAfterRestart to reuse the same per-spec config tree across a quit-and-restart.

Actions Taken

  • Finding 4: desktop.fixture.ts now throws an explicit "PW_SANDBOX is not set" error at module load if the var is missing, so the diagnostic is clear when imported outside the Playwright runner.
  • Finding 5: re-exported SANDBOX_DIR_PREFIX from utils/sandbox.ts; the two project specs import it again. Single source of truth restored, misleading rationale dropped from the doc comment.
  • Finding 1: README updated to document the runner-side path assumption explicitly. Cross-filesystem Server support tracked as a follow-up.
  • Finding 2: README updated with an explicit "safe under workers: 1" note covering the shared HOME / RSTUDIO_DATA_HOME design.
  • Findings 3 and 6: no code changes; rationale captured here.

All in commit 8a8b22e.

@ronblum

ronblum commented May 14, 2026

Copy link
Copy Markdown
Contributor Author

Addresses #17584.

@ronblum

ronblum commented May 14, 2026

Copy link
Copy Markdown
Contributor Author

New commit 2797858. Adds a console.warn when PW_SANDBOX_SEED_POSITAI=1 triggers Playwright to copy real ~/.positai/ into the sandbox.

[sandbox] WARNING: Real Posit AI credentials were copied into the sandbox from ~/.positai. Tokens persist if the run is preserved or teardown fails. Only use this on machines with a dedicated test account.

@ronblum
ronblum force-pushed the test/ron/updates-to-playwright-sandbox branch from 2797858 to 3eaf158 Compare May 15, 2026 15:27
…rootExpr, tighten sandbox test asserts, sweep README for wonky terms
@ronblum

ronblum commented May 15, 2026

Copy link
Copy Markdown
Contributor Author

Review

Bundled four findings (1 Medium, 3 Low):

Finding 1 (Medium) -- fixtures/sandbox-teardown.ts: failure detection relies on process.exitCode, which would silently delete the sandbox on failed runs, defeating the documented "preserve on failure for triage" promise.

Finding 2 (Low) -- tests/sandbox.test.ts:26-30: asserts fs.readdirSync(electronData).length > 0 after picking configDirs[0]. Two fragility points -- non-deterministic index under future parallelism, and async Electron writes could be empty for a tick on slower machines.

Finding 3 (Low) -- tests/sandbox.test.ts:46-49: path.dirname(sandbox.dir) === SANDBOX only holds when rsession shares a filesystem with the runner. The assertion encodes the co-located assumption as a hard invariant.

Finding 4 (Low) -- utils/sandbox.ts:24-32 (rootExpr): hardcodes the runner-side PW_SANDBOX path into the R expression with no probe for existence on the R side. Remote rsession would fail inside tempfile/dir.create with a marker timeout rather than a useful diagnostic.

Assessment

Initial calibration skipped Findings 3 and 4 as "premature future-proofing" because I read the README's documented limitation as scoping cross-filesystem Server to a future slice. Discussion clarified that remote-host Server is an actively-used configuration (via PW_RSTUDIO_SERVER_URL and three companion env vars), so Findings 3 and 4 became real, not hypothetical.

Verified Finding 1 by running a deliberately-failing test: confirmed Playwright's globalTeardown signature is (config) only -- no FullResult parameter -- and that process.exitCode is set after globalTeardown returns, not before. So the originally-proposed result.status fix wouldn't have worked, and the existing process.exitCode check was equally broken. The correct mechanism is a custom reporter's onTestEnd hook, which fires before globalTeardown and can relay the pass/fail signal via a marker file.

Settled on: take all four. Findings 3 and 4 conceptually couple -- both surface the runner-vs-rsession filesystem-mismatch case -- so the fix path for both was an adaptive rootExpr() plus a relaxed assertion.

Actions Taken

  1. fixtures/sandbox-reporter.ts (new): custom reporter that writes a .failed marker file inside $PW_SANDBOX via onTestEnd on the first non-pass test status.
  2. fixtures/sandbox-teardown.ts: reads the .failed marker instead of process.exitCode; documented why process.exitCode and FullResult are both unavailable in the globalTeardown signature.
  3. playwright.config.ts: added ./fixtures/sandbox-reporter.ts to the reporter array alongside html and list.
  4. utils/sandbox.ts (rootExpr): adaptive R expression -- uses path.expand(PW_SANDBOX) when it exists on the rsession host, else falls back to dirname(tempdir()). Restores Server-mode functionality against remote rsession (regression from pre-branch behavior).
  5. tests/sandbox.test.ts (Desktop): replaced readdirSync(electronData).length > 0 with expect.poll(() => fs.existsSync(...'Local State')); added comment noting the configDirs[0] indexing is safe under workers: 1.
  6. tests/sandbox.test.ts (Server): dropped path.dirname(sandbox.dir) === SANDBOX and the runner-side fs.existsSync(sandbox.dir) checks; kept the prefix check and the "no config trees written locally" assertions.
  7. README.md: rewrote the cross-filesystem paragraph to document the new adaptive behavior and the remote-rsession workdir cleanup caveat; cleaned up wonky terms (plumbed, Plumbing, boots, mint).

Verified the failure-detection mechanism end-to-end with a deliberately-failing test: sandbox is preserved with the .failed marker and the [sandbox] preserving <path> (test failures) log fires. Passing path reverified -- sandbox is removed cleanly.

Commit: eeaab4c392

@ronblum

ronblum commented May 16, 2026

Copy link
Copy Markdown
Contributor Author

Review

Four review agents in parallel (code quality, test coverage, silent failures, comment accuracy). Zero Critical findings, 7 Important, 25 Suggestions across the four reports. Highlights:

  • code-reviewer (7 Suggestions): teardown rm error handling; reporter marker-write silent swallow; cpSync symlink + error handling; redundant [sandbox] root: log; @server_only describe pattern; rootExpr() IIFE rebuild; "signed out" log noise.
  • pr-test-analyzer (4 Important + 4 Suggestions): no automated coverage for PW_SANDBOX_ROOT* branches, .failed marker logic, SandboxReporter status branches, or rootExpr() fallback. Plus suggestions to tighten configDirs[0] and verify rstudio-prefs.json exists.
  • silent-failure-hunter (1 Important + 4 Suggestions): cpSync unguarded with warning fired before copy; { force: true } masking errors in teardown rm; reporter swallow without log; silent R-side fallback in rootExpr(); mkdirSync parent-create lacks PW_SANDBOX_ROOT context.
  • comment-analyzer (2 Important + 10 Suggestions): misleading "worker-scoped launch" comment; teardown JSDoc framing; remaining "mint" wonky terms; <runid> -> <rand>; ambiguous "it" in privacy note; vague configRoot comment; "drop the marker" diction.

Assessment

Calibrated each finding in code context before recommending. Two general patterns:

(1) The four pr-test-analyzer "Important" findings all want unit tests for fixture code -- but e2e/rstudio/ doesn't have a unit-test framework (only Playwright). Adding Vitest/Jest is a meaningful infrastructure lift for what is, today, mostly bug surface that fails loud. Deferred to a follow-up slice.

(2) The error-handling polish across silent-failure-hunter and code-reviewer is mostly cheap and high-value -- mostly TAKE.

One finding was wrong: comment-analyzer flagged // Triggers the worker-scoped launch. as misleading, claiming rstudioPage is test-scoped. Per README.md:113, rstudioPage IS worker-scoped ("shared rstudioPage scoped to the worker, so all tests in a file share one RStudio session"). Original comment is accurate; SKIP.

Final tally: 12 taken, 5 deferred, ~15 skipped (low-value polish, or already-accurate code).

Actions Taken

Applied in commit c1198ed across 7 files:

  1. fixtures/sandbox-teardown.ts -- wrap fs.promises.rm in try/catch, drop { force: true } so real errors surface as a log line instead of an unhandled rejection on Windows EBUSY/EPERM.
  2. fixtures/sandbox-reporter.ts -- console.warn in marker-write catch with the underlying error message; comment polish ("drop the marker" -> "write the marker").
  3. fixtures/sandbox-setup.ts -- wrap fs.cpSync (Posit AI seed) and fs.mkdirSync (parent dir creation) with clearer error context that names the offending env var; "Mint" -> "Create"; disambiguate the privacy-note pronoun.
  4. fixtures/desktop.fixture.ts -- drop the duplicate [sandbox] root: log (globalSetup already logs it once).
  5. utils/sandbox.ts -- runner-side prefix check in createSandbox(): if the returned R workdir isn't under $PW_SANDBOX, log a one-line warning that the rsession-host fallback fired and the workdir won't be auto-cleaned. Also "mint" -> "create".
  6. tests/sandbox.test.ts -- tighten configDirs.length > 0 -> === 1; assert config-home/rstudio-prefs.json was created (protects the prefs-isolation contract); update the workers: 1 comment to mention exposing configRoot via DesktopSession.
  7. README.md -- pw_sandbox_<runid> -> pw_sandbox_<rand>.

Deferred for a follow-up slice: add unit-test infrastructure to e2e/rstudio/ and write tests for globalSetup env-var branches, globalTeardown marker logic, SandboxReporter.onTestEnd status branches, rootExpr() fallback, and the Posit AI seed warning.

Skipped: misleading "worker-scoped" comment finding (original is accurate per README:113); various low-value polish (rootExpr() IIFE cache, AppData TODO issue link, framing nits, etc.).

@ronblum

ronblum commented May 16, 2026

Copy link
Copy Markdown
Contributor Author

Review

Three Low-severity findings against commit aa02273 (the Copilot seed addition):

Finding 1 (Low) -- fixtures/sandbox-setup.ts:113-115 and JSDoc on line 31: Windows Copilot source is hardcoded as path.join(os.homedir(), 'AppData', 'Local', 'github-copilot'), but JSDoc and README document the source as %LOCALAPPDATA%\github-copilot\. These diverge if LOCALAPPDATA is redirected (uncommon Windows config like roaming profiles, developer-rebased AppData).

Finding 2 (Low) -- fixtures/sandbox-setup.ts:108-141: the Copilot seed block is a near-duplicate of the Posit AI seed block immediately above (env-var parsing, existence probe, fs.cpSync, four log variants). With a third seed (Pro license, tracked separately) on the way, duplication will compound.

Finding 3 (Low) -- fixtures/sandbox-setup.ts:118-124: if fs.cpSync fails after a partial copy, the half-written destCopilot is not cleaned up; a retry that preserves the sandbox would inherit half-copied credentials.

Assessment

Finding 1: TAKE. One-line fix that matches the documented contract. Verified with LOCALAPPDATA='C:\nonexistent\test-localappdata' PW_SANDBOX_SEED_COPILOT=1 -- the log line correctly reported the redirected path.

Finding 2: DEFER. The reviewer themselves notes "defer if the next seed isn't imminent; otherwise extract." The Pro license seed slice (tracked separately) is the right moment to extract a seedFromEnv helper, when all three call sites are visible at once. Folded into that to-do.

Finding 3: SKIP. The "retry inherits half-copied creds" framing doesn't reflect how the sandbox works in practice: every playwright test invocation creates a fresh sandbox via fs.mkdtempSync(path.join(parent, 'pw_sandbox_')), so state never carries between runs. With PW_SANDBOX_SKIP_CLEANUP=1 the failed sandbox is preserved, but the next run starts from a brand-new sandbox directory -- it doesn't reuse the preserved one. So the partial-copy dir is purely a disk-hygiene concern (orphaned data in the preserved sandbox), not a correctness issue. Not worth defensive cleanup-on-catch logic.

Aside: the reviewer noted "This was raised in the prior review attempt and is unchanged" for Finding 1. None of the six prior PR comments reference LOCALAPPDATA or the Copilot source path; the framing wasn't accurate. The technical merit still stands.

Actions Taken

Applied in commit f28e0f3:

  1. fixtures/sandbox-setup.ts -- Windows Copilot source now resolves through process.env.LOCALAPPDATA with path.join(os.homedir(), 'AppData', 'Local') as the fallback when the env var is unset. Matches the documented %LOCALAPPDATA%\github-copilot\ contract.

  2. fixtures/sandbox-setup.ts (bundled cleanup) -- dropped the two unconditional [sandbox] PW_SANDBOX_SEED_* not set; ... log lines for both Posit AI and Copilot. These printed on every invocation regardless of whether the affected tests would run, and would compound to three lines once the Pro license seed lands. The seeded .../set but no real ... found branches that fire when the user opts in remain in place.

Deferred to the Pro license seed slice: extract a seedFromEnv helper to collapse the Posit AI and Copilot blocks, picking up the Pro path as a third call site.

Skipped: partial-copy cleanup on cpSync failure (orphaned data in preserved-sandbox edge case, not a correctness issue).

@ronblum
ronblum changed the base branch from rel-golden-wattle to main May 16, 2026 12:51
@ronblum

ronblum commented May 17, 2026

Copy link
Copy Markdown
Contributor Author

Review

Two Low findings against commit 854e8c7269:

Finding 1 (Low) -- e2e/rstudio/tests/panes/posit-assistant-chat/chat-user-skills.test.ts:33: process.env.PW_SANDBOX! uses a non-null assertion at module load without a guard. If the spec is ever loaded without the global sandbox setup having run, USER_HOME silently becomes undefined/user-home and the failure surfaces deep in path/filesystem operations, far from the root cause.

Finding 2 (Low) -- e2e/rstudio/tests/sandbox.test.ts:25-33: after relaxing the count assertion to >= 1, the test still uses configDirs[0] to pick the dir to validate. fs.readdirSync order is filesystem-dependent, so on multi-config-dir runs a structurally broken sibling (e.g., a half-initialized config from a Desktop spawn that died mid-launch) can hide silently behind a healthy one.

Assessment

Both findings were tagged "raised in the prior review attempt and was not addressed." Verified against the PR's prior review history -- the framing is inaccurate for both:

  • Finding 1 calls out a pattern that an earlier review flagged in desktop.fixture.ts:16 and tests/sandbox.test.ts:14 (those locations were addressed in commit 8a8b22eff1), but the current location chat-user-skills.test.ts:33 is brand-new code introduced in 854e8c7269 -- it could not have been raised before.
  • Finding 2's specific framing (non-deterministic index masking a partial-init dir) was not raised in any prior review on this PR. Adjacent concerns about configDirs[0] were, and were addressed.

The substance of both findings stands independent of the framing.

Finding 1: TAKE. One-line consistency gap with the same pattern adopted in desktop.fixture.ts. Worth applying the guard so the failure mode is loud rather than undefined/user-home.

Finding 2: TAKE with the reviewer's second option (iterate over every configDirs entry and assert layout on each). The first option offered (sort for determinism) is weaker -- it doesn't actually pick a healthier dir. The iterate path makes any sibling partial-init dir impossible to mask. Empirically all 10 config dirs in the full-suite run had the same structure, so iterating is safe today. Future-better alternative is exposing configRoot from the fixture so the test validates only its own launch -- tracked for a follow-up.

Also flagged: the demo snippet shown in the README and the create-tests skill used process.env.PW_SANDBOX!, which would propagate the unguarded pattern to anyone copying it. Updated those to show the guarded form.

Actions Taken

Applied in commit 7dc5cc5fdf across four files:

  1. tests/panes/posit-assistant-chat/chat-user-skills.test.ts -- replaced the non-null assertion with a module-load guard (const PW_SANDBOX = process.env.PW_SANDBOX; if (!PW_SANDBOX) throw new Error(...)) and derived USER_HOME from the guarded variable. Same diagnostic style as the existing desktop.fixture.ts check.

  2. tests/sandbox.test.ts -- iterate over every config_* dir and assert the layout (rstudio-prefs.json, electron-userdata, electron-userdata/Local State) on each, with per-dir messages on failure. Updated the surrounding comment to explain why iterating is the correct stance under multi-spawn runs.

  3. e2e/rstudio/README.md -- rewrote the user-home-relative-path demo snippet to show the guarded pattern (const PW_SANDBOX = process.env.PW_SANDBOX; if (!PW_SANDBOX) throw new Error(...)) instead of the non-null-assertion shorthand. Same prose, safer recipe.

  4. .claude/skills/rstudio-create-playwright-tests/SKILL.md -- same demo-snippet update as the README.

Verified with two scoped re-runs: chat-user-skills.test.ts (3 of 3 passing, second run after a flaky PA-response timeout on the first); sandbox.test.ts Desktop (passing, iterate path validates all config dirs as expected).

@ronblum
ronblum merged commit 0c10ad1 into main May 17, 2026
8 checks passed
@ronblum
ronblum deleted the test/ron/updates-to-playwright-sandbox branch May 17, 2026 13:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants