PageCatalogue
A table of a service's pages, with a test for each check on each page, so the report lists what was checked:
class EveryPageSpec extends ViewSpecBase with PageCatalogue {
catalogue(
staticPage("Info")(inject[InfoView](draftId)),
formPage("Name", nameForm)(inject[NameView](_, draftId)),
formPage("Date of birth", dobForm, "part of a date" -> Map("value.day" -> "1"))(
inject[DateOfBirthView](_, draftId)
),
staticPage("Not found")(inject[PageNotFoundView]())
.exceptTranslation("i18n-same-links")
)
}
Name
- must render blank, in en
- must render with errors, in en
- must meet one-h1 in en: a page has exactly one
=
- must render blank, in cy
- must meet one-h1 in cy: a page has exactly one
=
- must translate consistently by i18n-same-links, cy against en: every language links to the same places
It writes its tests in the AnyWordSpec style. For another style, mix in PageCases and call its checks from tests of your own.
Attributes
- Source
- PageCatalogue.scala
- Graph
-
- Supertypes
-
trait PageCasestrait I18nCheckstrait TwirlSpectrait SuiteLifecycletrait SuiteMixintrait TwirlSpecDsltrait TwirlMatcherstrait ContentExpectationstrait FormExpectationstrait FramingExpectationstrait AnyWordSpecLiketrait Documentingtrait Alertingtrait Notifyingtrait Informingtrait CanVerbtrait MustVerbtrait ShouldVerbtrait TestRegistrationtrait TestSuitetrait Suitetrait Serializabletrait Assertionstrait TripleEqualstrait TripleEqualsSupportclass Objecttrait Matchableclass AnyShow all
Members list
Type members
Inherited classlikes
Class whose instances are after words, which can be used to reduce text duplication.
Class whose instances are after words, which can be used to reduce text duplication.
If you are repeating a word or phrase at the beginning of each string inside a block, you can "move the word or phrase" out of the block with an after word. You create an after word by passing the repeated word or phrase to the afterWord method. Once created, you can place the after word after when, a verb (should, must, or can), or which. (You can't place one after in or is, the words that introduce a test.) Here's an example that has after words used in all three places:
import org.scalatest._
class ScalaTestGUISpec extends wordspec.AnyWordSpec {
def theUser = afterWord("the user")
def display = afterWord("display")
def is = afterWord("is")
"The ScalaTest GUI" when theUser {
"clicks on an event report in the list box" should display {
"a blue background in the clicked-on row in the list box" in {}
"the details for the event in the details area" in {}
"a rerun button" which is {
"enabled if the clicked-on event is rerunnable" in {}
"disabled if the clicked-on event is not rerunnable" in {}
}
}
}
}
Running the previous AnyWordSpec in the Scala interpreter would yield:
scala> (new ScalaTestGUISpec).execute()
The ScalaTest GUI (when the user clicks on an event report in the list box)
- should display a blue background in the clicked-on row in the list box
- should display the details for the event in the details area
- should display a rerun button that is enabled if the clicked-on event is rerunnable
- should display a rerun button that is disabled if the clicked-on event is not rerunnable
Attributes
- Inherited from:
- AnyWordSpecLike
- Source
- AnyWordSpecLike.scala
- Supertypes
-
class Objecttrait Matchableclass Any
Class used via an implicit conversion to enable two objects to be compared with === and !== with a Boolean result and an enforced type constraint between two object types. For example:
Class used via an implicit conversion to enable two objects to be compared with === and !== with a Boolean result and an enforced type constraint between two object types. For example:
assert(a === b) assert(c !== d)
You can also check numeric values against another with a tolerance. Here are some examples:
assert(a === (2.0 +- 0.1)) assert(c !== (2.0 +- 0.1))
Value parameters
- leftSide
-
An object to convert to
Equalizer, which represents the value on the left side of a===or!==invocation.
Attributes
- Inherited from:
- TripleEqualsSupport
- Source
- TripleEqualsSupport.scala
- Supertypes
-
class Objecttrait Matchableclass Any
Class used via an implicit conversion to enable any two objects to be compared with === and !== with a Boolean result and no enforced type constraint between two object types. For example:
Class used via an implicit conversion to enable any two objects to be compared with === and !== with a Boolean result and no enforced type constraint between two object types. For example:
assert(a === b) assert(c !== d)
You can also check numeric values against another with a tolerance. Here are some examples:
assert(a === (2.0 +- 0.1)) assert(c !== (2.0 +- 0.1))
Value parameters
- leftSide
-
An object to convert to
Equalizer, which represents the value on the left side of a===or!==invocation.
Attributes
- Inherited from:
- TripleEqualsSupport
- Source
- TripleEqualsSupport.scala
- Supertypes
-
class Objecttrait Matchableclass Any
Class that supports shorthand scope registration via the instance referenced from AnyWordSpecLike's it field.
Class that supports shorthand scope registration via the instance referenced from AnyWordSpecLike's it field.
This class enables syntax such as the following test registration:
"A Stack" when { ... }
it should { ... }
^
For more information and examples of the use of the it field, see the main documentation for AnyWordSpec.
Attributes
- Inherited from:
- AnyWordSpecLike
- Source
- AnyWordSpecLike.scala
- Supertypes
-
class Objecttrait Matchableclass Any
A test function taking no arguments and returning an Outcome.
A test function taking no arguments and returning an Outcome.
For more detail and examples, see the relevant section in the documentation for trait fixture.FlatSpec.
Attributes
- Inherited from:
- TestSuite
- Source
- TestSuite.scala
- Supertypes
-
trait TestDatatrait () => Outcomeclass Objecttrait Matchableclass Any
Class that supports the registration of tagged tests.
Class that supports the registration of tagged tests.
Instances of this class are returned by the taggedAs method of class AnyWordSpecStringWrapper.
Attributes
- Inherited from:
- AnyWordSpecLike
- Source
- AnyWordSpecLike.scala
- Supertypes
-
class Objecttrait Matchableclass Any
This class supports the syntax of FlatSpec, WordSpec, fixture.FlatSpec, and fixture.WordSpec.
This class supports the syntax of FlatSpec, WordSpec, fixture.FlatSpec, and fixture.WordSpec.
This class is used in conjunction with an implicit conversion to enable can methods to be invoked on Strings.
Attributes
- Inherited from:
- CanVerb
- Source
- CanVerb.scala
- Supertypes
-
class Objecttrait Matchableclass Any
This class supports the syntax of FlatSpec, WordSpec, fixture.FlatSpec, and fixture.WordSpec.
This class supports the syntax of FlatSpec, WordSpec, fixture.FlatSpec, and fixture.WordSpec.
This class is used in conjunction with an implicit conversion to enable must methods to be invoked on Strings.
Attributes
- Inherited from:
- MustVerb
- Source
- MustVerb.scala
- Supertypes
-
class Objecttrait Matchableclass Any
This class supports the syntax of FlatSpec, WordSpec, fixture.FlatSpec, and fixture.WordSpec.
This class supports the syntax of FlatSpec, WordSpec, fixture.FlatSpec, and fixture.WordSpec.
This class is used in conjunction with an implicit conversion to enable should methods to be invoked on Strings.
Attributes
- Inherited from:
- ShouldVerb
- Source
- ShouldVerb.scala
- Supertypes
-
class Objecttrait Matchableclass Any
Class that supports shorthand scope registration via the instance referenced from AnyWordSpecLike's they field.
Class that supports shorthand scope registration via the instance referenced from AnyWordSpecLike's they field.
This class enables syntax such as the following test registration:
"Basketball players" when { ... }
they should { ... }
^
For more information and examples of the use of the they field, see the main documentation for AnyWordSpec.
Attributes
- Inherited from:
- AnyWordSpecLike
- Source
- AnyWordSpecLike.scala
- Supertypes
-
class Objecttrait Matchableclass Any
Attributes
- Inherited from:
- Assertions
- Source
- Assertions.scala
- Supertypes
-
class Objecttrait Matchableclass Any
A class that via an implicit conversion (named convertToWordSpecStringWrapper) enables methods when, which, in, is, taggedAs and ignore to be invoked on Strings.
A class that via an implicit conversion (named convertToWordSpecStringWrapper) enables methods when, which, in, is, taggedAs and ignore to be invoked on Strings.
This class provides much of the syntax for AnyWordSpec, however, it does not add the verb methods (should, must, and can) to String. Instead, these are added via the ShouldVerb, MustVerb, and CanVerb traits, which AnyWordSpec mixes in, to avoid a conflict with implicit conversions provided in Matchers and MustMatchers.
Attributes
- Inherited from:
- AnyWordSpecLike
- Source
- AnyWordSpecLike.scala
- Supertypes
-
class Objecttrait Matchableclass Any
Value members
Concrete methods
A test for each of a page's checks, under its label, as checksOf lists them: in each language, that each state renders and each rule over every state, then each comparison of a language with English.
A test for each of a page's checks, under its label, as checksOf lists them: in each language, that each state renders and each rule over every state, then each comparison of a language with English.
Attributes
- Source
- PageCatalogue.scala
A page's tests under its one label: a test for each of its checks, as catalogue writes them, then the spec's own, so the report does not name the page twice:
A page's tests under its one label: a test for each of its checks, as catalogue writes them, then the spec's own, so the report does not name the page twice:
cataloguePage(formPage("Name", nameForm)(inject[NameView](_, draftId))) {
"ask for the name" in { ... }
}
Attributes
- Source
- PageCatalogue.scala
Inherited methods
Returns a TripleEqualsInvocationOnSpread[T], given an Spread[T], to facilitate the “<left> should !== (<pivot> +- <tolerance>)” syntax of Matchers.
Returns a TripleEqualsInvocationOnSpread[T], given an Spread[T], to facilitate the “<left> should !== (<pivot> +- <tolerance>)” syntax of Matchers.
Value parameters
- right
-
the
Spread[T]against which to compare the left-hand value
Attributes
- Returns
-
a
TripleEqualsInvocationOnSpreadwrapping the passedSpread[T]value, withexpectingEqualset tofalse. - Inherited from:
- TripleEqualsSupport
- Source
- TripleEqualsSupport.scala
Returns a TripleEqualsInvocation[Null], given a null reference, to facilitate the “<left> should !== null” syntax of Matchers.
Returns a TripleEqualsInvocation[Null], given a null reference, to facilitate the “<left> should !== null” syntax of Matchers.
Value parameters
- right
-
a null reference
Attributes
- Returns
-
a
TripleEqualsInvocationwrapping the passednullvalue, withexpectingEqualset tofalse. - Inherited from:
- TripleEqualsSupport
- Source
- TripleEqualsSupport.scala
Returns a TripleEqualsInvocation[T], given an object of type T, to facilitate the “<left> should !== <right>” syntax of Matchers.
Returns a TripleEqualsInvocation[T], given an object of type T, to facilitate the “<left> should !== <right>” syntax of Matchers.
Value parameters
- right
-
the right-hand side value for an equality assertion
Attributes
- Returns
-
a
TripleEqualsInvocationwrapping the passed right value, withexpectingEqualset tofalse. - Inherited from:
- TripleEqualsSupport
- Source
- TripleEqualsSupport.scala
Returns a TripleEqualsInvocationOnSpread[T], given an Spread[T], to facilitate the “<left> should === (<pivot> +- <tolerance>)” syntax of Matchers.
Returns a TripleEqualsInvocationOnSpread[T], given an Spread[T], to facilitate the “<left> should === (<pivot> +- <tolerance>)” syntax of Matchers.
Value parameters
- right
-
the
Spread[T]against which to compare the left-hand value
Attributes
- Returns
-
a
TripleEqualsInvocationOnSpreadwrapping the passedSpread[T]value, withexpectingEqualset totrue. - Inherited from:
- TripleEqualsSupport
- Source
- TripleEqualsSupport.scala
Returns a TripleEqualsInvocation[Null], given a null reference, to facilitate the “<left> should === null” syntax of Matchers.
Returns a TripleEqualsInvocation[Null], given a null reference, to facilitate the “<left> should === null” syntax of Matchers.
Value parameters
- right
-
a null reference
Attributes
- Returns
-
a
TripleEqualsInvocationwrapping the passednullvalue, withexpectingEqualset totrue. - Inherited from:
- TripleEqualsSupport
- Source
- TripleEqualsSupport.scala
Returns a TripleEqualsInvocation[T], given an object of type T, to facilitate the “<left> should === <right>” syntax of Matchers.
Returns a TripleEqualsInvocation[T], given an object of type T, to facilitate the “<left> should === <right>” syntax of Matchers.
Value parameters
- right
-
the right-hand side value for an equality assertion
Attributes
- Returns
-
a
TripleEqualsInvocationwrapping the passed right value, withexpectingEqualset totrue. - Inherited from:
- TripleEqualsSupport
- Source
- TripleEqualsSupport.scala
Creates an after word that an be used to reduce text duplication.
Creates an after word that an be used to reduce text duplication.
If you are repeating a word or phrase at the beginning of each string inside a block, you can "move the word or phrase" out of the block with an after word. You create an after word by passing the repeated word or phrase to the afterWord method. Once created, you can place the after word after when, a verb (should, must, or can), or which. (You can't place one after in or is, the words that introduce a test.) Here's an example that has after words used in all three places:
import org.scalatest._
class ScalaTestGUISpec extends wordspec.AnyWordSpec {
def theUser = afterWord("the user")
def display = afterWord("display")
def is = afterWord("is")
"The ScalaTest GUI" when theUser {
"clicks on an event report in the list box" should display {
"a blue background in the clicked-on row in the list box" in {}
"the details for the event in the details area" in {}
"a rerun button" which is {
"enabled if the clicked-on event is rerunnable" in {}
"disabled if the clicked-on event is not rerunnable" in {}
}
}
}
}
Running the previous AnyWordSpec in the Scala interpreter would yield:
scala> (new ScalaTestGUISpec).execute()
The ScalaTest GUI (when the user clicks on an event report in the list box)
- should display a blue background in the clicked-on row in the list box
- should display the details for the event in the details area
- should display a rerun button that is enabled if the clicked-on event is rerunnable
- should display a rerun button that is disabled if the clicked-on event is not rerunnable
Attributes
- Inherited from:
- AnyWordSpecLike
- Source
- AnyWordSpecLike.scala
Returns an Alerter that during test execution will forward strings passed to its apply method to the current reporter. If invoked in a constructor, it will register the passed string for forwarding later during test execution. If invoked while this AnyWordSpec is being executed, such as from inside a test function, it will forward the information to the current reporter immediately. If invoked at any other time, it will print to the standard output. This method can be called safely by any thread.
Returns an Alerter that during test execution will forward strings passed to its apply method to the current reporter. If invoked in a constructor, it will register the passed string for forwarding later during test execution. If invoked while this AnyWordSpec is being executed, such as from inside a test function, it will forward the information to the current reporter immediately. If invoked at any other time, it will print to the standard output. This method can be called safely by any thread.
Attributes
- Inherited from:
- AnyWordSpecLike
- Source
- AnyWordSpecLike.scala
Where a passing check's warnings go. Standard output here, because a spec base on this trait may have no ScalaTest reporter to hand, and a warning nobody sees is no warning. TwirlSpec routes them to ScalaTest's alert, and a spec base with Alerting can do the same in one line:
Where a passing check's warnings go. Standard output here, because a spec base on this trait may have no ScalaTest reporter to hand, and a warning nobody sees is no warning. TwirlSpec routes them to ScalaTest's alert, and a spec base with Alerting can do the same in one line:
override protected def alertHook(message: String): Unit = alert(message)
Attributes
- Definition Classes
- Inherited from:
- TwirlSpec
- Source
- TwirlSpec.scala
One selector's first match comes before another's in document order.
One selector's first match comes before another's in document order.
Reading order is not a detail: an error summary announced after the form it describes is announced too late to be useful.
Attributes
- Inherited from:
- ContentExpectations
- Source
- ContentExpectations.scala
Extra configuration for this suite's application.
Extra configuration for this suite's application.
Attributes
- Inherited from:
- TwirlSpec
- Source
- TwirlSpec.scala
Assert that a boolean condition, described in String message, is true. If the condition is true, this method returns normally. Else, it throws TestFailedException with a helpful error message appended with the String obtained by invoking toString on the specified clue as the exception's detail message.
Assert that a boolean condition, described in String message, is true. If the condition is true, this method returns normally. Else, it throws TestFailedException with a helpful error message appended with the String obtained by invoking toString on the specified clue as the exception's detail message.
This method is implemented in terms of a Scala macro that will generate a more helpful error message for expressions of this form:
-
assert(a == b, "a good clue")
-
assert(a != b, "a good clue")
-
assert(a === b, "a good clue")
-
assert(a !== b, "a good clue")
-
assert(a > b, "a good clue")
-
assert(a >= b, "a good clue")
-
assert(a < b, "a good clue")
-
assert(a <= b, "a good clue")
-
assert(a startsWith "prefix", "a good clue")
-
assert(a endsWith "postfix", "a good clue")
-
assert(a contains "something", "a good clue")
-
assert(a eq b, "a good clue")
-
assert(a ne b, "a good clue")
-
assert(a > 0 && b > 5, "a good clue")
-
assert(a > 0 || b > 5, "a good clue")
-
assert(a.isEmpty, "a good clue")
-
assert(!a.isEmpty, "a good clue")
-
assert(a.isInstanceOf[String], "a good clue")
-
assert(a.length == 8, "a good clue")
-
assert(a.size == 8, "a good clue")
-
assert(a.exists(_ == 8), "a good clue")
At this time, any other form of expression will just get a TestFailedException with message saying the given expression was false. In the future, we will enhance this macro to give helpful error messages in more situations. In ScalaTest 2.0, however, this behavior was sufficient to allow the === that returns Boolean to be the default in tests. This makes === consistent between tests and production code.
Value parameters
- clue
-
An objects whose
toStringmethod returns a message to include in a failure report. - condition
-
the boolean condition to assert
Attributes
- Throws
-
NullArgumentException
if
messageisnull.TestFailedExceptionif the condition is
false. - Inherited from:
- Assertions
- Source
- Assertions.scala
Assert that a boolean condition is true. If the condition is true, this method returns normally. Else, it throws TestFailedException.
Assert that a boolean condition is true. If the condition is true, this method returns normally. Else, it throws TestFailedException.
This method is implemented in terms of a Scala macro that will generate a more helpful error message for expressions of this form:
-
assert(a == b)
-
assert(a != b)
-
assert(a === b)
-
assert(a !== b)
-
assert(a > b)
-
assert(a >= b)
-
assert(a < b)
-
assert(a <= b)
-
assert(a startsWith "prefix")
-
assert(a endsWith "postfix")
-
assert(a contains "something")
-
assert(a eq b)
-
assert(a ne b)
-
assert(a > 0 && b > 5)
-
assert(a > 0 || b > 5)
-
assert(a.isEmpty)
-
assert(!a.isEmpty)
-
assert(a.isInstanceOf[String])
-
assert(a.length == 8)
-
assert(a.size == 8)
-
assert(a.exists(_ == 8))
At this time, any other form of expression will get a TestFailedException with message saying the given expression was false. In the future, we will enhance this macro to give helpful error messages in more situations. In ScalaTest 2.0, however, this behavior was sufficient to allow the === that returns Boolean to be the default in tests. This makes === consistent between tests and production code.
Value parameters
- condition
-
the boolean condition to assert
Attributes
- Throws
-
TestFailedException
if the condition is
false. - Inherited from:
- Assertions
- Source
- Assertions.scala
Asserts that a given string snippet of code passes both the Scala parser and type checker.
Asserts that a given string snippet of code passes both the Scala parser and type checker.
You can use this to make sure a snippet of code compiles:
assertCompiles("val a: Int = 1")
Although assertCompiles is implemented with a macro that determines at compile time whether the snippet of code represented by the passed string compiles, errors (i.e., snippets of code that do not compile) are reported as test failures at runtime.
Value parameters
- code
-
the snippet of code that should compile
Attributes
- Inherited from:
- Assertions
- Source
- Assertions.scala
Asserts that a given string snippet of code does not pass either the Scala parser or type checker.
Asserts that a given string snippet of code does not pass either the Scala parser or type checker.
Often when creating libraries you may wish to ensure that certain arrangements of code that represent potential “user errors” do not compile, so that your library is more error resistant. ScalaTest's Assertions trait includes the following syntax for that purpose:
assertDoesNotCompile("val a: String = \"a string")
Although assertDoesNotCompile is implemented with a macro that determines at compile time whether the snippet of code represented by the passed string doesn't compile, errors (i.e., snippets of code that do compile) are reported as test failures at runtime.
Note that the difference between assertTypeError and assertDoesNotCompile is that assertDoesNotCompile will succeed if the given code does not compile for any reason, whereas assertTypeError will only succeed if the given code does not compile because of a type error. If the given code does not compile because of a syntax error, for example, assertDoesNotCompile will return normally but assertTypeError will throw a TestFailedException.
Value parameters
- code
-
the snippet of code that should not type check
Attributes
- Inherited from:
- Assertions
- Source
- Assertions.scala
Assert that the value passed as expected equals the value passed as actual. If the actual value equals the expected value (as determined by ==), assertResult returns normally. Else, assertResult throws a TestFailedException whose detail message includes the expected and actual values.
Assert that the value passed as expected equals the value passed as actual. If the actual value equals the expected value (as determined by ==), assertResult returns normally. Else, assertResult throws a TestFailedException whose detail message includes the expected and actual values.
Value parameters
- actual
-
the actual value, which should equal the passed
expectedvalue - expected
-
the expected value
Attributes
- Throws
-
TestFailedException
if the passed
actualvalue does not equal the passedexpectedvalue. - Inherited from:
- Assertions
- Source
- Assertions.scala
Assert that the value passed as expected equals the value passed as actual. If the actual equals the expected (as determined by ==), assertResult returns normally. Else, if actual is not equal to expected, assertResult throws a TestFailedException whose detail message includes the expected and actual values, as well as the String obtained by invoking toString on the passed clue.
Assert that the value passed as expected equals the value passed as actual. If the actual equals the expected (as determined by ==), assertResult returns normally. Else, if actual is not equal to expected, assertResult throws a TestFailedException whose detail message includes the expected and actual values, as well as the String obtained by invoking toString on the passed clue.
Value parameters
- actual
-
the actual value, which should equal the passed
expectedvalue - clue
-
An object whose
toStringmethod returns a message to include in a failure report. - expected
-
the expected value
Attributes
- Throws
-
TestFailedException
if the passed
actualvalue does not equal the passedexpectedvalue. - Inherited from:
- Assertions
- Source
- Assertions.scala
Ensure that an expected exception is thrown by the passed function value. The thrown exception must be an instance of the type specified by the type parameter of this method. This method invokes the passed function. If the function throws an exception that's an instance of the specified type, this method returns Succeeded. Else, whether the passed function returns normally or completes abruptly with a different exception, this method throws TestFailedException.
Ensure that an expected exception is thrown by the passed function value. The thrown exception must be an instance of the type specified by the type parameter of this method. This method invokes the passed function. If the function throws an exception that's an instance of the specified type, this method returns Succeeded. Else, whether the passed function returns normally or completes abruptly with a different exception, this method throws TestFailedException.
Note that the type specified as this method's type parameter may represent any subtype of AnyRef, not just Throwable or one of its subclasses. In Scala, exceptions can be caught based on traits they implement, so it may at times make sense to specify a trait that the intercepted exception's class must mix in. If a class instance is passed for a type that could not possibly be used to catch an exception (such as String, for example), this method will complete abruptly with a TestFailedException.
Also note that the difference between this method and intercept is that this method does not return the expected exception, so it does not let you perform further assertions on that exception. Instead, this method returns Succeeded, which means it can serve as the last statement in an async- or safe-style suite. It also indicates to the reader of the code that nothing further is expected about the thrown exception other than its type. The recommended usage is to use assertThrows by default, intercept only when you need to inspect the caught exception further.
Value parameters
- classTag
-
an implicit
ClassTagrepresenting the type of the specified type parameter. - f
-
the function value that should throw the expected exception
Attributes
- Returns
-
the
Succeededsingleton, if an exception of the expected type is thrown - Throws
-
TestFailedException
if the passed function does not complete abruptly with an exception that's an instance of the specified type.
- Inherited from:
- Assertions
- Source
- Assertions.scala
Asserts that a given string snippet of code does not pass the Scala type checker, failing if the given snippet does not pass the Scala parser.
Asserts that a given string snippet of code does not pass the Scala type checker, failing if the given snippet does not pass the Scala parser.
Often when creating libraries you may wish to ensure that certain arrangements of code that represent potential “user errors” do not compile, so that your library is more error resistant. ScalaTest's Assertions trait includes the following syntax for that purpose:
assertTypeError("val a: String = 1")
Although assertTypeError is implemented with a macro that determines at compile time whether the snippet of code represented by the passed string type checks, errors (i.e., snippets of code that do type check) are reported as test failures at runtime.
Note that the difference between assertTypeError and assertDoesNotCompile is that assertDoesNotCompile will succeed if the given code does not compile for any reason, whereas assertTypeError will only succeed if the given code does not compile because of a type error. If the given code does not compile because of a syntax error, for example, assertDoesNotCompile will return normally but assertTypeError will throw a TestFailedException.
Value parameters
- code
-
the snippet of code that should not type check
Attributes
- Inherited from:
- Assertions
- Source
- Assertions.scala
Assume that a boolean condition, described in String message, is true. If the condition is true, this method returns normally. Else, it throws TestCanceledException with a helpful error message appended with String obtained by invoking toString on the specified clue as the exception's detail message.
Assume that a boolean condition, described in String message, is true. If the condition is true, this method returns normally. Else, it throws TestCanceledException with a helpful error message appended with String obtained by invoking toString on the specified clue as the exception's detail message.
This method is implemented in terms of a Scala macro that will generate a more helpful error message for expressions of this form:
-
assume(a == b, "a good clue")
-
assume(a != b, "a good clue")
-
assume(a === b, "a good clue")
-
assume(a !== b, "a good clue")
-
assume(a > b, "a good clue")
-
assume(a >= b, "a good clue")
-
assume(a < b, "a good clue")
-
assume(a <= b, "a good clue")
-
assume(a startsWith "prefix", "a good clue")
-
assume(a endsWith "postfix", "a good clue")
-
assume(a contains "something", "a good clue")
-
assume(a eq b, "a good clue")
-
assume(a ne b, "a good clue")
-
assume(a > 0 && b > 5, "a good clue")
-
assume(a > 0 || b > 5, "a good clue")
-
assume(a.isEmpty, "a good clue")
-
assume(!a.isEmpty, "a good clue")
-
assume(a.isInstanceOf[String], "a good clue")
-
assume(a.length == 8, "a good clue")
-
assume(a.size == 8, "a good clue")
-
assume(a.exists(_ == 8), "a good clue")
At this time, any other form of expression will just get a TestCanceledException with message saying the given expression was false. In the future, we will enhance this macro to give helpful error messages in more situations. In ScalaTest 2.0, however, this behavior was sufficient to allow the === that returns Boolean to be the default in tests. This makes === consistent between tests and production code.
Value parameters
- clue
-
An objects whose
toStringmethod returns a message to include in a failure report. - condition
-
the boolean condition to assume
Attributes
- Throws
-
NullArgumentException
if
messageisnull.TestCanceledExceptionif the condition is
false. - Inherited from:
- Assertions
- Source
- Assertions.scala
Assume that a boolean condition is true. If the condition is true, this method returns normally. Else, it throws TestCanceledException.
Assume that a boolean condition is true. If the condition is true, this method returns normally. Else, it throws TestCanceledException.
This method is implemented in terms of a Scala macro that will generate a more helpful error message for expressions of this form:
-
assume(a == b)
-
assume(a != b)
-
assume(a === b)
-
assume(a !== b)
-
assume(a > b)
-
assume(a >= b)
-
assume(a < b)
-
assume(a <= b)
-
assume(a startsWith "prefix")
-
assume(a endsWith "postfix")
-
assume(a contains "something")
-
assume(a eq b)
-
assume(a ne b)
-
assume(a > 0 && b > 5)
-
assume(a > 0 || b > 5)
-
assume(a.isEmpty)
-
assume(!a.isEmpty)
-
assume(a.isInstanceOf[String])
-
assume(a.length == 8)
-
assume(a.size == 8)
-
assume(a.exists(_ == 8))
At this time, any other form of expression will just get a TestCanceledException with message saying the given expression was false. In the future, we will enhance this macro to give helpful error messages in more situations. In ScalaTest 2.0, however, this behavior was sufficient to allow the === that returns Boolean to be the default in tests. This makes === consistent between tests and production code.
Value parameters
- condition
-
the boolean condition to assume
Attributes
- Throws
-
TestCanceledException
if the condition is
false. - Inherited from:
- Assertions
- Source
- Assertions.scala
Measure the other languages against this one rather than against the first page given.
Measure the other languages against this one rather than against the first page given.
Attributes
- Inherited from:
- I18nChecks
- Source
- I18nChecks.scala
The bullet list contains exactly these items, in order.
The bullet list contains exactly these items, in order.
Attributes
- Inherited from:
- ContentExpectations
- Source
- ContentExpectations.scala
The button with this id says this.
The button with this id says this.
Attributes
- Inherited from:
- FormExpectations
- Source
- FormExpectations.scala
Throws TestCanceledException, with the passed Throwable cause, to indicate a test failed. The getMessage method of the thrown TestCanceledException will return cause.toString.
Throws TestCanceledException, with the passed Throwable cause, to indicate a test failed. The getMessage method of the thrown TestCanceledException will return cause.toString.
Value parameters
- cause
-
a
Throwablethat indicates the cause of the cancellation.
Attributes
- Throws
-
NullArgumentException
if
causeisnull - Inherited from:
- Assertions
- Source
- Assertions.scala
Throws TestCanceledException, with the passed String message as the exception's detail message and Throwable cause, to indicate a test failed.
Throws TestCanceledException, with the passed String message as the exception's detail message and Throwable cause, to indicate a test failed.
Value parameters
- cause
-
A
Throwablethat indicates the cause of the failure. - message
-
A message describing the failure.
Attributes
- Throws
-
NullArgumentException
if
messageorcauseisnull - Inherited from:
- Assertions
- Source
- Assertions.scala
Throws TestCanceledException, with the passed String message as the exception's detail message, to indicate a test was canceled.
Throws TestCanceledException, with the passed String message as the exception's detail message, to indicate a test was canceled.
Value parameters
- message
-
A message describing the cancellation.
Attributes
- Throws
-
NullArgumentException
if
messageisnull - Inherited from:
- Assertions
- Source
- Assertions.scala
Throws TestCanceledException to indicate a test was canceled.
Throws TestCanceledException to indicate a test was canceled.
Attributes
- Inherited from:
- Assertions
- Source
- Assertions.scala
The caption against any expected value.
The caption against any expected value.
Attributes
- Inherited from:
- FramingExpectations
- Source
- FramingExpectations.scala
The caption rendered above (or inside) the h1.
The caption rendered above (or inside) the h1.
Attributes
- Inherited from:
- FramingExpectations
- Source
- FramingExpectations.scala
The caption, given as the exact words rather than a message key.
The caption, given as the exact words rather than a message key.
Attributes
- Inherited from:
- FramingExpectations
- Source
- FramingExpectations.scala
Assert against a page directly, outside a matcher.
Assert against a page directly, outside a matcher.
Attributes
- Inherited from:
- TwirlMatchers
- Source
- TwirlMatchers.scala
Each of this page's states meets the standards in every language.
Each of this page's states meets the standards in every language.
Attributes
- Inherited from:
- PageCases
- Source
- PageCatalogue.scala
Each of this page's states says the same thing in every language. A state that does not render in one of them has nothing to compare.
Each of this page's states says the same thing in every language. A state that does not render in one of them has nothing to compare.
Attributes
- Inherited from:
- PageCases
- Source
- PageCatalogue.scala
The checkboxes sharing this name, value by default.
The checkboxes sharing this name, value by default.
Attributes
- Inherited from:
- FormExpectations
- Source
- FormExpectations.scala
Each of this page's checks on its own, for a test of its own, named for the language it ran in: in each language the application is configured for, that each state renders and that the page meets each standards rule, and then, for each other language, that it translates consistently with the first, English, by each comparison rule. A rule's check runs it over every state, so together they check what checkStandards and checkTranslation check, and a failure names the rule and the language.
Each of this page's checks on its own, for a test of its own, named for the language it ran in: in each language the application is configured for, that each state renders and that the page meets each standards rule, and then, for each other language, that it translates consistently with the first, English, by each comparison rule. A rule's check runs it over every state, so together they check what checkStandards and checkTranslation check, and a failure names the rule and the language.
Each state renders once in each language, when a check first reads it, and again in each run of the suite. Where it does not render, its own check fails, and a rule's check that found nothing in the states that did is cancelled, as it could not check them all. The check of a standards rule the page is excused from runs the rule silently, as meetStandardsExcept does, for unusedExclusions, and fails where the spec runs no rule of that id.
The checks are named after standardsRules and languages when this is called, so the rules and applicationConfig must be defined by then: by a def, a lazy val, or a val declared above the call. As they run, the checks build the rules again in each language: a state's check fails where the spec runs a rule no check was named after, and a rule's check where the spec does not run it. A page's states need names of their own, as their checks are named after them.
Attributes
- Inherited from:
- PageCases
- Source
- PageCatalogue.scala
The column headers of the one table on the page, or in within, in order: what tableHeaders reads, less the header each row has of its own.
The column headers of the one table on the page, or in within, in order: what tableHeaders reads, less the header each row has of its own.
Attributes
- Inherited from:
- ContentExpectations
- Source
- ContentExpectations.scala
The resolved message appears somewhere in the page's visible text.
The resolved message appears somewhere in the page's visible text.
Attributes
- Inherited from:
- ContentExpectations
- Source
- ContentExpectations.scala
Somewhere in the page body, given as the exact words rather than a message key.
Somewhere in the page body, given as the exact words rather than a message key.
Attributes
- Inherited from:
- ContentExpectations
- Source
- ContentExpectations.scala
Provides a A CanEqual B for any two types A and B, enforcing the type constraint that A must be a subtype of B, given an explicit Equivalence[B].
Provides a A CanEqual B for any two types A and B, enforcing the type constraint that A must be a subtype of B, given an explicit Equivalence[B].
This method is used to enable the Explicitly DSL for TypeCheckedTripleEquals by requiring an explicit Equivalance[B], but taking an implicit function that provides evidence that A is a subtype of B.
The returned Constraint's areEqual method uses the implicitly passed Equivalence[B]'s areEquivalent method to determine equality.
This method is overridden and made implicit by subtraits LowPriorityTypeCheckedConstraint (extended by TypeCheckedTripleEquals), and overriden as non-implicit by the other subtraits in this package.
Value parameters
- equivalenceOfB
-
an
Equivalence[B]type class to which theConstraint.areEqualmethod will delegate to determine equality. - ev
-
evidence that
Ais a subype of B
Attributes
- Returns
-
an
A CanEqual Binstance whoseareEqualmethod delegates to theareEquivalentmethod of the passedEquivalence[B]. - Definition Classes
-
TripleEquals -> TripleEqualsSupport
- Inherited from:
- TripleEquals
- Source
- TripleEquals.scala
Provides an A CanEqual B instance for any two types A and B, enforcing the type constraint that B must be a subtype of A, given an explicit Equivalence[A].
Provides an A CanEqual B instance for any two types A and B, enforcing the type constraint that B must be a subtype of A, given an explicit Equivalence[A].
This method is used to enable the Explicitly DSL for TypeCheckedTripleEquals by requiring an explicit Equivalance[B], but taking an implicit function that provides evidence that A is a subtype of B. For example, under TypeCheckedTripleEquals, this method (as an implicit method), would be used to compile this statement:
def closeEnoughTo1(num: Double): Boolean = (num === 1.0)(decided by forgivingEquality)
The returned Constraint's areEqual method uses the implicitly passed Equivalence[A]'s areEquivalent method to determine equality.
This method is overridden and made implicit by subtraits TypeCheckedTripleEquals) and overriden as non-implicit by the other subtraits in this package.
Value parameters
- equalityOfA
-
an
Equivalence[A]type class to which theConstraint.areEqualmethod will delegate to determine equality. - ev
-
evidence that
Bis a subype of A
Attributes
- Returns
-
an
A CanEqual Binstance whoseareEqualmethod delegates to theareEquivalentmethod of the passedEquivalence[A]. - Definition Classes
-
TripleEquals -> TripleEqualsSupport
- Inherited from:
- TripleEquals
- Source
- TripleEquals.scala
Converts to an CheckingEqualizer that provides === and !== operators that result in Boolean and enforce a type constraint.
Converts to an CheckingEqualizer that provides === and !== operators that result in Boolean and enforce a type constraint.
This method is overridden and made implicit by subtrait TypeCheckedTripleEquals, and overriden as non-implicit by the other subtraits in this package.
Value parameters
- left
-
the object whose type to convert to
CheckingEqualizer.
Attributes
- Throws
-
NullPointerException
if
leftisnull. - Definition Classes
-
TripleEquals -> TripleEqualsSupport
- Inherited from:
- TripleEquals
- Source
- TripleEquals.scala
At least one element matches this selector. The plural form, where several matches are legitimate.
At least one element matches this selector. The plural form, where several matches are legitimate.
Attributes
- Inherited from:
- ContentExpectations
- Source
- ContentExpectations.scala
The language the current block runs in: English unless inside inLanguage, and always the configured form of it, so the page, its messages and the request's language cookie agree.
The language the current block runs in: English unless inside inLanguage, and always the configured form of it, so the page, its messages and the request's language cookie agree.
Attributes
- Inherited from:
- TwirlSpec
- Source
- TwirlSpec.scala
A GOV.UK date input, three fields under one legend, named value by default.
A GOV.UK date input, three fields under one legend, named value by default.
Attributes
- Inherited from:
- FormExpectations
- Source
- FormExpectations.scala
Returns an Equality[A] for any type A that determines equality by first calling .deep on any Array (on either the left or right side), then comparing the resulting objects with ==.
Returns an Equality[A] for any type A that determines equality by first calling .deep on any Array (on either the left or right side), then comparing the resulting objects with ==.
Attributes
- Returns
-
a default
Equalityfor typeA - Inherited from:
- TripleEqualsSupport
- Source
- TripleEqualsSupport.scala
What an assistive technology reads after the control's name.
What an assistive technology reads after the control's name.
Attributes
- Inherited from:
- FormExpectations
- Source
- FormExpectations.scala
The visible summary of a collapsed details block.
The visible summary of a collapsed details block.
Attributes
- Inherited from:
- ContentExpectations
- Source
- ContentExpectations.scala
The control is disabled, on itself or through an enclosing fieldset.
The control is disabled, on itself or through an enclosing fieldset.
Attributes
- Inherited from:
- FormExpectations
- Source
- FormExpectations.scala
The page shows all of this, and holds to every rule standardsRules resolves to: none in the core, and each check trait's own once mixed in.
The page shows all of this, and holds to every rule standardsRules resolves to: none in the core, and each check trait's own once mixed in.
Attributes
- Inherited from:
- TwirlMatchers
- Source
- TwirlMatchers.scala
As display, but without the standards — for the rare page that has to break a rule, or while a legacy view is being brought up to standard.
As display, but without the standards — for the rare page that has to break a rule, or while a legacy view is being brought up to standard.
Attributes
- Inherited from:
- TwirlMatchers
- Source
- TwirlMatchers.scala
A `` found by name or id, with builders for its label and options.
A `` found by name or id, with builders for its label and options.
Attributes
- Inherited from:
- FormExpectations
- Source
- FormExpectations.scala
An element with this id exists.
An element with this id exists.
Attributes
- Inherited from:
- ContentExpectations
- Source
- ContentExpectations.scala
Exactly this many elements match.
Exactly this many elements match.
Attributes
- Inherited from:
- ContentExpectations
- Source
- ContentExpectations.scala
The element with this id carries this class.
The element with this id carries this class.
Attributes
- Inherited from:
- ContentExpectations
- Source
- ContentExpectations.scala
The element with this id says this.
The element with this id says this.
Attributes
- Inherited from:
- ContentExpectations
- Source
- ContentExpectations.scala
This control is not disabled.
This control is not disabled.
Attributes
- Inherited from:
- FormExpectations
- Source
- FormExpectations.scala
The error summary lists exactly these field -> message key entries, in order, and every entry links to an element that exists on the page.
The error summary lists exactly these field -> message key entries, in order, and every entry links to an element that exists on the page.
Attributes
- Inherited from:
- FormExpectations
- Source
- FormExpectations.scala
The error summary mentions this field, whatever else it lists.
The error summary mentions this field, whatever else it lists.
Attributes
- Inherited from:
- FormExpectations
- Source
- FormExpectations.scala
The heading above the error summary.
The heading above the error summary.
Attributes
- Inherited from:
- FormExpectations
- Source
- FormExpectations.scala
The browser title in full, including service name and " - GOV.UK".
The browser title in full, including service name and " - GOV.UK".
Attributes
- Inherited from:
- FramingExpectations
- Source
- FramingExpectations.scala
Executes one or more tests in this Suite, printing results to the standard output.
Executes one or more tests in this Suite, printing results to the standard output.
This method invokes run on itself, passing in values that can be configured via the parameters to this method, all of which have default values. This behavior is convenient when working with ScalaTest in the Scala interpreter. Here's a summary of this method's parameters and how you can use them:
The testName parameter
If you leave testName at its default value (of null), this method will pass None to the testName parameter of run, and as a result all the tests in this suite will be executed. If you specify a testName, this method will pass Some(testName) to run, and only that test will be run. Thus to run all tests in a suite from the Scala interpreter, you can write:
scala> (new ExampleSuite).execute()
(The above syntax actually invokes the overloaded parameterless form of execute, which calls this form with its default parameter values.) To run just the test named "my favorite test" in a suite from the Scala interpreter, you would write:
scala> (new ExampleSuite).execute("my favorite test")
Or:
scala> (new ExampleSuite).execute(testName = "my favorite test")
The configMap parameter
If you provide a value for the configMap parameter, this method will pass it to run. If not, the default value of an empty Map will be passed. For more information on how to use a config map to configure your test suites, see the config map section in the main documentation for this trait. Here's an example in which you configure a run with the name of an input file:
scala> (new ExampleSuite).execute(configMap = Map("inputFileName" -> "in.txt")
The color parameter
If you leave the color parameter unspecified, this method will configure the reporter it passes to run to print to the standard output in color (via ansi escape characters). If you don't want color output, specify false for color, like this:
scala> (new ExampleSuite).execute(color = false)
The durations parameter
If you leave the durations parameter unspecified, this method will configure the reporter it passes to run to not print durations for tests and suites to the standard output. If you want durations printed, specify true for durations, like this:
scala> (new ExampleSuite).execute(durations = true)
The shortstacks and fullstacks parameters
If you leave both the shortstacks and fullstacks parameters unspecified, this method will configure the reporter it passes to run to not print stack traces for failed tests if it has a stack depth that identifies the offending line of test code. If you prefer a short stack trace (10 to 15 stack frames) to be printed with any test failure, specify true for shortstacks:
scala> (new ExampleSuite).execute(shortstacks = true)
For full stack traces, set fullstacks to true:
scala> (new ExampleSuite).execute(fullstacks = true)
If you specify true for both shortstacks and fullstacks, you'll get full stack traces.
The stats parameter
If you leave the stats parameter unspecified, this method will not fire RunStarting and either RunCompleted or RunAborted events to the reporter it passes to run. If you specify true for stats, this method will fire the run events to the reporter, and the reporter will print the expected test count before the run, and various statistics after, including the number of suites completed and number of tests that succeeded, failed, were ignored or marked pending. Here's how you get the stats:
scala> (new ExampleSuite).execute(stats = true)
To summarize, this method will pass to run:
-
testName-Noneif this method'stestNameparameter is left at its default value ofnull, elseSome(testName). -
reporter- a reporter that prints to the standard output -
stopper- aStopperwhoseapplymethod always returnsfalse -
filter- aFilterconstructed withNonefortagsToIncludeandSet()fortagsToExclude -
configMap- theconfigMappassed to this method -
distributor-None -
tracker- a newTracker
Note: In ScalaTest, the terms "execute" and "run" basically mean the same thing and can be used interchangably. The reason this method isn't named run is that it takes advantage of default arguments, and you can't mix overloaded methods and default arguments in Scala. (If named run, this method would have the same name but different arguments than the main run method that takes seven arguments. Thus it would overload and couldn't be used with default argument values.)
Design note: This method has two "features" that may seem unidiomatic. First, the default value of testName is null. Normally in Scala the type of testName would be Option[String] and the default value would be None, as it is in this trait's run method. The null value is used here for two reasons. First, in ScalaTest 1.5, execute was changed from four overloaded methods to one method with default values, taking advantage of the default and named parameters feature introduced in Scala 2.8. To not break existing source code, testName needed to have type String, as it did in two of the overloaded execute methods prior to 1.5. The other reason is that execute has always been designed to be called primarily from an interpeter environment, such as the Scala REPL (Read-Evaluate-Print-Loop). In an interpreter environment, minimizing keystrokes is king. A String type with a null default value lets users type suite.execute("my test name") rather than suite.execute(Some("my test name")), saving several keystrokes.
The second non-idiomatic feature is that shortstacks and fullstacks are all lower case rather than camel case. This is done to be consistent with the Shell, which also uses those forms. The reason lower case is used in the Shell is to save keystrokes in an interpreter environment. Most Unix commands, for example, are all lower case, making them easier and quicker to type. In the ScalaTest Shell, methods like shortstacks, fullstacks, and nostats, etc., are designed to be all lower case so they feel more like shell commands than methods.
Value parameters
- color
-
a boolean that configures whether output is printed in color
- configMap
-
a
Mapof key-value pairs that can be used by the executingSuiteof tests. - durations
-
a boolean that configures whether test and suite durations are printed to the standard output
- fullstacks
-
a boolean that configures whether full stack traces should be printed for test failures
- shortstacks
-
a boolean that configures whether short stack traces should be printed for test failures
- stats
-
a boolean that configures whether test and suite statistics are printed to the standard output
- testName
-
the name of one test to run.
Attributes
- Throws
-
IllegalArgumentException
if
testNameis defined, but no test with the specified test name exists in thisSuiteNullArgumentExceptionif the passed
configMapparameter isnull. - Inherited from:
- Suite
- Source
- Suite.scala
Bundle expectations so a service can name its own house rules once.
Bundle expectations so a service can name its own house rules once.
Attributes
- Inherited from:
- TwirlSpecDsl
- Source
- TwirlSpecDsl.scala
The total number of tests that are expected to run when this Suite's run method is invoked.
The total number of tests that are expected to run when this Suite's run method is invoked.
This trait's implementation of this method returns the sum of:
-
the size of the
testNamesList, minus the number of tests marked as ignored and any tests that are exluded by the passedFilter -
the sum of the values obtained by invoking
expectedTestCounton every nestedSuitecontained innestedSuites
Value parameters
- filter
-
a
Filterwith which to filter tests to count based on their tags
Attributes
- Inherited from:
- Suite
- Source
- Suite.scala
Throws TestFailedException, with the passed Throwable cause, to indicate a test failed. The getMessage method of the thrown TestFailedException will return cause.toString.
Throws TestFailedException, with the passed Throwable cause, to indicate a test failed. The getMessage method of the thrown TestFailedException will return cause.toString.
Value parameters
- cause
-
a
Throwablethat indicates the cause of the failure.
Attributes
- Throws
-
NullArgumentException
if
causeisnull - Inherited from:
- Assertions
- Source
- Assertions.scala
Throws TestFailedException, with the passed String message as the exception's detail message and Throwable cause, to indicate a test failed.
Throws TestFailedException, with the passed String message as the exception's detail message and Throwable cause, to indicate a test failed.
Value parameters
- cause
-
A
Throwablethat indicates the cause of the failure. - message
-
A message describing the failure.
Attributes
- Throws
-
NullArgumentException
if
messageorcauseisnull - Inherited from:
- Assertions
- Source
- Assertions.scala
Throws TestFailedException, with the passed String message as the exception's detail message, to indicate a test failed.
Throws TestFailedException, with the passed String message as the exception's detail message, to indicate a test failed.
Value parameters
- message
-
A message describing the failure.
Attributes
- Throws
-
NullArgumentException
if
messageisnull - Inherited from:
- Assertions
- Source
- Assertions.scala
Throws TestFailedException to indicate a test failed.
Throws TestFailedException to indicate a test failed.
Attributes
- Inherited from:
- Assertions
- Source
- Assertions.scala
Whether warnings fail the test.
The inline error message rendered against a specific field.
The inline error message rendered against a specific field.
Attributes
- Inherited from:
- FormExpectations
- Source
- FormExpectations.scala
A file input with this name or id is present.
A file input with this name or id is present.
Attributes
- Inherited from:
- FormExpectations
- Source
- FormExpectations.scala
The form is a GET to this action.
The form is a GET to this action.
Attributes
- Inherited from:
- FormExpectations
- Source
- FormExpectations.scala
A page with a form: blank, with the errors of an empty submission, and with those of each submission named here. The empty submission is the blank form sent untouched, as a browser sends it: each control with the value it renders with, so a field left empty arrives empty rather than missing and meets the form's own message rather than Play's generic error.required, and an unchecked or disabled control is left out. Where it cannot tell which of several forms holds the fields, as when more than one could send them or none is named after them, it sends nothing. A submission that gives no errors fails its check, because that state would show nothing the blank form does not.
A page with a form: blank, with the errors of an empty submission, and with those of each submission named here. The empty submission is the blank form sent untouched, as a browser sends it: each control with the value it renders with, so a field left empty arrives empty rather than missing and meets the form's own message rather than Play's generic error.required, and an unchecked or disabled control is left out. Where it cannot tell which of several forms holds the fields, as when more than one could send them or none is named after them, it sends nothing. A submission that gives no errors fails its check, because that state would show nothing the blank form does not.
Attributes
- Inherited from:
- PageCases
- Source
- PageCatalogue.scala
The form posts (or gets) to a specific URL.
The form posts (or gets) to a specific URL.
Attributes
- Inherited from:
- FormExpectations
- Source
- FormExpectations.scala
Each name submits this value, as a browser would submit the form. For a name submitted more than once, such as a group of checkboxes, the value has to be among the ones it submits.
Each name submits this value, as a browser would submit the form. For a name submitted more than once, such as a group of checkboxes, the value has to be among the ones it submits.
Attributes
- Inherited from:
- FormExpectations
- Source
- FormExpectations.scala
The single = against any expected value, ignoring a caption rendered inside it.
The single = against any expected value, ignoring a caption rendered inside it.
Attributes
- Inherited from:
- FramingExpectations
- Source
- FramingExpectations.scala
The single =.
A heading at a given level says this.
A heading at a given level says this.
Attributes
- Inherited from:
- FramingExpectations
- Source
- FramingExpectations.scala
The =, given as the exact words rather than a message key.
The =, given as the exact words rather than a message key.
Attributes
- Inherited from:
- FramingExpectations
- Source
- FramingExpectations.scala
A hidden input with this name carries this value.
A hidden input with this name carries this value.
Attributes
- Inherited from:
- FormExpectations
- Source
- FormExpectations.scala
Run the same block once per configured language.
Run the same block once per configured language.
Attributes
- Inherited from:
- TwirlSpec
- Source
- TwirlSpec.scala
Run a block in English, whatever language the enclosing block is in.
Run a block in English, whatever language the enclosing block is in.
Attributes
- Inherited from:
- TwirlSpec
- Source
- TwirlSpec.scala
Render this block with messages and a request for the given language in scope.
Render this block with messages and a request for the given language in scope.
The language must be one the application is configured for. Play would otherwise render the first configured language in its place, and a Welsh spec would pass on English text, so an unconfigured language fails the test instead. The block runs in the configured form of the language: a request for cy runs in cy-GB where that is what is configured, and a request for en-GB runs in en where only en is, which is how Play itself narrows a region.
Attributes
- Inherited from:
- TwirlSpec
- Source
- TwirlSpec.scala
Returns an Informer that during test execution will forward strings passed to its apply method to the current reporter. If invoked in a constructor, it will register the passed string for forwarding later during test execution. If invoked from inside a scope, it will forward the information to the current reporter immediately. If invoked from inside a test function, it will record the information and forward it to the current reporter only after the test completed, as recordedEvents of the test completed event, such as TestSucceeded. If invoked at any other time, it will print to the standard output. This method can be called safely by any thread.
Returns an Informer that during test execution will forward strings passed to its apply method to the current reporter. If invoked in a constructor, it will register the passed string for forwarding later during test execution. If invoked from inside a scope, it will forward the information to the current reporter immediately. If invoked from inside a test function, it will record the information and forward it to the current reporter only after the test completed, as recordedEvents of the test completed event, such as TestSucceeded. If invoked at any other time, it will print to the standard output. This method can be called safely by any thread.
Attributes
- Inherited from:
- AnyWordSpecLike
- Source
- AnyWordSpecLike.scala
An instance from the application's injector: inject[MyView] is how a spec gets the view it tests, and inject[MyView](form, index) applies it.
An instance from the application's injector: inject[MyView] is how a spec gets the view it tests, and inject[MyView](form, index) applies it.
Attributes
- Inherited from:
- TwirlSpec
- Source
- TwirlSpec.scala
The text of an inset text block.
The text of an inset text block.
Attributes
- Inherited from:
- ContentExpectations
- Source
- ContentExpectations.scala
Intercept and return an exception that's expected to be thrown by the passed function value. The thrown exception must be an instance of the type specified by the type parameter of this method. This method invokes the passed function. If the function throws an exception that's an instance of the specified type, this method returns that exception. Else, whether the passed function returns normally or completes abruptly with a different exception, this method throws TestFailedException.
Intercept and return an exception that's expected to be thrown by the passed function value. The thrown exception must be an instance of the type specified by the type parameter of this method. This method invokes the passed function. If the function throws an exception that's an instance of the specified type, this method returns that exception. Else, whether the passed function returns normally or completes abruptly with a different exception, this method throws TestFailedException.
Note that the type specified as this method's type parameter may represent any subtype of AnyRef, not just Throwable or one of its subclasses. In Scala, exceptions can be caught based on traits they implement, so it may at times make sense to specify a trait that the intercepted exception's class must mix in. If a class instance is passed for a type that could not possibly be used to catch an exception (such as String, for example), this method will complete abruptly with a TestFailedException.
Also note that the difference between this method and assertThrows is that this method returns the expected exception, so it lets you perform further assertions on that exception. By contrast, the assertThrows method returns Succeeded, which means it can serve as the last statement in an async- or safe-style suite. assertThrows also indicates to the reader of the code that nothing further is expected about the thrown exception other than its type. The recommended usage is to use assertThrows by default, intercept only when you need to inspect the caught exception further.
Value parameters
- classTag
-
an implicit
ClassTagrepresenting the type of the specified type parameter. - f
-
the function value that should throw the expected exception
Attributes
- Returns
-
the intercepted exception, if it is of the expected type
- Throws
-
TestFailedException
if the passed function does not complete abruptly with an exception that's an instance of the specified type.
- Inherited from:
- Assertions
- Source
- Assertions.scala
The control is marked invalid for an assistive technology.
The control is marked invalid for an assistive technology.
Attributes
- Inherited from:
- FormExpectations
- Source
- FormExpectations.scala
Every language the application is configured for, English first — en or a regional English such as en-GB.
Every language the application is configured for, English first — en or a regional English such as en-GB.
Attributes
- Inherited from:
- TwirlSpec
- Source
- TwirlSpec.scala
A link with the given text pointing at the given URL.
A link with the given text pointing at the given URL.
Attributes
- Inherited from:
- ContentExpectations
- Source
- ContentExpectations.scala
A link, given as the exact words rather than a message key.
A link, given as the exact words rather than a message key.
Attributes
- Inherited from:
- ContentExpectations
- Source
- ContentExpectations.scala
A link found by id, whatever it says.
A link found by id, whatever it says.
Attributes
- Inherited from:
- ContentExpectations
- Source
- ContentExpectations.scala
Text expectations take message keys by default; wrap a string in literal when you really do mean the exact words.
Text expectations take message keys by default; wrap a string in literal when you really do mean the exact words.
Attributes
- Inherited from:
- TwirlSpecDsl
- Source
- TwirlSpecDsl.scala
Provides an A CanEqual B for any two types A and B, enforcing the type constraint that A must be a subtype of B, given an implicit Equivalence[B].
Provides an A CanEqual B for any two types A and B, enforcing the type constraint that A must be a subtype of B, given an implicit Equivalence[B].
The returned Constraint's areEqual method uses the implicitly passed Equivalence[A]'s areEquivalent method to determine equality.
This method is overridden and made implicit by subtraits LowPriorityTypeCheckedConstraint (extended by TypeCheckedTripleEquals), and overriden as non-implicit by the other subtraits in this package.
Value parameters
- equivalenceOfB
-
an
Equivalence[B]type class to which theConstraint.areEqualmethod will delegate to determine equality. - ev
-
evidence that
Ais a subype of B
Attributes
- Returns
-
an
A CanEqual Binstance whoseareEqualmethod delegates to theareEquivalentmethod of the passedEquivalence[B]. - Definition Classes
-
TripleEquals -> TripleEqualsSupport
- Inherited from:
- TripleEquals
- Source
- TripleEquals.scala
Returns a Documenter that during test execution will forward strings passed to its apply method to the current reporter. If invoked in a constructor, it will register the passed string for forwarding later during test execution. If invoked from inside a scope, it will forward the information to the current reporter immediately. If invoked from inside a test function, it will record the information and forward it to the current reporter only after the test completed, as recordedEvents of the test completed event, such as TestSucceeded. If invoked at any other time, it will print to the standard output. This method can be called safely by any thread.
Returns a Documenter that during test execution will forward strings passed to its apply method to the current reporter. If invoked in a constructor, it will register the passed string for forwarding later during test execution. If invoked from inside a scope, it will forward the information to the current reporter immediately. If invoked from inside a test function, it will record the information and forward it to the current reporter only after the test completed, as recordedEvents of the test completed event, such as TestSucceeded. If invoked at any other time, it will print to the standard output. This method can be called safely by any thread.
Attributes
- Inherited from:
- AnyWordSpecLike
- Source
- AnyWordSpecLike.scala
The page's outline, as page.outline prints it, is the one saved in this file:
The page's outline, as page.outline prints it, is the one saved in this file:
render(view(form)) must matchOutlineSnapshot(Path.of("test/resources/outlines/name.txt"))
A file that is missing, or holds another outline, fails, with the page's outline or the lines that differ, and updateOutlineSnapshots writes it instead. Line endings and spaces at the ends of lines do not count. The outline's format changes only in a minor version, whose changelog says so. A snapshot asserts nothing for coverage: assertEverything still asks for what the page shows to be asserted.
Attributes
- Inherited from:
- TwirlMatchers
- Source
- TwirlMatchers.scala
Match text against a regular expression rather than an exact string.
Match text against a regular expression rather than an exact string.
Attributes
- Inherited from:
- TwirlSpecDsl
- Source
- TwirlSpecDsl.scala
Whatever standardsRules resolves to, for a spec that has its own assertions already.
Whatever standardsRules resolves to, for a spec that has its own assertions already.
Attributes
- Inherited from:
- TwirlMatchers
- Source
- TwirlMatchers.scala
As meetStandardsExcept, with the reason for the exclusion, which a failure then reports alongside the ids:
As meetStandardsExcept, with the reason for the exclusion, which a failure then reports alongside the ids:
page must meetStandardsExcept(Seq("one-h1"), because = "legacy page, see JIRA-123")
Attributes
- Inherited from:
- TwirlMatchers
- Source
- TwirlMatchers.scala
The standards, minus the named rules. Prefer fixing the page: an exclusion here hides the rule on every page it is applied to.
The standards, minus the named rules. Prefer fixing the page: an exclusion here hides the rule on every page it is applied to.
Every id must name an active rule. A misspelt id, or one for a rule this spec does not run, would exclude nothing, so it fails the match instead. The excluded rules still run, silently, so unusedExclusions can tell an exclusion that is still needed from one that has outlived its reason.
Attributes
- Inherited from:
- TwirlMatchers
- Source
- TwirlMatchers.scala
A message key with its arguments, where an expectation takes any expected value: summaryList(messageKey("x.dob", name) -> "27 March 1993").
A message key with its arguments, where an expectation takes any expected value: summaryList(messageKey("x.dob", name) -> "27 March 1993").
Attributes
- Inherited from:
- TwirlSpecDsl
- Source
- TwirlSpecDsl.scala
A message, resolved and normalised, ready to compare against page text.
A message, resolved and normalised, ready to compare against page text.
Attributes
- Inherited from:
- TwirlSpecDsl
- Source
- TwirlSpecDsl.scala
An immutable IndexedSeq of this Suite object's nested Suites. If this Suite contains no nested Suites, this method returns an empty IndexedSeq. This trait's implementation of this method returns an empty List.
An immutable IndexedSeq of this Suite object's nested Suites. If this Suite contains no nested Suites, this method returns an empty IndexedSeq. This trait's implementation of this method returns an empty List.
Attributes
- Inherited from:
- Suite
- Source
- Suite.scala
The resolved message appears nowhere in the page's visible text.
The resolved message appears nowhere in the page's visible text.
Attributes
- Inherited from:
- ContentExpectations
- Source
- ContentExpectations.scala
Nothing matches this selector.
Nothing matches this selector.
Attributes
- Inherited from:
- ContentExpectations
- Source
- ContentExpectations.scala
No element with this id exists.
No element with this id exists.
Attributes
- Inherited from:
- ContentExpectations
- Source
- ContentExpectations.scala
Page text has its quotes, spaces and soft hyphens normalised before comparison, and a raw messages(...) value has not — so page.text must include(messages("x")) fails on a curly apostrophe that looks identical. Normalise the expected side the same way.
Page text has its quotes, spaces and soft hyphens normalised before comparison, and a raw messages(...) value has not — so page.text must include(messages("x")) fails on a curly apostrophe that looks identical. Normalise the expected side the same way.
Attributes
- Inherited from:
- TwirlSpecDsl
- Source
- TwirlSpecDsl.scala
Returns a Notifier that during test execution will forward strings passed to its apply method to the current reporter. If invoked in a constructor, it will register the passed string for forwarding later during test execution. If invoked while this AnyWordSpec is being executed, such as from inside a test function, it will forward the information to the current reporter immediately. If invoked at any other time, it will print to the standard output. This method can be called safely by any thread.
Returns a Notifier that during test execution will forward strings passed to its apply method to the current reporter. If invoked in a constructor, it will register the passed string for forwarding later during test execution. If invoked while this AnyWordSpec is being executed, such as from inside a test function, it will forward the information to the current reporter immediately. If invoked at any other time, it will print to the standard output. This method can be called safely by any thread.
Attributes
- Inherited from:
- AnyWordSpecLike
- Source
- AnyWordSpecLike.scala
The text of a notification banner.
The text of a notification banner.
Attributes
- Inherited from:
- ContentExpectations
- Source
- ContentExpectations.scala
The numbered list contains exactly these items, in order.
The numbered list contains exactly these items, in order.
Attributes
- Inherited from:
- ContentExpectations
- Source
- ContentExpectations.scala
The body of a confirmation panel.
The body of a confirmation panel.
Attributes
- Inherited from:
- ContentExpectations
- Source
- ContentExpectations.scala
The title of a confirmation panel.
The title of a confirmation panel.
Attributes
- Inherited from:
- ContentExpectations
- Source
- ContentExpectations.scala
The message appears inside a paragraph.
The message appears inside a paragraph.
Attributes
- Inherited from:
- ContentExpectations
- Source
- ContentExpectations.scala
Throws TestPendingException to indicate a test is pending.
Throws TestPendingException to indicate a test is pending.
A pending test is one that has been given a name but is not yet implemented. The purpose of pending tests is to facilitate a style of testing in which documentation of behavior is sketched out before tests are written to verify that behavior (and often, the before the behavior of the system being tested is itself implemented). Such sketches form a kind of specification of what tests and functionality to implement later.
To support this style of testing, a test can be given a name that specifies one bit of behavior required by the system being tested. The test can also include some code that sends more information about the behavior to the reporter when the tests run. At the end of the test, it can call method pending, which will cause it to complete abruptly with TestPendingException. Because tests in ScalaTest can be designated as pending with TestPendingException, both the test name and any information sent to the reporter when running the test can appear in the report of a test run. (In other words, the code of a pending test is executed just like any other test.) However, because the test completes abruptly with TestPendingException, the test will be reported as pending, to indicate the actual test, and possibly the functionality it is intended to test, has not yet been implemented.
Note: This method always completes abruptly with a TestPendingException. Thus it always has a side effect. Methods with side effects are usually invoked with parentheses, as in pending(). This method is defined as a parameterless method, in flagrant contradiction to recommended Scala style, because it forms a kind of DSL for pending tests. It enables tests in suites such as FunSuite or FunSpec to be denoted by placing "(pending)" after the test name, as in:
test("that style rules are not laws") (pending)
Readers of the code see "pending" in parentheses, which looks like a little note attached to the test name to indicate it is pending. Whereas "(pending()) looks more like a method call, "(pending)" lets readers stay at a higher level, forgetting how it is implemented and just focusing on the intent of the programmer who wrote the code.
Attributes
- Inherited from:
- Assertions
- Source
- Assertions.scala
Execute the passed block of code, and if it completes abruptly, throw TestPendingException, else throw TestFailedException.
Execute the passed block of code, and if it completes abruptly, throw TestPendingException, else throw TestFailedException.
This method can be used to temporarily change a failing test into a pending test in such a way that it will automatically turn back into a failing test once the problem originally causing the test to fail has been fixed. At that point, you need only remove the pendingUntilFixed call. In other words, a pendingUntilFixed surrounding a block of code that isn't broken is treated as a test failure. The motivation for this behavior is to encourage people to remove pendingUntilFixed calls when there are no longer needed.
This method facilitates a style of testing in which tests are written before the code they test. Sometimes you may encounter a test failure that requires more functionality than you want to tackle without writing more tests. In this case you can mark the bit of test code causing the failure with pendingUntilFixed. You can then write more tests and functionality that eventually will get your production code to a point where the original test won't fail anymore. At this point the code block marked with pendingUntilFixed will no longer throw an exception (because the problem has been fixed). This will in turn cause pendingUntilFixed to throw TestFailedException with a detail message explaining you need to go back and remove the pendingUntilFixed call as the problem orginally causing your test code to fail has been fixed.
Value parameters
- f
-
a block of code, which if it completes abruptly, should trigger a
TestPendingException
Attributes
- Throws
-
TestPendingException
if the passed block of code completes abruptly with an
ExceptionorAssertionError - Inherited from:
- Assertions
- Source
- Assertions.scala
The radio buttons sharing this name, value by default as Play's form helpers name them.
The radio buttons sharing this name, value by default as Play's form helpers name them.
Attributes
- Inherited from:
- FormExpectations
- Source
- FormExpectations.scala
Registers an ignored test.
Registers an ignored test.
Value parameters
- testFun
-
the test function
- testTags
-
the test tags
- testText
-
the test text
Attributes
- Inherited from:
- AnyWordSpecLike
- Source
- AnyWordSpecLike.scala
Registers a test.
Registers a test.
Value parameters
- testFun
-
the test function
- testTags
-
the test tags
- testText
-
the test text
Attributes
- Inherited from:
- AnyWordSpecLike
- Source
- AnyWordSpecLike.scala
Parse rendered HTML into a page for an explicit language and its messages, rather than the implicit ones.
Parse rendered HTML into a page for an explicit language and its messages, rather than the implicit ones.
Attributes
- Inherited from:
- TwirlSpecDsl
- Source
- TwirlSpecDsl.scala
Parse rendered HTML into a page that can be asked questions.
Parse rendered HTML into a page that can be asked questions.
Attributes
- Inherited from:
- TwirlSpecDsl
- Source
- TwirlSpecDsl.scala
Render the same view in a given language, which must be one the application is configured for.
Render the same view in a given language, which must be one the application is configured for.
Attributes
- Inherited from:
- TwirlSpecDsl
- Source
- TwirlSpecDsl.scala
Render the same view in every configured language.
Render the same view in every configured language.
Attributes
- Inherited from:
- TwirlSpec
- Source
- TwirlSpec.scala
Render a view in the current language: render, with the language made explicit.
Render a view in the current language: render, with the language made explicit.
Attributes
- Inherited from:
- TwirlSpec
- Source
- TwirlSpec.scala
Whether passing tests still surface their warnings in the test output.
Whether passing tests still surface their warnings in the test output.
Attributes
- Inherited from:
- TwirlMatchers
- Source
- TwirlMatchers.scala
This control is marked required.
This control is marked required.
Attributes
- Inherited from:
- FormExpectations
- Source
- FormExpectations.scala
The fully qualified class name of the rerunner to rerun this suite. This implementation will look at this.getClass and see if it is either an accessible Suite, or it has a WrapWith annotation. If so, it returns the fully qualified class name wrapped in a Some, or else it returns None.
The fully qualified class name of the rerunner to rerun this suite. This implementation will look at this.getClass and see if it is either an accessible Suite, or it has a WrapWith annotation. If so, it returns the fully qualified class name wrapped in a Some, or else it returns None.
Attributes
- Inherited from:
- Suite
- Source
- Suite.scala
Find an element the way an assistive technology does: by role, then by the name it announces. Prefer this over an id or a class — if a control cannot be found by role and name, it cannot be found by a screen reader either.
Find an element the way an assistive technology does: by role, then by the name it announces. Prefer this over an id or a class — if a control cannot be found by role and name, it cannot be found by a screen reader either.
Attributes
- Inherited from:
- TwirlSpecDsl
- Source
- TwirlSpecDsl.scala
Runs this suite of tests.
Runs this suite of tests.
Value parameters
- args
-
the
Argsfor this run - testName
-
an optional name of one test to execute. If
None, all relevant tests should be executed. I.e.,Noneacts like a wildcard that means execute all relevant tests in thisSuite.
Attributes
- Returns
-
a
Statusobject that indicates when all tests and nested suites started by this method have completed, and whether or not a failure occurred. - Throws
-
NullArgumentException
if any passed parameter is
null. - Inherited from:
- SuiteLifecycle
- Source
- SuiteLifecycle.scala
Run a test. This trait's implementation runs the test registered with the name specified by testName. Each test's name is a concatenation of the text of all describers surrounding a test, from outside in, and the test's spec text, with one space placed between each item. (See the documenation for testNames for an example.)
Run a test. This trait's implementation runs the test registered with the name specified by testName. Each test's name is a concatenation of the text of all describers surrounding a test, from outside in, and the test's spec text, with one space placed between each item. (See the documenation for testNames for an example.)
Value parameters
- args
-
the
Argsfor this run - testName
-
the name of one test to execute.
Attributes
- Returns
-
a
Statusobject that indicates when the test started by this method has completed, and whether or not it failed . - Throws
-
NullArgumentException
if any of
testName,reporter,stopper, orconfigMapisnull. - Definition Classes
-
AnyWordSpecLike -> TestSuite -> Suite
- Inherited from:
- AnyWordSpecLike
- Source
- AnyWordSpecLike.scala
Run zero to many of this AnyWordSpec's tests.
Run zero to many of this AnyWordSpec's tests.
This method takes a testName parameter that optionally specifies a test to invoke. If testName is Some, this trait's implementation of this method invokes runTest on this object, passing in:
-
testName- theStringvalue of thetestNameOptionpassed to this method -
reporter- theReporterpassed to this method, or one that wraps and delegates to it -
stopper- theStopperpassed to this method, or one that wraps and delegates to it -
configMap- theconfigMappassed to this method, or one that wraps and delegates to it
This method takes a Set of tag names that should be included (tagsToInclude), and a Set that should be excluded (tagsToExclude), when deciding which of this Suite's tests to execute. If tagsToInclude is empty, all tests will be executed except those those belonging to tags listed in the tagsToExclude Set. If tagsToInclude is non-empty, only tests belonging to tags mentioned in tagsToInclude, and not mentioned in tagsToExclude will be executed. However, if testName is Some, tagsToInclude and tagsToExclude are essentially ignored. Only if testName is None will tagsToInclude and tagsToExclude be consulted to determine which of the tests named in the testNames Set should be run. For more information on trait tags, see the main documentation for this trait.
If testName is None, this trait's implementation of this method invokes testNames on this Suite to get a Set of names of tests to potentially execute. (A testNames value of None essentially acts as a wildcard that means all tests in this Suite that are selected by tagsToInclude and tagsToExclude should be executed.) For each test in the testName Set, in the order they appear in the iterator obtained by invoking the elements method on the Set, this trait's implementation of this method checks whether the test should be run based on the tagsToInclude and tagsToExclude Sets. If so, this implementation invokes runTest, passing in:
-
testName- theStringname of the test to run (which will be one of the names in thetestNamesSet) -
reporter- theReporterpassed to this method, or one that wraps and delegates to it -
stopper- theStopperpassed to this method, or one that wraps and delegates to it -
configMap- theconfigMappassed to this method, or one that wraps and delegates to it
Value parameters
- args
-
the
Argsfor this run - testName
-
an optional name of one test to run. If
None, all relevant tests should be run. I.e.,Noneacts like a wildcard that means run all relevant tests in thisSuite.
Attributes
- Returns
-
a
Statusobject that indicates when all tests started by this method have completed, and whether or not a failure occurred. - Throws
-
IllegalArgumentException
if
testNameis defined, but no test with the specified test name exists in thisSuiteNullArgumentExceptionif any of the passed parameters is
null. - Definition Classes
-
AnyWordSpecLike -> Suite
- Inherited from:
- AnyWordSpecLike
- Source
- AnyWordSpecLike.scala
The service or site name in the header.
The service or site name in the header.
Attributes
- Inherited from:
- FramingExpectations
- Source
- FramingExpectations.scala
The active rule set as one expectation, for asserting on the result.
The active rule set as one expectation, for asserting on the result.
Attributes
- Inherited from:
- TwirlMatchers
- Source
- TwirlMatchers.scala
Which rules run alongside every display(...). Empty here; rule modules add theirs via super.standardsRules.
Which rules run alongside every display(...). Empty here; rule modules add theirs via super.standardsRules.
Attributes
- Inherited from:
- TwirlMatchers
- Source
- TwirlMatchers.scala
A page with one state.
An h2 with the given message key.
An h2 with the given message key.
Attributes
- Inherited from:
- FramingExpectations
- Source
- FramingExpectations.scala
The submit control says this, site.continue by default.
The submit control says this, site.continue by default.
Attributes
- Inherited from:
- FormExpectations
- Source
- FormExpectations.scala
The submit control says exactly these words.
The submit control says exactly these words.
Attributes
- Inherited from:
- FormExpectations
- Source
- FormExpectations.scala
A string ID for this Suite that is intended to be unique among all suites reported during a run.
A string ID for this Suite that is intended to be unique among all suites reported during a run.
This trait's implementation of this method returns the fully qualified name of this object's class. Each suite reported during a run will commonly be an instance of a different Suite class, and in such cases, this default implementation of this method will suffice. However, in special cases you may need to override this method to ensure it is unique for each reported suite. For example, if you write a Suite subclass that reads in a file whose name is passed to its constructor and dynamically creates a suite of tests based on the information in that file, you will likely need to override this method in your Suite subclass, perhaps by appending the pathname of the file to the fully qualified class name. That way if you run a suite of tests based on a directory full of these files, you'll have unique suite IDs for each reported suite.
The suite ID is intended to be unique, because ScalaTest does not enforce that it is unique. If it is not unique, then you may not be able to uniquely identify a particular test of a particular suite. This ability is used, for example, to dynamically tag tests as having failed in the previous run when rerunning only failed tests.
Attributes
- Returns
-
this
Suiteobject's ID. - Inherited from:
- Suite
- Source
- Suite.scala
A user-friendly suite name for this Suite.
A user-friendly suite name for this Suite.
This trait's implementation of this method returns the simple name of this object's class. This trait's implementation of runNestedSuites calls this method to obtain a name for Reports to pass to the suiteStarting, suiteCompleted, and suiteAborted methods of the Reporter.
Attributes
- Returns
-
this
Suiteobject's suite name. - Inherited from:
- Suite
- Source
- Suite.scala
The summary list holds exactly these key -> value rows, in order. A key is a message key, or any expected value: messageKey("x.dob", name) for one that takes arguments, literal, matching or anyText.
The summary list holds exactly these key -> value rows, in order. A key is a message key, or any expected value: messageKey("x.dob", name) for one that takes arguments, literal, matching or anyText.
Attributes
- Inherited from:
- ContentExpectations
- Source
- ContentExpectations.scala
A row of a govukSummaryList, by its key.
A row of a govukSummaryList, by its key.
Attributes
- Inherited from:
- ContentExpectations
- Source
- ContentExpectations.scala
The table header cells, in order.
The table header cells, in order.
Attributes
- Inherited from:
- ContentExpectations
- Source
- ContentExpectations.scala
A row whose cells read exactly like this.
A row whose cells read exactly like this.
Attributes
- Inherited from:
- ContentExpectations
- Source
- ContentExpectations.scala
A Map whose keys are String names of tagged tests and whose associated values are the Set of tags for the test. If this AnyWordSpec contains no tags, this method returns an empty Map.
A Map whose keys are String names of tagged tests and whose associated values are the Set of tags for the test. If this AnyWordSpec contains no tags, this method returns an empty Map.
This trait's implementation returns tags that were passed as strings contained in Tag objects passed to taggedAs.
In addition, this trait's implementation will also auto-tag tests with class level annotations. For example, if you annotate @Ignore at the class level, all test methods in the class will be auto-annotated with org.scalatest.Ignore.
Attributes
- Definition Classes
-
AnyWordSpecLike -> Suite
- Inherited from:
- AnyWordSpecLike
- Source
- AnyWordSpecLike.scala
An instance of a template's class, for a check going through a directory of templates. There is no application here to ask for one. TwirlSpec asks its own, and a spec base with an application can do the same in one line:
An instance of a template's class, for a check going through a directory of templates. There is no application here to ask for one. TwirlSpec asks its own, and a spec base with an application can do the same in one line:
override protected def templateInstance(template: Class[_]): AnyRef =
app.injector.instanceOf(template).asInstanceOf[AnyRef]
Attributes
- Definition Classes
- Inherited from:
- TwirlSpec
- Source
- TwirlSpec.scala
Provides a TestData instance for the passed test name, given the passed config map.
Provides a TestData instance for the passed test name, given the passed config map.
This method is used to obtain a TestData instance to pass to withFixture(NoArgTest) and withFixture(OneArgTest) and the beforeEach and afterEach methods of trait BeforeAndAfterEach.
Value parameters
- testName
-
the name of the test for which to return a
TestDatainstance - theConfigMap
-
the config map to include in the returned
TestData
Attributes
- Returns
-
a
TestDatainstance for the specified test, which includes the specified config map - Definition Classes
-
AnyWordSpecLike -> Suite
- Inherited from:
- AnyWordSpecLike
- Source
- AnyWordSpecLike.scala
An immutable Set of test names. If this AnyWordSpec contains no tests, this method returns an empty Set.
An immutable Set of test names. If this AnyWordSpec contains no tests, this method returns an empty Set.
This trait's implementation of this method will return a set that contains the names of all registered tests. The set's iterator will return those names in the order in which the tests were registered. Each test's name is composed of the concatenation of the text of each surrounding describer, in order from outside in, and the text of the example itself, with all components separated by a space. For example, consider this AnyWordSpec:
import org.scalatest._
class StackSpec {
"A Stack" when {
"not empty" must {
"allow me to pop" in {}
}
"not full" must {
"allow me to push" in {}
}
}
}
Invoking testNames on this AnyWordSpec will yield a set that contains the following two test name strings:
"A Stack (when not empty) must allow me to pop" "A Stack (when not full) must allow me to push"
Attributes
- Definition Classes
-
AnyWordSpecLike -> Suite
- Inherited from:
- AnyWordSpecLike
- Source
- AnyWordSpecLike.scala
A textarea found by name or id, with the same builders as textInput.
A textarea found by name or id, with the same builders as textInput.
Attributes
- Inherited from:
- FormExpectations
- Source
- FormExpectations.scala
A text input found by name or id; chain the builders for its label, hint, value, autocomplete and type.
A text input found by name or id; chain the builders for its label, hint, value, autocomplete and type.
Attributes
- Inherited from:
- FormExpectations
- Source
- FormExpectations.scala
The browser title against any expected value, ignoring the layout's suffix and an error prefix.
The browser title against any expected value, ignoring the layout's suffix and an error prefix.
Attributes
- Inherited from:
- FramingExpectations
- Source
- FramingExpectations.scala
The browser title, ignoring the " - Service name - GOV.UK" suffix the layout appends and the translated "Error:" prefix an error state adds.
The browser title, ignoring the " - Service name - GOV.UK" suffix the layout appends and the translated "Error:" prefix an error state adds.
Attributes
- Inherited from:
- FramingExpectations
- Source
- FramingExpectations.scala
The browser title, given as the exact words rather than a message key.
The browser title, given as the exact words rather than a message key.
Attributes
- Inherited from:
- FramingExpectations
- Source
- FramingExpectations.scala
Every language renders the same page as the base language, differing only in words.
Every language renders the same page as the base language, differing only in words.
Attributes
- Inherited from:
- I18nChecks
- Source
- I18nChecks.scala
As translateConsistently, without the named rules.
As translateConsistently, without the named rules.
Attributes
- Inherited from:
- I18nChecks
- Source
- I18nChecks.scala
What a page may legitimately keep the same between languages.
What a page may legitimately keep the same between languages.
Attributes
- Inherited from:
- I18nChecks
- Source
- I18nChecks.scala
The differences, for a spec that would rather report than fail.
The differences, for a spec that would rather report than fail.
Attributes
- Inherited from:
- I18nChecks
- Source
- I18nChecks.scala
Provides an A CanEqual B instance for any two types A and B, enforcing the type constraint that B must be a subtype of A, given an implicit Equivalence[A].
Provides an A CanEqual B instance for any two types A and B, enforcing the type constraint that B must be a subtype of A, given an implicit Equivalence[A].
The returned Constraint's areEqual method uses the implicitly passed Equivalence[A]'s areEquivalent method to determine equality.
This method is overridden and made implicit by subtraits TypeCheckedTripleEquals) and overriden as non-implicit by the other subtraits in this package.
Value parameters
- equalityOfA
-
an
Equivalence[A]type class to which theConstraint.areEqualmethod will delegate to determine equality. - ev
-
evidence that
Bis a subype of A
Attributes
- Returns
-
an
A CanEqual Binstance whoseareEqualmethod delegates to theareEquivalentmethod of the passedEquivalence[A]. - Definition Classes
-
TripleEquals -> TripleEqualsSupport
- Inherited from:
- TripleEquals
- Source
- TripleEquals.scala
The rules this spec has excluded with meetStandardsExcept that found nothing on any page they were excluded from, and so exclude nothing.
The rules this spec has excluded with meetStandardsExcept that found nothing on any page they were excluded from, and so exclude nothing.
Ask it in the spec's last test, once every exclusion has run:
"need every exclusion it makes" in { unusedExclusions mustBe empty }
It knows only the tests that have run, so a run of one test can report an exclusion that another test needs.
Attributes
- Inherited from:
- TwirlMatchers
- Source
- TwirlMatchers.scala
Whether matchOutlineSnapshot writes the file it is given, where the file is missing or holds another outline, rather than failing. On where the environment sets TWIRLSPEC_UPDATE_SNAPSHOTS=true, to write snapshots again locally after a page was changed on purpose. Never in CI, where it would pass whatever a page had become.
Whether matchOutlineSnapshot writes the file it is given, where the file is missing or holds another outline, rather than failing. On where the environment sets TWIRLSPEC_UPDATE_SNAPSHOTS=true, to write snapshots again locally after a page was changed on purpose. Never in CI, where it would pass whatever a page had become.
Attributes
- Inherited from:
- TwirlMatchers
- Source
- TwirlMatchers.scala
The text of a GOV.UK warning callout.
The text of a GOV.UK warning callout.
Attributes
- Inherited from:
- ContentExpectations
- Source
- ContentExpectations.scala
Executes the block of code passed as the second parameter, and, if it completes abruptly with a ModifiableMessage exception, prepends the "clue" string passed as the first parameter to the beginning of the detail message of that thrown exception, then rethrows it. If clue does not end in a white space character, one space will be added between it and the existing detail message (unless the detail message is not defined).
Executes the block of code passed as the second parameter, and, if it completes abruptly with a ModifiableMessage exception, prepends the "clue" string passed as the first parameter to the beginning of the detail message of that thrown exception, then rethrows it. If clue does not end in a white space character, one space will be added between it and the existing detail message (unless the detail message is not defined).
This method allows you to add more information about what went wrong that will be reported when a test fails. Here's an example:
withClue("(Employee's name was: " + employee.name + ")") {
intercept[IllegalArgumentException] {
employee.getTask(-1)
}
}
If an invocation of intercept completed abruptly with an exception, the resulting message would be something like:
(Employee's name was Bob Jones) Expected IllegalArgumentException to be thrown, but no exception was thrown
Attributes
- Throws
-
NullArgumentException
if the passed
clueisnull - Inherited from:
- Assertions
- Source
- Assertions.scala
Run the passed test function in the context of a fixture established by this method.
Run the passed test function in the context of a fixture established by this method.
This method should set up the fixture needed by the tests of the current suite, invoke the test function, and if needed, perform any clean up needed after the test completes. Because the NoArgTest function passed to this method takes no parameters, preparing the fixture will require side effects, such as reassigning instance vars in this Suite or initializing a globally accessible external database. If you want to avoid reassigning instance vars you can use FixtureSuite.
This trait's implementation of runTest invokes this method for each test, passing in a NoArgTest whose apply method will execute the code of the test.
This trait's implementation of this method simply invokes the passed NoArgTest function.
Value parameters
- test
-
the no-arg test function to run with a fixture
Attributes
- Inherited from:
- TestSuite
- Source
- TestSuite.scala
These expectations, asked of one part of the page: the one element this selector matches, for a page with two tables, or a search form before the form under test.
These expectations, asked of one part of the page: the one element this selector matches, for a page with two tables, or a search form before the form under test.
within("#results")(columnHeaders("x.name", "x.born"), tableRow("Ada", "1815"))
within("form[action='/save']")(formPostsTo("/save"), submitButton())
What it matches has to be one element, or the expectation fails, as it does for anything naming one element. What an element says of another by id, such as for or aria-describedby, still reaches the whole page. So do the standards, and the page's title and language. What is asserted here counts for the page's coverage.
Attributes
- Inherited from:
- ContentExpectations
- Source
- ContentExpectations.scala
Deprecated and Inherited methods
The conversionCheckedConstraint method has been deprecated and will be removed in a future version of Scalactic. It is no longer needed now that the deprecation period of ConversionCheckedTripleEquals has expired. It will not be replaced.
The conversionCheckedConstraint method has been deprecated and will be removed in a future version of Scalactic. It is no longer needed now that the deprecation period of ConversionCheckedTripleEquals has expired. It will not be replaced.
Provides an A CanEqual B instance for any two types A and B, enforcing the type constraint that B is implicitly convertible to A, given an implicit Equivalence[A].
The returned Constraint's areEqual method uses the implicitly passed Equivalence[A]'s areEquivalent method to determine equality.
This method is overridden and made implicit by subtraits ConversionCheckedTripleEquals) and overriden as non-implicit by the other subtraits in this package.
Value parameters
- cnv
-
an implicit conversion from
Bto A - equivalenceOfA
-
an
Equivalence[A]type class to which theConstraint.areEqualmethod will delegate to determine equality.
Attributes
- Returns
-
an
A CanEqual Binstance whoseareEqualmethod delegates to theareEquivalentmethod of the passedEquivalence[A]. - Deprecated
-
[Since version 3.1.0]The conversionCheckedConstraint method has been deprecated and will be removed in a future version of ScalaTest. It is no longer needed now that the deprecation period of ConversionCheckedTripleEquals has expired. It will not be replaced. - Definition Classes
-
TripleEquals -> TripleEqualsSupport
- Inherited from:
- TripleEquals
- Source
- TripleEquals.scala
The convertEquivalenceToAToBConversionConstraint method has been deprecated and will be removed in a future version of Scalactic. It is no longer needed now that the deprecation period of ConversionCheckedTripleEquals has expired. It will not be replaced.
The convertEquivalenceToAToBConversionConstraint method has been deprecated and will be removed in a future version of Scalactic. It is no longer needed now that the deprecation period of ConversionCheckedTripleEquals has expired. It will not be replaced.
Provides an A CanEqual B instance for any two types A and B, enforcing the type constraint that A is implicitly convertible to B, given an explicit Equivalence[B].
This method is used to enable the Explicitly DSL for ConversionCheckedTripleEquals by requiring an explicit Equivalance[B], but taking an implicit function that converts from A to B.
The returned Constraint's areEqual method uses the implicitly passed Equivalence[B]'s areEquivalent method to determine equality.
This method is overridden and made implicit by subtraits LowPriorityConversionCheckedConstraint (extended by ConversionCheckedTripleEquals), and overriden as non-implicit by the other subtraits in this package.
Value parameters
- cnv
-
an implicit conversion from
Ato B - equalityOfB
-
an
Equivalence[B]type class to which theConstraint.areEqualmethod will delegate to determine equality.
Attributes
- Returns
-
an
A CanEqual Binstance whoseareEqualmethod delegates to theareEquivalentmethod of the passedEquivalence[B]. - Deprecated
-
[Since version 3.1.0]The convertEquivalenceToAToBConversionConstraint method has been deprecated and will be removed in a future version of ScalaTest. It is no longer needed now that the deprecation period of ConversionCheckedTripleEquals has expired. It will not be replaced. - Definition Classes
-
TripleEquals -> TripleEqualsSupport
- Inherited from:
- TripleEquals
- Source
- TripleEquals.scala
The convertEquivalenceToBToAConversionConstraint method has been deprecated and will be removed in a future version of Scalactic. It is no longer needed now that the deprecation period of ConversionCheckedTripleEquals has expired. It will not be replaced.
The convertEquivalenceToBToAConversionConstraint method has been deprecated and will be removed in a future version of Scalactic. It is no longer needed now that the deprecation period of ConversionCheckedTripleEquals has expired. It will not be replaced.
Provides an A CanEqual B instance for any two types A and B, enforcing the type constraint that B is implicitly convertible to A, given an explicit Equivalence[A].
This method is used to enable the Explicitly DSL for ConversionCheckedTripleEquals by requiring an explicit Equivalance[A], but taking an implicit function that converts from B to A. For example, under ConversionCheckedTripleEquals, this method (as an implicit method), would be used to compile this statement:
def closeEnoughTo1(num: Double): Boolean = (num === 1.0)(decided by forgivingEquality)
The returned Constraint's areEqual method uses the implicitly passed Equivalence[A]'s areEquivalent method to determine equality.
This method is overridden and made implicit by subtraits ConversionCheckedTripleEquals) and overriden as non-implicit by the other subtraits in this package.
Value parameters
- cnv
-
an implicit conversion from
Bto A - equivalenceOfA
-
an
Equivalence[A]type class to which theConstraint.areEqualmethod will delegate to determine equality.
Attributes
- Returns
-
an
A CanEqual Binstance whoseareEqualmethod delegates to theareEquivalentmethod of the passedEquivalence[A]. - Deprecated
-
[Since version 3.1.0]The convertEquivalenceToBToAConversionConstraint method has been deprecated and will be removed in a future version of ScalaTest. It is no longer needed now that the deprecation period of ConversionCheckedTripleEquals has expired. It will not be replaced. - Definition Classes
-
TripleEquals -> TripleEqualsSupport
- Inherited from:
- TripleEquals
- Source
- TripleEquals.scala
The lowPriorityConversionCheckedConstraint method has been deprecated and will be removed in a future version of Scalactic. It is no longer needed now that the deprecation period of ConversionCheckedTripleEquals has expired. It will not be replaced.
The lowPriorityConversionCheckedConstraint method has been deprecated and will be removed in a future version of Scalactic. It is no longer needed now that the deprecation period of ConversionCheckedTripleEquals has expired. It will not be replaced.
Provides an A CanEqual B instance for any two types A and B, enforcing the type constraint that A is implicitly convertible to B, given an implicit Equivalence[B].
The returned Constraint's areEqual method uses the implicitly passed Equivalence[B]'s areEquivalent method to determine equality.
This method is overridden and made implicit by subtraits LowPriorityConversionCheckedConstraint (extended by ConversionCheckedTripleEquals), and overriden as non-implicit by the other subtraits in this package.
Value parameters
- cnv
-
an implicit conversion from
Ato B - equalityOfB
-
an
Equivalence[B]type class to which theConstraint.areEqualmethod will delegate to determine equality.
Attributes
- Returns
-
an
A CanEqual Binstance whoseareEqualmethod delegates to theareEquivalentmethod of the passedEquivalence[B]. - Deprecated
-
[Since version 3.1.0]The lowPriorityConversionCheckedConstraint method has been deprecated and will be removed in a future version of ScalaTest. It is no longer needed now that the deprecation period of ConversionCheckedTripleEquals has expired. It will not be replaced. - Definition Classes
-
TripleEquals -> TripleEqualsSupport
- Inherited from:
- TripleEquals
- Source
- TripleEquals.scala
Trap and return any thrown exception that would normally cause a ScalaTest test to fail, or create and return a new RuntimeException indicating no exception is thrown.
Trap and return any thrown exception that would normally cause a ScalaTest test to fail, or create and return a new RuntimeException indicating no exception is thrown.
This method is intended to be used in the Scala interpreter to eliminate large stack traces when trying out ScalaTest assertions and matcher expressions. It is not intended to be used in regular test code. If you want to ensure that a bit of code throws an expected exception, use intercept, not trap. Here's an example interpreter session without trap:
scala> import org.scalatest._ import org.scalatest._ scala> import Matchers._ import Matchers._ scala> val x = 12 a: Int = 12 scala> x shouldEqual 13 org.scalatest.exceptions.TestFailedException: 12 did not equal 13 at org.scalatest.Assertions$class.newAssertionFailedException(Assertions.scala:449) at org.scalatest.Assertions$.newAssertionFailedException(Assertions.scala:1203) at org.scalatest.Assertions$AssertionsHelper.macroAssertTrue(Assertions.scala:417) at .<init>(<console>:15) at .<clinit>(<console>) at .<init>(<console>:7) at .<clinit>(<console>) at $print(<console>) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at scala.tools.nsc.interpreter.IMain$ReadEvalPrint.call(IMain.scala:731) at scala.tools.nsc.interpreter.IMain$Request.loadAndRun(IMain.scala:980) at scala.tools.nsc.interpreter.IMain.loadAndRunReq$1(IMain.scala:570) at scala.tools.nsc.interpreter.IMain.interpret(IMain.scala:601) at scala.tools.nsc.interpreter.IMain.interpret(IMain.scala:565) at scala.tools.nsc.interpreter.ILoop.reallyInterpret$1(ILoop.scala:745) at scala.tools.nsc.interpreter.ILoop.interpretStartingWith(ILoop.scala:790) at scala.tools.nsc.interpreter.ILoop.command(ILoop.scala:702) at scala.tools.nsc.interpreter.ILoop.processLine$1(ILoop.scala:566) at scala.tools.nsc.interpreter.ILoop.innerLoop$1(ILoop.scala:573) at scala.tools.nsc.interpreter.ILoop.loop(ILoop.scala:576) at scala.tools.nsc.interpreter.ILoop$$anonfun$process$1.apply$mcZ$sp(ILoop.scala:867) at scala.tools.nsc.interpreter.ILoop$$anonfun$process$1.apply(ILoop.scala:822) at scala.tools.nsc.interpreter.ILoop$$anonfun$process$1.apply(ILoop.scala:822) at scala.tools.nsc.util.ScalaClassLoader$.savingContextLoader(ScalaClassLoader.scala:135) at scala.tools.nsc.interpreter.ILoop.process(ILoop.scala:822) at scala.tools.nsc.MainGenericRunner.runTarget$1(MainGenericRunner.scala:83) at scala.tools.nsc.MainGenericRunner.process(MainGenericRunner.scala:96) at scala.tools.nsc.MainGenericRunner$.main(MainGenericRunner.scala:105) at scala.tools.nsc.MainGenericRunner.main(MainGenericRunner.scala)
That's a pretty tall stack trace. Here's what it looks like when you use trap:
scala> trap { x shouldEqual 13 }
res1: Throwable = org.scalatest.exceptions.TestFailedException: 12 did not equal 13
Much less clutter. Bear in mind, however, that if no exception is thrown by the passed block of code, the trap method will create a new NormalResult (a subclass of Throwable made for this purpose only) and return that. If the result was the Unit value, it will simply say that no exception was thrown:
scala> trap { x shouldEqual 12 }
res2: Throwable = No exception was thrown.
If the passed block of code results in a value other than Unit, the NormalResult's toString will print the value:
scala> trap { "Dude!" }
res3: Throwable = No exception was thrown. Instead, result was: "Dude!"
Although you can access the result value from the NormalResult, its type is Any and therefore not very convenient to use. It is not intended that trap be used in test code. The sole intended use case for trap is decluttering Scala interpreter sessions by eliminating stack traces when executing assertion and matcher expressions.
Attributes
- Deprecated
- The trap method is no longer needed for demos in the REPL, which now abreviates stack traces, and will be removed in a future version of ScalaTest
- Inherited from:
- Assertions
- Source
- Assertions.scala
Inherited fields
For "there is a heading, its wording is asserted elsewhere".
For "there is a heading, its wording is asserted elsewhere".
Attributes
- Inherited from:
- TwirlSpecDsl
- Source
- TwirlSpecDsl.scala
The application this suite renders with, shared across the JVM with every suite that uses the same applicationConfig.
The application this suite renders with, shared across the JVM with every suite that uses the same applicationConfig.
Attributes
- Inherited from:
- TwirlSpec
- Source
- TwirlSpec.scala
A GOV.UK back link is present.
A GOV.UK back link is present.
Attributes
- Inherited from:
- FramingExpectations
- Source
- FramingExpectations.scala
Supports shared test registration in AnyWordSpecs.
Supports shared test registration in AnyWordSpecs.
This field enables syntax such as the following:
behave like nonFullStack(stackWithOneItem) ^
For more information and examples of the use of behave, see the Shared tests section in the main documentation for this trait.
Attributes
- Inherited from:
- AnyWordSpecLike
- Source
- AnyWordSpecLike.scala
The English Lang, the base language for everything here.
The English Lang, the base language for everything here.
Attributes
- Inherited from:
- TwirlSpec
- Source
- TwirlSpec.scala
GOV.UK requires the browser title of a page in an error state to be prefixed, so screen reader users hear that something went wrong before the page name.
GOV.UK requires the browser title of a page in an error state to be prefixed, so screen reader users hear that something went wrong before the page name.
Attributes
- Inherited from:
- FormExpectations
- Source
- FormExpectations.scala
A submit control is present, whatever it says.
A submit control is present, whatever it says.
Attributes
- Inherited from:
- FormExpectations
- Source
- FormExpectations.scala
Supports shorthand scope registration in AnyWordSpecLikes.
Supports shorthand scope registration in AnyWordSpecLikes.
This field enables syntax such as the following test registration:
"A Stack" when { ... }
it should { ... }
^
For more information and examples of the use of the it field, see the main documentation for AnyWordSpec.
Attributes
- Inherited from:
- AnyWordSpecLike
- Source
- AnyWordSpecLike.scala
A language switcher, however it is rendered.
A language switcher, however it is rendered.
Attributes
- Inherited from:
- FramingExpectations
- Source
- FramingExpectations.scala
The application's MessagesApi, held as a stable value for the implicits below.
The application's MessagesApi, held as a stable value for the implicits below.
Attributes
- Inherited from:
- TwirlSpec
- Source
- TwirlSpec.scala
There is no back link, for a page a citizen must not reverse out of.
There is no back link, for a page a citizen must not reverse out of.
Attributes
- Inherited from:
- FramingExpectations
- Source
- FramingExpectations.scala
No error summary and no inline error messages anywhere on the page.
No error summary and no inline error messages anywhere on the page.
Attributes
- Inherited from:
- FormExpectations
- Source
- FormExpectations.scala
The alpha or beta phase banner is present.
The alpha or beta phase banner is present.
Attributes
- Inherited from:
- FramingExpectations
- Source
- FramingExpectations.scala
Attributes
- Inherited from:
- Assertions
- Source
- Assertions.scala
A sign out link is present.
A sign out link is present.
Attributes
- Inherited from:
- FramingExpectations
- Source
- FramingExpectations.scala
The Succeeded singleton.
The Succeeded singleton.
You can use succeed to solve a type error when an async test does not end in either Future[Assertion] or Assertion. Because Assertion is a type alias for Succeeded.type, putting succeed at the end of a test body (or at the end of a function being used to map the final future of a test body) will solve the type error.
Attributes
- Inherited from:
- Assertions
- Source
- Assertions.scala
Supports shorthand scope registration in AnyWordSpecLikes.
Supports shorthand scope registration in AnyWordSpecLikes.
This field enables syntax such as the following test registration:
"A Stack" when { ... }
they should { ... }
^
For more information and examples of the use of the they field, see the main documentation for AnyWordSpec.
Attributes
- Inherited from:
- AnyWordSpecLike
- Source
- AnyWordSpecLike.scala
The session-timeout dialog is wired up.
The session-timeout dialog is wired up.
Attributes
- Inherited from:
- FramingExpectations
- Source
- FramingExpectations.scala
Deprecated and Inherited fields
The styleName lifecycle method has been deprecated and will be removed in a future version of ScalaTest.
The styleName lifecycle method has been deprecated and will be removed in a future version of ScalaTest.
This method was used to support the chosen styles feature, which was deactivated in 3.1.0. The internal modularization of ScalaTest in 3.2.0 will replace chosen styles as the tool to encourage consistency across a project. We do not plan a replacement for styleName.
Attributes
- Deprecated
-
[Since version 3.1.0]The styleName lifecycle method has been deprecated and will be removed in a future version of ScalaTest with no replacement. - Inherited from:
- AnyWordSpecLike
- Source
- AnyWordSpecLike.scala
Extensions
Inherited extensions
Attributes
- Inherited from:
- Assertions
- Source
- Assertions.scala
Attributes
- Inherited from:
- Assertions
- Source
- Assertions.scala
Implicits
Inherited implicits
Converts to an Equalizer that provides === and !== operators that result in Boolean and enforce no type constraint.
Converts to an Equalizer that provides === and !== operators that result in Boolean and enforce no type constraint.
This method is overridden and made implicit by subtrait TripleEquals and overriden as non-implicit by the other subtraits in this package.
Value parameters
- left
-
the object whose type to convert to
Equalizer.
Attributes
- Throws
-
NullPointerException
if
leftisnull. - Definition Classes
-
TripleEquals -> TripleEqualsSupport
- Inherited from:
- TripleEquals
- Source
- TripleEquals.scala
Implicitly converts an object of type String to a StringCanWrapper, to enable can methods to be invokable on that object.
Implicitly converts an object of type String to a StringCanWrapper, to enable can methods to be invokable on that object.
Attributes
- Inherited from:
- CanVerb
- Source
- CanVerb.scala
Implicitly converts an object of type String to a StringMustWrapper, to enable must methods to be invokable on that object.
Implicitly converts an object of type String to a StringMustWrapper, to enable must methods to be invokable on that object.
Attributes
- Inherited from:
- MustVerb
- Source
- MustVerb.scala
Implicitly converts an object of type String to a StringShouldWrapperForVerb, to enable should methods to be invokable on that object.
Implicitly converts an object of type String to a StringShouldWrapperForVerb, to enable should methods to be invokable on that object.
Attributes
- Inherited from:
- ShouldVerb
- Source
- ShouldVerb.scala
Implicitly converts Strings to WordSpecStringWrapper, which enables methods when, which, in, is, taggedAs and ignore to be invoked on Strings.
Implicitly converts Strings to WordSpecStringWrapper, which enables methods when, which, in, is, taggedAs and ignore to be invoked on Strings.
Attributes
- Inherited from:
- AnyWordSpecLike
- Source
- AnyWordSpecLike.scala
Messages for the current language, implicitly, so a view can be applied directly.
Messages for the current language, implicitly, so a view can be applied directly.
Attributes
- Inherited from:
- TwirlSpec
- Source
- TwirlSpec.scala
The application's MessagesApi, implicitly, for renderIn and the message-file matchers.
The application's MessagesApi, implicitly, for renderIn and the message-file matchers.
Attributes
- Inherited from:
- TwirlSpec
- Source
- TwirlSpec.scala
A GET request carrying the language cookie for the current language, implicitly, for a view that takes one.
A GET request carrying the language cookie for the current language, implicitly, for a view that takes one.
Where play-filters-helpers is on the classpath, as it is in a Play application built with the Play sbt plugin, it also carries a signed CSRF token, so a form renders its token field as it does in production: Play's @helper.CSRF.formField throws without one, and formWithCSRF leaves the field out. Without that library the request carries no token.
Attributes
- Inherited from:
- TwirlSpec
- Source
- TwirlSpec.scala
Supports the registration of subjects.
Supports the registration of subjects.
For example, this method enables syntax such as the following:
"A Stack" should { ...
^
This function is passed as an implicit parameter to a should method provided in ShouldVerb, a must method provided in MustVerb, and a can method provided in CanVerb. When invoked, this function registers the subject and executes the block.
Attributes
- Inherited from:
- AnyWordSpecLike
- Source
- AnyWordSpecLike.scala
Supports the registration of subject descriptions with after words.
Supports the registration of subject descriptions with after words.
For example, this method enables syntax such as the following:
def provide = afterWord("provide")
"The ScalaTest Matchers DSL" can provide { ... }
^
This function is passed as an implicit parameter to a should method provided in ShouldVerb, a must method provided in MustVerb, and a can method provided in CanVerb. When invoked, this function registers the subject and executes the block.
Attributes
- Inherited from:
- AnyWordSpecLike
- Source
- AnyWordSpecLike.scala
Provides an A CanEqual B instance for any two types A and B, with no type constraint enforced, given an implicit Equality[A].
Provides an A CanEqual B instance for any two types A and B, with no type constraint enforced, given an implicit Equality[A].
The returned Constraint's areEqual method uses the implicitly passed Equality[A]'s areEqual method to determine equality.
This method is overridden and made implicit by subtraits TripleEquals and overriden as non-implicit by the other subtraits in this package.
Value parameters
- equalityOfA
-
an
Equality[A]type class to which theConstraint.areEqualmethod will delegate to determine equality.
Attributes
- Returns
-
an
A CanEqual Binstance whoseareEqualmethod delegates to theareEqualmethod of the passedEquality[A]. - Definition Classes
-
TripleEquals -> TripleEqualsSupport
- Inherited from:
- TripleEquals
- Source
- TripleEquals.scala