appfolio / ae_page_objects

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

Backport Capybara.wait_until #144

Closed dtognazzini closed 8 years ago

dtognazzini commented 8 years ago

Addresses #99

dtognazzini commented 8 years ago

@ipmsteven, @pkmiec

Hey guys. I'm curious what your thoughts are on these changes.

wait_until is the same code from Capybara 1, which is often very useful when writing page objects code where you need to wait for a condition to occur over several elements. Following the removal of wait_until from Capybara 1, most folks have moved this type of waiting into the test suites, which is a good idea and something we've done as well. Still, sometimes you need to perform waiting actually in page object code.

poll_until is pretty much the same thing as wait_until, but zeroes-out the per-node waiting, which is super useful when asking questions like "is this node absent/present/visible/hidden right now?" and you don't want to wait. poll_until is also used for "document loading" when looking across multiple windows. I was struggling finding a good name for poll_until. My thought was that by ignoring the per node waiting, the user wants to do something like poll the page, but not wait for any particular element. Whereas wait_until implies waiting for an arbitrary condition to occur, poll_until implies polling the page for a condition, which is signified by zeroing-out the per node wait time.

dtognazzini commented 8 years ago

After talking with @pkmiec, we concluded that the poll_until functionality, while useful internally to AePageObjects, doesn't have use externally. I've made some changes to hide it.

ipmsteven commented 8 years ago

👍