Complex interactions in code
// simulate typing in the box by running successive autocomplete searches
.repeat((s: Session) => 4 min s.getTypedAttribute[String]("query").length, "i")(
exec((s: Session) => s.setAttribute("prefix", s.getTypedAttribute[String]("query") take s.getTypedAttribute[Int]("i")+1))
.exec(
http("autocomplete")
.get("/autocomplete")
.queryParam("q.query", "${prefix}")
.queryParam("q.store", "${store}")
.headers(acceptJson)
.check(status.is(200))
)
.pause(0 milliseconds, 30 milliseconds)
)