Skip to content

Visual compare can screenshot before local stylesheets finish loading #2401

Description

@chubes4

Problem

wordpress.visual-compare can produce and classify a pixel diff while local linked stylesheets are still pending. waitForVisualComparePaintReady() caps its load wait and stylesheet wait at 10 seconds each, even when the command has a substantially larger wall timeout. Capture diagnostics then report pending stylesheets and low-confidence readiness, but the already-written screenshots continue into comparison as if they were conclusive.

This can create a false large layout delta when a pending stylesheet owns responsive visibility or geometry.

Expected behavior

  • Use a bounded stylesheet-readiness budget derived from the visual command timeout.
  • Preserve enough wall time for settling, snapshots, screenshots, and diagnostics.
  • Do not classify screenshots as conclusive visual evidence when required local stylesheets remain incomplete.
  • Cover delayed local stylesheet loading with deterministic tests.

Acceptance criteria

  1. A local stylesheet that completes within the derived readiness budget is applied before capture.
  2. A stylesheet that remains pending after the budget produces explicit incomplete-capture evidence rather than a misleading visual-diff classification.
  3. Existing external-request isolation and overall command bounds remain intact.

AI assistance

OpenAI GPT-5.6 Sol via OpenCode diagnosed the capture evidence, traced the owning implementation, and drafted this issue under human direction.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions