appfolio / ae_page_objects

Page Objects for Capybara
MIT License
28 stars 9 forks source link

xw - increase wait_until time when loading a page #195

Open weixing2014 opened 7 years ago

weixing2014 commented 7 years ago

This change is due to some flakey tests I found in my project.

In short, it's possible that DocumentLoader tries to load an AePageObject document before the AePageObject document is ready, especially when the document takes more than 5 seconds to load Under such a circumstance, it throws an exception like below:

Minitest::UnexpectedError: AePageObjects::DocumentLoadError: Couldn't find document with type in ["PropertyPageObjects::Reports::BufferedGeneralLedgerPage"] in any of the open windows: [{:window_handle=>"{cbf5df5a-b2db-cc41-a073-c50b3220aeaa}", :document=>"#<PropertyPageObjects::Reports::Responsive::TwelveMonthIncomeStatementPage:0x007f8b148c5400>"}, **{:window_handle=>"{e867c2a5-24d0-7342-a872-ee2176356988}", :document=>"<none>"}**]

To fix this issue, I set the default loading time to 10 seconds when DocumentLoader tries to load an AePageObject document. This change should be able to fix the most flakey tests (I'll be surprised if any page requires more than 10 seconds to load) and to avoid the similar flakey cases in the future.