[misc] Fix flickering tests.

(cherry picked from commit 8be005543827b4068149771d90cd25f659263d5c)