Skip to content

Look for the cancelled-screenshots toast as it shows - #402

Merged
SunkenInTime merged 3 commits into
mainfrom
t3/screenshot-cancel-test
Oct 28, 2026
Merged

SunkenInTime merged 3 commits into
mainfrom
t3/screenshot-cancel-test

Conversation

@SunkenInTime

@SunkenInTime SunkenInTime commented Oct 28, 2026 •

Copy link
Copy Markdown
Owner

page_screenshots_test "only Stop ends a capture" failed on and off on Windows: in CI's windows-test lane and locally, including twice in a row on main on Oct 20. It came up again on #399, whose extra work per frame made it fail more often (locally 2 out of 3 runs on that stack, 3 out of 3 passes on main).

Cause: the "Screenshots cancelled." toast is shown while the test waits in real time (runAsync) for the dialog to close, so the toast's 3-second auto-close timer runs on real time. That breaks the test in two ways:

  • The toast was gone before the check. Timed runs put the toast at about 3.0 s and the final check at about 5.1 s, under a second of margin, and a slow runner closed it first.
  • Once that was fixed, CI showed the second way: the toast closed itself after the test ended, on a torn-down tree ("AnimationController.dispose() called more than once"). Dismissing it at the end of the test was too late, because its real-time removal could already be under way.

Fix: the test takes the toast away the moment it sees it, while waiting for the dialog to close. That stops its real-time timer, so its removal runs on the test's clock and finishes inside the test. The app is unchanged.

Checked:

ci: test desktop

"only Stop ends a capture" failed on and off on Windows: the toast is shown
while the test waits in real time for the dialog to close, so its 3-second
timer runs on real time, and a slow run let it close before the check. The
test now notes the toast while it waits, as the user would see it.
@coderabbitai

coderabbitai Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: da19b995-cf6f-49c9-89a9-c088468c6d6a
Commits

Reviewing files that changed from the base of the PR and between bb7ccaf and 85a7841.

Files selected for processing: 1
  • test/page_screenshots_test.dart

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

Walkthrough

The screenshot cancellation test now records whether the “Screenshots cancelled.” toast appears while the save dialog closes. It checks whether the toast appeared during the wait instead of requiring it to remain visible afterward.

Changes: Screenshot cancellation test

Layer / File(s) Summary
Observe cancellation toast during close
test/page_screenshots_test.dart
The test pumps real and test time while the dialog closes, records whether the cancellation toast appears, and asserts that it was observed during the wait.

Priority: Low

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Other

Possibly related PRs

Merge Risk: Minimal · up to 85a78

The test-only timing change has no identified merge-blocking risk.

Pre-merge checks: Passed 4
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title describes the main change: checking for the cancelled-screenshots toast while it appears. The wording is slightly awkward but remains clear and relevant.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Finishing Touches
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Its timer runs on real time, so on CI it fired after the test and removed
the toast from a torn-down tree (AnimationController disposed twice).
Dismissing it at the end was too late: its closing timer runs on real time
and could already have started removing it, which finished after the test on
a torn-down tree. Taken away when it shows, its removal runs on the test's
clock and is done before the test ends.
@SunkenInTime
SunkenInTime merged commit 696a5f2 into main Oct 28, 2026
14 checks passed
@SunkenInTime
SunkenInTime deleted the t3/screenshot-cancel-test branch October 28, 2026 01:56
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.

1 participant