Skip to content

💡 [REQUEST] - Add visual regression testing with Playwright screenshots #129

@righ

Description

@righ

Summary

Layout regressions like unwanted scrollbar appearance, element clipping, or overlay misalignment cannot be detected by interaction-based e2e tests alone. In the 3.0.4 cycle, the scrollbar regression at sheet edges was only found through manual testing. Introduce Visual Regression Testing (VRT) using Playwright's built-in toHaveScreenshot() to catch these automatically.

Reference Issues

No response

Basic Example

Append screenshot assertions to existing e2e tests to avoid additional URL accesses:

// At the end of an existing test
await expect(page.locator('.gs-tabular')).toHaveScreenshot();

Priority targets:

  • Sheets where content fits exactly (scrollbar edge cases)
  • Cell selection at right/bottom edges
  • Overlay positioning after CSS resize
  • Autofill handle visibility

CI environment should be fixed (e.g., Docker / GitHub Actions Linux) for consistent scrollbar rendering and font baselines.

Drawbacks

  • Environment dependency — Screenshot baselines are OS/DPR-specific. CI must use a fixed environment, and local runs may not match.
  • Baseline maintenance — Intentional visual changes require updating committed baseline images.
  • Threshold tuning — Anti-aliasing differences may cause flakiness; a small maxDiffPixelRatio tolerance may be needed.

Unresolved questions

  • Which CI environment to standardize on (Docker image, browser version)?
  • How much tolerance (maxDiffPixelRatio) is appropriate to avoid false positives?
  • Should baselines live in the repo or be stored as CI artifacts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions