The improvements consist of the following main parts:
Use FluentWait instead of just assertions (
For those situations we should use FluentWait with our convenience methods waitUntil and assertEventually. There we have the possibility to describe the status we expect to reach, like the status indicator after a publication to turn green, as a condition and the selenium framework evaluates it periodically until met.
Rely on explicit instead of implicit waits (
Selenium FluentWaits are considered explicit waits because we declare a condition we are looking for, for a certain amount of time which could be individually configured. Selenium provides another way to wait for elements in the DOM with implicit waits which are used globally. That wait or timeout is used whenever the DOM is queried for an element by the driver.
Implicit waits do not ideally work in more complex situation because they work when querying the DOM tree and not when waiting for derived attributes like displayed or combinations of conditions. This is why we have FluentWaits.
Because implicit and explicit timeouts influence each other (see
MGNLCE-89 for more details) they should not be used simultaneously.
Incorrect use of appIsLoaded() condition (
We used the condition appIsLoaded() as general wait if something is happening condition. This worked ... but only by accident. The condition was implemented incorrect for most situations but instead of failing it turned into a delay(10). Because this is quite expensive in the end we have to use appropriate conditions instead of appIsLoaded()
There are other small changes ... best have a look at the PR.
Most notable is probably the use of a correct log4j.xml which directs all log messages during the tests into a log file. JUnit and Selenium messages are still displayed as expected.