I would think this is probably easy to do, but I really don't know Scala at all.
I have a scenario where a first time user will log in and see a page, then if they log in again they won't see this page. So the best I've come up with so far is this:
val chain = exec(
http("Login page")
.get("/en/login")
.headers(Config.HTML_HEADER)
).exec(
http("login request")
.post("/en/j_spring_security_check")
.formParam("j_username", """${username}""")
.formParam("j_password", """${password}""")
.check(status.is(200))
.check(currentLocationRegex(".*termsAndConditions").optional.saveAs("tc"))
)
.doIf(session => !session("tc").equals(null)) { // this doesn't work
exec(AgreeTermsAndConditions.chain)
}
So I've tried a bunch of things on the doIf, the goal is just do if session "tc" is not set. Is there an easy way to do that?