Skip to content

Commit

Permalink
Upgrade to Scala 3
Browse files Browse the repository at this point in the history
 - #121
 - remove Scala 2.12 from support scala versions
 - upgrade Scala 2.13 to 2.13.6
 - add Scala 3.0.2 to support scala versions and make it the default version
 - upgraded sbt to 1.5.5
 - upgrade scalaTestSeleniumVersion to 3.2.9.0
 - upgraded playJsonVersion to 2.10.0-RC5 (no released version yet for Scala 3)
 - removed scala-collection-compat as it is no longer needed
 - rewrite HtmlElementGauge, WebClientExposingDriverConfigFixtures, AemTweaks and Gauge to be compatible with Scala 3
  • Loading branch information
DaniRey committed Oct 8, 2021
1 parent e6c53dc commit bac6d87
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 13 deletions.
11 changes: 5 additions & 6 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ import ScalaWebTestBuild._

import scala.xml.transform.RewriteRule

lazy val supportedScalaVersions = Seq("2.13.3", "2.12.12")
lazy val supportedScalaVersions = Seq("3.0.2", "2.13.6")

val projectVersion = "4.0.1-SNAPSHOT"
val scalaTestVersion = "3.2.9"
val scalaTestSeleniumVersion = "3.2.0.0"
val scalaTestSeleniumVersion = "3.2.9.0"
val seleniumVersion = "3.141.59"
val htmlUnitVersion = "2.41.0"
val slf4jVersion = "1.7.28"
val playJsonVersion = "2.9.0"
val playJsonVersion = "2.10.0-RC5"

val versions = Map("scalaWebTest" -> projectVersion, "scalaTest" -> scalaTestVersion, "selenium" -> seleniumVersion, "htmlUnit" -> htmlUnitVersion, "playJson" -> playJsonVersion)

Expand All @@ -26,8 +26,8 @@ lazy val root = (project in file("."))
lazy val commonSettings = Seq(
organization := "org.scalawebtest",
version := projectVersion,
scalaVersion := "2.13.3",
scalacOptions := Seq("-unchecked", "-deprecation", "-Xfatal-warnings"),
scalaVersion := "3.0.2",
scalacOptions := Seq("-unchecked", "-deprecation", "-Xfatal-warnings", "-rewrite", "-source:3.0-migration"),
publishMavenStyle := true,
publishTo := {
val nexus = "https://oss.sonatype.org/"
Expand All @@ -53,7 +53,6 @@ lazy val core = Project(id = "scalawebtest-core", base = file("scalawebtest-core
"org.seleniumhq.selenium" % "htmlunit-driver" % htmlUnitVersion,
"org.jsoup" % "jsoup" % "1.13.1",
"org.slf4j" % "slf4j-api" % slf4jVersion,
"org.scala-lang.modules" %% "scala-collection-compat" % "2.1.6"
)
)

Expand Down
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.3.13
sbt.version=1.5.5
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ trait AemTweaks {
def withWcmMode[X](mode: WcmMode): (X => Unit) => X => Unit = withWcmModeInternal(mode, _: X => Unit)

private def withWcmModeInternal[X](mode: WcmMode, f: X => Unit): X => Unit = {
x: X => {
(x: X) => {
setWcmModeCookie(mode)
try {
f(x)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ trait WebClientExposingDriverConfigFixtures {
def withJavascript[X](f: X => Unit): X => Unit = withJavascript(f, enabled = true)

private def withFollowingRedirectsInternal[X](f: X => Unit, enableRedirects: Boolean): X => Unit = {
x: X => {
(x: X) => {
val webClientExposingDriver = asWebClientExposingDriverOrError(webDriver)
val redirectionEnabled = webClientExposingDriver.getOptions.isRedirectEnabled
webClientExposingDriver.getOptions.setRedirectEnabled(enableRedirects)
Expand All @@ -71,7 +71,7 @@ trait WebClientExposingDriverConfigFixtures {
}

private def withCssInternal[X](f: X => Unit, enableCss: Boolean): X => Unit = {
x: X => {
(x: X) => {
val webClientExposingDriver = asWebClientExposingDriverOrError(webDriver)
val wasEnabled = webClientExposingDriver.getOptions.isCssEnabled
webClientExposingDriver.getOptions.setCssEnabled(enableCss)
Expand All @@ -84,7 +84,7 @@ trait WebClientExposingDriverConfigFixtures {
}

private def withJavascript[X](f: X => Unit, enabled: Boolean): X => Unit = {
x: X => {
(x: X) => {
val webClientExposingDriver = asWebClientExposingDriverOrError(webDriver)
val jsEnabled = webClientExposingDriver.getOptions.isJavaScriptEnabled
webClientExposingDriver.getOptions.setJavaScriptEnabled(enabled)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import org.openqa.selenium.{JavascriptExecutor, WebDriver, WebElement}
import org.scalawebtest.core.gauge.FragmentParser.parseFragment

import scala.jdk.CollectionConverters._
import scala.language.reflectiveCalls
import scala.reflect.Selectable.reflectiveSelectable
import scala.xml.NodeSeq


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ case class Gauge(testee: JsValue, fitValues: Boolean, fitArraySizes: Boolean, ig
case s: JsString => fitsString(json, breadcrumb, s)
case b: JsBoolean => fitsBoolean(json, breadcrumb, b)
case JsNull => fitsNull(json, breadcrumb)
case _ => fail("Invalid element in gauge definition")
case null => fail("Invalid element in gauge definition")
}
}

Expand Down

0 comments on commit bac6d87

Please sign in to comment.