🐛 [TempuraTesting] UI tests fail on orientation change
umbertovolta opened this issue · comments
Steps to reproduce:
- Add 2 test functions which call
uiTest(testCases:context:)
on a context with different orientation - Run tests making sure to perform the previous two functions sequentially
- The last one to be run of the previous two functions will fail for
exceeded timeout
Description:
When running UI tests on contexts with different orientations, it is possible to see test functions failing for exceeded timeout.
This because the first test after changing orientation is blocked by the isViewReadyClosure
, which never returns true. In particular, because of the internal var isOrientationCorrect
.
In fact, what happens is that XCUIDevice.shared.orientation
is set too late, and the value of UIScreen.main.bounds.size
from the context
(used to set the snapshotConfiguration
) is wrong.
Suggested Fix:
When the context
's screenSize
is not specified, we should make sure to use the proper value (i.e. accessing UIScreen.main.bounds.size
only after setting XCUIDevice.shared.orientation
)
Notes:
TempuraTesting Version 7.0.0
┆Issue is synchronized with this Asana task by Unito
The PR linked above is a simple fix for this issue. Since it is not perfect, let's discuss if we like it.