Synonym for org.scalawebtest.core.gauge.HtmlGauge#fits.
Synonym for org.scalawebtest.core.gauge.HtmlGauge#fits. Use whatever reads better in your current context.
Assert that the current document fits
the HTML snippet provided as definition for the Gauge
.
Assert that the current document fits
the HTML snippet provided as definition for the Gauge
.
Technically the HTML snippet has to be XML. You might have to add some closing tags for this. This XML is then used to create an abstract syntax tree (AST), which is used as gauge definition.
For example:
fits (<table class="zebra"><tr><td><a href="/path/to/node">something</a></td></tr></table>)
The current document is expected to fit
the provided gauge
definition (the NodeSeq/XML parameter of the fits
method).
The current document may contain additional elements, before the section which fits
the gauge
. The document may contain additional elements in between the one, resembled in the gauge
.
Without special markers attributes and text, after being trimmed, have to be equal to the once in the gauge
. The only exception is the class attribute.
The classes listed in the gauge, are expected to be available on the test node, but order as well as additional classes do not matter.
The parent child relationships, as well as the order between the elements has to be the same, as in the gauge
.
You may use the following refinements:
* The marker @contains
might be used in scala.xml.Text$ and attributes of scala.xml.Elem to request that the text or attribute contains the following text, i.e.
<a href="@contains index">Home</a>
matches
<a href="/index.html">Home</a>
but doesn't match
<a href="/home.html">Home</a>
or
@contains new NEBA version available
matches
new NEBA version available since
but doesn't match
new neba version available since
The marker @regex
might be used in scala.xml.Text$ and attributes of scala.xml.Elem to request a regex pattern match, i.e.
<a href="@regex http:\/\/[a-zA-Z]+\.domain.com.*,"></a>
matches
<a href="http://my.domain.com/index.html"></a>
but doesn't match
<a href="http://my.domain.org/index.html"></a>
or
@regex new NEBA version [0-9.]+ available
matches
new NEBA Version 4.0.0 available
but doesn't match
new NEBA Version 4.0.0-RC1 available