test(android): bound the screenshot write wait by wall time, not event-loop turns

Merged
TH
2mo ago
+4-2

Summary

screenshotAndroid drops a display rotation probe still running after the capture flaked on Coverage CI (run, on #3241, which doesn't touch this code). It failed with "the capture must start one grace timer once written".

The test waits for the real PNG write, which runs on the libuv thread pool, before asserting that the 250 ms grace timer is installed. It allowed a fixed 1,000 setImmediate turns, but a loaded thread pool can need more than that. The wait is now bounded by wall time (10 s, performance.now(), which the fake timers don't touch, since only setTimeout/clearTimeout are faked). The assertions are unchanged.

Validation

  • Reproduced locally by holding the thread pool for about 300 ms (UV_THREADPOOL_SIZE=1 plus one pbkdf2 call) during the capture. The old test fails with the CI assertion; the new one passes.
  • pnpm check:affected --run passed.

🤖 Generated with Claude Code