trait AllBrowsersPerSuite extends TestSuiteMixin with WebBrowser with Eventually with IntegrationPatience
Trait that uses a shared test approach to enable
you to run the same tests on multiple browsers in a ScalaTest Suite
, where each kind of browser is started and stopped
just once for the whole Suite
.
Note: the difference between this trait and AllBrowsersPerTest is that this trait will allow you to write tests that rely on maintaining browser state between the tests. This is a good fit for integration tests in which each test builds on actions taken by the previous tests.
This trait overrides Suite
's withFixture
lifecycle method to create a new WebDriver
instance the first time it is needed by each test, and close it the first time it is not needed (thus allowing multiple tests
to share the same browser), and overrides the tags
lifecycle method to tag the shared tests so you can
filter them by browser type. This trait's self-type, ServerProvider, will ensure
a TestServer
and Application
are available to each test. The self-type will require that you mix in either
GuiceOneServerPerSuite, GuiceOneServerPerTest,
ConfiguredServer before you mix in this trait. Your choice among these three
ServerProvider
s will determine the extent to which a TestServer
is shared by multiple tests.
You'll need to place any tests that you want executed by multiple browsers in a sharedTests
method. Because all tests in a ScalaTest Suite
must have unique names, you'll need to append the browser name (available from the BrowserInfo
passed
to sharedTests
) to each test name:
def sharedTests(browser: BrowserInfo) { "The blog app home page" must { "have the correct title " + browser.name in { go to (host + "index.html") pageTitle must be ("Awesome Blog") }
All tests registered via sharedTests
will be registered for each desired WebDriver
, as specified by the browsers
field. When
running, any tests for browser drivers that are unavailable on the current platform will be canceled.
All tests registered under sharedTests
will be
tagged automatically if they end with a browser name in square brackets. For example, if a test name ends
with [Firefox]
, it will be automatically tagged with "org.scalatest.tags.FirefoxBrowser"
. This will
allow you can include or exclude the shared tests by browser type using ScalaTest's regular tagging feature.
You can use tagging to include or exclude browsers that you sometimes want to test with, but not always. If you
never want to test with a particular browser, you can prevent tests for it from being registered at all
by overriding browsers
and excluding its BrowserInfo
in the returned Seq
. For example, to disable registration of
tests for HtmlUnit
, you'd write:
override lazy val browsers: IndexedSeq[BrowserInfo] = Vector( FirefoxInfo, SafariInfo, InternetExplorerInfo, ChromeInfo )
Note that this trait can only be mixed into traits that register tests as functions, as the shared tests technique
is not possible in style traits that declare tests as methods, such as org.scalatest.Spec
. Attempting to do so
will become a type error once we release ScalaTest 2.2.0.
package org.scalatestplus.play.examples.allbrowserspersuite import org.scalatestplus.play._ import org.scalatestplus.play.guice._ import play.api.{Play, Application} import play.api.inject.guice._ import play.api.routing._ import play.api.cache.ehcache.EhCacheModule class ExampleSpec extends PlaySpec with GuiceOneServerPerSuite with AllBrowsersPerSuite { // Override fakeApplication if you need an Application with other than // default parameters. def fakeApplication() = new GuiceApplicationBuilder() .disable[EhCacheModule] .configure("foo" -> "bar") .router(TestRoutes.router) .build() // Place tests you want run in different browsers in the `sharedTests` method: def sharedTests(browser: BrowserInfo) = { "The AllBrowsersPerSuite trait" must { "provide a web driver " + browser.name in { go to ("http://localhost:" + port + "/testing") pageTitle mustBe "Test Page" click on find(name("b")).value eventually { pageTitle mustBe "scalatest" } } } } // Place tests that don't need a WebDriver outside the `sharedTests` method // in the constructor, the usual place for tests in a `PlaySpec` "The AllBrowsersPerSuite trait" must { "provide an Application" in { app.configuration.getOptional[String]("foo") mustBe Some("bar") } "make the Application available implicitly" in { def getConfig(key: String)(implicit app: Application) = app.configuration.getOptional[String](key) getConfig("foo") mustBe Some("bar") } "provide an http endpoint" in { runningServer.endpoints.httpEndpoint must not be empty } "provide an actual running server" in { import java.net._ val url = new URL("http://localhost:" + port + "/boum") val con = url.openConnection().asInstanceOf[HttpURLConnection] try con.getResponseCode mustBe 404 finally con.disconnect() } } }
Here's how the output would look if you ran the above test class in sbt on a platform that did not support Selenium drivers for Internet Explorer or Chrome:
> test-only *allbrowserspersharedsuite* [info] ExampleSpec: [info] The AllBrowsersPerSuite trait [info] - must provide a web driver [Firefox] [info] The AllBrowsersPerSuite trait [info] - must provide a web driver [Safari] [info] The AllBrowsersPerSuite trait [info] - must provide a web driver [InternetExplorer] !!! CANCELED !!! [info] Was unable to create a Selenium InternetExplorerDriver on this platform. (AllBrowsersPerSuite.scala:257) [info] The AllBrowsersPerSuite trait [info] - must provide a web driver [Chrome] !!! CANCELED !!! [info] Was unable to create a Selenium ChromeDriver on this platform. (AllBrowsersPerSuite.scala:257) [info] The AllBrowsersPerSuite trait [info] - must provide a web driver [HtmlUnit] [info] The AllBrowsersPerSuite trait [info] - must provide a Application [info] - must make the Application available implicitly [info] - must start the Application [info] - must provide the port [info] - must provide an actual running server
Because the shared tests will be tagged according to browser, you can include or exclude tests based on the browser they use. For example, here's how the output would look if you ran the above test class with sbt and ask to include only Firefox:
> test-only *allbrowserspersharedtest* -- -n org.scalatest.tags.FirefoxBrowser [info] ExampleSpec: [info] The AllBrowsersPerSuite trait [info] - must provide a web driver [Firefox] [info] The AllBrowsersPerSuite trait [info] The AllBrowsersPerSuite trait [info] The AllBrowsersPerSuite trait [info] The AllBrowsersPerSuite trait [info] The AllBrowsersPerSuite trait
- Self Type
- AllBrowsersPerSuite with TestSuite with ServerProvider
- Source
- AllBrowsersPerSuite.scala
- Alphabetic
- By Inheritance
- AllBrowsersPerSuite
- IntegrationPatience
- Eventually
- PatienceConfiguration
- AbstractPatienceConfiguration
- ScaledTimeSpans
- WebBrowser
- TestSuiteMixin
- SuiteMixin
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Type Members
- final class ActiveElementTarget extends SwitchTarget[Element]
- Definition Classes
- WebBrowser
- final class AlertTarget extends SwitchTarget[Alert]
- Definition Classes
- WebBrowser
- final class Checkbox extends Element
- Definition Classes
- WebBrowser
- case class ClassNameQuery extends Query with Product with Serializable
- Definition Classes
- WebBrowser
- final class ColorField extends ValueElement
- Definition Classes
- WebBrowser
- class CookiesNoun extends AnyRef
- Definition Classes
- WebBrowser
- case class CssSelectorQuery extends Query with Product with Serializable
- Definition Classes
- WebBrowser
- final class DateField extends ValueElement
- Definition Classes
- WebBrowser
- final class DateTimeField extends ValueElement
- Definition Classes
- WebBrowser
- final class DateTimeLocalField extends ValueElement
- Definition Classes
- WebBrowser
- final class DefaultContentTarget extends SwitchTarget[WebDriver]
- Definition Classes
- WebBrowser
- case class Dimension extends Product with Serializable
- Definition Classes
- WebBrowser
- sealed trait Element extends AnyRef
- Definition Classes
- WebBrowser
- final class EmailField extends ValueElement
- Definition Classes
- WebBrowser
- final class FrameElementTarget extends SwitchTarget[WebDriver]
- Definition Classes
- WebBrowser
- final class FrameIndexTarget extends SwitchTarget[WebDriver]
- Definition Classes
- WebBrowser
- final class FrameNameOrIdTarget extends SwitchTarget[WebDriver]
- Definition Classes
- WebBrowser
- final class FrameWebElementTarget extends SwitchTarget[WebDriver]
- Definition Classes
- WebBrowser
- case class IdQuery extends Query with Product with Serializable
- Definition Classes
- WebBrowser
- case class LinkTextQuery extends Query with Product with Serializable
- Definition Classes
- WebBrowser
- final class MonthField extends ValueElement
- Definition Classes
- WebBrowser
- class MultiSel extends Element
- Definition Classes
- WebBrowser
- class MultiSelOptionSeq extends IndexedSeq[String]
- Definition Classes
- WebBrowser
- case class NameQuery extends Query with Product with Serializable
- Definition Classes
- WebBrowser
- final class NumberField extends ValueElement
- Definition Classes
- WebBrowser
- case class PartialLinkTextQuery extends Query with Product with Serializable
- Definition Classes
- WebBrowser
- final class PasswordField extends ValueElement
- Definition Classes
- WebBrowser
- final case class PatienceConfig extends Product with Serializable
- Definition Classes
- AbstractPatienceConfiguration
- case class Point extends Product with Serializable
- Definition Classes
- WebBrowser
- sealed trait Query extends Product with Serializable
- Definition Classes
- WebBrowser
- final class RadioButton extends Element
- Definition Classes
- WebBrowser
- final class RadioButtonGroup extends AnyRef
- Definition Classes
- WebBrowser
- final class RangeField extends ValueElement
- Definition Classes
- WebBrowser
- final class SearchField extends ValueElement
- Definition Classes
- WebBrowser
- class SingleSel extends Element
- Definition Classes
- WebBrowser
- sealed abstract class SwitchTarget[T] extends AnyRef
- Definition Classes
- WebBrowser
- case class TagNameQuery extends Query with Product with Serializable
- Definition Classes
- WebBrowser
- final class TelField extends ValueElement
- Definition Classes
- WebBrowser
- final class TextArea extends ValueElement
- Definition Classes
- WebBrowser
- final class TextField extends ValueElement
- Definition Classes
- WebBrowser
- final class TimeField extends ValueElement
- Definition Classes
- WebBrowser
- final class UrlField extends ValueElement
- Definition Classes
- WebBrowser
- trait ValueElement extends Element
- Definition Classes
- WebBrowser
- final class WeekField extends ValueElement
- Definition Classes
- WebBrowser
- final class WindowTarget extends SwitchTarget[WebDriver]
- Definition Classes
- WebBrowser
- final class WrappedCookie extends AnyRef
- Definition Classes
- WebBrowser
- case class XPathQuery extends Query with Product with Serializable
- Definition Classes
- WebBrowser
Abstract Value Members
- abstract def expectedTestCount(filter: Filter): Int
- Definition Classes
- SuiteMixin
- abstract def nestedSuites: IndexedSeq[Suite]
- Definition Classes
- SuiteMixin
- abstract def rerunner: Option[String]
- Definition Classes
- SuiteMixin
- abstract def run(testName: Option[String], args: Args): Status
- Definition Classes
- SuiteMixin
- abstract def runNestedSuites(args: Args): Status
- Attributes
- protected
- Definition Classes
- SuiteMixin
- abstract def runTest(testName: String, args: Args): Status
- Attributes
- protected
- Definition Classes
- SuiteMixin
- abstract def sharedTests(browser: BrowserInfo): Unit
Registers tests "shared" by multiple browsers.
Registers tests "shared" by multiple browsers.
Implement this method by placing tests you wish to run for multiple browsers. This method will be called during the initialization of this trait once for each browser whose
BrowserInfo
appears in theIndexedSeq
referenced from thebrowsers
field.Make sure you append
browser.name
to each test declared insharedTests
, to ensure they all have unique names. Here's an example:def sharedTests(browser: BrowserInfo) { "The blog app home page" must { "have the correct title " + browser.name in { go to (host + "index.html") pageTitle must be ("Awesome Blog") }
If you don't append
browser.name
to each test name you'll likely be rewarded with aDuplicateTestNameException
when you attempt to run the suite.- browser
the passed in
BrowserInfo
instance
- abstract val styleName: String
- Definition Classes
- SuiteMixin
- abstract def suiteId: String
- Definition Classes
- SuiteMixin
- abstract def suiteName: String
- Definition Classes
- SuiteMixin
- abstract def testDataFor(testName: String, theConfigMap: ConfigMap): TestData
- Definition Classes
- SuiteMixin
- abstract def testNames: Set[String]
- Definition Classes
- SuiteMixin
Concrete Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##(): Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- val activeElement: (AllBrowsersPerSuite.this)#ActiveElementTarget
- Definition Classes
- WebBrowser
- def addCookie(name: String, value: String, path: String, expiry: Date, domain: String, secure: Boolean)(implicit driver: WebDriver): Unit
- Definition Classes
- WebBrowser
- val alertBox: (AllBrowsersPerSuite.this)#AlertTarget
- Definition Classes
- WebBrowser
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- lazy val browsers: IndexedSeq[BrowserInfo]
Info for available browsers.
Info for available browsers. Override to add in custom
BrowserInfo
implementations.- Attributes
- protected
- def captureTo(fileName: String)(implicit driver: WebDriver): Unit
- Definition Classes
- WebBrowser
- def checkbox(queryString: String)(implicit driver: WebDriver, pos: Position): (AllBrowsersPerSuite.this)#Checkbox
- Definition Classes
- WebBrowser
- def checkbox(query: (AllBrowsersPerSuite.this)#Query)(implicit driver: WebDriver, pos: Position): (AllBrowsersPerSuite.this)#Checkbox
- Definition Classes
- WebBrowser
- lazy val chromeDriverService: ChromeDriverService
Method to provide
ChromeDriverService
for creatingChromeDriver
, you can override this method to provide a customized instance ofChromeDriverService
Method to provide
ChromeDriverService
for creatingChromeDriver
, you can override this method to provide a customized instance ofChromeDriverService
- returns
an instance of
ChromeDriverService
- Attributes
- protected
- lazy val chromeOptions: ChromeOptions
Method to provide
ChromeOptions
for creatingChromeDriver
, you can override this method to provide a customized instance ofChromeOptions
Method to provide
ChromeOptions
for creatingChromeDriver
, you can override this method to provide a customized instance ofChromeOptions
- returns
an instance of
ChromeOptions
- Attributes
- protected
- def className(className: String): (AllBrowsersPerSuite.this)#ClassNameQuery
- Definition Classes
- WebBrowser
- def clickOn(element: (AllBrowsersPerSuite.this)#Element): Unit
- Definition Classes
- WebBrowser
- def clickOn(queryString: String)(implicit driver: WebDriver, pos: Position): Unit
- Definition Classes
- WebBrowser
- def clickOn(query: (AllBrowsersPerSuite.this)#Query)(implicit driver: WebDriver): Unit
- Definition Classes
- WebBrowser
- def clickOn(element: WebElement): Unit
- Definition Classes
- WebBrowser
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- def close()(implicit driver: WebDriver): Unit
- Definition Classes
- WebBrowser
- def colorField(queryString: String)(implicit driver: WebDriver, pos: Position): (AllBrowsersPerSuite.this)#ColorField
- Definition Classes
- WebBrowser
- def colorField(query: (AllBrowsersPerSuite.this)#Query)(implicit driver: WebDriver, pos: Position): (AllBrowsersPerSuite.this)#ColorField
- Definition Classes
- WebBrowser
- def cookie(name: String)(implicit driver: WebDriver, pos: Position): (AllBrowsersPerSuite.this)#WrappedCookie
- Definition Classes
- WebBrowser
- val cookies: (AllBrowsersPerSuite.this)#CookiesNoun
- Definition Classes
- WebBrowser
- def cssSelector(cssSelector: String): (AllBrowsersPerSuite.this)#CssSelectorQuery
- Definition Classes
- WebBrowser
- def currentUrl(implicit driver: WebDriver): String
- Definition Classes
- WebBrowser
- def dateField(queryString: String)(implicit driver: WebDriver, pos: Position): (AllBrowsersPerSuite.this)#DateField
- Definition Classes
- WebBrowser
- def dateField(query: (AllBrowsersPerSuite.this)#Query)(implicit driver: WebDriver, pos: Position): (AllBrowsersPerSuite.this)#DateField
- Definition Classes
- WebBrowser
- def dateTimeField(queryString: String)(implicit driver: WebDriver, pos: Position): (AllBrowsersPerSuite.this)#DateTimeField
- Definition Classes
- WebBrowser
- def dateTimeField(query: (AllBrowsersPerSuite.this)#Query)(implicit driver: WebDriver, pos: Position): (AllBrowsersPerSuite.this)#DateTimeField
- Definition Classes
- WebBrowser
- def dateTimeLocalField(queryString: String)(implicit driver: WebDriver, pos: Position): (AllBrowsersPerSuite.this)#DateTimeLocalField
- Definition Classes
- WebBrowser
- def dateTimeLocalField(query: (AllBrowsersPerSuite.this)#Query)(implicit driver: WebDriver, pos: Position): (AllBrowsersPerSuite.this)#DateTimeLocalField
- Definition Classes
- WebBrowser
- val defaultContent: (AllBrowsersPerSuite.this)#DefaultContentTarget
- Definition Classes
- WebBrowser
- def deleteAllCookies()(implicit driver: WebDriver, pos: Position): Unit
- Definition Classes
- WebBrowser
- def deleteCookie(name: String)(implicit driver: WebDriver, pos: Position): Unit
- Definition Classes
- WebBrowser
- def emailField(queryString: String)(implicit driver: WebDriver, pos: Position): (AllBrowsersPerSuite.this)#EmailField
- Definition Classes
- WebBrowser
- def emailField(query: (AllBrowsersPerSuite.this)#Query)(implicit driver: WebDriver, pos: Position): (AllBrowsersPerSuite.this)#EmailField
- Definition Classes
- WebBrowser
- def enter(value: String)(implicit driver: WebDriver, pos: Position): Unit
- Definition Classes
- WebBrowser
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def eventually[T](fun: => T)(implicit config: (AllBrowsersPerSuite.this)#PatienceConfig, pos: Position): T
- Definition Classes
- Eventually
- def eventually[T](interval: Interval)(fun: => T)(implicit config: (AllBrowsersPerSuite.this)#PatienceConfig, pos: Position): T
- Definition Classes
- Eventually
- def eventually[T](timeout: Timeout)(fun: => T)(implicit config: (AllBrowsersPerSuite.this)#PatienceConfig, pos: Position): T
- Definition Classes
- Eventually
- def eventually[T](timeout: Timeout, interval: Interval)(fun: => T)(implicit pos: Position): T
- Definition Classes
- Eventually
- def executeAsyncScript(script: String, args: AnyRef*)(implicit driver: WebDriver): AnyRef
- Definition Classes
- WebBrowser
- def executeScript[T](script: String, args: AnyRef*)(implicit driver: WebDriver): AnyRef
- Definition Classes
- WebBrowser
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- def find(queryString: String)(implicit driver: WebDriver): Option[(AllBrowsersPerSuite.this)#Element]
- Definition Classes
- WebBrowser
- def find(query: (AllBrowsersPerSuite.this)#Query)(implicit driver: WebDriver): Option[(AllBrowsersPerSuite.this)#Element]
- Definition Classes
- WebBrowser
- def findAll(queryString: String)(implicit driver: WebDriver): Iterator[(AllBrowsersPerSuite.this)#Element]
- Definition Classes
- WebBrowser
- def findAll(query: (AllBrowsersPerSuite.this)#Query)(implicit driver: WebDriver): Iterator[(AllBrowsersPerSuite.this)#Element]
- Definition Classes
- WebBrowser
- lazy val firefoxOptions: FirefoxOptions
Method to provide
FirefoxOptions
for creatingFirefoxDriver
, you can override this method to provide a customized instance ofFirefoxOptions
Method to provide
FirefoxOptions
for creatingFirefoxDriver
, you can override this method to provide a customized instance ofFirefoxOptions
- returns
an instance of
FirefoxOptions
- Attributes
- protected
- lazy val firefoxProfile: FirefoxProfile
Method to provide
FirefoxProfile
for creatingFirefoxDriver
, you can override this method to provide a customized instance ofFirefoxProfile
Method to provide
FirefoxProfile
for creatingFirefoxDriver
, you can override this method to provide a customized instance ofFirefoxProfile
- returns
an instance of
FirefoxProfile
- Attributes
- protected
- def frame(query: (AllBrowsersPerSuite.this)#Query)(implicit driver: WebDriver, pos: Position): (AllBrowsersPerSuite.this)#FrameWebElementTarget
- Definition Classes
- WebBrowser
- def frame(element: (AllBrowsersPerSuite.this)#Element): (AllBrowsersPerSuite.this)#FrameElementTarget
- Definition Classes
- WebBrowser
- def frame(element: WebElement): (AllBrowsersPerSuite.this)#FrameWebElementTarget
- Definition Classes
- WebBrowser
- def frame(nameOrId: String): (AllBrowsersPerSuite.this)#FrameNameOrIdTarget
- Definition Classes
- WebBrowser
- def frame(index: Int): (AllBrowsersPerSuite.this)#FrameIndexTarget
- Definition Classes
- WebBrowser
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def goBack()(implicit driver: WebDriver): Unit
- Definition Classes
- WebBrowser
- def goForward()(implicit driver: WebDriver): Unit
- Definition Classes
- WebBrowser
- def goTo(page: Page)(implicit driver: WebDriver): Unit
- Definition Classes
- WebBrowser
- def goTo(url: String)(implicit driver: WebDriver): Unit
- Definition Classes
- WebBrowser
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def id(elementId: String): (AllBrowsersPerSuite.this)#IdQuery
- Definition Classes
- WebBrowser
- def implicitlyWait(timeout: Span)(implicit driver: WebDriver): Unit
- Definition Classes
- WebBrowser
- def interval(value: Span): Interval
- Definition Classes
- PatienceConfiguration
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def isScreenshotSupported(implicit driver: WebDriver): Boolean
- Definition Classes
- WebBrowser
- def linkText(linkText: String): (AllBrowsersPerSuite.this)#LinkTextQuery
- Definition Classes
- WebBrowser
- def monthField(queryString: String)(implicit driver: WebDriver, pos: Position): (AllBrowsersPerSuite.this)#MonthField
- Definition Classes
- WebBrowser
- def monthField(query: (AllBrowsersPerSuite.this)#Query)(implicit driver: WebDriver, pos: Position): (AllBrowsersPerSuite.this)#MonthField
- Definition Classes
- WebBrowser
- def multiSel(queryString: String)(implicit driver: WebDriver, pos: Position): (AllBrowsersPerSuite.this)#MultiSel
- Definition Classes
- WebBrowser
- def multiSel(query: (AllBrowsersPerSuite.this)#Query)(implicit driver: WebDriver, pos: Position): (AllBrowsersPerSuite.this)#MultiSel
- Definition Classes
- WebBrowser
- def name(elementName: String): (AllBrowsersPerSuite.this)#NameQuery
- Definition Classes
- WebBrowser
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def numberField(queryString: String)(implicit driver: WebDriver, pos: Position): (AllBrowsersPerSuite.this)#NumberField
- Definition Classes
- WebBrowser
- def numberField(query: (AllBrowsersPerSuite.this)#Query)(implicit driver: WebDriver, pos: Position): (AllBrowsersPerSuite.this)#NumberField
- Definition Classes
- WebBrowser
- def pageSource(implicit driver: WebDriver): String
- Definition Classes
- WebBrowser
- def pageTitle(implicit driver: WebDriver): String
- Definition Classes
- WebBrowser
- def partialLinkText(partialLinkText: String): (AllBrowsersPerSuite.this)#PartialLinkTextQuery
- Definition Classes
- WebBrowser
- implicit val patienceConfig: (AllBrowsersPerSuite.this)#PatienceConfig
- Definition Classes
- IntegrationPatience → AbstractPatienceConfiguration
- def pressKeys(value: String)(implicit driver: WebDriver): Unit
- Definition Classes
- WebBrowser
- def pwdField(queryString: String)(implicit driver: WebDriver, pos: Position): (AllBrowsersPerSuite.this)#PasswordField
- Definition Classes
- WebBrowser
- def pwdField(query: (AllBrowsersPerSuite.this)#Query)(implicit driver: WebDriver, pos: Position): (AllBrowsersPerSuite.this)#PasswordField
- Definition Classes
- WebBrowser
- def quit()(implicit driver: WebDriver): Unit
- Definition Classes
- WebBrowser
- def radioButton(queryString: String)(implicit driver: WebDriver, pos: Position): (AllBrowsersPerSuite.this)#RadioButton
- Definition Classes
- WebBrowser
- def radioButton(query: (AllBrowsersPerSuite.this)#Query)(implicit driver: WebDriver, pos: Position): (AllBrowsersPerSuite.this)#RadioButton
- Definition Classes
- WebBrowser
- def radioButtonGroup(groupName: String)(implicit driver: WebDriver, pos: Position): (AllBrowsersPerSuite.this)#RadioButtonGroup
- Definition Classes
- WebBrowser
- def rangeField(queryString: String)(implicit driver: WebDriver, pos: Position): (AllBrowsersPerSuite.this)#RangeField
- Definition Classes
- WebBrowser
- def rangeField(query: (AllBrowsersPerSuite.this)#Query)(implicit driver: WebDriver, pos: Position): (AllBrowsersPerSuite.this)#RangeField
- Definition Classes
- WebBrowser
- def reloadPage()(implicit driver: WebDriver): Unit
- Definition Classes
- WebBrowser
- def runTests(testName: Option[String], args: Args): Status
Invokes
super.runTests
, ensuring that the currently installedWebDriver
(returned bywebDriver
) is closed, if necessary.Invokes
super.runTests
, ensuring that the currently installedWebDriver
(returned bywebDriver
) is closed, if necessary. For more information on how this behavior fits into the big picture, see the documentation for thewithFixture
method.- testName
an optional name of one test to run. If
None
, all relevant tests should be run. I.e.,None
acts like a wildcard that means run all relevant tests in thisSuite
.- args
the
Args
for this run- returns
a
Status
object that indicates when all tests and nested suites started by this method have completed, and whether or not a failure occurred.
- Definition Classes
- AllBrowsersPerSuite → SuiteMixin
- final def scaled(span: Span): Span
- Definition Classes
- ScaledTimeSpans
- def searchField(queryString: String)(implicit driver: WebDriver, pos: Position): (AllBrowsersPerSuite.this)#SearchField
- Definition Classes
- WebBrowser
- def searchField(query: (AllBrowsersPerSuite.this)#Query)(implicit driver: WebDriver, pos: Position): (AllBrowsersPerSuite.this)#SearchField
- Definition Classes
- WebBrowser
- def setCaptureDir(targetDirPath: String): Unit
- Definition Classes
- WebBrowser
- def setScriptTimeout(timeout: Span)(implicit driver: WebDriver): Unit
- Definition Classes
- WebBrowser
- def singleSel(queryString: String)(implicit driver: WebDriver, pos: Position): (AllBrowsersPerSuite.this)#SingleSel
- Definition Classes
- WebBrowser
- def singleSel(query: (AllBrowsersPerSuite.this)#Query)(implicit driver: WebDriver, pos: Position): (AllBrowsersPerSuite.this)#SingleSel
- Definition Classes
- WebBrowser
- def spanScaleFactor: Double
- Definition Classes
- ScaledTimeSpans
- def submit()(implicit driver: WebDriver, pos: Position): Unit
- Definition Classes
- WebBrowser
- def switchTo[T](target: (AllBrowsersPerSuite.this)#SwitchTarget[T])(implicit driver: WebDriver, pos: Position): T
- Definition Classes
- WebBrowser
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def tagName(tagName: String): (AllBrowsersPerSuite.this)#TagNameQuery
- Definition Classes
- WebBrowser
- def tags: Map[String, Set[String]]
Automatically tag browser tests with browser tags based on the test name: if a test ends in a browser name in square brackets, it will be tagged as using that browser.
Automatically tag browser tests with browser tags based on the test name: if a test ends in a browser name in square brackets, it will be tagged as using that browser. For example, if a test name ends in
[Firefox]
, it will be tagged withorg.scalatest.tags.FirefoxBrowser
. The browser tags will be merged with tags returned fromsuper.tags
, so no existing tags will be lost when the browser tags are added.- returns
super.tags
with additional browser tags added for any browser-specific tests
- Definition Classes
- AllBrowsersPerSuite → SuiteMixin
- def telField(queryString: String)(implicit driver: WebDriver, pos: Position): (AllBrowsersPerSuite.this)#TelField
- Definition Classes
- WebBrowser
- def telField(query: (AllBrowsersPerSuite.this)#Query)(implicit driver: WebDriver, pos: Position): (AllBrowsersPerSuite.this)#TelField
- Definition Classes
- WebBrowser
- def textArea(queryString: String)(implicit driver: WebDriver, pos: Position): (AllBrowsersPerSuite.this)#TextArea
- Definition Classes
- WebBrowser
- def textArea(query: (AllBrowsersPerSuite.this)#Query)(implicit driver: WebDriver, pos: Position): (AllBrowsersPerSuite.this)#TextArea
- Definition Classes
- WebBrowser
- def textField(queryString: String)(implicit driver: WebDriver, pos: Position): (AllBrowsersPerSuite.this)#TextField
- Definition Classes
- WebBrowser
- def textField(query: (AllBrowsersPerSuite.this)#Query)(implicit driver: WebDriver, pos: Position): (AllBrowsersPerSuite.this)#TextField
- Definition Classes
- WebBrowser
- def timeField(queryString: String)(implicit driver: WebDriver, pos: Position): (AllBrowsersPerSuite.this)#TimeField
- Definition Classes
- WebBrowser
- def timeField(query: (AllBrowsersPerSuite.this)#Query)(implicit driver: WebDriver, pos: Position): (AllBrowsersPerSuite.this)#TimeField
- Definition Classes
- WebBrowser
- def timeout(value: Span): Timeout
- Definition Classes
- PatienceConfiguration
- def toString(): String
- Definition Classes
- AnyRef → Any
- def urlField(queryString: String)(implicit driver: WebDriver, pos: Position): (AllBrowsersPerSuite.this)#UrlField
- Definition Classes
- WebBrowser
- def urlField(query: (AllBrowsersPerSuite.this)#Query)(implicit driver: WebDriver, pos: Position): (AllBrowsersPerSuite.this)#UrlField
- Definition Classes
- WebBrowser
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- implicit def webDriver: WebDriver
Implicit method to get the
WebDriver
for the current test. - def weekField(queryString: String)(implicit driver: WebDriver, pos: Position): (AllBrowsersPerSuite.this)#WeekField
- Definition Classes
- WebBrowser
- def weekField(query: (AllBrowsersPerSuite.this)#Query)(implicit driver: WebDriver, pos: Position): (AllBrowsersPerSuite.this)#WeekField
- Definition Classes
- WebBrowser
- def window(nameOrHandle: String): (AllBrowsersPerSuite.this)#WindowTarget
- Definition Classes
- WebBrowser
- def windowHandle(implicit driver: WebDriver): String
- Definition Classes
- WebBrowser
- def windowHandles(implicit driver: WebDriver): Set[String]
- Definition Classes
- WebBrowser
- def withFixture(test: (AllBrowsersPerSuite.this)#NoArgTest): Outcome
Inspects the current test name and if it ends with the name of one of the
BrowserInfo
s mentioned in thebrowsers
IndexedSeq
; if so, and aWebDriver
of that type is already installed and being returned bywebDriver
, does nothing so that the current test can reuse the same browser used by the previous test; otherwise, closes the currently installedWebDriver
, if necessary, and creates a new web driver by invokingcreateWebDriver
on thatBrowserInfo
and, unless it is anUnavailableDriver
, installs it so it will be returned bywebDriver
during the test.Inspects the current test name and if it ends with the name of one of the
BrowserInfo
s mentioned in thebrowsers
IndexedSeq
; if so, and aWebDriver
of that type is already installed and being returned bywebDriver
, does nothing so that the current test can reuse the same browser used by the previous test; otherwise, closes the currently installedWebDriver
, if necessary, and creates a new web driver by invokingcreateWebDriver
on thatBrowserInfo
and, unless it is anUnavailableDriver
, installs it so it will be returned bywebDriver
during the test. (If the driver is unavailable on the host platform, thecreateWebDriver
method will returnUnavailableDriver
, and thiswithFixture
implementation will cancel the test automatically.) If the current test name does not end in a browser name, thiswithFixture
method closes the currently installedWebDriver
, if necessary, and installsBrowserInfo.UnneededDriver
as the driver to be returned bywebDriver
during the test. If the test is not canceled because of an unavailable driver, thiswithFixture
method invokessuper.withFixture
.Note that unlike AllBrowsersPerTest, this trait's
withFixture
method does not ensure that theWebDriver
is closed aftersuper.withFixture
returns. Instead, this trait will close the currently installedWebDriver
only when it needs to replace the currently installed driver with a new one. This just-in-time approach to closingWebDriver
s is how this trait allows its shared tests to reuse the same browser, but will at the end of the day, leave the lastWebDriver
unclosed afterwithFixture
returns for the last time. This last-usedWebDriver
will be closed, if necessary, byrunTests
instead.- test
the no-arg test function to run with a fixture
- returns
the
Outcome
of the test execution
- Definition Classes
- AllBrowsersPerSuite → TestSuiteMixin
- def withScreenshot[T](fun: => T)(implicit driver: WebDriver): T
- Definition Classes
- WebBrowser
- def xpath(xpath: String): (AllBrowsersPerSuite.this)#XPathQuery
- Definition Classes
- WebBrowser