Cucumber browser automation with Kotlin

Submitted by Dickens A S on Wed, 11/06/2019 - 15:45

Kick start browser automation in cucumber using kotlin

System.setProperty("webdriver.chrome.driver", System.getProperty("user.dir")+"\\driver\\chromedriver.exe")
driver = ChromeDriver()

Given("I am on the Google search page") {
   driver.get("https:\\www.google.com")
}

GitHub https://github.com/dickensas/kotlin-gradle-templates/tree/master/cucumber

Use the above to do a google search using Selenium WebDriver and Gherkin feature

KotlinX HTML with coroutines

Submitted by Dickens A S on Mon, 11/04/2019 - 16:10

use KotlinX with coroutines to create a delay in HTML rendering

GitHub https://github.com/dickensas/kotlin-gradle-templates/tree/master/coroutines-html

var detectDiv = GlobalScope.launch {
	delay(2000L) //wait for 2 second browser ready hack
	val myDiv = document.create.div {
		p { +"some text " }
		div { +"my div tag" }
	}

	var root = document.getElementById("root")
	root?.append(myDiv)
}

 

Kickstart Kotlin Web Assembly with Spring Boot

Submitted by Dickens A S on Sun, 11/03/2019 - 13:22

Easily create Kotlin Web Assembly project from these multiplatform boilerplate Gradle DSL

GitHub https://github.com/dickensas/kotlin-gradle-templates/tree/master/sboot-wasm

Kotlin Code

package wasm

fun main() {
    println("Hello World!")
}

JavaScript Code

No need to write JavaScript code simply put this HTML

Kickstart kotlin code and run in browser using CDN

Submitted by Dickens A S on Fri, 11/01/2019 - 13:57

Easily create kotlin project from these boilerplate Gradle DSL  Run in browser without additional JS packaging scripts

the Kotlin dependency is added in browser using below CDN

<script src="https://cdn.jsdelivr.net/npm/kotlin@1.3.50/kotlin.js"></script>

Source code available in GitHub