Skip to content

Commit a431d10

Browse files
authored
Merge pull request #12 from scalatest/feature-3.2.0.0
Release 3.2.0.0
2 parents 6a60621 + 0434d50 commit a431d10

File tree

7 files changed

+46
-33
lines changed

7 files changed

+46
-33
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
*.log
33
target/
44
.idea/
5+
_site/

build.sbt

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ developers := List(
2424
)
2525

2626
scalaVersion := "2.13.2"
27-
crossScalaVersions := List("2.10.7", "2.11.12", "2.12.11", "2.13.2")
27+
crossScalaVersions := List("2.10.7", "2.11.12", "2.12.11", "2.13.2", "0.24.0")
2828

2929
libraryDependencies ++= Seq(
3030
"org.scalatest" %% "scalatest-core" % "3.2.0",
@@ -36,6 +36,8 @@ libraryDependencies ++= Seq(
3636
"org.scalatest" %% "scalatest-shouldmatchers" % "3.2.0" % Test
3737
)
3838

39+
Test / scalacOptions ++= (if (isDotty.value) Seq("-language:implicitConversions") else Nil)
40+
3941
import scala.xml.{Node => XmlNode, NodeSeq => XmlNodeSeq, _}
4042
import scala.xml.transform.{RewriteRule, RuleTransformer}
4143

@@ -91,11 +93,17 @@ publishArtifact in Test := false
9193

9294
pomIncludeRepository := { _ => false }
9395

94-
credentials += Credentials(Path.userHome / ".ivy2" / ".credentials")
95-
96-
pgpSecretRing := file((Path.userHome / ".gnupg" / "secring.gpg").getAbsolutePath)
96+
pomExtra := (
97+
<scm>
98+
<url>https://github.com/scalatest/scalatestplus-selenium</url>
99+
<connection>scm:git:git@github.com:scalatest/scalatestplus-selenium.git</connection>
100+
<developerConnection>
101+
scm:git:git@github.com:scalatest/scalatestplus-selenium.git
102+
</developerConnection>
103+
</scm>
104+
)
97105

98-
pgpPassphrase := None
106+
credentials += Credentials(Path.userHome / ".ivy2" / ".credentials")
99107

100108
scalacOptions ++= Seq(
101109
"-deprecation",

project/build.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
sbt.version=1.2.8
1+
sbt.version=1.3.12

project/plugins.sbt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.1")
2-
3-
addSbtPlugin("com.geirsson" % "sbt-ci-release" % "1.2.2")
1+
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "2.0.1")
42

53
addSbtPlugin("com.typesafe.sbt" % "sbt-osgi" % "0.9.4")
4+
5+
addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "0.4.1")

