Skip to content

electroma/selenide-kotlin-wrapper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DSL to simplify Selenide Test scenarios creation in Kotlin language

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:

  • Concise syntax

  • Code completion simply works (at least in Idea)

  • Integrated Truth-based Spock-like checks

  • Page and module objects with lazy evaluation

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 }
}

About

DSL to simplify Selenide Test scenarios creation in Kolin language

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages