How are people handling flaky snapshot behavior wh...
# squarelibraries
r
How are people handling flaky snapshot behavior when using Paparazzi? I'm seeing a number of flaky snapshot failures where tests behave differently when run in isolation versus as part of a larger suite. When run individually, the snapshots are correct, but when run together, I sometimes get different images (because of test ordering, frame capture timing etc..) I have
LocalCursorDisabled
set to
false
, but cursor visibility is still flaky. From what I understand,
LocalCursorDisabled
doesn't actually hide the cursor - it just disables blinking, which leaves the cursor visible all the time. I've come across a few issues in the Paparazzi repository requesting APIs to allow taking snapshots after reaching a certain state or after waiting for the UI to stabilize. That made me wonder - how are people handling these kinds of scenarios today? Are there any recommended patterns or workarounds for making Paparazzi snapshot tests more deterministic?
s
I have
LocalCursorDisabled
set to
false
, but cursor visibility is still flaky. From what I understand,
LocalCursorDisabled
doesn't actually hide the cursor - it just disables blinking, which leaves the cursor visible all the time.
I'm surprised this is causing flakes. Is paparazzi generating screenshots without the cursor for you?
I'm seeing a number of flaky snapshot failures where tests behave differently when run in isolation versus as part of a larger suite. When run individually, the snapshots are correct, but when run together, I sometimes get different images
Could this be related? https://github.com/cashapp/paparazzi/issues/1867
r
Is paparazzi generating screenshots without the cursor for you?
It generates the cursor/caret when the test is executed in isolation (i.e., just that test class), but the cursor is missing when it's executed as part of a larger test suite. The composable under test, uses an effect-handler (LaunchedEffect/SideEffect) to request focus. My assumption is that this is likely the cause - that Paparazzi is taking the snapshot before the recomposition completes or before the focus request has finished processing.
Could this be related? github.com/cashapp/paparazzi/issues/1867
Looks like the fix for this was released in
2.0.0-alpha05
. I am able to reproduce it in same latest version.