From 79bd735a3d33cb862e89af84544c6c863735e5be Mon Sep 17 00:00:00 2001 From: mk-sgent <97879405+mk-sgent@users.noreply.github.com> Date: Mon, 26 Feb 2024 12:45:08 +0100 Subject: [PATCH] qa-auto/HSP-6605 Check that Travel Entry tasks display the correct region and district in Task Management Directory * qa-auto/HSP-6605 Check that Travel Entry tasks display the correct region and district in Task Management Directory - initial commit * qa-auto/HSP-6605 Check that Travel Entry tasks display the correct region and district in Task Management Directory - second commit --- .../aCommonComponents/SideCards.java | 12 +++++--- .../application/tasks/TaskManagementPage.java | 2 ++ .../e2etests/steps/api/TravelEntrySteps.java | 11 ++++++++ .../tasks/TaskManagementSteps.java | 28 +++++++++++++++++++ .../features/sanity/web/TravelEntry.feature | 24 +++++++++++++--- 5 files changed, 69 insertions(+), 8 deletions(-) diff --git a/sormas-e2e-tests/src/main/java/org/sormas/e2etests/pages/application/aCommonComponents/SideCards.java b/sormas-e2e-tests/src/main/java/org/sormas/e2etests/pages/application/aCommonComponents/SideCards.java index 7ddee286fc5..80fa747f956 100644 --- a/sormas-e2e-tests/src/main/java/org/sormas/e2etests/pages/application/aCommonComponents/SideCards.java +++ b/sormas-e2e-tests/src/main/java/org/sormas/e2etests/pages/application/aCommonComponents/SideCards.java @@ -48,7 +48,8 @@ public class SideCards { public static By HANDOVER_SIDE_CARD = By.xpath("//div[@location='sormasToSormas']"); public static final By SURVEILLANCE_REPORT_NOTIFICATION_DETAILS = By.id("notificationDetails"); public static final By POPUP_EDIT_REPORT_WINDOW_SAVE_BUTTON = By.cssSelector(".v-window #commit"); - public static final By POPUP_EDIT_REPORT_WINDOW_DISCARD_BUTTON = By.cssSelector(".v-window #discard"); + public static final By POPUP_EDIT_REPORT_WINDOW_DISCARD_BUTTON = + By.cssSelector(".v-window #discard"); public static final By SURVEILLANCE_REPORT_UUID_TEXT = By.cssSelector(".popupContent #uuid"); public static final By SURVEILLANCE_REPORT_EXTERNAL_ID_TEXT = By.cssSelector(".popupContent #externalId"); @@ -58,9 +59,12 @@ public class SideCards { By.cssSelector("#reportingUser > input"); public static final By TYPE_OF_REPORTING_COMBOBOX = By.cssSelector("#reportingType > div"); public static final By REPORTER_FACILITY_COMBOBOX = By.cssSelector("#facility > div"); - public static final By REPORTER_FACILITY_REGION_COMBOBOX = By.cssSelector("#facilityRegion > div"); - public static final By REPORTER_FACILITY_DISTRICT_COMBOBOX = By.cssSelector("#facilityDistrict > div"); - public static final By REPORTER_FACILITY_CATEGORY_COMBOBOX = By.cssSelector("#facilityTypeGroup > div"); + public static final By REPORTER_FACILITY_REGION_COMBOBOX = + By.cssSelector("#facilityRegion > div"); + public static final By REPORTER_FACILITY_DISTRICT_COMBOBOX = + By.cssSelector("#facilityDistrict > div"); + public static final By REPORTER_FACILITY_CATEGORY_COMBOBOX = + By.cssSelector("#facilityTypeGroup > div"); public static final By REPORTER_FACILITY_TYPE_COMBOBOX = By.cssSelector("#facilityType > div"); public static final By CLOSE_POPUP_SHARING_MESSAGE = By.xpath("//div[@class='v-window v-widget v-has-width']//div[@class='v-window-closebox']"); diff --git a/sormas-e2e-tests/src/main/java/org/sormas/e2etests/pages/application/tasks/TaskManagementPage.java b/sormas-e2e-tests/src/main/java/org/sormas/e2etests/pages/application/tasks/TaskManagementPage.java index dfdc3996912..ab9b7e72ede 100644 --- a/sormas-e2e-tests/src/main/java/org/sormas/e2etests/pages/application/tasks/TaskManagementPage.java +++ b/sormas-e2e-tests/src/main/java/org/sormas/e2etests/pages/application/tasks/TaskManagementPage.java @@ -64,6 +64,8 @@ public class TaskManagementPage { "//div[@class='popupContent']//div[contains(@id, '-delete') and not(contains(@id, 'null-delete'))]"); public static final By CUSTOM_EXPORT_CONFIGURATION_NAME_INPUT = By.xpath("//div[@id='sormasui-1655777373-overlays']//input[@type='text']"); + public static final By FIRST_GRID_REGION_VALUE = By.xpath("//tbody/tr/td[5]"); + public static final By FIRST_GRID_DISTRICT_VALUE = By.xpath("//tbody/tr/td[6]"); public static By getCheckboxByIndex(String idx) { return By.xpath(String.format("(//input[@type=\"checkbox\"])[%s]", idx)); diff --git a/sormas-e2e-tests/src/test/java/org/sormas/e2etests/steps/api/TravelEntrySteps.java b/sormas-e2e-tests/src/test/java/org/sormas/e2etests/steps/api/TravelEntrySteps.java index 16447f6c35d..c19e08ddbfd 100644 --- a/sormas-e2e-tests/src/test/java/org/sormas/e2etests/steps/api/TravelEntrySteps.java +++ b/sormas-e2e-tests/src/test/java/org/sormas/e2etests/steps/api/TravelEntrySteps.java @@ -25,6 +25,8 @@ import cucumber.api.java8.En; import io.restassured.http.Method; +import java.util.ArrayList; +import java.util.List; import java.util.concurrent.TimeUnit; import javax.inject.Inject; import lombok.SneakyThrows; @@ -35,12 +37,14 @@ import org.sormas.e2etests.helpers.RestAssuredClient; import org.sormas.e2etests.helpers.WebDriverHelpers; import org.sormas.e2etests.helpers.api.sormasrest.TravelEntryHelper; +import org.sormas.e2etests.pages.application.entries.EditTravelEntryPage; import org.sormas.e2etests.state.ApiState; public class TravelEntrySteps implements En { private static WebDriverHelpers webDriverHelpers; private final RestAssuredClient restAssuredClient; + public static List travelEntriesUUID = new ArrayList<>(); @Inject public TravelEntrySteps( @@ -77,6 +81,13 @@ public TravelEntrySteps( webDriverHelpers.waitUntilIdentifiedElementIsVisibleAndClickable(UUID_INPUT); }); + When( + "I collect uuid of the new travel entry", + () -> { + travelEntriesUUID.add( + webDriverHelpers.getValueFromWebElement(EditTravelEntryPage.UUID_INPUT)); + }); + When( "I filter by last created travel entry via API", () -> { diff --git a/sormas-e2e-tests/src/test/java/org/sormas/e2etests/steps/web/application/tasks/TaskManagementSteps.java b/sormas-e2e-tests/src/test/java/org/sormas/e2etests/steps/web/application/tasks/TaskManagementSteps.java index d0bda6c778d..d0f4e95ac73 100644 --- a/sormas-e2e-tests/src/test/java/org/sormas/e2etests/steps/web/application/tasks/TaskManagementSteps.java +++ b/sormas-e2e-tests/src/test/java/org/sormas/e2etests/steps/web/application/tasks/TaskManagementSteps.java @@ -36,6 +36,7 @@ import static org.sormas.e2etests.pages.application.samples.SamplesDirectoryPage.CONFIRM_BUTTON; import static org.sormas.e2etests.pages.application.tasks.CreateNewTaskPage.*; import static org.sormas.e2etests.pages.application.tasks.TaskManagementPage.*; +import static org.sormas.e2etests.steps.api.TravelEntrySteps.travelEntriesUUID; import static org.sormas.e2etests.steps.web.application.events.EventDirectorySteps.eventsUUID; import com.opencsv.CSVParser; @@ -195,6 +196,17 @@ public TaskManagementSteps( getByEventUuid(eventsUUID.get(0))); }); + When( + "^I am search the last created travel Entry by API in task management directory$", + () -> { + webDriverHelpers.waitForPageLoadingSpinnerToDisappear(70); + webDriverHelpers.fillAndSubmitInWebElement( + GENERAL_SEARCH_INPUT, travelEntriesUUID.get(0)); + webDriverHelpers.waitForPageLoadingSpinnerToDisappear(15); + webDriverHelpers.waitUntilIdentifiedElementIsVisibleAndClickable( + getByEventUuid(travelEntriesUUID.get(0))); + }); + When( "^I filter Task context by ([^\"]*)$", (String filterType) -> { @@ -234,6 +246,22 @@ public TaskManagementSteps( softly.assertAll(); }); + When( + "^I check that region and district are correct displayed for the last created travel entry by API in task management$", + () -> { + softly.assertEquals( + manager.getRegionName( + apiState.getCreatedTravelEntry().getResponsibleRegion().getUuid()), + webDriverHelpers.getTextFromWebElement(FIRST_GRID_REGION_VALUE), + "Regions are not equal"); + softly.assertEquals( + manager.getDistrictName( + apiState.getCreatedTravelEntry().getResponsibleDistrict().getUuid()), + webDriverHelpers.getTextFromWebElement(FIRST_GRID_DISTRICT_VALUE), + "Districts are not equal"); + softly.assertAll(); + }); + When( "^I check displayed task's context is ([^\"]*)$", (String taskContext) -> { diff --git a/sormas-e2e-tests/src/test/resources/features/sanity/web/TravelEntry.feature b/sormas-e2e-tests/src/test/resources/features/sanity/web/TravelEntry.feature index 695e5573eab..6453a82bc40 100644 --- a/sormas-e2e-tests/src/test/resources/features/sanity/web/TravelEntry.feature +++ b/sormas-e2e-tests/src/test/resources/features/sanity/web/TravelEntry.feature @@ -196,6 +196,7 @@ Feature: Create travel entries When I fill the required fields in a new travel entry form with same person data And I click on Save button from the new travel entry form Then I check if National Health Id, Nickname and Passport number appear in Pick or create person popup + @tmsLink=SORDEV-7166 @env_de Scenario: Test Link DEA TravelEntries to cases Given I log in as a Admin User @@ -401,6 +402,7 @@ Feature: Create travel entries When I back to deleted travel entry by url Then I check if reason of deletion is set to "Löschen auf Anforderung der betroffenen Person nach DSGVO" And I check if External ID input on travel entry edit page is disabled + @tmsLink=SORDEV-10227 @env_de Scenario: Test Permanent deletion for Person for Travel Entry Given I log in as a National User @@ -468,10 +470,8 @@ Feature: Create travel entries @tmsLink=SORQA-669 @env_de @oldfake Scenario: Check automatic deletion of TRAVEL_ENTRY origin 16 days ago Given API: I create a new person - And API: I check that POST call status code is 200 Then API: I create a new travel entry with creation date 16 days ago - And API: I check that POST call status code is 200 Then I log in as a Admin User And I open the last created travel entry via api @@ -490,7 +490,6 @@ Feature: Create travel entries Given API: I create a new person And API: I check that POST call status code is 200 Then API: I create a new travel entry with creation date 13 days ago - And API: I check that POST call status code is 200 Then I log in as a Admin User And I open the last created travel entry via api @@ -502,4 +501,21 @@ Feature: Create travel entries And API: I check that GET call status code is 200 Then I click on the Entries button from navbar And I filter by last created travel entry via API - And I check that number of displayed Travel Entry results is 1 \ No newline at end of file + And I check that number of displayed Travel Entry results is 1 + + @tmsLink=HSP-6605 @env_de + Scenario: Check that Travel Entry tasks display the correct region and district in Task Management Directory + Given API: I create a new person + And API: I check that POST call status code is 200 + Then API: I create a new travel entry with creation date 2 days ago + And API: I check that POST call status code is 200 + Then I log in as a Admin User + And I open the last created travel entry via api + And I collect uuid of the new travel entry + And I click NEW TASK in Edit Travel Entry page + Then I fill a new task form with specific data for DE version + And I click on Save button in New Task form + Then I check if new task is displayed in Task tab on Edit Travel Entry page + And I click on the Tasks button from navbar + And I am search the last created travel Entry by API in task management directory + And I check that region and district are correct displayed for the last created travel entry by API in task management \ No newline at end of file