I was trying to run a GEB test using Gradle; It works fine if I run everything from a method but fails if I use a helper function:
Scenario 1 that works:
def "Select ORG Unit and save the invoice and Delete it"() {
when: "We click arrivals drop-down link"
waitFor { inprogtoArrivals.isDisplayed() }
then: "Click on the Arrivals Tab"
waitFor { $('#arrivalsTab').find("a").click() }
Browser.drive {
go driver.currentUrl
}
waitFor { createInvoice.click() }
}
Scenario 2 that doesn't work:
def uploadInvoice() {
when: "We click arrivals drop-down link"
waitFor { inprogtoArrivals.isDisplayed() }
then: "Click on the Arrivals Tab"
waitFor { $('#arrivalsTab').find("a").click() }
}
def "Select ORG Unit and save the invoice and Delete it"() {
when:
uploadInvoice()
Browser.drive {
go driver.currentUrl
}
then:
waitFor { createInvoice.click() }
}
Here, it can't handle uploadInvoice()
and fails. Can anyone please help me to solve this issue?