fix(workbench): match current RStudio Pro Workbench Jobs selectors#513
Open
samcofer wants to merge 2 commits into
Open
fix(workbench): match current RStudio Pro Workbench Jobs selectors#513samcofer wants to merge 2 commits into
samcofer wants to merge 2 commits into
Conversation
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>
|
Preview Links
|
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.
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.
Problem
workbench/test_jobs.py::test_workbench_job[chromium]was skipping with: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 inRStudioSession(src/vip_tests/workbench/pages/rstudio_session.py) no longer matched the RStudio Pro IDE DOM, soWORKBENCH_JOBS_TAB.wait_for(state="visible")timed out and hit thepytest.skipattest_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:
WORKBENCH_JOBS_TAB[id*='workbenchjobs'](no underscore), or abutton<div id="rstudio_workbench_tab_workbench_jobs">— underscore inworkbench_jobs, and aDIVnot abuttonWORKBENCH_JOB_NEW_BUTTONRun Script as Workbench Job<button id="rstudio_tb_startworkbenchjob" title="Run a job on a cluster">Start Workbench Job</button>WORKBENCH_JOB_SUBMIT_BUTTONSubmit#rstudio_dlg_okwith textStartWORKBENCH_JOBS_PANEL#rstudio_workbench_panel_workbenchjobs#rstudio_workbench_panel_workbench_jobsThe 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_scriptmatches the existinginput[id*='script']branch) all resolve.ruff checkandruff format --checkpass.🤖 Generated with Claude Code