Skip to content

fix(workbench): match current RStudio Pro Workbench Jobs selectors#513

Open
samcofer wants to merge 2 commits into
mainfrom
fix/workbench-jobs-selectors
Open

fix(workbench): match current RStudio Pro Workbench Jobs selectors#513
samcofer wants to merge 2 commits into
mainfrom
fix/workbench-jobs-selectors

Conversation

@samcofer

@samcofer samcofer commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Problem

workbench/test_jobs.py::test_workbench_job[chromium] was skipping with:

Workbench Jobs tab not found — Workbench Jobs (Launcher) may not be available in this Workbench configuration

on deployments that do have Launcher jobs enabled (reproduced against pwb.demo.soleng.posit.it, Posit Workbench 2026.07.0). This was a false negative: the feature is available, but the selectors in RStudioSession (src/vip_tests/workbench/pages/rstudio_session.py) no longer matched the RStudio Pro IDE DOM, so WORKBENCH_JOBS_TAB.wait_for(state="visible") timed out and hit the pytest.skip at test_jobs.py:266.

Root cause

Inspecting a live RStudio Pro session (Workbench 2026.07.0, R 4.6.1) over the Chrome DevTools Protocol revealed four stale selectors:

Selector Old (broken) Actual DOM
WORKBENCH_JOBS_TAB [id*='workbenchjobs'] (no underscore), or a button <div id="rstudio_workbench_tab_workbench_jobs"> — underscore in workbench_jobs, and a DIV not a button
WORKBENCH_JOB_NEW_BUTTON text/title Run Script as Workbench Job <button id="rstudio_tb_startworkbenchjob" title="Run a job on a cluster">Start Workbench Job</button>
WORKBENCH_JOB_SUBMIT_BUTTON text Submit dialog OK button #rstudio_dlg_ok with text Start
WORKBENCH_JOBS_PANEL #rstudio_workbench_panel_workbenchjobs #rstudio_workbench_panel_workbench_jobs

The tab mismatch is what produced the exact skip observed.

Fix

Each selector now accepts both the current underscore IDs (workbench_jobs) and the legacy no-underscore variants (workbenchjobs), so the test works across RStudio Pro builds without another break when IDs shift.

Verified over CDP against a live session: tab, panel, new-job button, and the submission dialog (script input rstudio_tbb_text_pro_job_script matches the existing input[id*='script'] branch) all resolve. ruff check and ruff format --check pass.

🤖 Generated with Claude Code

The Workbench Job scenario skipped with "Workbench Jobs tab not found" on
deployments that actually have Launcher jobs enabled (e.g.
pwb.demo.soleng.posit.it). The skip fired because the selectors in
RStudioSession no longer matched the IDE DOM:

- WORKBENCH_JOBS_TAB used [id*='workbenchjobs'] (no underscore) or a
  button, but the live tab is <div id="rstudio_workbench_tab_workbench_jobs">
  (underscore in workbench_jobs, and a DIV not a button).
- WORKBENCH_JOB_NEW_BUTTON expected "Run Script as Workbench Job", but the
  button is <button id="rstudio_tb_startworkbenchjob">Start Workbench Job</button>.
- WORKBENCH_JOB_SUBMIT_BUTTON expected "Submit", but the dialog OK button is
  #rstudio_dlg_ok with text "Start".
- WORKBENCH_JOBS_PANEL used the old no-underscore panel id.

Each selector now accepts both the current underscore IDs and the legacy
no-underscore variants for backward compatibility across RStudio Pro builds.
Verified against a live session over CDP: tab, panel, new-job button, and
submission dialog all match.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

The broadened WORKBENCH_JOBS_TAB selector included [id*='workbench_jobs']
and [id*='workbenchjobs'] substring clauses that also match the Workbench
Jobs panel (rstudio_workbench_panel_workbench_jobs), so the tab locator
resolved to two elements. wait_for() then raised a Playwright strict-mode
error -- not a PlaywrightTimeoutError -- which run_as_workbench_job does not
catch, crashing the test instead of skipping or passing on the very
2026.07.0 deployment this fix targets.

Restrict the tab locator to the two exact IDs plus the text fallback, which
already cover the underscore/no-underscore naming across builds without
matching the panel. Also drop the dead button[title='Run Script as Workbench
Job'] clause (that string is the dialog aria-label, never a button title),
refresh the stale module docstring, and add selftests locking the
cross-build coverage and the anti-collision invariant.
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