diff --git a/tx-cucumber-tests/src/test/java/org/eclipse/tractusx/traceability/test/TraceabilityTestStepDefinition.java b/tx-cucumber-tests/src/test/java/org/eclipse/tractusx/traceability/test/TraceabilityTestStepDefinition.java index 46005d2e22..283d41a304 100644 --- a/tx-cucumber-tests/src/test/java/org/eclipse/tractusx/traceability/test/TraceabilityTestStepDefinition.java +++ b/tx-cucumber-tests/src/test/java/org/eclipse/tractusx/traceability/test/TraceabilityTestStepDefinition.java @@ -110,9 +110,14 @@ public void iCheckIfQualityInvestigationHasProperValues(DataTable dataTable) { .pollInterval(1, TimeUnit.SECONDS) .ignoreExceptions() .until(() -> { - QualityNotificationResponse result = restProvider.getNotification(getNotificationIdBasedOnEnv(), INVESTIGATION); - NotificationValidator.assertHasFields(result, normalize(dataTable.asMap())); - return true; + try { + QualityNotificationResponse result = restProvider.getNotification(getNotificationIdBasedOnEnv(), INVESTIGATION); + NotificationValidator.assertHasFields(result, normalize(dataTable.asMap())); + return true; + } catch (AssertionError assertionError) { + assertionError.printStackTrace(); + return false; + } } ); } @@ -215,7 +220,6 @@ private Long getNotificationIdBasedOnEnv() { } - @And("I request assets with {string}") public void iRequestAssetsWith(String ownerFilter) { requestedAssets = restProvider.getAssets(ownerFilter); @@ -308,9 +312,14 @@ public void iCheckIfQualityAlertHasProperValues(DataTable dataTable) { .pollInterval(1, TimeUnit.SECONDS) .ignoreExceptions() .until(() -> { - QualityNotificationResponse result = restProvider.getNotification(getNotificationIdBasedOnEnv(), ALERT); - NotificationValidator.assertHasFields(result, normalize(dataTable.asMap())); - return true; + try { + QualityNotificationResponse result = restProvider.getNotification(getNotificationIdBasedOnEnv(), ALERT); + NotificationValidator.assertHasFields(result, normalize(dataTable.asMap())); + return true; + } catch (AssertionError assertionError) { + assertionError.printStackTrace(); + return false; + } } ); } diff --git a/tx-cucumber-tests/src/test/java/org/eclipse/tractusx/traceability/test/tooling/rest/RestProvider.java b/tx-cucumber-tests/src/test/java/org/eclipse/tractusx/traceability/test/tooling/rest/RestProvider.java index c37c3c3849..d8615a17ff 100644 --- a/tx-cucumber-tests/src/test/java/org/eclipse/tractusx/traceability/test/tooling/rest/RestProvider.java +++ b/tx-cucumber-tests/src/test/java/org/eclipse/tractusx/traceability/test/tooling/rest/RestProvider.java @@ -31,7 +31,6 @@ import io.restassured.specification.RequestSpecification; import lombok.Getter; import org.apache.http.HttpStatus; -import org.awaitility.Duration; import org.eclipse.tractusx.traceability.test.tooling.EnvVariablesResolver; import org.eclipse.tractusx.traceability.test.tooling.NotificationTypeEnum; import org.eclipse.tractusx.traceability.test.tooling.TraceXEnvironmentEnum; @@ -39,12 +38,10 @@ import org.eclipse.tractusx.traceability.test.tooling.rest.request.UpdateQualityNotificationRequest; import org.eclipse.tractusx.traceability.test.tooling.rest.request.UpdateQualityNotificationStatusRequest; import org.eclipse.tractusx.traceability.test.tooling.rest.response.QualityNotificationResponse; -import org.hamcrest.Matchers; import qualitynotification.base.response.QualityNotificationIdResponse; import java.time.Instant; import java.util.List; -import java.util.concurrent.TimeUnit; import static com.fasterxml.jackson.databind.DeserializationFeature.FAIL_ON_IGNORED_PROPERTIES; import static com.fasterxml.jackson.databind.DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES; @@ -52,7 +49,6 @@ import static com.fasterxml.jackson.databind.DeserializationFeature.READ_UNKNOWN_ENUM_VALUES_USING_DEFAULT_VALUE; import static com.fasterxml.jackson.databind.SerializationFeature.WRITE_DATES_AS_TIMESTAMPS; import static io.restassured.RestAssured.given; -import static org.awaitility.Awaitility.await; import static org.eclipse.tractusx.traceability.test.tooling.TraceXEnvironmentEnum.TRACE_X_A; import static org.eclipse.tractusx.traceability.test.tooling.TraceXEnvironmentEnum.TRACE_X_B; @@ -189,23 +185,18 @@ public List getReceivedNotifications(NotificationTy } public QualityNotificationResponse getNotification(Long investigationId, NotificationTypeEnum notificationType) { - return await() - .atMost(Duration.TWO_MINUTES) - .pollInterval(1, TimeUnit.SECONDS) - .until(() -> given().spec(getRequestSpecification()) - .contentType(ContentType.JSON) - .when() - .get("/api/" + notificationType.label + "/" + investigationId) - .then() - .statusCode(HttpStatus.SC_OK) - .log() - .body() - .extract() - .body().as(QualityNotificationResponse.class), Matchers.notNullValue() - ); + return given().spec(getRequestSpecification()) + .contentType(ContentType.JSON) + .when() + .get("/api/" + notificationType.label + "/" + investigationId) + .then() + .statusCode(HttpStatus.SC_OK) + .log() + .body() + .extract() + .body().as(QualityNotificationResponse.class); } - private RequestSpecification getRequestSpecification() { final String accessToken = authentication.obtainAccessToken(); diff --git a/tx-cucumber-tests/src/test/resources/features/1_TRACEFOSS-1393.feature b/tx-cucumber-tests/src/test/resources/features/1_TRACEFOSS-1393.feature index 9bedc5be6d..92ac6ae9f4 100644 --- a/tx-cucumber-tests/src/test/resources/features/1_TRACEFOSS-1393.feature +++ b/tx-cucumber-tests/src/test/resources/features/1_TRACEFOSS-1393.feature @@ -178,7 +178,7 @@ Feature: ⭐ [BE][QUALITY_ALERTS] Create (POST) quality alerts (Rest API) Then I check, if quality alert has proper values | "status" | "DECLINED" | And I check, if quality alert has proper values - | "description" | "declined in TRACEFOSS-1545" | + | "declineReason" | "declined in TRACEFOSS-1545" | #Check if *ACCEPTANCE* of quality alerts is processed correctly which contains following checks: #* correct ACCEPTANCE on receiver side diff --git a/tx-cucumber-tests/src/test/resources/features/2_TRACEFOSS-600.feature b/tx-cucumber-tests/src/test/resources/features/2_TRACEFOSS-600.feature index 86fdbcc9dd..c13e5c2122 100644 --- a/tx-cucumber-tests/src/test/resources/features/2_TRACEFOSS-600.feature +++ b/tx-cucumber-tests/src/test/resources/features/2_TRACEFOSS-600.feature @@ -166,7 +166,7 @@ Feature: ⭐ [BE][QUALITY_ALERTS] Enable Quality Alerts Then I check, if quality alert has proper values | "status" | "DECLINED" | And I check, if quality alert has proper values - | "description" | "declined in TRACEFOSS-1545" | + | "declineReason" | "declined in TRACEFOSS-1545" | #Check if *ACCEPTANCE* of quality alerts is processed correctly which contains following checks: #* correct ACCEPTANCE on receiver side