Very barebones Kotlin + Cucumber + Selenium starter kit.
It has a minimalist setup of getting these to work together and implements a very simple scenario with a basic Page Object Model implementation to make it work.
src/test/kotlin/com/arthur/features/basicSteps is the glue that implements the Gherkin Steps in Kotlin. src/test/kotlin/com/arthur/features/pages has the POM classes. src/test/kotlin/com/arthur/RunTests needed for running with JUnit. src/test/resources/com/arthur/features/basic.feature basic feature src/test/resources/chromedriver OSX chromedriver src/test/resources/geckodriver OSX geckodriver (Firefox)
Nothing fancy, opens the browser, goes to Amazon.com, searches for batteries, adds the first one on the list to the shopping cart, then goes to the shopping cart and removes it.
Just run the gradle task test
.
By default this will just open Chrome, but if you pass the -Ddriver=Firefox
as an argument to the task it will use Firefox instead.
The selection is not done in any fancy way, just an if driver==Firefox
kind of check, doing more than this was kind of beyond the point of this little repo.
Chrome was tested with version 84.0.4147 and Firefox was 79.0, the bundled drivers are compatible with those versions.
This was made to be run on OSX, that's why it has the OSX drivers in the resources, to run in another OS there are two simple ways:
- Edit
build.gradle
on lines 38 and 39 there are the paths to the drivers - Just overwrite the properties via command line with
-Dwebdriver.chrome.driver=src/path/to/driver
.