appfolio / ae_page_objects

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

Fix exception contracts #184

Open dtognazzini opened 8 years ago

dtognazzini commented 8 years ago

2 changes:

  1. Node delegates some methods to the underlying Capybara node. These delegations nest Capybara::ElementNotFound under AePageObjects::LoadingElementFailed. AePageObjects::LoadingElementFailed indicates that an AePageObjects::Element failed to load. Capybara::ElementNotFound indicates that a Capybara element failed to be found. The Capybara exception should only be nested under the AePageObjects exception when the Capybara exception is the cause for an AePageObjects element failing to load.
  2. Replaced use of find() delegation in Node with node.find(). In every case, Node wants to find the underlying Capybara element. Before this change, subclasses could define a find method and override the behavior in Node of finding the underlying Capybara node. For example, AePageObjects::Collection does this today. Subclasses should be able to define methods without overriding this behavior.