diff --git a/module/src/main/scala/org/scalatestplus/play/AllBrowsersPerSuite.scala b/module/src/main/scala/org/scalatestplus/play/AllBrowsersPerSuite.scala index 8837633a..e0a54600 100644 --- a/module/src/main/scala/org/scalatestplus/play/AllBrowsersPerSuite.scala +++ b/module/src/main/scala/org/scalatestplus/play/AllBrowsersPerSuite.scala @@ -83,7 +83,6 @@ import org.scalatestplus.play.BrowserFactory.{ GrumpyDriver, UnavailableDriver, *
* package org.scalatestplus.play.examples.allbrowserspersuite * - * import play.api.test._ * import org.scalatestplus.play._ * import org.scalatestplus.play.guice._ * import play.api.{Play, Application} @@ -124,8 +123,8 @@ import org.scalatestplus.play.BrowserFactory.{ GrumpyDriver, UnavailableDriver, * def getConfig(key: String)(implicit app: Application) = app.configuration.getOptional[String](key) * getConfig("foo") mustBe Some("bar") * } - * "provide the port" in { - * port mustBe Helpers.testServerPort + * "provide an http endpoint" in { + * runningServer.endpoints.httpEndpoint must not be empty * } * "provide an actual running server" in { * import java.net._ diff --git a/module/src/main/scala/org/scalatestplus/play/AllBrowsersPerTest.scala b/module/src/main/scala/org/scalatestplus/play/AllBrowsersPerTest.scala index 983c238e..6d6f0a57 100644 --- a/module/src/main/scala/org/scalatestplus/play/AllBrowsersPerTest.scala +++ b/module/src/main/scala/org/scalatestplus/play/AllBrowsersPerTest.scala @@ -87,7 +87,6 @@ import org.openqa.selenium.firefox.FirefoxProfile ** package org.scalatestplus.play.examples.allbrowserspertest * - * import play.api.test._ * import org.scalatest._ * import org.scalatestplus.play._ * import play.api.{Play, Application} @@ -127,8 +126,8 @@ import org.openqa.selenium.firefox.FirefoxProfile * def getConfig(key: String)(implicit app: Application) = app.configuration.getOptional[String](key) * getConfig("foo") mustBe Some("bar") * } - * "provide the port" in { - * port mustBe Helpers.testServerPort + * "provide an http endpoint" in { + * runningServer.endpoints.httpEndpoint must not be empty * } * "provide an actual running server" in { * import java.net._ diff --git a/module/src/main/scala/org/scalatestplus/play/BaseOneServerPerSuite.scala b/module/src/main/scala/org/scalatestplus/play/BaseOneServerPerSuite.scala index a3ebf297..6369e7bd 100644 --- a/module/src/main/scala/org/scalatestplus/play/BaseOneServerPerSuite.scala +++ b/module/src/main/scala/org/scalatestplus/play/BaseOneServerPerSuite.scala @@ -63,8 +63,8 @@ import org.scalatest._ * def getConfig(key: String)(implicit app: Application) = app.configuration.getOptional[String](key) * getConfig("ehcacheplugin") mustBe Some("disabled") * } - * "provide the port number" in { - * port mustBe Helpers.testServerPort + * "provide an http endpoint" in { + * runningServer.endpoints.httpEndpoint must not be empty * } * "provide an actual running server" in { * import Helpers._ @@ -86,7 +86,6 @@ import org.scalatest._ ** package org.scalatestplus.play.examples.oneserverpersuite * - * import play.api.test._ * import org.scalatest._ * import org.scalatestplus.play._ * import play.api.{Play, Application} @@ -120,8 +119,8 @@ import org.scalatest._ * def getConfig(key: String)(implicit app: Application) = app.configuration.getOptional[String](key) * getConfig("ehcacheplugin") mustBe Some("disabled") * } - * "provide the port number" in { - * port mustBe Helpers.testServerPort + * "provide an http endpoint" in { + * runningServer.endpoints.httpEndpoint must not be empty * } * "provide an actual running server" in { * import Helpers._ @@ -142,11 +141,9 @@ trait BaseOneServerPerSuite extends TestSuiteMixin with ServerProvider { this: T */ implicit lazy val app: Application = fakeApplication() - /** - * The port used by the `TestServer`. By default this will be set to the result returned from - * `Helpers.testServerPort`. You can override this to provide a different port number. - */ - lazy val port: Int = Helpers.testServerPort + implicit protected lazy val runningServer: RunningServer = new DefaultTestServerFactory { + override def serverProvider(app: Application) = play.core.server.NettyServer.provider + }.start(app) /** * Invokes `start` on a new `TestServer` created with the `Application` provided by `app` and the @@ -161,17 +158,15 @@ trait BaseOneServerPerSuite extends TestSuiteMixin with ServerProvider { this: T * @return a `Status` object that indicates when all tests and nested suites started by this method have completed, and whether or not a failure occurred. */ abstract override def run(testName: Option[String], args: Args): Status = { - val testServer = TestServer(port, app) - testServer.start() try { val newConfigMap = args.configMap + ("org.scalatestplus.play.app" -> app) + ("org.scalatestplus.play.port" -> port) val newArgs = args.copy(configMap = newConfigMap) val status = super.run(testName, newArgs) - status.whenCompleted { _ => testServer.stop() } + status.whenCompleted { _ => runningServer.stopServer.close() } status } catch { // In case the suite aborts, ensure the server is stopped case ex: Throwable => - testServer.stop() + runningServer.stopServer.close() throw ex } } diff --git a/module/src/main/scala/org/scalatestplus/play/BaseOneServerPerTest.scala b/module/src/main/scala/org/scalatestplus/play/BaseOneServerPerTest.scala index 73e75f5c..92780acc 100644 --- a/module/src/main/scala/org/scalatestplus/play/BaseOneServerPerTest.scala +++ b/module/src/main/scala/org/scalatestplus/play/BaseOneServerPerTest.scala @@ -36,7 +36,6 @@ import org.scalatest._ ** package org.scalatestplus.play.examples.oneserverpertest * - * import play.api.test._ * import org.scalatest._ * import org.scalatestplus.play._ * import play.api.{Play, Application} @@ -59,8 +58,8 @@ import org.scalatest._ * def getConfig(key: String)(implicit app: Application) = app.configuration.getOptional[String](key) * getConfig("ehcacheplugin") mustBe Some("disabled") * } - * "provide the port number" in { - * port mustBe Helpers.testServerPort + * "provide an http endpoint" in { + * runningServer.endpoints.httpEndpoint must not be empty * } * "provide an actual running server" in { * import Helpers._ @@ -76,12 +75,23 @@ import org.scalatest._ */ trait BaseOneServerPerTest extends TestSuiteMixin with ServerProvider { this: TestSuite with FakeApplicationFactory => - private var privateApp: Application = _ + @volatile private var privateApp: Application = _ + @volatile private var privateServer: RunningServer = _ /** * Implicit method that returns the `Application` instance for the current test. */ - implicit final def app: Application = synchronized { privateApp } + implicit final def app: Application = { + val a = privateApp + if (a == null) { throw new IllegalStateException("Test isn't running yet so application is not available") } + a + } + + implicit final def runningServer: RunningServer = { + val rs = privateServer + if (rs == null) { throw new IllegalStateException("Test isn't running yet so the server endpoints are not available") } + privateServer + } /** * Creates new instance of `Application` with parameters set to their defaults. Override this method if you @@ -89,11 +99,10 @@ trait BaseOneServerPerTest extends TestSuiteMixin with ServerProvider { this: Te */ def newAppForTest(testData: TestData): Application = fakeApplication() - /** - * The port used by the `TestServer`. By default this will be set to the result returned from - * `Helpers.testServerPort`. You can override this to provide a different port number. - */ - lazy val port: Int = Helpers.testServerPort + protected def newServerForTest(app: Application, testData: TestData): RunningServer = + new DefaultTestServerFactory { + override def serverProvider(app: Application) = play.core.server.NettyServer.provider + }.start(app) /** * Creates new `Application` and running `TestServer` instances before executing each test, and @@ -104,9 +113,18 @@ trait BaseOneServerPerTest extends TestSuiteMixin with ServerProvider { this: Te * @return the `Outcome` of the test execution */ abstract override def withFixture(test: NoArgTest) = { - synchronized { privateApp = newAppForTest(test) } - Helpers.running(TestServer(port, app)) { - super.withFixture(test) + // Need to synchronize within a suite because we store current app/server in fields in the class + // Could possibly pass app/server info in a ScalaTest object? + synchronized { + privateApp = newAppForTest(test) + privateServer = newServerForTest(app, test) + try super.withFixture(test) finally { + val rs = privateServer // Store before nulling fields + privateApp = null + privateServer = null + // Stop server and release locks + rs.stopServer.close() + } } } } diff --git a/module/src/main/scala/org/scalatestplus/play/ConfiguredBrowser.scala b/module/src/main/scala/org/scalatestplus/play/ConfiguredBrowser.scala index 76cf57e9..d2459b58 100644 --- a/module/src/main/scala/org/scalatestplus/play/ConfiguredBrowser.scala +++ b/module/src/main/scala/org/scalatestplus/play/ConfiguredBrowser.scala @@ -44,7 +44,6 @@ import BrowserFactory.UninitializedDriver ** package org.scalatestplus.play.examples.onebrowserpersuite * - * import play.api.test.Helpers * import org.scalatest.tags.FirefoxBrowser * import org.scalatestplus.play._ * import play.api.{Play, Application} @@ -68,8 +67,8 @@ import BrowserFactory.UninitializedDriver * def getConfig(key: String)(implicit app: Application) = app.configuration.getOptional[String](key) * getConfig("ehcacheplugin") mustBe Some("disabled") * } - * "provide the port number" in { - * port mustBe Helpers.testServerPort + * "provide an http endpoint" in { + * runningServer.endpoints.httpEndpoint must not be empty * } * "provide an actual running server" in { * import java.net._ diff --git a/module/src/main/scala/org/scalatestplus/play/ConfiguredServer.scala b/module/src/main/scala/org/scalatestplus/play/ConfiguredServer.scala index 72be84ab..74259e0d 100644 --- a/module/src/main/scala/org/scalatestplus/play/ConfiguredServer.scala +++ b/module/src/main/scala/org/scalatestplus/play/ConfiguredServer.scala @@ -17,6 +17,8 @@ package org.scalatestplus.play import org.scalatest._ import play.api.Application +import play.api.test.RunningServer +import play.core.server.{ ServerEndpoint, ServerEndpoints } /** * Trait that provides a configured `Application` and server port number to the suite into which it is mixed. @@ -55,8 +57,8 @@ import play.api.Application * def getConfig(key: String)(implicit app: Application) = app.configuration.getOptional[String](key) * getConfig("ehcacheplugin") mustBe Some("disabled") * } - * "provide the port number" in { - * port mustBe Helpers.testServerPort + * "provide an http endpoint" in { + * runningServer.endpoints.httpEndpoint must not be empty * } * "provide an actual running server" in { * import Helpers._ @@ -81,14 +83,29 @@ trait ConfiguredServer extends TestSuiteMixin with ServerProvider { this: TestSu */ implicit final def app: Application = synchronized { configuredApp } - private var configuredPort: Int = -1 + implicit protected lazy val runningServer: RunningServer = + RunningServer( + app, + ServerEndpoints(Seq(ServerEndpoint( + description = "ConfiguredServer endpoint", + scheme = "http", + host = "localhost", + port = configuredPort, + expectedHttpVersions = Set.empty, + expectedServerAttr = None, + ssl = None + ))), + new AutoCloseable { def close() = () } + ) + + private var _configuredPort: Int = -1 /** * The "configured" port number, passed into `run` via the `ConfigMap`, at which the `TestServer` is running. * * @return the configured port number */ - def port: Int = synchronized { configuredPort } + final protected def configuredPort: Int = synchronized { _configuredPort } /** * Looks in `args.configMap` for a key named "org.scalatestplus.play.app" whose value is a `Application`, @@ -105,7 +122,6 @@ trait ConfiguredServer extends TestSuiteMixin with ServerProvider { this: TestSu * I.e., `None` acts like a wildcard that means run all relevant tests in this `Suite`. * @param args the `Args` for this run * @return a `Status` object that indicates when all tests and nested suites started by this method have completed, and whether or not a failure occurred. - * * @throws java.lang.IllegalArgumentException if the `Application` and/or port number does not appear in `args.configMap` under the expected keys */ abstract override def run(testName: Option[String], args: Args): Status = { @@ -114,7 +130,7 @@ trait ConfiguredServer extends TestSuiteMixin with ServerProvider { this: TestSu case None => throw new Exception("Trait ConfiguredServer needs an Application value associated with key \"org.scalatestplus.play.app\" in the config map. Did you forget to annotate a nested suite with @DoNotDiscover?") } args.configMap.getOptional[Int]("org.scalatestplus.play.port") match { - case Some(cp) => synchronized { configuredPort = cp } + case Some(cp) => synchronized { _configuredPort = cp } case None => throw new Exception("Trait ConfiguredServer needs an Int value associated with key \"org.scalatestplus.play.port\" in the config map. Did you forget to annotate a nested suite with @DoNotDiscover?") } super.run(testName, args) diff --git a/module/src/main/scala/org/scalatestplus/play/OneBrowserPerSuite.scala b/module/src/main/scala/org/scalatestplus/play/OneBrowserPerSuite.scala index 87be9338..11d3caa2 100644 --- a/module/src/main/scala/org/scalatestplus/play/OneBrowserPerSuite.scala +++ b/module/src/main/scala/org/scalatestplus/play/OneBrowserPerSuite.scala @@ -55,7 +55,6 @@ import scala.util.Try ** package org.scalatestplus.play.examples.onebrowserpersuite * - * import play.api.test.Helpers * import org.scalatest.tags.FirefoxBrowser * import org.scalatestplus.play._ * import play.api.{Play, Application} @@ -79,8 +78,8 @@ import scala.util.Try * def getConfig(key: String)(implicit app: Application) = app.configuration.getOptional[String](key) * getConfig("ehcacheplugin") mustBe Some("disabled") * } - * "provide the port number" in { - * port mustBe Helpers.testServerPort + * "provide an http endpoint" in { + * runningServer.endpoints.httpEndpoint must not be empty * } * "provide an actual running server" in { * import java.net._ @@ -107,7 +106,6 @@ import scala.util.Try ** package org.scalatestplus.play.examples.onebrowserpersuite * - * import play.api.test._ * import org.scalatest._ * import tags.FirefoxBrowser * import org.scalatestplus.play._ @@ -144,8 +142,8 @@ import scala.util.Try * def getConfig(key: String)(implicit app: Application) = app.configuration.getOptional[String](key) * getConfig("ehcacheplugin") mustBe Some("disabled") * } - * "provide the port number" in { - * port mustBe Helpers.testServerPort + * "provide an http endpoint" in { + * runningServer.endpoints.httpEndpoint must not be empty * } * "provide an actual running server" in { * import Helpers._ @@ -193,8 +191,8 @@ import scala.util.Try * def getConfig(key: String)(implicit app: Application) = app.configuration.getOptional[String](key) * getConfig("ehcacheplugin") mustBe Some("disabled") * } - * "provide the port number" in { - * port mustBe Helpers.testServerPort + * "provide an http endpoint" in { + * runningServer.endpoints.httpEndpoint must not be empty * } * "provide an actual running server" in { * import Helpers._ diff --git a/module/src/main/scala/org/scalatestplus/play/OneBrowserPerTest.scala b/module/src/main/scala/org/scalatestplus/play/OneBrowserPerTest.scala index 55cc0475..e6129e01 100644 --- a/module/src/main/scala/org/scalatestplus/play/OneBrowserPerTest.scala +++ b/module/src/main/scala/org/scalatestplus/play/OneBrowserPerTest.scala @@ -45,7 +45,6 @@ import BrowserFactory.UninitializedDriver ** package org.scalatestplus.play.examples.onebrowserpertest * - * import play.api.test._ * import org.scalatest._ * import org.scalatest.tags.FirefoxBrowser * import org.scalatestplus.play._ @@ -70,8 +69,8 @@ import BrowserFactory.UninitializedDriver * def getConfig(key: String)(implicit app: Application) = app.configuration.getOptional[String](key) * getConfig("ehcacheplugin") mustBe Some("disabled") * } - * "provide the port number" in { - * port mustBe Helpers.testServerPort + * "provide an http endpoint" in { + * runningServer.endpoints.httpEndpoint must not be empty * } * "provide an actual running server" in { * import Helpers._ diff --git a/module/src/main/scala/org/scalatestplus/play/ServerProvider.scala b/module/src/main/scala/org/scalatestplus/play/ServerProvider.scala index 0cd08726..727fc6de 100644 --- a/module/src/main/scala/org/scalatestplus/play/ServerProvider.scala +++ b/module/src/main/scala/org/scalatestplus/play/ServerProvider.scala @@ -16,6 +16,7 @@ package org.scalatestplus.play import play.api.Application +import play.api.test.RunningServer /** * Trait that defines abstract methods that providing a port number and implicit `Application` and a concrete @@ -38,10 +39,13 @@ trait ServerProvider { */ implicit def app: Application + implicit protected def runningServer: RunningServer + /** * The port used by the `TestServer`. */ - def port: Int + // TODO: Document that this has been converted to a final method + final def port: Int = portNumber.value /** * Implicit `PortNumber` instance that wraps `port`. The value returned from `portNumber.value` @@ -49,6 +53,11 @@ trait ServerProvider { * * @return the configured port number, wrapped in a `PortNumber` */ - implicit final lazy val portNumber: PortNumber = PortNumber(port) + implicit def portNumber: PortNumber = { + val httpEndpoint = runningServer.endpoints.httpEndpoint + val port = httpEndpoint + .fold(throw new IllegalStateException("No HTTP port available for test server"))(_.port) + PortNumber(port) + } } diff --git a/module/src/test/scala/org/scalatestplus/play/ChromeFactorySpec.scala b/module/src/test/scala/org/scalatestplus/play/ChromeFactorySpec.scala index f700c9ff..acb6572c 100644 --- a/module/src/test/scala/org/scalatestplus/play/ChromeFactorySpec.scala +++ b/module/src/test/scala/org/scalatestplus/play/ChromeFactorySpec.scala @@ -15,7 +15,6 @@ */ package org.scalatestplus.play -import play.api.test._ import org.scalatest._ import play.api.Application import org.openqa.selenium.WebDriver @@ -50,8 +49,8 @@ class ChromeFactorySpec extends UnitSpec with GuiceOneServerPerSuite with OneBro "make the Application available implicitly" in { getConfig("foo") mustBe Some("bar") } - "provide the port" in { - port mustBe Helpers.testServerPort + "provide an http endpoint" in { + runningServer.endpoints.httpEndpoint must not be empty } "send 404 on a bad request" in { diff --git a/module/src/test/scala/org/scalatestplus/play/ConfiguredBrowserNestedSuite.scala b/module/src/test/scala/org/scalatestplus/play/ConfiguredBrowserNestedSuite.scala index f8d8a2f1..fa0eba97 100644 --- a/module/src/test/scala/org/scalatestplus/play/ConfiguredBrowserNestedSuite.scala +++ b/module/src/test/scala/org/scalatestplus/play/ConfiguredBrowserNestedSuite.scala @@ -15,11 +15,8 @@ */ package org.scalatestplus.play -import play.api.test._ import org.scalatest._ -import events._ -import play.api.{ Play, Application } -import scala.collection.mutable.ListBuffer +import play.api.Application import org.openqa.selenium.WebDriver @DoNotDiscover @@ -51,8 +48,8 @@ class ConfiguredBrowserNestedSuite extends UnitSpec with ConfiguredServer with C val configuredPort = configMap.getOptional[Int]("org.scalatestplus.play.port") configuredPort.value mustEqual port } - "provide the port" in { - port mustBe Helpers.testServerPort + "provide an http endpoint" in { + runningServer.endpoints.httpEndpoint must not be empty } "send 404 on a bad request" in { diff --git a/module/src/test/scala/org/scalatestplus/play/ConfiguredServerNestedSuite.scala b/module/src/test/scala/org/scalatestplus/play/ConfiguredServerNestedSuite.scala index 93c7704b..628ef23c 100644 --- a/module/src/test/scala/org/scalatestplus/play/ConfiguredServerNestedSuite.scala +++ b/module/src/test/scala/org/scalatestplus/play/ConfiguredServerNestedSuite.scala @@ -15,11 +15,8 @@ */ package org.scalatestplus.play -import play.api.test._ import org.scalatest._ -import events._ -import play.api.{ Play, Application } -import scala.collection.mutable.ListBuffer +import play.api.Application @DoNotDiscover class ConfiguredServerNestedSuite extends UnitSpec with ConfiguredServer { @@ -50,8 +47,8 @@ class ConfiguredServerNestedSuite extends UnitSpec with ConfiguredServer { val configuredPort = configMap.getOptional[Int]("org.scalatestplus.play.port") configuredPort.value mustEqual port } - "provide the port" in { - port mustBe Helpers.testServerPort + "provide an http endpoint" in { + runningServer.endpoints.httpEndpoint must not be empty } "send 404 on a bad request" in { import java.net._ diff --git a/module/src/test/scala/org/scalatestplus/play/ConfiguredServerWithAllBrowsersPerSuiteSpec.scala b/module/src/test/scala/org/scalatestplus/play/ConfiguredServerWithAllBrowsersPerSuiteSpec.scala index 8d9becb2..a15be609 100644 --- a/module/src/test/scala/org/scalatestplus/play/ConfiguredServerWithAllBrowsersPerSuiteSpec.scala +++ b/module/src/test/scala/org/scalatestplus/play/ConfiguredServerWithAllBrowsersPerSuiteSpec.scala @@ -20,7 +20,6 @@ import org.scalatest._ import org.scalatestplus.play.guice.GuiceOneServerPerSuite import play.api.Application import play.api.inject.guice._ -import play.api.test._ class ConfiguredServerWithAllBrowsersPerSuiteSpec extends Suites( new ConfiguredServerWithAllBrowsersPerSuiteNestedSpec @@ -66,8 +65,8 @@ class ConfiguredServerWithAllBrowsersPerSuiteNestedSpec extends UnitSpec with Co "make the Application available implicitly" in { getConfig("foo") mustBe Some("bar") } - "provide the port" in { - port mustBe Helpers.testServerPort + "provide an http endpoint" in { + runningServer.endpoints.httpEndpoint must not be empty } "send 404 on a bad request" in { import java.net._ diff --git a/module/src/test/scala/org/scalatestplus/play/ConfiguredServerWithAllBrowsersPerTestSpec.scala b/module/src/test/scala/org/scalatestplus/play/ConfiguredServerWithAllBrowsersPerTestSpec.scala index 072b1f85..9f490905 100644 --- a/module/src/test/scala/org/scalatestplus/play/ConfiguredServerWithAllBrowsersPerTestSpec.scala +++ b/module/src/test/scala/org/scalatestplus/play/ConfiguredServerWithAllBrowsersPerTestSpec.scala @@ -19,7 +19,6 @@ import org.scalatest._ import org.scalatestplus.play.guice.GuiceOneServerPerSuite import play.api.Application import play.api.inject.guice._ -import play.api.test._ class ConfiguredServerWithAllBrowsersPerTestSpec extends Suites( new ConfiguredServerWithAllBrowsersPerTestNestedSpec @@ -57,8 +56,8 @@ class ConfiguredServerWithAllBrowsersPerTestNestedSpec extends UnitSpec with Con "make the Application available implicitly" in { getConfig("foo") mustBe Some("bar") } - "provide the port" in { - port mustBe Helpers.testServerPort + "provide an http endpoint" in { + runningServer.endpoints.httpEndpoint must not be empty } "send 404 on a bad request" in { import java.net._ diff --git a/module/src/test/scala/org/scalatestplus/play/ConfiguredServerWithConfiguredBrowserSpec.scala b/module/src/test/scala/org/scalatestplus/play/ConfiguredServerWithConfiguredBrowserSpec.scala index b5b07bc0..11152fc0 100644 --- a/module/src/test/scala/org/scalatestplus/play/ConfiguredServerWithConfiguredBrowserSpec.scala +++ b/module/src/test/scala/org/scalatestplus/play/ConfiguredServerWithConfiguredBrowserSpec.scala @@ -20,7 +20,6 @@ import org.scalatest._ import org.scalatestplus.play.guice.GuiceOneServerPerSuite import play.api.Application import play.api.inject.guice._ -import play.api.test._ class ConfiguredServerWithConfiguredBrowserSpec extends UnitSpec with SequentialNestedSuiteExecution with GuiceOneServerPerSuite with OneBrowserPerSuite with HtmlUnitFactory { @@ -65,8 +64,8 @@ class ConfiguredServerWithConfiguredBrowserNestedSpec extends UnitSpec with Conf val configuredPort = configMap.getOptional[Int]("org.scalatestplus.play.port") configuredPort.value mustEqual port } - "provide the port" in { - port mustBe Helpers.testServerPort + "provide an http endpoint" in { + runningServer.endpoints.httpEndpoint must not be empty } "send 404 on a bad request" in { import java.net._ diff --git a/module/src/test/scala/org/scalatestplus/play/ConfiguredServerWithOneBrowserPerSuiteSpec.scala b/module/src/test/scala/org/scalatestplus/play/ConfiguredServerWithOneBrowserPerSuiteSpec.scala index 7d17b7f8..d6240c2f 100644 --- a/module/src/test/scala/org/scalatestplus/play/ConfiguredServerWithOneBrowserPerSuiteSpec.scala +++ b/module/src/test/scala/org/scalatestplus/play/ConfiguredServerWithOneBrowserPerSuiteSpec.scala @@ -20,7 +20,6 @@ import org.scalatest._ import org.scalatestplus.play.guice.GuiceOneServerPerSuite import play.api.Application import play.api.inject.guice._ -import play.api.test._ class ConfiguredServerWithOneBrowserPerSuiteSpec extends Suites( new ConfiguredServerWithOneBrowserPerSuiteNestedSpec @@ -54,8 +53,8 @@ class ConfiguredServerWithOneBrowserPerSuiteNestedSpec extends UnitSpec with Con "make the Application available implicitly" in { getConfig("foo") mustBe Some("bar") } - "provide the port" in { - port mustBe Helpers.testServerPort + "provide an http endpoint" in { + runningServer.endpoints.httpEndpoint must not be empty } "send 404 on a bad request" in { import java.net._ diff --git a/module/src/test/scala/org/scalatestplus/play/ConfiguredServerWithOneBrowserPerTestSpec.scala b/module/src/test/scala/org/scalatestplus/play/ConfiguredServerWithOneBrowserPerTestSpec.scala index 2beaef4b..dca684fc 100644 --- a/module/src/test/scala/org/scalatestplus/play/ConfiguredServerWithOneBrowserPerTestSpec.scala +++ b/module/src/test/scala/org/scalatestplus/play/ConfiguredServerWithOneBrowserPerTestSpec.scala @@ -15,7 +15,6 @@ */ package org.scalatestplus.play -import play.api.test._ import org.scalatest._ import org.scalatestplus.play.guice.GuiceOneServerPerSuite import play.api.Application @@ -44,8 +43,8 @@ class ConfiguredServerWithOneBrowserPerTestNestedSpec extends UnitSpec with Conf "make the FakeApplication available implicitly" in { getConfig("foo") mustBe Some("bar") } - "provide the port" in { - port mustBe Helpers.testServerPort + "provide an http endpoint" in { + runningServer.endpoints.httpEndpoint must not be empty } "send 404 on a bad request" in { import java.net._ diff --git a/module/src/test/scala/org/scalatestplus/play/HtmlUnitFactorySpec.scala b/module/src/test/scala/org/scalatestplus/play/HtmlUnitFactorySpec.scala index 04f986b9..ad4f00ac 100644 --- a/module/src/test/scala/org/scalatestplus/play/HtmlUnitFactorySpec.scala +++ b/module/src/test/scala/org/scalatestplus/play/HtmlUnitFactorySpec.scala @@ -20,7 +20,6 @@ import org.scalatest._ import org.scalatestplus.play.guice.GuiceOneServerPerSuite import play.api.Application import play.api.inject.guice._ -import play.api.test._ class HtmlUnitFactorySpec extends UnitSpec with GuiceOneServerPerSuite with OneBrowserPerSuite with HtmlUnitFactory { @@ -49,8 +48,8 @@ class HtmlUnitFactorySpec extends UnitSpec with GuiceOneServerPerSuite with OneB "make the Application available implicitly" in { getConfig("foo") mustBe Some("bar") } - "provide the port" in { - port mustBe Helpers.testServerPort + "provide an http endpoint" in { + runningServer.endpoints.httpEndpoint must not be empty } "send 404 on a bad request" in { import java.net._ diff --git a/module/src/test/scala/org/scalatestplus/play/InternetExplorerFactorySpec.scala b/module/src/test/scala/org/scalatestplus/play/InternetExplorerFactorySpec.scala index d0e11b67..d6cd685f 100644 --- a/module/src/test/scala/org/scalatestplus/play/InternetExplorerFactorySpec.scala +++ b/module/src/test/scala/org/scalatestplus/play/InternetExplorerFactorySpec.scala @@ -15,7 +15,6 @@ */ package org.scalatestplus.play -import play.api.test._ import org.scalatest._ import play.api.Application import org.openqa.selenium.WebDriver @@ -49,8 +48,8 @@ class InternetExplorerFactorySpec extends UnitSpec with GuiceOneServerPerSuite w "make the Application available implicitly" in { getConfig("foo") mustBe Some("bar") } - "provide the port" in { - port mustBe Helpers.testServerPort + "provide an http endpoint" in { + runningServer.endpoints.httpEndpoint must not be empty } "send 404 on a bad request" in { import java.net._ diff --git a/module/src/test/scala/org/scalatestplus/play/OneChromeBrowserPerTestSpec.scala b/module/src/test/scala/org/scalatestplus/play/OneChromeBrowserPerTestSpec.scala index b19d0b1a..d75a1273 100644 --- a/module/src/test/scala/org/scalatestplus/play/OneChromeBrowserPerTestSpec.scala +++ b/module/src/test/scala/org/scalatestplus/play/OneChromeBrowserPerTestSpec.scala @@ -39,8 +39,8 @@ class OneChromeBrowserPerTestSpec extends UnitSpec with GuiceOneServerPerTest wi "make the Application available implicitly" in { getConfig("foo") mustBe Some("bar") } - "provide the port" in { - port mustBe Helpers.testServerPort + "provide an http endpoint" in { + runningServer.endpoints.httpEndpoint must not be empty } "send 404 on a bad request" in { import java.net._ diff --git a/module/src/test/scala/org/scalatestplus/play/OneHtmlUnitBrowserPerTestSpec.scala b/module/src/test/scala/org/scalatestplus/play/OneHtmlUnitBrowserPerTestSpec.scala index a3e39d96..7bcfe516 100644 --- a/module/src/test/scala/org/scalatestplus/play/OneHtmlUnitBrowserPerTestSpec.scala +++ b/module/src/test/scala/org/scalatestplus/play/OneHtmlUnitBrowserPerTestSpec.scala @@ -19,7 +19,6 @@ import org.scalatest._ import org.scalatestplus.play.guice.GuiceOneServerPerTest import play.api.Application import play.api.inject.guice._ -import play.api.test._ class OneHtmlUnitBrowserPerTestSpec extends UnitSpec with GuiceOneServerPerTest with OneBrowserPerTest with HtmlUnitFactory { @@ -39,8 +38,8 @@ class OneHtmlUnitBrowserPerTestSpec extends UnitSpec with GuiceOneServerPerTest "make the Application available implicitly" in { getConfig("foo") mustBe Some("bar") } - "provide the port" in { - port mustBe Helpers.testServerPort + "provide an http endpoint" in { + runningServer.endpoints.httpEndpoint must not be empty } "send 404 on a bad request" in { import java.net._ diff --git a/module/src/test/scala/org/scalatestplus/play/OneInternetExplorerBrowserPerTestSpec.scala b/module/src/test/scala/org/scalatestplus/play/OneInternetExplorerBrowserPerTestSpec.scala index ebd32819..570c964c 100644 --- a/module/src/test/scala/org/scalatestplus/play/OneInternetExplorerBrowserPerTestSpec.scala +++ b/module/src/test/scala/org/scalatestplus/play/OneInternetExplorerBrowserPerTestSpec.scala @@ -15,7 +15,6 @@ */ package org.scalatestplus.play -import play.api.test._ import org.scalatest._ import org.scalatestplus.play.guice.GuiceOneServerPerTest import play.api.Application @@ -39,8 +38,8 @@ class OneInternetExplorerBrowserPerTestSpec extends UnitSpec with GuiceOneServer "make the Application available implicitly" in { getConfig("foo") mustBe Some("bar") } - "provide the port" in { - port mustBe Helpers.testServerPort + "provide an http endpoint" in { + runningServer.endpoints.httpEndpoint must not be empty } "send 404 on a bad request" in { import java.net._ diff --git a/module/src/test/scala/org/scalatestplus/play/OneSafariBrowserPerTestSpec.scala b/module/src/test/scala/org/scalatestplus/play/OneSafariBrowserPerTestSpec.scala index 48f8cfc1..3f877bfb 100644 --- a/module/src/test/scala/org/scalatestplus/play/OneSafariBrowserPerTestSpec.scala +++ b/module/src/test/scala/org/scalatestplus/play/OneSafariBrowserPerTestSpec.scala @@ -15,7 +15,6 @@ */ package org.scalatestplus.play -import play.api.test._ import org.scalatest._ import org.scalatestplus.play.guice.GuiceOneServerPerTest import play.api.Application @@ -39,8 +38,8 @@ class OneSafariBrowserPerTestSpec extends UnitSpec with GuiceOneServerPerTest wi "make the Application available implicitly" in { getConfig("foo") mustBe Some("bar") } - "provide the port" in { - port mustBe Helpers.testServerPort + "provide an http endpoint" in { + runningServer.endpoints.httpEndpoint must not be empty } "send 404 on a bad request" in { import java.net._ diff --git a/module/src/test/scala/org/scalatestplus/play/OneServerPerSuiteComponentSpec.scala b/module/src/test/scala/org/scalatestplus/play/OneServerPerSuiteComponentSpec.scala index e8d81084..0348564d 100644 --- a/module/src/test/scala/org/scalatestplus/play/OneServerPerSuiteComponentSpec.scala +++ b/module/src/test/scala/org/scalatestplus/play/OneServerPerSuiteComponentSpec.scala @@ -60,8 +60,8 @@ class OneServerPerSuiteComponentSpec extends UnitSpec with OneServerPerSuiteWith "override the configuration" in { app.configuration.getOptional[String]("foo") mustBe Some("bar") } - "provide the port" in { - port mustBe Helpers.testServerPort + "provide an http endpoint" in { + runningServer.endpoints.httpEndpoint must not be empty } "send 404 on a bad request" in { import java.net._ diff --git a/module/src/test/scala/org/scalatestplus/play/OneServerPerSuiteSpec.scala b/module/src/test/scala/org/scalatestplus/play/OneServerPerSuiteSpec.scala index 24181e2c..9753a81d 100644 --- a/module/src/test/scala/org/scalatestplus/play/OneServerPerSuiteSpec.scala +++ b/module/src/test/scala/org/scalatestplus/play/OneServerPerSuiteSpec.scala @@ -15,7 +15,6 @@ */ package org.scalatestplus.play -import play.api.test._ import org.scalatest._ import org.scalatestplus.play.guice.GuiceOneServerPerSuite import play.api.Application @@ -45,8 +44,8 @@ class OneServerPerSuiteSpec extends UnitSpec with GuiceOneServerPerSuite { "make the Application available implicitly" in { getConfig("foo") mustBe Some("bar") } - "provide the port" in { - port mustBe Helpers.testServerPort + "provide an http endpoint" in { + runningServer.endpoints.httpEndpoint must not be empty } "send 404 on a bad request" in { import java.net._ diff --git a/module/src/test/scala/org/scalatestplus/play/OneServerPerSuiteWithAllBrowsersPerSuiteSpec.scala b/module/src/test/scala/org/scalatestplus/play/OneServerPerSuiteWithAllBrowsersPerSuiteSpec.scala index 16b7e03b..bcee8458 100644 --- a/module/src/test/scala/org/scalatestplus/play/OneServerPerSuiteWithAllBrowsersPerSuiteSpec.scala +++ b/module/src/test/scala/org/scalatestplus/play/OneServerPerSuiteWithAllBrowsersPerSuiteSpec.scala @@ -15,7 +15,6 @@ */ package org.scalatestplus.play -import play.api.test._ import play.api.Application import org.openqa.selenium.WebDriver import org.scalatestplus.play.guice.GuiceOneServerPerSuite @@ -59,8 +58,8 @@ class OneServerPerSuiteWithAllBrowsersPerSuiteSpec extends UnitSpec with GuiceOn "make the Application available implicitly" in { getConfig("foo") mustBe Some("bar") } - "provide the port" in { - port mustBe Helpers.testServerPort + "provide an http endpoint" in { + runningServer.endpoints.httpEndpoint must not be empty } "send 404 on a bad request" in { import java.net._ diff --git a/module/src/test/scala/org/scalatestplus/play/OneServerPerSuiteWithAllBrowsersPerTestSpec.scala b/module/src/test/scala/org/scalatestplus/play/OneServerPerSuiteWithAllBrowsersPerTestSpec.scala index bac9e215..219259fa 100644 --- a/module/src/test/scala/org/scalatestplus/play/OneServerPerSuiteWithAllBrowsersPerTestSpec.scala +++ b/module/src/test/scala/org/scalatestplus/play/OneServerPerSuiteWithAllBrowsersPerTestSpec.scala @@ -16,7 +16,6 @@ package org.scalatestplus.play import org.scalatestplus.play.guice.GuiceOneServerPerSuite -import play.api.test._ import play.api.Application import play.api.inject.guice._ @@ -50,8 +49,8 @@ class OneServerPerSuiteWithAllBrowsersPerTestSpec extends UnitSpec with GuiceOne "make the Application available implicitly" in { getConfig("foo") mustBe Some("bar") } - "provide the port" in { - port mustBe Helpers.testServerPort + "provide an http endpoint" in { + runningServer.endpoints.httpEndpoint must not be empty } "send 404 on a bad request" in { import java.net._ diff --git a/module/src/test/scala/org/scalatestplus/play/OneServerPerSuiteWithConfiguredBrowserSpec.scala b/module/src/test/scala/org/scalatestplus/play/OneServerPerSuiteWithConfiguredBrowserSpec.scala index 259c2805..1c64fb4c 100644 --- a/module/src/test/scala/org/scalatestplus/play/OneServerPerSuiteWithConfiguredBrowserSpec.scala +++ b/module/src/test/scala/org/scalatestplus/play/OneServerPerSuiteWithConfiguredBrowserSpec.scala @@ -15,7 +15,6 @@ */ package org.scalatestplus.play -import play.api.test._ import org.scalatest._ import play.api.Application import org.openqa.selenium.WebDriver @@ -65,8 +64,8 @@ class OneServerPerSuiteWithConfiguredBrowserNestedSpec extends UnitSpec with Con val configuredPort = configMap.getOptional[Int]("org.scalatestplus.play.port") configuredPort.value mustEqual port } - "provide the port" in { - port mustBe Helpers.testServerPort + "provide an http endpoint" in { + runningServer.endpoints.httpEndpoint must not be empty } "send 404 on a bad request" in { import java.net._ diff --git a/module/src/test/scala/org/scalatestplus/play/OneServerPerSuiteWithOneBrowserPerSuiteSpec.scala b/module/src/test/scala/org/scalatestplus/play/OneServerPerSuiteWithOneBrowserPerSuiteSpec.scala index 82564e58..7bc7054f 100644 --- a/module/src/test/scala/org/scalatestplus/play/OneServerPerSuiteWithOneBrowserPerSuiteSpec.scala +++ b/module/src/test/scala/org/scalatestplus/play/OneServerPerSuiteWithOneBrowserPerSuiteSpec.scala @@ -15,7 +15,6 @@ */ package org.scalatestplus.play -import play.api.test._ import org.scalatest._ import play.api.Application import org.openqa.selenium.WebDriver @@ -49,8 +48,8 @@ class OneServerPerSuiteWithOneBrowserPerSuiteSpec extends UnitSpec with GuiceOne "make the Application available implicitly" in { getConfig("foo") mustBe Some("bar") } - "provide the port" in { - port mustBe Helpers.testServerPort + "provide an http endpoint" in { + runningServer.endpoints.httpEndpoint must not be empty } "send 404 on a bad request" in { import java.net._ diff --git a/module/src/test/scala/org/scalatestplus/play/OneServerPerSuiteWithOneBrowserPerTestSpec.scala b/module/src/test/scala/org/scalatestplus/play/OneServerPerSuiteWithOneBrowserPerTestSpec.scala index 1d0f93eb..ff880ef0 100644 --- a/module/src/test/scala/org/scalatestplus/play/OneServerPerSuiteWithOneBrowserPerTestSpec.scala +++ b/module/src/test/scala/org/scalatestplus/play/OneServerPerSuiteWithOneBrowserPerTestSpec.scala @@ -15,7 +15,6 @@ */ package org.scalatestplus.play -import play.api.test._ import org.scalatestplus.play.guice.GuiceOneServerPerSuite import play.api.Application import play.api.inject.guice._ @@ -38,8 +37,8 @@ class OneServerPerSuiteWithOneBrowserPerTestSpec extends UnitSpec with GuiceOneS "make the Application available implicitly" in { getConfig("foo") mustBe Some("bar") } - "provide the port" in { - port mustBe Helpers.testServerPort + "provide an http endpoint" in { + runningServer.endpoints.httpEndpoint must not be empty } "send 404 on a bad request" in { import java.net._ diff --git a/module/src/test/scala/org/scalatestplus/play/OneServerPerTestComponentSpec.scala b/module/src/test/scala/org/scalatestplus/play/OneServerPerTestComponentSpec.scala index c371d07e..1bb199cd 100644 --- a/module/src/test/scala/org/scalatestplus/play/OneServerPerTestComponentSpec.scala +++ b/module/src/test/scala/org/scalatestplus/play/OneServerPerTestComponentSpec.scala @@ -49,8 +49,8 @@ class OneServerPerTestComponentSpec extends UnitSpec with OneServerPerTestWithCo "override the configuration" in { app.configuration.getOptional[String]("foo") mustBe Some("bar") } - "provide the port" in { - port mustBe Helpers.testServerPort + "provide an http endpoint" in { + runningServer.endpoints.httpEndpoint must not be empty } "send 404 on a bad request" in { import java.net._ diff --git a/module/src/test/scala/org/scalatestplus/play/OneServerPerTestSpec.scala b/module/src/test/scala/org/scalatestplus/play/OneServerPerTestSpec.scala index c8b10af2..8478577c 100644 --- a/module/src/test/scala/org/scalatestplus/play/OneServerPerTestSpec.scala +++ b/module/src/test/scala/org/scalatestplus/play/OneServerPerTestSpec.scala @@ -15,7 +15,6 @@ */ package org.scalatestplus.play -import play.api.test._ import org.scalatest._ import org.scalatestplus.play.guice.GuiceOneServerPerTest import play.api.Application @@ -36,8 +35,8 @@ class OneServerPerTestSpec extends UnitSpec with GuiceOneServerPerTest { "make the Application available implicitly" in { getConfig("foo") mustBe Some("bar") } - "provide the port" in { - port mustBe Helpers.testServerPort + "provide an http endpoint" in { + runningServer.endpoints.httpEndpoint must not be empty } "send 404 on a bad request" in { import java.net._ diff --git a/module/src/test/scala/org/scalatestplus/play/OneServerPerTestWithAllBrowsersPerSuiteSpec.scala b/module/src/test/scala/org/scalatestplus/play/OneServerPerTestWithAllBrowsersPerSuiteSpec.scala index a93fa907..4c981c91 100644 --- a/module/src/test/scala/org/scalatestplus/play/OneServerPerTestWithAllBrowsersPerSuiteSpec.scala +++ b/module/src/test/scala/org/scalatestplus/play/OneServerPerTestWithAllBrowsersPerSuiteSpec.scala @@ -15,7 +15,6 @@ */ package org.scalatestplus.play -import play.api.test._ import org.scalatest._ import play.api.Application import org.openqa.selenium.WebDriver @@ -60,8 +59,8 @@ class OneServerPerTestWithAllBrowsersPerSuiteSpec extends UnitSpec with GuiceOne "make the Application available implicitly" in { getConfig("foo") mustBe Some("bar") } - "provide the port" in { - port mustBe Helpers.testServerPort + "provide an http endpoint" in { + runningServer.endpoints.httpEndpoint must not be empty } "send 404 on a bad request" in { import java.net._ diff --git a/module/src/test/scala/org/scalatestplus/play/OneServerPerTestWithAllBrowsersPerTestSpec.scala b/module/src/test/scala/org/scalatestplus/play/OneServerPerTestWithAllBrowsersPerTestSpec.scala index dbf07b88..2f7714ac 100644 --- a/module/src/test/scala/org/scalatestplus/play/OneServerPerTestWithAllBrowsersPerTestSpec.scala +++ b/module/src/test/scala/org/scalatestplus/play/OneServerPerTestWithAllBrowsersPerTestSpec.scala @@ -15,7 +15,6 @@ */ package org.scalatestplus.play -import play.api.test._ import org.scalatest._ import org.scalatestplus.play.guice.GuiceOneServerPerTest import play.api.Application @@ -51,8 +50,8 @@ class OneServerPerTestWithAllBrowsersPerTestSpec extends UnitSpec with GuiceOneS "make the Application available implicitly" in { getConfig("foo") mustBe Some("bar") } - "provide the port" in { - port mustBe Helpers.testServerPort + "provide an http endpoint" in { + runningServer.endpoints.httpEndpoint must not be empty } "send 404 on a bad request" in { import java.net._ diff --git a/module/src/test/scala/org/scalatestplus/play/OneServerPerTestWithConfiguredBrowserSpec.scala b/module/src/test/scala/org/scalatestplus/play/OneServerPerTestWithConfiguredBrowserSpec.scala index 79e3c501..ea091a56 100644 --- a/module/src/test/scala/org/scalatestplus/play/OneServerPerTestWithConfiguredBrowserSpec.scala +++ b/module/src/test/scala/org/scalatestplus/play/OneServerPerTestWithConfiguredBrowserSpec.scala @@ -15,7 +15,6 @@ */ package org.scalatestplus.play -import play.api.test._ import org.scalatest._ import play.api.Application import org.openqa.selenium.WebDriver @@ -65,8 +64,8 @@ class OneServerPerTestWithConfiguredBrowserNestedSpec extends UnitSpec with Conf val configuredPort = configMap.getOptional[Int]("org.scalatestplus.play.port") configuredPort.value mustEqual port } - "provide the port" in { - port mustBe Helpers.testServerPort + "provide an http endpoint" in { + runningServer.endpoints.httpEndpoint must not be empty } "send 404 on a bad request" in { import java.net._ diff --git a/module/src/test/scala/org/scalatestplus/play/OneServerPerTestWithOneBrowserPerSuiteSpec.scala b/module/src/test/scala/org/scalatestplus/play/OneServerPerTestWithOneBrowserPerSuiteSpec.scala index 692b7c77..03ba3599 100644 --- a/module/src/test/scala/org/scalatestplus/play/OneServerPerTestWithOneBrowserPerSuiteSpec.scala +++ b/module/src/test/scala/org/scalatestplus/play/OneServerPerTestWithOneBrowserPerSuiteSpec.scala @@ -15,7 +15,6 @@ */ package org.scalatestplus.play -import play.api.test._ import org.scalatest._ import play.api.Application import org.openqa.selenium.WebDriver @@ -49,8 +48,8 @@ class OneServerPerTestWithOneBrowserPerSuiteSpec extends UnitSpec with GuiceOneS "make the Application available implicitly" in { getConfig("foo") mustBe Some("bar") } - "provide the port" in { - port mustBe Helpers.testServerPort + "provide an http endpoint" in { + runningServer.endpoints.httpEndpoint must not be empty } "send 404 on a bad request" in { import java.net._ diff --git a/module/src/test/scala/org/scalatestplus/play/OneServerPerTestWithOneBrowserPerTestSpec.scala b/module/src/test/scala/org/scalatestplus/play/OneServerPerTestWithOneBrowserPerTestSpec.scala index 9d27ccf5..8ec20f9d 100644 --- a/module/src/test/scala/org/scalatestplus/play/OneServerPerTestWithOneBrowserPerTestSpec.scala +++ b/module/src/test/scala/org/scalatestplus/play/OneServerPerTestWithOneBrowserPerTestSpec.scala @@ -15,7 +15,6 @@ */ package org.scalatestplus.play -import play.api.test._ import org.scalatest._ import org.scalatestplus.play.guice.GuiceOneServerPerTest import play.api.Application @@ -39,8 +38,8 @@ class OneServerPerTestWithOneBrowserPerTestSpec extends UnitSpec with GuiceOneSe "make the Application available implicitly" in { getConfig("foo") mustBe Some("bar") } - "provide the port" in { - port mustBe Helpers.testServerPort + "provide an http endpoint" in { + runningServer.endpoints.httpEndpoint must not be empty } "send 404 on a bad request" in { import java.net._ diff --git a/module/src/test/scala/org/scalatestplus/play/PhantomJSFactorySpec.scala b/module/src/test/scala/org/scalatestplus/play/PhantomJSFactorySpec.scala index 6542d010..0907c552 100644 --- a/module/src/test/scala/org/scalatestplus/play/PhantomJSFactorySpec.scala +++ b/module/src/test/scala/org/scalatestplus/play/PhantomJSFactorySpec.scala @@ -15,7 +15,6 @@ */ package org.scalatestplus.play -import play.api.test._ import org.scalatest._ import play.api.Application import org.openqa.selenium.WebDriver @@ -50,8 +49,8 @@ class PhantomJSFactorySpec extends UnitSpec with GuiceOneServerPerSuite with One "make the Application available implicitly" in { getConfig("foo") mustBe Some("bar") } - "provide the port" in { - port mustBe Helpers.testServerPort + "provide an http endpoint" in { + runningServer.endpoints.httpEndpoint must not be empty } "send 404 on a bad request" in { import java.net._ diff --git a/module/src/test/scala/org/scalatestplus/play/SafariFactorySpec.scala b/module/src/test/scala/org/scalatestplus/play/SafariFactorySpec.scala index 41a6dfe8..5ccaabb4 100644 --- a/module/src/test/scala/org/scalatestplus/play/SafariFactorySpec.scala +++ b/module/src/test/scala/org/scalatestplus/play/SafariFactorySpec.scala @@ -15,7 +15,6 @@ */ package org.scalatestplus.play -import play.api.test._ import org.scalatest._ import play.api.Application import org.openqa.selenium.WebDriver @@ -49,8 +48,8 @@ class SafariFactorySpec extends UnitSpec with GuiceOneServerPerSuite with OneBro "make the Application available implicitly" in { getConfig("foo") mustBe Some("bar") } - "provide the port" in { - port mustBe Helpers.testServerPort + "provide an http endpoint" in { + runningServer.endpoints.httpEndpoint must not be empty } "send 404 on a bad request" in { import java.net._ diff --git a/module/src/test/scala/org/scalatestplus/play/ServerSpecSpec.scala b/module/src/test/scala/org/scalatestplus/play/ServerSpecSpec.scala index aefcd4b7..027f4e67 100644 --- a/module/src/test/scala/org/scalatestplus/play/ServerSpecSpec.scala +++ b/module/src/test/scala/org/scalatestplus/play/ServerSpecSpec.scala @@ -18,7 +18,6 @@ package org.scalatestplus.play import org.scalatest._ import play.api.Application import play.api.inject.guice._ -import play.api.test._ class ServerSpecSpec extends ServerSpec { @@ -35,8 +34,8 @@ class ServerSpecSpec extends ServerSpec { "make the Application available implicitly" in { getConfig("foo") mustBe Some("bar") } - "provide the port" in { - port mustBe Helpers.testServerPort + "provide an http endpoint" in { + runningServer.endpoints.httpEndpoint must not be empty } "send 404 on a bad request" in { import java.net._ diff --git a/module/src/test/scala/org/scalatestplus/play/examples/guice/allbrowserspersuite/ExampleSpec.scala b/module/src/test/scala/org/scalatestplus/play/examples/guice/allbrowserspersuite/ExampleSpec.scala index c11672f5..b7b40e46 100644 --- a/module/src/test/scala/org/scalatestplus/play/examples/guice/allbrowserspersuite/ExampleSpec.scala +++ b/module/src/test/scala/org/scalatestplus/play/examples/guice/allbrowserspersuite/ExampleSpec.scala @@ -15,7 +15,6 @@ */ package org.scalatestplus.play.examples.guice.allbrowserspersuite -import play.api.test._ import org.scalatestplus.play._ import org.scalatestplus.play.guice.GuiceOneServerPerSuite import play.api.Application @@ -55,8 +54,8 @@ class ExampleSpec extends PlaySpec with GuiceOneServerPerSuite with AllBrowsersP def getConfig(key: String)(implicit app: Application) = app.configuration.getOptional[String](key) getConfig("foo") mustBe Some("bar") } - "provide the port" in { - port mustBe Helpers.testServerPort + "provide an http endpoint" in { + runningServer.endpoints.httpEndpoint must not be empty } "provide an actual running server" in { import java.net._ diff --git a/module/src/test/scala/org/scalatestplus/play/examples/guice/allbrowserspertest/ExampleSpec.scala b/module/src/test/scala/org/scalatestplus/play/examples/guice/allbrowserspertest/ExampleSpec.scala index a74a08f9..2523e22e 100644 --- a/module/src/test/scala/org/scalatestplus/play/examples/guice/allbrowserspertest/ExampleSpec.scala +++ b/module/src/test/scala/org/scalatestplus/play/examples/guice/allbrowserspertest/ExampleSpec.scala @@ -15,7 +15,6 @@ */ package org.scalatestplus.play.examples.guice.allbrowserspertest -import play.api.test._ import org.scalatest._ import org.scalatestplus.play._ import org.scalatestplus.play.guice._ @@ -55,8 +54,8 @@ class ExampleSpec extends PlaySpec with GuiceOneServerPerTest with AllBrowsersPe def getConfig(key: String)(implicit app: Application) = app.configuration.getOptional[String](key) getConfig("foo") mustBe Some("bar") } - "provide the port" in { - port mustBe Helpers.testServerPort + "provide an http endpoint" in { + runningServer.endpoints.httpEndpoint must not be empty } "provide an actual running server" in { import java.net._ diff --git a/module/src/test/scala/org/scalatestplus/play/examples/guice/onebrowserpersuite/ExampleSpec.scala b/module/src/test/scala/org/scalatestplus/play/examples/guice/onebrowserpersuite/ExampleSpec.scala index cfbe6364..93e784d7 100644 --- a/module/src/test/scala/org/scalatestplus/play/examples/guice/onebrowserpersuite/ExampleSpec.scala +++ b/module/src/test/scala/org/scalatestplus/play/examples/guice/onebrowserpersuite/ExampleSpec.scala @@ -15,7 +15,6 @@ */ package org.scalatestplus.play.examples.guice.onebrowserpersuite -import play.api.test.Helpers import org.scalatest.tags.FirefoxBrowser import org.scalatestplus.play._ import org.scalatestplus.play.guice.GuiceOneServerPerSuite @@ -41,8 +40,8 @@ class ExampleSpec extends PlaySpec with GuiceOneServerPerSuite with OneBrowserPe def getConfig(key: String)(implicit app: Application) = app.configuration.getOptional[String](key) getConfig("foo") mustBe Some("bar") } - "provide the port number" in { - port mustBe Helpers.testServerPort + "provide an http endpoint" in { + runningServer.endpoints.httpEndpoint must not be empty } "provide an actual running server" in { import java.net._ diff --git a/module/src/test/scala/org/scalatestplus/play/examples/guice/onebrowserpersuite/MultiBrowserExampleSpec.scala b/module/src/test/scala/org/scalatestplus/play/examples/guice/onebrowserpersuite/MultiBrowserExampleSpec.scala index 664b8e9a..3f12fb9f 100644 --- a/module/src/test/scala/org/scalatestplus/play/examples/guice/onebrowserpersuite/MultiBrowserExampleSpec.scala +++ b/module/src/test/scala/org/scalatestplus/play/examples/guice/onebrowserpersuite/MultiBrowserExampleSpec.scala @@ -15,7 +15,6 @@ */ package org.scalatestplus.play.examples.guice.onebrowserpersuite -import play.api.test._ import org.scalatest._ import tags._ import org.scalatestplus.play._ @@ -42,8 +41,8 @@ abstract class MultiBrowserExampleSpec extends PlaySpec with GuiceOneServerPerSu def getConfig(key: String)(implicit app: Application): Option[String] = app.configuration.getOptional[String](key) getConfig("foo") mustBe Some("bar") } - "provide the port number" in { - port mustBe Helpers.testServerPort + "provide an http endpoint" in { + runningServer.endpoints.httpEndpoint must not be empty } "provide an actual running server" in { import java.net._ diff --git a/module/src/test/scala/org/scalatestplus/play/examples/guice/onebrowserpersuite/NestedExampleSpec.scala b/module/src/test/scala/org/scalatestplus/play/examples/guice/onebrowserpersuite/NestedExampleSpec.scala index 1a054e5d..a3882bcf 100644 --- a/module/src/test/scala/org/scalatestplus/play/examples/guice/onebrowserpersuite/NestedExampleSpec.scala +++ b/module/src/test/scala/org/scalatestplus/play/examples/guice/onebrowserpersuite/NestedExampleSpec.scala @@ -15,7 +15,6 @@ */ package org.scalatestplus.play.examples.guice.onebrowserpersuite -import play.api.test._ import org.scalatest._ import org.scalatestplus.play._ import org.scalatestplus.play.guice.GuiceOneServerPerSuite @@ -54,8 +53,8 @@ class BlueSpec extends PlaySpec with ConfiguredServer with ConfiguredBrowser { def getConfig(key: String)(implicit app: Application): Option[String] = app.configuration.getOptional[String](key) getConfig("foo") mustBe Some("bar") } - "provide the port number" in { - port mustBe Helpers.testServerPort + "provide an http endpoint" in { + runningServer.endpoints.httpEndpoint must not be empty } "provide an actual running server" in { import java.net._ diff --git a/module/src/test/scala/org/scalatestplus/play/examples/guice/onebrowserpertest/ExampleSpec.scala b/module/src/test/scala/org/scalatestplus/play/examples/guice/onebrowserpertest/ExampleSpec.scala index 5e3f97fb..7e2bab9f 100644 --- a/module/src/test/scala/org/scalatestplus/play/examples/guice/onebrowserpertest/ExampleSpec.scala +++ b/module/src/test/scala/org/scalatestplus/play/examples/guice/onebrowserpertest/ExampleSpec.scala @@ -15,7 +15,6 @@ */ package org.scalatestplus.play.examples.guice.onebrowserpertest -import play.api.test._ import org.scalatest._ import org.scalatest.tags.FirefoxBrowser import org.scalatestplus.play._ @@ -42,8 +41,8 @@ class ExampleSpec extends PlaySpec with GuiceOneServerPerTest with OneBrowserPer def getConfig(key: String)(implicit app: Application) = app.configuration.getOptional[String](key) getConfig("foo") mustBe Some("bar") } - "provide the port number" in { - port mustBe Helpers.testServerPort + "provide an http endpoint" in { + runningServer.endpoints.httpEndpoint must not be empty } "provide an actual running server" in { import java.net._ diff --git a/module/src/test/scala/org/scalatestplus/play/examples/guice/oneserverpersuite/ExampleSpec.scala b/module/src/test/scala/org/scalatestplus/play/examples/guice/oneserverpersuite/ExampleSpec.scala index 1ad38191..f38a3182 100644 --- a/module/src/test/scala/org/scalatestplus/play/examples/guice/oneserverpersuite/ExampleSpec.scala +++ b/module/src/test/scala/org/scalatestplus/play/examples/guice/oneserverpersuite/ExampleSpec.scala @@ -15,7 +15,6 @@ */ package org.scalatestplus.play.examples.guice.oneserverpersuite -import play.api.test._ import org.scalatestplus.play._ import org.scalatestplus.play.guice.GuiceOneServerPerSuite import play.api.Application @@ -36,8 +35,8 @@ class ExampleSpec extends PlaySpec with GuiceOneServerPerSuite { def getConfig(key: String)(implicit app: Application): Option[String] = app.configuration.getOptional[String](key) getConfig("foo") mustBe Some("bar") } - "provide the port number" in { - port mustBe Helpers.testServerPort + "provide an http endpoint" in { + runningServer.endpoints.httpEndpoint must not be empty } "provide an actual running server" in { import java.net._ diff --git a/module/src/test/scala/org/scalatestplus/play/examples/guice/oneserverpersuite/NestedExampleSpec.scala b/module/src/test/scala/org/scalatestplus/play/examples/guice/oneserverpersuite/NestedExampleSpec.scala index cf7cd2a6..d42948e5 100644 --- a/module/src/test/scala/org/scalatestplus/play/examples/guice/oneserverpersuite/NestedExampleSpec.scala +++ b/module/src/test/scala/org/scalatestplus/play/examples/guice/oneserverpersuite/NestedExampleSpec.scala @@ -15,7 +15,6 @@ */ package org.scalatestplus.play.examples.guice.oneserverpersuite -import play.api.test._ import org.scalatest._ import org.scalatestplus.play._ import org.scalatestplus.play.guice.GuiceOneServerPerSuite @@ -51,8 +50,8 @@ class BlueSpec extends PlaySpec with ConfiguredServer { def getConfig(key: String)(implicit app: Application) = app.configuration.getOptional[String](key) getConfig("foo") mustBe Some("bar") } - "provide the port number" in { - port mustBe Helpers.testServerPort + "provide an http endpoint" in { + runningServer.endpoints.httpEndpoint must not be empty } "provide an actual running server" in { import java.net._ diff --git a/module/src/test/scala/org/scalatestplus/play/examples/guice/oneserverpertest/ExampleSpec.scala b/module/src/test/scala/org/scalatestplus/play/examples/guice/oneserverpertest/ExampleSpec.scala index 88b34640..6633d541 100644 --- a/module/src/test/scala/org/scalatestplus/play/examples/guice/oneserverpertest/ExampleSpec.scala +++ b/module/src/test/scala/org/scalatestplus/play/examples/guice/oneserverpertest/ExampleSpec.scala @@ -15,7 +15,6 @@ */ package org.scalatestplus.play.examples.guice.oneserverpertest -import play.api.test._ import org.scalatest._ import org.scalatestplus.play._ import org.scalatestplus.play.guice._ @@ -40,8 +39,8 @@ class ExampleSpec extends PlaySpec with GuiceOneServerPerTest { def getConfig(key: String)(implicit app: Application): Option[String] = app.configuration.getOptional[String](key) getConfig("foo") mustBe Some("bar") } - "provide the port number" in { - port mustBe Helpers.testServerPort + "provide an http endpoint" in { + runningServer.endpoints.httpEndpoint must not be empty } "provide an actual running server" in { import java.net._