Je travaille avec des tests sur geb
et j'ai un problème. J'ai besoin de sauvegarder/imprimer l'adresse de la page courante (fonction SaveUrl()
).
Test de Spock :
class TestSpec extends GebReportingSpec {
def "Google"() {
given: "go to google.com"
to GooglePage
when: "we at Google home page"
at GooglePage
then: "Search Yahoo"
Search("Yahoo")
SaveUrl()
}
}
GooglePage :
class GooglePage extends Page {
static url = "http://www.google.by"
static at = { $("title").text() == "Google"}
static content = {
theModule { module SearchModule }
}
def Search(String arg0) {
theModule.field.value(arg0)
theModule.search.click()
}
def SaveUrl() {
// need implement
}
}
Modile :
class SearchModule extends Module {
static content = {
field { $("input", name: "q") }
search { $("input", name: "btnK") }
}
}
Aidez-nous à sauvegarder/imprimer l'URL actuelle.
Merci de votre attention !