Motivation: replace Groovy-based GEB builders with Selenide-based typed Kotlin DSL
Why not to use Geb builders?
-
Groovy future is not clear
-
Type safety helps even in tests (closure annotations are not enough + Geb is based on methodMissing)
-
Compilation time matters
Features:
Example scenario code:
goto(HomePage()) {
searchFor("Kotlin")
verify("Suggestions appear and contain Island").waitForCheck {
that(suggestions).containsAllOf("Kotlin", "Kotlin Island")
}
submitSearch()
}
at(WikiMultiPage("Kotlin")) {
verify("There are several results, including island and language")
.that(results.topics)
.containsAllOf("Kotlin Island", "Kotlin (programming language)")
results["Kotlin (programming language)"]!!.click()
}
Example module:
class SearchResults(override val rootSupplier: () -> SelenideElement) : Module {
private val resultLinks by eq { root.findAll("a") }
val topics by eq { resultLinks.map { it.title() } }
operator fun get(title: String) = resultLinks.find { it.title() == title }
}