One of the most common issues we have with browser tests is things failing due to JS not having loaded.
Something like:
Given I am on the X page
And I click the open JS overlay button
Then I see an overlay
In this case if I click the open JS overlay button executes before the overlay JavaScript has loaded the latter step (or this step) will fail.
To remedy this in MobileFrontend and QuickSurveys we run the following snipper of JS to see if the module is ready
'mw.loader.getState("ext.quicksurveys.init") === "ready";'
We'd like to formalise this in the Selenium library.