Skip to content

fix(workbench): skip IDE tests gracefully when IDE is unavailable#208

Merged
ian-flores merged 4 commits intomainfrom
fix-workbench-ide-launch
Apr 22, 2026
Merged

fix(workbench): skip IDE tests gracefully when IDE is unavailable#208
ian-flores merged 4 commits intomainfrom
fix-workbench-ide-launch

Conversation

@ian-flores
Copy link
Copy Markdown
Collaborator

@ian-flores ian-flores commented Apr 21, 2026

Summary

Two IDE-launch tests hard-failed with cryptic Playwright timeouts when the IDE wasn't installed or the DOM selector drifted. Both now convert those cases into a clean pytest.skip with a descriptive reason.

  • fix(workbench): test_launch_jupyter should skip when Jupyter is not installed #186test_launch_jupyter timed out 30s waiting for #modalCancelBtn when Jupyter was not actually available: the tab was present but clicking it showed an error state without a Launch button. Added a short wait_for(state="visible") on the Launch button after the tab click; on PlaywrightTimeoutError we dismiss the dialog and skip with a clear message. Also hardened the existing "tab absent" branch so a missing cancel button no longer triggers the 30-second default timeout.
  • fix(workbench): test_launch_positron fails — positron console selector not found #187test_launch_positron hard-failed on .positron-console visibility when the selector had drifted or Positron was not available. positron_console_accessible now uses the existing _expect_ide_or_skip helper (same pattern used for the Positron workbench element).