src/main/scala/org/scalatestplus/selenium/WebBrowser.scala

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1888,18 +1888,18 @@ trait WebBrowser {
18881888
*/
18891889
def clear(): Unit = { underlying.clear() }
18901890
}
1891-
1892-
trait ValueElement extends Element {
1893-
val underlying: WebElement
18941891

1895-
def checkCorrectType(isA: (TagMeta) => Boolean, typeDescription: String)(implicit pos: source.Position): Unit = {
1896-
if(!isA(TagMeta(underlying)))
1897-
throw new TestFailedException(
1892+
private def checkCorrectType(underlying: WebElement, isA: (TagMeta) => Boolean, typeDescription: String)(implicit pos: source.Position): Unit = {
1893+
if(!isA(TagMeta(underlying)))
1894+
throw new TestFailedException(
18981895
(_: StackDepthException) => Some("Element " + underlying + " is not " + typeDescription + " field."),
18991896
None,
19001897
pos
19011898
)
1902-
}
1899+
}
1900+
1901+
trait ValueElement extends Element {
1902+
val underlying: WebElement
19031903

19041904
/**
19051905
* Gets this field's value.
@@ -1956,7 +1956,7 @@ trait WebBrowser {
19561956
* @throws TestFailedExeption if the passed <code>WebElement</code> does not represent a email field
19571957
*/
19581958
final class EmailField(val underlying: WebElement)(implicit pos: source.Position) extends ValueElement {
1959-
checkCorrectType(isEmailField, "email")
1959+
checkCorrectType(underlying, isEmailField, "email")
19601960
}
19611961

19621962
/**
@@ -1975,7 +1975,7 @@ trait WebBrowser {
19751975
* @throws TestFailedExeption if the passed <code>WebElement</code> does not represent a color field
19761976
*/
19771977
final class ColorField(val underlying: WebElement)(implicit pos: source.Position) extends ValueElement {
1978-
checkCorrectType(isColorField, "color")
1978+
checkCorrectType(underlying, isColorField, "color")
19791979
}
19801980

19811981
/**
@@ -1994,7 +1994,7 @@ trait WebBrowser {
19941994
* @throws TestFailedExeption if the passed <code>WebElement</code> does not represent a date field
19951995
*/
19961996
final class DateField(val underlying: WebElement)(implicit pos: source.Position) extends ValueElement {
1997-
checkCorrectType(isDateField, "date")
1997+
checkCorrectType(underlying, isDateField, "date")
19981998
}
19991999

20002000
/**
@@ -2013,7 +2013,7 @@ trait WebBrowser {
20132013
* @throws TestFailedExeption if the passed <code>WebElement</code> does not represent a datetime field
20142014
*/
20152015
final class DateTimeField(val underlying: WebElement)(implicit pos: source.Position) extends ValueElement {
2016-
checkCorrectType(isDateTimeField, "datetime")
2016+
checkCorrectType(underlying, isDateTimeField, "datetime")
20172017
}
20182018

20192019
/**
@@ -2032,7 +2032,7 @@ trait WebBrowser {
20322032
* @throws TestFailedExeption if the passed <code>WebElement</code> does not represent a datetime-local field
20332033
*/
20342034
final class DateTimeLocalField(val underlying: WebElement)(implicit pos: source.Position) extends ValueElement {
2035-
checkCorrectType(isDateTimeLocalField, "datetime-local")
2035+
checkCorrectType(underlying, isDateTimeLocalField, "datetime-local")
20362036
}
20372037

20382038
/**
@@ -2051,7 +2051,7 @@ trait WebBrowser {
20512051
* @throws TestFailedExeption if the passed <code>WebElement</code> does not represent a month field
20522052
*/
20532053
final class MonthField(val underlying: WebElement)(implicit pos: source.Position) extends ValueElement {
2054-
checkCorrectType(isMonthField, "month")
2054+
checkCorrectType(underlying, isMonthField, "month")
20552055
}
20562056

20572057
/**
@@ -2070,7 +2070,7 @@ trait WebBrowser {
20702070
* @throws TestFailedExeption if the passed <code>WebElement</code> does not represent a number field
20712071
*/
20722072
final class NumberField(val underlying: WebElement)(implicit pos: source.Position) extends ValueElement {
2073-
checkCorrectType(isNumberField, "number")
2073+
checkCorrectType(underlying, isNumberField, "number")
20742074
}
20752075

20762076
/**
@@ -2089,7 +2089,7 @@ trait WebBrowser {
20892089
* @throws TestFailedExeption if the passed <code>WebElement</code> does not represent a range field
20902090
*/
20912091
final class RangeField(val underlying: WebElement)(implicit pos: source.Position) extends ValueElement {
2092-
checkCorrectType(isRangeField, "range")
2092+
checkCorrectType(underlying, isRangeField, "range")
20932093
}
20942094

20952095
/**
@@ -2108,7 +2108,7 @@ trait WebBrowser {
21082108
* @throws TestFailedExeption if the passed <code>WebElement</code> does not represent a search field
21092109
*/
21102110
final class SearchField(val underlying: WebElement)(implicit pos: source.Position) extends ValueElement {
2111-
checkCorrectType(isSearchField, "search")
2111+
checkCorrectType(underlying, isSearchField, "search")
21122112
}
21132113

21142114
/**
@@ -2127,7 +2127,7 @@ trait WebBrowser {
21272127
* @throws TestFailedExeption if the passed <code>WebElement</code> does not represent a tel field
21282128
*/
21292129
final class TelField(val underlying: WebElement)(implicit pos: source.Position) extends ValueElement {
2130-
checkCorrectType(isTelField, "tel")
2130+
checkCorrectType(underlying, isTelField, "tel")
21312131
}
21322132

21332133
/**
@@ -2146,7 +2146,7 @@ trait WebBrowser {
21462146
* @throws TestFailedExeption if the passed <code>WebElement</code> does not represent a time field
21472147
*/
21482148
final class TimeField(val underlying: WebElement)(implicit pos: source.Position) extends ValueElement {
2149-
checkCorrectType(isTimeField, "time")
2149+
checkCorrectType(underlying, isTimeField, "time")
21502150
}
21512151

21522152
/**
@@ -2165,7 +2165,7 @@ trait WebBrowser {
21652165
* @throws TestFailedExeption if the passed <code>WebElement</code> does not represent a url field
21662166
*/
21672167
final class UrlField(val underlying: WebElement)(implicit pos: source.Position) extends ValueElement {
2168-
checkCorrectType(isUrlField, "url")
2168+
checkCorrectType(underlying, isUrlField, "url")
21692169
}
21702170

21712171
/**
@@ -2184,7 +2184,7 @@ trait WebBrowser {
21842184
* @throws TestFailedExeption if the passed <code>WebElement</code> does not represent a week field
21852185
*/
21862186
final class WeekField(val underlying: WebElement)(implicit pos: source.Position) extends ValueElement {
2187-
checkCorrectType(isWeekField, "week")
2187+
checkCorrectType(underlying, isWeekField, "week")
21882188
}
21892189

21902190
/**

src/test/scala/org/scalatestplus/selenium/JettySpec.scala

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ import org.eclipse.jetty.server.{NetworkConnector, Server}
2020
import org.eclipse.jetty.webapp.WebAppContext
2121

2222
trait JettySpec extends funspec.AnyFunSpec {
23-
24-
private val serverThread = new Thread() {
23+
24+
class ServerThread extends Thread {
2525
private val server = new Server(0)
2626

2727
override def run(): Unit = {
@@ -37,15 +37,17 @@ trait JettySpec extends funspec.AnyFunSpec {
3737
}
3838

3939
def isStarted = server.isStarted()
40-
def getHost = {
40+
def getHost() = {
4141
val conn = server.getConnectors()(0).asInstanceOf[NetworkConnector]
4242
"http://localhost:" + conn.getLocalPort + "/"
4343
}
4444
}
45+
46+
private val serverThread = new ServerThread()
4547

4648
import scala.language.reflectiveCalls
4749

48-
lazy val host = serverThread.getHost
50+
lazy val host = serverThread.getHost()
4951

5052
override def run(testName: Option[String], args: Args): Status = {
5153
serverThread.start()

src/test/scala/org/scalatestplus/selenium/WebBrowserSpec.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ import scala.reflect.ClassTag
3333
import org.scalactic.source.Position.here
3434
import org.openqa.selenium.firefox.FirefoxOptions
3535

36+
import scala.language.postfixOps
37+
3638
trait InputFieldBehaviour extends JettySpec with matchers.should.Matchers with SpanSugar with WebBrowser with HtmlUnit {
3739
def inputField[T <: ValueElement](file: String, fn: (String) => T, typeDescription: String, description: String, value1: String, value2: String, lineNumber: Int): Unit = {
3840
it("should throw TFE with valid stack depth if specified item not found") {

0 commit comments

Comments
 (0)