Given this page:
class SomePage {
...
static content = {
button(required: false) { $('.some-incorrect-selector').module(SomeButtonModule) }
...
}
}
and given this Spec:
class SomeSpec {
def 'Clicking on the button should take user to AnotherPage' () {
given:
def page = to SomePage
when:
page.button.click()
then:
at AnotherPage
}
}
Expected behaviour:
An exception should be thrown when the button element is missing and can't be clicked.
Actual behaviour:
When the button doesn't exist on SomePage the test is still reaching the at check for AnotherPage