Highlights of this release
Update from ScalaWebTest < 3.0.0
For #12 we redesigned our configurations and replaced IntegrationSettings.host and IntegrationSetting.projectRoot with the method Configuration.useBaseUri(uri: String), which can be accessed as config.useBaseUri(uri).
In your tests replace the following or similar
override val host = my.server:8080
override val projectRoot = "/myapp"
config.useBaseUri("http://my.server:8080/myapp")
override val loginPath = "/login"
loginConfig.useLoginUri("http://my.server:8080/login")
org.scalatest.ConfigMap
parameter. You have to adapt the signature of beforeLogin
, login
, afterLogin
,
as well as beforeAll
and afterAll
accordingly.
For example
override def login(): Unit =
override def login(configMap: ConfigMap): Unit =
With #90 we removed org.scalawebtest.core.gauge.Gauge (which was deprecated since 1.1.0). Simply replace your import with org.scalawebtest.core.gauge.HtmlGauge.
Configuration can be provided via Runner arguments or environment variables
With #12 we added the ability to configure ScalaWebTest via Runner arguments or environment variables. The latter is especially useful when using docker. config.baseUri can be overwritten by runner argument scalawebtest.base.uri or environment variable SCALAWEBTEST_BASE_URI. The same is true for loginConfig.loginUri with scalawebtest.base.uri and SCALAWEBTEST_BASE_URI
Any Selenium WebDriver can be used
HtmlUnit remains the default WebDriver. It is the best way to start, because no additional setup on the host is required. For JavaScript heavy applications, HtmlUnit is not the best solution. Chrome support is part of ScalaWebTest, for other WebDrivers one might take inspiration from our Chrome implementation. To use Chrome, extend org.scalawebtest.core.browser.SeleniumChrome and provide the path to the ChromeDriver via run argument webdriver.chrome.driver or the environment variable WEBDRIVER_CHROME_DRIVER. Alternatively you may start the Chrome Driver Service yourself and provide webdriver.chrome.driver.service.url respectively WEBDRIVER_CHROME_DRIVER_SERVICE_URL. Additionally the Webdriver arguments can be changed with webdriver.chrome.arguments respectively WEBDRIVER_CHROME_ARGUMENTS
Support Scala 2.13, drop support for Scala 2.10
With #72 we added support for Scala 2.13 and dropped support for Scala 2.10
Accessor methods for HTTP Response Code and Response Headers
With HtmlUnit we have access to Response Code and Response Headers. With #21 we addd convenience methods to access this information via org.scalawebtest.core.ResponseAccessors. As this information is not available over the WebDriver API, this feature can only be used with HtmlUnit. It is no problem to use multiple browsers in one set of integration tests.
Improved readability with currentPage
With #83 we added the currentPage keyword. This allows to rewrite tests from.
import org.scalawebtest.core.gauge.HtmlGauge._
"Homepage" should "contain a title" in {
fits(<h1>title</h1>)
}
"Homepage" should "contain a title" in {
currentPage fits <h1>title</h1>
}
All changes in detail
Review the closed issues of Milestone 3.0.0 on github, for a detailed list with all changes.