I am automating my project using Geb and Groovy. For Example: I am logging into Gmail and I define different Pages as - Inbox, Sent Item, Trash, Drafts, etc. Now in my spec I wanted to access an external website like yahoomail. How can I define it the spec to access an external Webiste. I use "go" to navigate to yahoo mail as below in my spec
then: "I go to Yahoo mail page"
go "https://login.yahoo.com/"
and: "Signing into Yahoo mail "
at YahooLoginPage
In the YahooLoginPage.groovy it is not finding the Next button which I define as static at
static at = { $("#login-signin") }
Error message I get :
Condition not satisfied:
|
null
Is there any other way to do this?
The problem is that you are using a method which has a void return type in a then:
Spock block. Every statement is asserted in then:
blocks and that method call evaluates to null
because of its return type and hence the failure you're getting.
Basically you should not use Geb's go()
method in a then:
- use it in in a given:
or when:
block instead.