Exam > Web UI testing >
On this page

Web UI testing

Steps chain fail fast by defaultExpectedToFail

Given


src/test/java/specs/Specs.java
public void hasParagraphText(String text) {
    $(By.tagName("p")).shouldHave(Condition.text(text));
}

Then


The following markup:
<e:browser url="/ui/dummy.html">
  <e:step name="hasParagraphText">Should fail</e:step>
  <e:step name="hasParagraphText">Shouldn't be executed</e:step>
</e:browser>
will be rendered as:
hasParagraphText
Element should have text "Should fail" {By.tagName: p}
Element: '<p>Hello world!</p>'
Actual value: text="Hello world!"
Screenshot: file:/home/runner/work/Exam/Exam/example/build/reports/specs/specs/ui/1647087990530.0.png
Page source: file:/home/runner/work/Exam/Exam/example/build/reports/specs/specs/ui/1647087990530.0.html
Timeout: 4 s.
Can disable fail fastExpectedToFail

Given


src/test/java/specs/Specs.java
public void hasParagraphText(String text) {
    $(By.tagName("p")).shouldHave(Condition.text(text));
}

Then


The following markup:
<e:browser url="/ui/dummy.html" failFast="false">
  <e:step name="hasParagraphText">Fails but next step should run</e:step>
  <e:step name="hasParagraphText" desc="Should successfully check text">Hello world!</e:step>
</e:browser>
will be rendered as:
hasParagraphText
Element should have text "Fails but next step should run" {By.tagName: p}
Element: '<p>Hello world!</p>'
Actual value: text="Hello world!"
Screenshot: file:/home/runner/work/Exam/Exam/example/build/reports/specs/specs/ui/1647087994719.1.png
Page source: file:/home/runner/work/Exam/Exam/example/build/reports/specs/specs/ui/1647087994719.1.html
Timeout: 4 s.
hasParagraphText

Should successfully check text

Given


src/test/java/specs/Specs.java
public String noParamsCheck() {
    $(By.tagName("p")).should(Condition.exist);
    return "valueFromMethodCall";
}

Then


The following markup:
<e:browser url="/ui/dummy.html">
  <e:step set="someVar" name="noParamsCheck"/>
</e:browser>
will be rendered as:
noParamsCheck

No description

Variable #someVar = valueFromMethodCall