ContentExpectations

io.github.frikit.twirlspec.expect.ContentExpectations

Expectations about the words on the page and the components carrying them.

Attributes

Source
ContentExpectations.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes

Members list

Value members

Concrete methods

def appearsBefore(first: String, second: String): Expectation

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

Source
ContentExpectations.scala
def bullets(keys: String*): Expectation

The bullet list contains exactly these items, in order.

The bullet list contains exactly these items, in order.

Attributes

Source
ContentExpectations.scala
def columnHeaders(keys: String*): Expectation

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

Source
ContentExpectations.scala
def content(key: String, args: Any*): Expectation

The resolved message appears somewhere in the page's visible text.

The resolved message appears somewhere in the page's visible text.

Attributes

Source
ContentExpectations.scala
def contentText(literal: String): Expectation

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

Source
ContentExpectations.scala
def cssSelector(selector: String): Expectation

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

Source
ContentExpectations.scala
def detailsSummary(key: String, args: Any*): Expectation

The visible summary of a collapsed details block.

The visible summary of a collapsed details block.

Attributes

Source
ContentExpectations.scala
def element(id: String): Expectation

An element with this id exists.

An element with this id exists.

Attributes

Source
ContentExpectations.scala
def elementCount(selector: String, expected: Int): Expectation

Exactly this many elements match.

Exactly this many elements match.

Attributes

Source
ContentExpectations.scala
def elementHasClass(id: String, className: String): Expectation

The element with this id carries this class.

The element with this id carries this class.

Attributes

Source
ContentExpectations.scala
def elementWithText(id: String, key: String, args: Any*): Expectation

The element with this id says this.

The element with this id says this.

Attributes

Source
ContentExpectations.scala
def insetText(key: String, args: Any*): Expectation

The text of an inset text block.

The text of an inset text block.

Attributes

Source
ContentExpectations.scala
def linkText(literal: String): LinkExpectation

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

Source
ContentExpectations.scala
def linkWithId(id: String): LinkExpectation

A link found by id, whatever it says.

A link found by id, whatever it says.

Attributes

Source
ContentExpectations.scala
def noContent(key: String, args: Any*): Expectation

The resolved message appears nowhere in the page's visible text.

The resolved message appears nowhere in the page's visible text.

Attributes

Source
ContentExpectations.scala
def noCssSelector(selector: String): Expectation

Nothing matches this selector.

Nothing matches this selector.

Attributes

Source
ContentExpectations.scala
def noElement(id: String): Expectation

No element with this id exists.

No element with this id exists.

Attributes

Source
ContentExpectations.scala
def notificationBanner(key: String, args: Any*): Expectation

The text of a notification banner.

The text of a notification banner.

Attributes

Source
ContentExpectations.scala
def numberedItems(keys: String*): Expectation

The numbered list contains exactly these items, in order.

The numbered list contains exactly these items, in order.

Attributes

Source
ContentExpectations.scala
def panelBody(key: String, args: Any*): Expectation

The body of a confirmation panel.

The body of a confirmation panel.

Attributes

Source
ContentExpectations.scala
def panelTitle(key: String, args: Any*): Expectation

The title of a confirmation panel.

The title of a confirmation panel.

Attributes

Source
ContentExpectations.scala
def paragraph(key: String, args: Any*): Expectation

The message appears inside a paragraph.

The message appears inside a paragraph.

Attributes

Source
ContentExpectations.scala
def summaryList(rows: (String | Expected, String)*): Expectation

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

Source
ContentExpectations.scala
def summaryRow(key: String, args: Any*): SummaryRowExpectation

A row of a govukSummaryList, by its key.

A row of a govukSummaryList, by its key.

Attributes

Source
ContentExpectations.scala
def tableHeaders(keys: String*): Expectation

The table header cells, in order.

The table header cells, in order.

Attributes

Source
ContentExpectations.scala
def tableRow(cells: String*): Expectation

A row whose cells read exactly like this.

A row whose cells read exactly like this.

Attributes

Source
ContentExpectations.scala
def warning(key: String, args: Any*): Expectation

The text of a GOV.UK warning callout.

The text of a GOV.UK warning callout.

Attributes

Source
ContentExpectations.scala
def within(selector: String)(expectations: Expectation*): Expectation

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

Source
ContentExpectations.scala