This is my gebish test and I don't know why it doesn't work.
def "create 9 more names"(){
def i = 0
8.times{
$("button", value:"newCat").click()
waitFor { $("input", name:"name") }
$("input", name:"name") << "gebTest"
$("input", name:"create").click()
waitFor { $("h1", text:"Show New Name") }
$("a", text:"new name").click()
waitFor {$("h1.title").text() == "Names"}
expect: at NewNamesPage
i++
}
}
This test does work:
def "create name"() {
$("button", value:"newCat").click()
waitFor { $("input", name:"name") }
$("input", name:"name") << "gebTest"+i
$("input", name:"create").click()
waitFor { $("h1", text:"Show New Name") }
$("a", text:"new name").click()
waitFor {$("h1.title").text() == "Names"}
expect: at NewNamesPage
}
So it seems to not like the spock block:
8.times {
//do something 8 times
}
I have also tries it with a for loop. It doesn't even start the loop.
Any ideas?