Skip to content

fix: add explicit render waits to step_jobs screenshot generation#77

Merged
MaximumTrainer merged 1 commit intomainfrom
copilot/fix-missing-screenshots
Apr 17, 2026
Merged

fix: add explicit render waits to step_jobs screenshot generation#77
MaximumTrainer merged 1 commit intomainfrom
copilot/fix-missing-screenshots

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 17, 2026

17-run-job-modal.png and 19-job-logs.png were never generated because both interaction blocks in step_jobs() failed silently — try_click / wait_for_selector couldn't find the buttons, and bare except: pass swallowed all diagnostics.

Root cause: no wait for Vue to finish rendering job data after page navigation. networkidle can fire before onMounted API calls complete, leaving the job card (and its buttons) absent from the DOM.

Changes to verification/take_screenshots.py:

  • Wait for .job-card, .empty-state before interacting — ensures Vue's reactive update from the /api/workspaces/{id}/jobs response has landed in the DOM
  • Replace try_click("button:has-text('Run New Job')") with explicit wait_for_selector(state="visible") + click() for more reliable element detection
  • Increase "View Logs" timeout from 3s → 8s
  • Wait for .logs-section after clicking "View Logs" before capturing screenshot
  • Print [WARN] on failure instead of silent pass
# Before: no data-render wait, silent failures
shot(page, "16-jobs-list.png")
if try_click(page, "button:has-text('Run New Job')"):
    try:
        ...
    except Exception:
        pass  # silent

# After: explicit render gate, diagnostic output
page.wait_for_selector(".job-card, .empty-state", timeout=10_000)
shot(page, "16-jobs-list.png")
try:
    run_btn = page.wait_for_selector(
        "button:has-text('Run New Job')", state="visible", timeout=8_000
    )
    if run_btn:
        run_btn.click()
        ...
except Exception as exc:
    print(f"    [WARN] jobs: Run New Job modal failed: {exc}")

… diagnostics

Agent-Logs-Url: https://github.com/MaximumTrainer/OpenDataMask/sessions/a1a7af6f-359c-4a73-8473-bb4bcc442f7e

Co-authored-by: MaximumTrainer <1376575+MaximumTrainer@users.noreply.github.com>
Copy link
Copy Markdown

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

This PR improves the reliability of the Playwright-based UI screenshot generator by adding explicit DOM render “gates” in step_jobs() so screenshots for running a job and viewing logs are consistently captured after the Vue UI has actually rendered job data.

Changes:

  • Add an explicit wait for .job-card, .empty-state before attempting any job-page interactions.
  • Replace best-effort clicking with explicit wait_for_selector(state="visible") + click() for “Run New Job”.
  • Increase timeouts and add a post-click wait for .logs-section, and emit [WARN] messages instead of silently swallowing exceptions.

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

@MaximumTrainer MaximumTrainer marked this pull request as ready for review April 17, 2026 16:41
@MaximumTrainer MaximumTrainer merged commit d572dde into main Apr 17, 2026
14 checks passed
@MaximumTrainer MaximumTrainer deleted the copilot/fix-missing-screenshots branch April 17, 2026 16:46
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.

3 participants