#testing

Usually Mockito provides methods with timeout,
verify(…, timeout(…). But often it is not useful.
Thread.sleep() is a bad practise and may not work in some situations. Also it waits concrete amount of time (e.g 3000ms) and will always wait this interval, even if the operation took 300ms.

A nice solution to the problem is using the test dependency Awaitility.
It is extremely easy to use, has a fluent API, polls regularly and is configurable, so every test can be optimised.
The idea behind it, is that it polls every 100ms (by default, but configurable) and after 10sec (also by default and configurable) it announce the test failed if the condition is not met.

await()
.atLeast(1, SECONDS)
.atMost(5, SECONDS)
.until(imageInCdnIsDeleted(imageUrl));

So, instead of waiting every time 10 minutes for test to finish, because of the sleep time, the suite will finish for the (near) max time required for the operations. For example it may finish for 3.5minutes, but also for 8minutes.

iOS WebView HTML video element inconsistency

Setting up a webview for iOS with a video element tag acts differently on iPhones and iPads. On iPhones when you play the video the video will be shown in fullscreen with the fullscreen video controler, on the other hand playing a video on the iPads will not play the video in fullscreen mode, it will play it in a container how the css specifies it.
Subscribe to #testing