How to find the cause
Run the test twenty times and read the failures. The same line failing each time is the assertion that does not wait.
Where flake is environmental
A slow server under test load answers late. Fix the wait in the test, and separately make the server warm before the suite starts.