Currently using 2.2.3. I’m doing slighly more complecated checks and I’m having issues with lack of checkIf
.
By currect execution is;:
def proceedToCheckout() = exec {
val checkoutUrl = cartUrl + "/checkout"
http("Proceed to checkout")
.post(checkoutUrl)
.header("Authorization", "Bearer ${BEARER_TOKEN}")
.check(status is 200)
.check(
jsonPath("$.shipments").findAll.saveAs("SHIPMENTS"),
jsonPath("$.selected_address_id").exists.saveAs("SELECTED_ADDRESS_ID"),
jsonPath("$.selected_payment_id").exists.saveAs("SELECTED_PAYMENT_ID"),
jsonPath("$.price_summary.total").exists.saveAs("TOTAL_PRICE"),
jsonPath("$.checkout_id").exists.saveAs("CHECKOUT_ID")
)
}.foreach("${SHIPMENTS}", "shipment") {
exec(session => {
val w: SessionAttribute = session("shipment")
val jsonStr: String = transformCheckoutToSelectedShipments(w.session.attributes(w.key).toString)
session.set("SELECTED_SHIPMENTS", jsonStr)
})
}
I want to only perform the second check and the transformation if the status is 200. Currently it will also perform the the clause in foreach. Is there a better way in of doing this conditional call?