Test plan

  • Ruff: just check passes
  • Selftests: uv run pytest selftests/ passes (303/303 locally)
  • Product tests against ganso01-staging Workbench (https://dev.ganso.lab.staging.posit.team, OIDC interactive auth):
    • test_launch_positron — skipped with my new message and parameterized 30s timeout: "Positron console element not found within timeout — selector may have changed or Positron may not be fully available (Locator.wait_for: Timeout 30000ms exceeded ... waiting for locator('.positron-console'))". Directly validates the _expect_ide_or_skip parameterization added in response to Copilot's feedback.
    • test_launch_jupyter — skipped via the pre-existing _expect_ide_or_skip path on .jp-Launcher (Jupyter UI didn't load inside the session). My new "Launch button did not appear" guard was not exercised on this Workbench because the Launch button appeared normally; the guard is defensive code for a specific misconfiguration (tab present but no Launch button) that doesn't manifest on ganso01. Selftests + code review cover that path.

Fixes #186
Fixes #187

- Detect the case where the IDE tab is present in the New Session dialog
  but the Launch button never appears (IDE not installed/functional), and
  pytest.skip before the subsequent click times out 30s on #modalCancelBtn.
- Cancel-button click now uses TIMEOUT_QUICK with a try/except so a
  missing cancel button no longer masks the real skip reason.
- positron_console_accessible now uses the existing _expect_ide_or_skip
  helper so a missing `.positron-console` element skips instead of
  hard-failing — matches the pattern used for the Positron workbench.

Fixes #186
Fixes #187
Copilot AI review requested due to automatic review settings April 21, 2026 22:02
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Improves Workbench IDE-launch Playwright tests by converting common “IDE unavailable / selector drift” failures into clear pytest.skip outcomes instead of hard timeouts.

Changes:

  • Add a fast post-tab-check in session launch to skip when the IDE tab opens but the Launch button never appears.
  • Introduce a best-effort helper to dismiss the “New Session” dialog before skipping.
  • Switch Positron console visibility assertion to use the shared “expect-or-skip” helper pattern.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +197 to +202
cancel = page.locator(NewSessionDialog.CANCEL_BUTTON)
if cancel.count() > 0:
try:
cancel.click(timeout=TIMEOUT_QUICK)
except PlaywrightTimeoutError:
pass
Copy link

Copilot AI Apr 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_dismiss_dialog_and_skip is described as “best-effort”, but it only suppresses PlaywrightTimeoutError from cancel.click(). If the cancel button exists but is detached/covered/not actionable, Playwright can raise a generic playwright.sync_api.Error (or other exceptions), which would still fail the test and mask the intended pytest.skip. Consider catching playwright.sync_api.Error (or even a broad Exception) here, since the whole point is to avoid any cancel-click failure hiding the skip reason.

Copilot uses AI. Check for mistakes.
Comment on lines +360 to +364
selector never appears, this may be an older Positron version or the
DOM structure may have changed — skip rather than hard-fail, matching
the ``_expect_ide_or_skip`` pattern used for the IDE workbench itself.
"""
console_panel = page.locator(PositronSession.CONSOLE_PANEL)
expect(console_panel).to_be_visible(timeout=TIMEOUT_CODE_EXEC)
_expect_ide_or_skip(page, PositronSession.CONSOLE_PANEL, "Positron console")
Copy link

Copilot AI Apr 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

positron_console_accessible now calls _expect_ide_or_skip, which waits up to TIMEOUT_IDE_LOAD (60s). Previously this step used TIMEOUT_CODE_EXEC (30s), so a missing/drifted console selector will take twice as long to skip. Also, _expect_ide_or_skip’s skip message implies “the IDE may not be installed”, which doesn’t match this docstring’s stated causes (older Positron / DOM drift). Consider extending _expect_ide_or_skip to accept a timeout and custom reason/message (or add a separate helper for optional UI panels) and use TIMEOUT_CODE_EXEC + a console-specific skip reason here.

Copilot uses AI. Check for mistakes.
- Annotate _dismiss_dialog_and_skip as -> NoReturn to make control-flow
  guarantee explicit to type checkers and readers
- Document intentional timeout change in positron_console_accessible:
  now uses TIMEOUT_IDE_LOAD (60s) vs previous TIMEOUT_CODE_EXEC (30s),
  which is deliberately more generous for slow deployments
@github-actions
Copy link
Copy Markdown

📸 Preview Screenshots – PR #208

Preview URLs:

Total screenshots uploaded: 9 (2 failed)


🌐 Website Preview

Website home page
Website home page

Getting Started
Getting Started

Shiny App
Shiny App

Test Inventory
Test Inventory

Feature Matrix
Feature Matrix

Report page
Report page

Example Report (viewport preview)
Example Report (viewport preview)


📊 Validation Report Preview

Validation Report home (viewport preview)
Validation Report home (viewport preview)

Validation Report details
Validation Report details


⚠️ Failed Screenshots

  • website-example-report.png (Example Report (full page, 22MB))
  • report-home.png (Validation Report home (full page, 23MB))

Generated by Copilot screenshot workflow. Triggering run: Website Preview #208

Generated by Capture preview screenshots for PRs · ● 3.7M ·

@ian-flores ian-flores marked this pull request as ready for review April 22, 2026 14:15
@ian-flores ian-flores merged commit f51b6f6 into main Apr 22, 2026
21 checks passed
@ian-flores ian-flores deleted the fix-workbench-ide-launch branch April 22, 2026 16:19
@github-actions
Copy link
Copy Markdown

PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-04-22 16:19 UTC

@github-actions
Copy link
Copy Markdown

Preview Screenshots for PR #208

Triggering workflow: Website Preview (run 24789594756) — conclusion: success


⚠️ Note: Both preview URLs returned HTTP 404. This PR was already merged to main and the previews were automatically cleaned up by the pr-preview-action cleanup job before screenshots could be captured.

Summary

Total screenshots uploaded 2
Successful renders 0 (both returned 404)
Failed renders 2

Captured URLs

URL Status
https://posit-dev.github.io/vip/pr-preview-site/pr-208/ ❌ 404 Not Found
https://posit-dev.github.io/vip/pr-preview/pr-208/ ❌ 404 Not Found

Screenshots

Both preview URLs returned the GitHub 404 page (shown below). The previews were cleaned up when the PR was merged.

Website preview (/vip/pr-preview-site/pr-208/):

website home - 404

Report preview (/vip/pr-preview/pr-208/):

report home - 404


Screenshots captured by the preview-screenshot-gallery workflow.

Generated by Capture preview screenshots for PRs · ● 2.8M ·

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants