A Simple template repository to showcase usage of Selenium tests using ScalaTest framework with Page Object Pattern way of organizing tests.
ScalaTest is the most flexible testing tool in the Scala ecosystem. With ScalaTest, you can test Scala, Scala.js (JavaScript), and Java code. ScalaTest includes a DSL for writing browser-based tests using Selenium.
To understand about the folder structure of this Scala project, please refer this blog post
We use sbt
as a build tool. It is an open-source build tool for Scala and Java projects, similar to
Apache's Maven and Ant.
Please follow the instructions to install sbt
on your machine
and available in PATH
Just like in any other project, the first step is to add selenium dependency to the build file(sbt) using
libraryDependencies += "org.seleniumhq.selenium" % "selenium-java" % "3.141.59" % "test"
To demonstrate the implementation of page object pattern we use two application here, Google Search and Spree Demo website. Note that we don't use Page Factory pattern here as its going to be deprecated.
The tests are located here and the pageobject classes are located here
sbt test
You could use Scala for Eclipse or IntelliJ Idea Community with Scala plugin
References: