Selenium #260

Merged
merged 4 commits into from Mar 23, 2013

Conversation

Projects
None yet
2 participants

added support to use the selenium dsl from the latest scalatest in Specs2 tests

@casualjim casualjim and 1 other commented on an outdated diff Mar 17, 2013

...ain/scala/org/scalatra/test/specs2/SeleniumSpec.scala
+package org.scalatra
+package test
+package specs2
+
+import org.specs2.Specification
+import org.specs2.specification.{BaseSpecification, Step, Fragments}
+
+import SeleniumWebBrowser._
+
+/**
+ * A base specification structure that starts the tester before the
+ * specification and stops it afterward. Clients probably want to extend
+ * ScalatraSpec or MutableScalatraSpec.
+ */
+trait BaseSeleniumSpec extends BaseSpecification with SeleniumTests {
+ override def map(fs: =>Fragments) = Step(start()) ^ super.map(fs) ^ Step(stop())
@casualjim

casualjim Mar 17, 2013

Owner

I think you can do this:

override def map(fs: =>Fragments) = sequential ^  super.map(fs)

Is there a reason for calling start and stop again?

@vansweej

vansweej Mar 17, 2013

yes, otherwise the test will not start

@casualjim casualjim commented on an outdated diff Mar 17, 2013

...main/scala/org/scalatra/test/SeleniumWebBrowser.scala
+ name(elementName)
+ }
+ }
+
+ trait Safari extends org.scalatest.selenium.Safari {
+ /**
+ * remapping of a selenium/scalatest method since it conflicts with
+ * a specs2 method
+ */
+ def nameQuery(elementName: String): NameQuery = {
+ name(elementName)
+ }
+ }
+
+ trait EmbeddedJettyContainerSelenium extends EmbeddedJettyContainer {
+ override def port: Int = 8081
@casualjim

casualjim Mar 17, 2013

Owner

it's impossible to specify the port for selenium? It needs to be fixed?

@casualjim casualjim commented on the diff Mar 23, 2013

...ain/scala/org/scalatra/test/specs2/SeleniumSpec.scala
+package org.scalatra
+package test
+package specs2
+
+import org.specs2.Specification
+import org.specs2.specification._
+import org.specs2.main.ArgumentsShortcuts._
+
+import SeleniumWebBrowser._
+
+/**
+ * A base specification structure that starts the tester before the
+ * specification and stops it afterward. Clients probably want to extend
+ * ScalatraSpec or MutableScalatraSpec.
+ */
+trait BaseSeleniumSpec extends BaseSpecification with SeleniumTests {
@casualjim

casualjim Mar 23, 2013

Owner

Can we just have a SeleniumTests trait and none of these base specs.
Specs2 has changed so this won't work anymore

casualjim merged commit e449289 into scalatra:develop Mar 23, 2013

vansweej deleted the unknown repository branch Mar 23, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment