diff --git a/irs-cucumber-tests/src/test/java/org/eclipse/tractusx/irs/cucumber/E2ETestStepDefinitionsForJobApi.java b/irs-cucumber-tests/src/test/java/org/eclipse/tractusx/irs/cucumber/E2ETestStepDefinitionsForJobApi.java index 060eba4b7..0f42c642c 100644 --- a/irs-cucumber-tests/src/test/java/org/eclipse/tractusx/irs/cucumber/E2ETestStepDefinitionsForJobApi.java +++ b/irs-cucumber-tests/src/test/java/org/eclipse/tractusx/irs/cucumber/E2ETestStepDefinitionsForJobApi.java @@ -318,14 +318,22 @@ public void iCheckIfTheOrderContainsBatches(int batchesSize) { @Then("I check, if the batch contains {int} jobs") public void iCheckIfTheBatchContainsJobs(int jobSize) { - batchResponse = givenAuthentication(authenticationPropertiesBuilder).contentType(ContentType.JSON) - .get("/irs/orders/" + orderId + "/batches/" - + batchId) - .as(BatchResponse.class); + await().atMost(10, TimeUnit.SECONDS) + .with() + .pollInterval(Duration.ofSeconds(1L)) + .until(() -> getBatchResponse().getJobs().size() == jobSize); + batchResponse = getBatchResponse(); assertThat(batchResponse.getJobsInBatchChecksum()).isEqualTo(jobSize); } + private BatchResponse getBatchResponse() { + return givenAuthentication(authenticationPropertiesBuilder).contentType(ContentType.JSON) + .get("/irs/orders/" + orderId + "/batches/" + + batchId) + .as(BatchResponse.class); + } + @Then("I check, if job parameter are set with aspects:") public void iCheckIfJobParameterAreSetWithAspects(List aspects) { completedJob = givenAuthentication(authenticationPropertiesBuilder).contentType(ContentType.JSON)