Skip to content

Instantly share code, notes, and snippets.

View webtau-ui-elements-using-page-object-and-wait.groovy
import static pages.Pages.*
scenario("search by specific query") {
search.submit("search this")
search.numberOfResults.waitToBe > 1
}
View webtau-ui-elements-using-page-object.groovy
import static pages.Pages.*
scenario("search by specific query") {
search.submit("search this")
search.numberOfResults.shouldBe > 1
}
View webtau-ui-elements-page-objects.groovy
package pages
class Pages {
static final def search = new SearchPage()
static final def calculation = new CalculationPage()
static final def form = new FormPage()
}
View webtau-ui-elements-page-object.groovy
package pages
import static org.testingisdocumenting.webtau.WebTauDsl.*
class SearchPage {
def searchBox = $('#search-box')
def numberOfResults = $('#results .result').count
def submit(query) {
browser.open("/search")
View webtau-ui-elements-initial-extraction-with-action.groovy
def searchBox = $('#search-box')
def numberOfResults = searchBox.count
scenario('search by specific query') {
submit('search this')
numberOfResults.shouldBe > 1
}
def submit(query) {
browser.open("/search")
View webtau-ui-elements-initial-extraction.groovy
def searchBox = $('#search-box')
def numberOfResults = searchBox.count
scenario('search by specific query') {
browser.open('/search')
searchBox.setValue('search this')
searchBox.sendKeys("\n")
numberOfResults.shouldBe > 1
View webtau-ui-no-extraction.groovy
scenario('search by specific query') {
browser.open('/search')
$('#search-box').setValue('search this')
$('#search-box').sendKeys("\n")
$('#results .result').count.shouldBe > 1
}
View webtau-customer-resource.groovy
class Customer {
Number id
String url // store url of the created entity
}
View webtau-crud-separated.groovy
def customerPayload = [firstName: "FN", lastName: "LN"]
def customer = createLazyResource("customer") { // lazy resource to be created on the first access
def id = http.post("/customers", customerPayload) {
return id
}
return new Customer(id: id, url: "/customers/${id}") // definition is below
}
View webtau-crud.groovy
scenario("CRUD operations for customer") {
def customerPayload = [firstName: "FN", lastName: "LN"]
def id = http.post("/customers", customerPayload) {
return id // return id value from response body
}
http.get("/customers/${id}") {
body.should == customerPayload // only specified properties will be asserted against
}
You can’t perform that action at this time.