Gizmo seeks to remove complexity in your testing framework by establishing common page model helpers to enable you to write neat, simple tests.
Whether it is Cucumber, RSpec or any other test framework, the underlying principle of Gizmo is the same: abstracting the amount of application specific code that defines your pages so you can focus on building robust and reliable tests.
The true power of Gizmo comes to the fore when generating your page mixins. Instead of convoluted and elaborate page selectors, you can target elements of your page with ease and precision.
Traditionally when testing against generated HTML an rspec or cucumber test would use CSS or xpath selectors to determine whether a particular item is present. At worst, a test would simply check for the existence of a key string in the entire page’s output.
Gizmo enables the developer to abstract these CSS and xpath selectors in to a separate mixin class, reducing copy/paste code and improving readability.
For example of, here’s what our code looks like before using Gizmo and a page model:
Here’s what the same test looks like after we’ve abstracted out our selectors:
And the associated mixin:
Simply specify your page selectors and reuse throughout your testing framework.