XCTestCase: Wait for app to idle

前端 未结 2 1434
故里飘歌
故里飘歌 2021-02-02 14:53

My UI-test fails because the test waits endless until the app idles. I can not see that there is anything happening in the background, like a loading spinner.

It just oc

2条回答
  •  走了就别回头了
    2021-02-02 15:25

    Perhaps you have some animation or some other background (or foreground) activity that updates your UI on the main thread frequently. This causes the app to never be "quiesce" - at least on this tab. In our application we had UIView animation with option Repeat. CPU usage was fine and it wasn't a battery drain, but it made the test fail every time. Disabling the animation fixed the issue. I couldn't find a way to force the test not to wait to be idle, so we ended up disabling the animation using #ifdef for the UI test target using runtime arguments as described here: https://stackoverflow.com/a/33466038/168996

提交回复
热议问题