With second - five.
With the last - one.
So "anotherIds" in the end of the loops will contain only one id instead of all that was collected during the loop.
val subscription = exec(ws("subscribe on model")
.sendText("""["subscribe_on_model", {"collection": "Model", "id": 2}]""")
.check(wsAwait.within(20).until(1).jsonPath("$..someIds[*]").findAll.saveAs("someIds")))
.foreach("${someIds}", "someId") {
exec(ws("subscribe on model2")
.sendText("""["subscribe_on_model", {"collection": "Model2", "id": "${someId}"}]""")
.check(wsAwait.within(20).until(1).jsonPath("$..anotherIds[*]").findAll.saveAs("anotherIds")))
}
.foreach("${anotherIds}", "anotherId") {
exec(ws("subscribe on model3")
.sendText("""["subscribe_on_model", {"collection": "Model3", "id": "${anotherId}"}]""")
.check(wsAwait.within(20).until(1).jsonPath("$..someAnotherIds[*]").findAll.saveAs("someAnotherIds")))
}