From d4fcfc336b837519c2ec941304051466707aa742 Mon Sep 17 00:00:00 2001 From: g-otn <44736064+g-otn@users.noreply.github.com> Date: Mon, 29 Jan 2024 23:33:55 -0300 Subject: [PATCH] fix: tests --- pom.xml | 2 ++ .../bdd/StepsDefinition.java | 26 ++++++++++++++----- src/test/resources/features/Order.feature | 12 ++++----- 3 files changed, 28 insertions(+), 12 deletions(-) diff --git a/pom.xml b/pom.xml index c62d3c3..4030a18 100644 --- a/pom.xml +++ b/pom.xml @@ -111,11 +111,13 @@ io.cucumber cucumber-java 7.15.0 + test io.cucumber cucumber-junit 7.15.0 + test io.rest-assured diff --git a/src/test/java/br/com/grupo63/serviceidentification/bdd/StepsDefinition.java b/src/test/java/br/com/grupo63/serviceidentification/bdd/StepsDefinition.java index 9e37b90..ca34521 100644 --- a/src/test/java/br/com/grupo63/serviceidentification/bdd/StepsDefinition.java +++ b/src/test/java/br/com/grupo63/serviceidentification/bdd/StepsDefinition.java @@ -18,14 +18,27 @@ public class StepsDefinition { private int productAmount; private int productId; private Response response; - private String authorizationHeader = "Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI4Y2Q5MjVlOS0wZTM4LTRkMTUtODNlMC1hZDUxN2MxYmI5ODcifQ.Hqk-xR35ZSKuhTIetzyaMhwMSr5ANCvgLm4xM6kmkUBqlex0zAsIY-DKGV_TCEFI8H1oJL8OTdeZKq4CMmTWdADxSGf8bxBVi3Z0PSClWFRrxwl1-Za5oyyypUfSS1mYgDTUDb3tAg7susUS5CKUzHd30zwWjOKCXRFzbxVm8j5VTh3Zjz2aI5EJMjzyZ79KxEyN0cS59Xtm0Crhaor9-nhGI6S_73HOmHvbrA5_AOsUVNpTZgppYMjJkHxwDimxyxH_tzakCQLUAG0Yw2YNKhUPVADEeBFuDN2kiy81XbYt12JgPK3_KdDqzb6cKjXYMeFVAEFJkcF6IGbcRQK__g"; - private static final String BASE_URL_IDENTIFICATION = "http://127.0.0.1:8081"; + private String authorizationHeader = "Bearer " + + "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI3NWQyZjM4My1hZmQ0LTRkZTQtOWY4MC1iZWU2NGQ5ZGRjNmQiLCJpYXQiOjE3MDY1NjY1MTcsImV4cCI6MTcwNjU3MDExN30.H-9boXhXOMqONjYK-_tryfCwv0ph7oSEsZchNAgUbgUcpPiquVfH3ijaUvCJJ3GLinuUtbwVy_Ub-WyTCMoKxCNH0HqFoCTneoPmSBtISTfEGkmIYOYbD6t992xHxCxdkEDzlUPIlg8p7JsBSD52OUPtmhrdQYOLdgYYoIJnEI7ZKZzHXbnMEJPbXOBdGnLVgKkrCVXDrEAehMnL09HHSlv4-F6GH3tY9zuuXAMDR6-lGDCa1VlIObshTqER8LxurWmLIGaTSauhNMHVw8set7XOdTQzvdf988Mh4ElH0VDiY8Od8jSmuq6xj2IjsFzyOBArZqEAUeHrFc4Lc4PT8g"; + + + /* Uncomment if local */ +// private static final String BASE_URL_IDENTIFICATION = "http://127.0.0.1:8081"; +// private static final String BASE_URL_ORDERS = "http://127.0.0.1:8082"; +// private static final String BASE_URL_PAYMENT = "http://127.0.0.1:8083"; +// private static final String BASE_URL_PRODUCTION = "http://127.0.0.1:8084"; + + /* Uncomment if remote */ + private static final String REMOTE_BASE_URL = "https://3843tddo99.execute-api.us-east-1.amazonaws.com"; + private static final String BASE_URL_IDENTIFICATION = REMOTE_BASE_URL; + private static final String BASE_URL_ORDERS = REMOTE_BASE_URL; + private static final String BASE_URL_PAYMENT = REMOTE_BASE_URL; + private static final String BASE_URL_PRODUCTION = REMOTE_BASE_URL; + + private static final String CONTEXT_PATH_IDENTIFICATION = "/identification/clients"; - private static final String BASE_URL_ORDERS = "http://127.0.0.1:8083"; private static final String CONTEXT_PATH_ORDERS = "/order/orders"; - private static final String BASE_URL_PAYMENT = "http://127.0.0.1:8080"; private static final String CONTEXT_PATH_PAYMENT = "/payment/payments"; - private static final String BASE_URL_PRODUCTION = "http://127.0.0.1:8082"; private static final String CONTEXT_PATH_PRODUCTION = "/production/status"; @Given("User wants to identify with national id {string}") @@ -45,7 +58,7 @@ public void sendTheRequestWithValidData() { @Then("User identified") public void userIdentified() { HashMap body = response.as(HashMap.class); - System.err.println("The identification was done and the client has id: " + body.get("id")); + System.err.println("The identification was done and the client can use the generated token:\n" + body.get("token")); } @Given("User selected product {int} unit of product {int}") @@ -57,6 +70,7 @@ public void userSelectedProductUnitOfProduct(int amount, int id) { @When("User checkout") public void userCheckout() { + System.out.println(BASE_URL_ORDERS + CONTEXT_PATH_ORDERS); response = given() .header("Authorization", authorizationHeader) .contentType(ContentType.JSON) diff --git a/src/test/resources/features/Order.feature b/src/test/resources/features/Order.feature index 1895147..87e5f37 100644 --- a/src/test/resources/features/Order.feature +++ b/src/test/resources/features/Order.feature @@ -1,7 +1,7 @@ Feature: Order Scenario: Identify when near totem - Given User wants to identify with national id "12312312312" + Given User wants to identify with national id "69805914011" When Send the request with valid data Then User identified @@ -11,26 +11,26 @@ Feature: Order Then Order created Scenario: Identified user with created order wants to pay - Given User wants to pay order 6 with QR Code + Given User wants to pay order 5 with QR Code When Initialize payment Then QR Code generated Scenario: Identified user with payment initialized wants to finish it - Given User paid initialized payment order 6 + Given User paid initialized payment order 5 When Finish payment Then Order should be received Scenario: Kitchen staff wants to advance status of order to PREPARING - Given Staff started preparing order 6 + Given Staff started preparing order 5 When Update order status Then Order status should be updated Scenario: Kitchen staff wants to advance status of order to READY - Given Staff finished preparing order 6 + Given Staff finished preparing order 5 When Update order status Then Order status should be updated Scenario: Kitchen staff wants to advance status of order to FINISHED - Given Staff delivered order 6 + Given Staff delivered order 5 When Update order status Then Order status should be updated \ No newline at end of file