Skip to content

Fix the screenshot tests all photographing the same view - #695

Merged
hannesa2 merged 2 commits into
masterfrom
capture-a-distinct-view-per-test
Sep 19, 2026
Merged

hannesa2 merged 2 commits into
masterfrom
capture-a-distinct-view-per-test

Conversation

@goneng

@goneng goneng commented Sep 19, 2026

Copy link
Copy Markdown
Collaborator

Have each screenshot test reach its view and prove it arrived, so the
suite covers three screens instead of one screen three times.

Closes #676.

The suite produced four PNGs but only two distinct images: main-window,
history-view and staging-view were byte-identical. The staging test
looked for a toolbar button named "Stage", which has never existed - the
Stage view is a sidebar item (PBSourceViewStageItem). On the miss it
fell through and photographed the unchanged history view under the
staging name, so a regression confined to the staging view could not be
caught, and any change to the shared window reported as three
differences.

  • Switch views through the View menu, which is where both views are
    actually reachable from.
  • Assert the destination is on screen before the shutter, so a missed
    switch fails the run instead of quietly yielding a duplicate.
  • Drop the capture from testMainWindowExists and keep it as a launch
    assertion, the main window being the history view already.
  • Select the history view in the context menu test too, since reaching
    the Stage view persists PBShowStageView and so decides what the next
    launch opens on.
  • Name extracted files after the attachment rather than its position in
    the walk, so a skipped capture no longer renumbers every file after it.

Test plan

  • make ui-test passes all four tests locally.
  • Three files extract, with three distinct SHA-256 hashes, where the
    same run previously gave four files and two distinct hashes.
  • staging-view.png now shows the Stage sidebar selection with the
    Unstaged Changes, Commit Message and Staged Changes panes, confirmed
    by eye; history-view.png shows the commit graph.

Expect one round of baseline churn

The screenshot comparison on this pull request will report the whole set
as changed, for two stacked reasons: the image set itself changes, and
the workflow extracts the baseline with the base commit's copy of
extract_screenshots.py, so the baseline side is still index-prefixed
while this side is not. Both settle once this is on master.

@goneng goneng added bugfix pipeline CI pipeline labels Sep 19, 2026
@goneng
goneng marked this pull request as ready for review September 19, 2026 16:52
@hannesa2

Copy link
Copy Markdown
Contributor

Thank you for the pull request.

One thing I found here, that the 3 new screenshots (the bottom 3 ones)
image
are complete ignored here. This is not a bug !

@hannesa2 hannesa2 mentioned this pull request Sep 19, 2026
@hannesa2

Copy link
Copy Markdown
Contributor

One thing I found here, that the 3 new screenshots (the bottom 3 ones) image are complete ignored here. This is not a bug !

This #696 fixes it

@hannesa2
hannesa2 self-requested a review September 19, 2026 18:18
@hannesa2
hannesa2 force-pushed the capture-a-distinct-view-per-test branch from 0ecba1a to 99203a8 Compare September 19, 2026 18:47
@hannesa2

Copy link
Copy Markdown
Contributor

I rebased (temporary) it to #696 (Detect new screenshots) to test the detection of new screenshots

hannesa2
hannesa2 previously approved these changes Sep 19, 2026

@hannesa2 hannesa2 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

But please wait till "Detect new screenshots" - #696 is merged.

@hannesa2
hannesa2 force-pushed the capture-a-distinct-view-per-test branch from 99203a8 to 7ca988c Compare September 19, 2026 19:42
Have each screenshot test reach its view and prove it arrived, so the
suite covers three screens instead of one screen three times.

- Switch views through the View menu, which is where the Stage view is
  reachable from. The toolbar button the staging test looked for has
  never existed, so that test always fell through and photographed the
  history view under the staging name.
- Assert the destination is on screen before the shutter, so a missed
  switch fails the run instead of quietly yielding a duplicate.
- Drop the capture from testMainWindowExists and keep it as a launch
  assertion, the main window being the history view already.
- Select the history view in the context menu test too, since reaching
  the Stage view persists PBShowStageView and so decides what the next
  launch opens on.
Drop the discovery-order prefix from the extracted filenames, so that a
test skipping its capture no longer renumbers every file after it and
makes the next comparison report the whole set as changed.

- Name each file after its attachment.
- Add a numeric suffix only where two attachments share a name.
@goneng
goneng force-pushed the capture-a-distinct-view-per-test branch from 7ca988c to ef43669 Compare September 19, 2026 19:58
@hannesa2

Copy link
Copy Markdown
Contributor

Screenshot differs: emulatorApi=arm64 with 3 screenshot(s)

setpoint (old) | diff | actual screenshot (new)

scripts/Screenshots-arm64/commit-context-menu.png (new screenshot)
screenshot

scripts/Screenshots-arm64/history-view.png (new screenshot)
screenshot

scripts/Screenshots-arm64/staging-view.png (new screenshot)
screenshot

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Screenshot tests capture the same view three times

2 participants