Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #260 from vansweej/selenium
Selenium
- Loading branch information
Showing
3 changed files
with
82 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
specs2/src/main/scala/org/scalatra/test/specs2/SeleniumSpec.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
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 { | ||
override def map(fs: =>Fragments) = sequential ^ Step(start()) ^ super.map(fs) ^ Step(stop()) | ||
} | ||
|
||
trait MutableSeleniumSpec extends Specification with BaseSeleniumSpec | ||
|
||
trait SeleniumSpec extends Specification with BaseSeleniumSpec |
55 changes: 55 additions & 0 deletions
55
test/src/main/scala/org/scalatra/test/SeleniumWebBrowser.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package org.scalatra.test | ||
|
||
object SeleniumWebBrowser { | ||
trait Chrome extends org.scalatest.selenium.Chrome { | ||
/** | ||
* remapping of a selenium/scalatest method since it conflicts with | ||
* a specs2 method | ||
*/ | ||
def nameQuery(elementName: String): NameQuery = { | ||
name(elementName) | ||
} | ||
} | ||
|
||
trait Firefox extends org.scalatest.selenium.Firefox { | ||
/** | ||
* remapping of a selenium/scalatest method since it conflicts with | ||
* a specs2 method | ||
*/ | ||
def nameQuery(elementName: String): NameQuery = { | ||
name(elementName) | ||
} | ||
} | ||
|
||
trait HtmlUnit extends org.scalatest.selenium.HtmlUnit { | ||
/** | ||
* remapping of a selenium/scalatest method since it conflicts with | ||
* a specs2 method | ||
*/ | ||
def nameQuery(elementName: String): NameQuery = { | ||
name(elementName) | ||
} | ||
} | ||
|
||
trait InternetExplorer extends org.scalatest.selenium.InternetExplorer { | ||
/** | ||
* remapping of a selenium/scalatest method since it conflicts with | ||
* a specs2 method | ||
*/ | ||
def nameQuery(elementName: String): NameQuery = { | ||
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 SeleniumTests extends EmbeddedJettyContainer with HttpComponentsClient { } | ||
} |