From ba986de563e51c5f590b3d424428fb72e814f3d6 Mon Sep 17 00:00:00 2001 From: Maciej Paszylka Date: Wed, 7 Sep 2022 18:17:41 +0200 Subject: [PATCH 01/10] test --- .../application/cases/EditCasePersonPage.java | 2 ++ .../application/cases/EditCasePersonSteps.java | 17 ++++++++++++++++- .../resources/features/sanity/web/Case.feature | 16 +++++++++++++++- .../features/sanity/web/Contacts.feature | 16 +++++++++++++++- .../resources/features/sanity/web/Event.feature | 10 ++++++++++ .../features/sanity/web/Persons.feature | 10 ++++++++++ .../features/sanity/web/TravelEntry.feature | 13 ++++++++++++- 7 files changed, 80 insertions(+), 4 deletions(-) diff --git a/sormas-e2e-tests/src/main/java/org/sormas/e2etests/pages/application/cases/EditCasePersonPage.java b/sormas-e2e-tests/src/main/java/org/sormas/e2etests/pages/application/cases/EditCasePersonPage.java index a5c5bb12c62..f1e45e6b02f 100644 --- a/sormas-e2e-tests/src/main/java/org/sormas/e2etests/pages/application/cases/EditCasePersonPage.java +++ b/sormas-e2e-tests/src/main/java/org/sormas/e2etests/pages/application/cases/EditCasePersonPage.java @@ -59,6 +59,8 @@ public class EditCasePersonPage { public static final By SEE_CASES_FOR_THIS_PERSON_BUTTON = By.id("See cases for this person"); public static final By PASSPORT_NUMBER_INPUT = By.cssSelector("#passportNumber"); public static final By NATIONAL_HEALTH_ID_INPUT = By.cssSelector("#nationalHealthId"); + public static final By COUNTRY_OF_BIRTH_LABEL_DE = By.xpath("//div[text()=\"Geburtsland\"]"); + public static final By CITIZENSHIP_LABEL_DE = By.xpath("//div[text()=\"Staatsb\u00FCrgerschaft\"]"); public static final By EDUCATION_COMBOBOX = By.cssSelector("[id='educationType'] [class='v-filterselect-button']"); public static final By COMMUNITY_CONTACT_PERSON_INPUT = By.cssSelector("#details"); diff --git a/sormas-e2e-tests/src/test/java/org/sormas/e2etests/steps/web/application/cases/EditCasePersonSteps.java b/sormas-e2e-tests/src/test/java/org/sormas/e2etests/steps/web/application/cases/EditCasePersonSteps.java index 46b831889c8..a538b06cc70 100644 --- a/sormas-e2e-tests/src/test/java/org/sormas/e2etests/steps/web/application/cases/EditCasePersonSteps.java +++ b/sormas-e2e-tests/src/test/java/org/sormas/e2etests/steps/web/application/cases/EditCasePersonSteps.java @@ -322,7 +322,22 @@ public EditCasePersonSteps( break; } }); - + When( + "I check that ([^\"]*) is not visible in Contact Information section for DE version", + (String option) -> { + webDriverHelpers.waitForPageLoadingSpinnerToDisappear(10); + By selector = null; + switch (option) { + case "Citizenship": + selector = CITIZENSHIP_LABEL_DE; + break; + case "Country of birth": + selector = COUNTRY_OF_BIRTH_LABEL_DE; + break; + } + softly.assertFalse(webDriverHelpers.isElementVisibleWithTimeout(selector,3), option + " is visible!"); + softly.assertAll(); + }); When( "I set Present condition of person to {string}", (String option) -> webDriverHelpers.selectFromCombobox(PRESENT_CONDITION_COMBOBOX, option)); diff --git a/sormas-e2e-tests/src/test/resources/features/sanity/web/Case.feature b/sormas-e2e-tests/src/test/resources/features/sanity/web/Case.feature index 6d9c0f26418..457fa29bb24 100644 --- a/sormas-e2e-tests/src/test/resources/features/sanity/web/Case.feature +++ b/sormas-e2e-tests/src/test/resources/features/sanity/web/Case.feature @@ -1778,4 +1778,18 @@ Feature: Case end to end tests Given I log in as Admin User in Keycloak enabled environment And I click on the Shares button from navbar Then I click on the The Eye Icon located in the Shares Page - And I check if received case id is equal with sent \ No newline at end of file + And I check if received case id is equal with sent + + @tmsLink=SORDEV-12441 @env_de + Scenario: Hide citizenship and country of birth on Edit Case Person page + Given API: I create a new person + And API: I check that POST call body is "OK" + And API: I check that POST call status code is 200 + Given API: I create a new case + Then API: I check that POST call body is "OK" + And API: I check that POST call status code is 200 + Given I log in as a National User + Then I navigate to the last created case via the url + And I navigate to case person tab + Then I check that Citizenship is not visible in Contact Information section for DE version + And I check that Country of birth is not visible in Contact Information section for DE version diff --git a/sormas-e2e-tests/src/test/resources/features/sanity/web/Contacts.feature b/sormas-e2e-tests/src/test/resources/features/sanity/web/Contacts.feature index f89e1e8ce5d..c101368062a 100644 --- a/sormas-e2e-tests/src/test/resources/features/sanity/web/Contacts.feature +++ b/sormas-e2e-tests/src/test/resources/features/sanity/web/Contacts.feature @@ -1158,4 +1158,18 @@ Feature: Contacts end to end tests Then I check the wording of the last two entries for type of contact When I click on Discard button in Create New Contact form And I click on the User Settings button from navbar - And I select "Deutsch" language from Combobox in User settings \ No newline at end of file + And I select "Deutsch" language from Combobox in User settings + + @tmsLink=SORDEV-12441 @env_de + Scenario: Hide citizenship and country of birth on Edit Contact Person + Given API: I create a new person + Then API: I check that POST call body is "OK" + And API: I check that POST call status code is 200 + Then API: I create a new contact + Then API: I check that POST call body is "OK" + And API: I check that POST call status code is 200 + Given I log in as a National User + And I navigate to the last created contact via the url + Then I open Contact Person tab + Then I check that Citizenship is not visible in Contact Information section for DE version + And I check that Country of birth is not visible in Contact Information section for DE version \ No newline at end of file diff --git a/sormas-e2e-tests/src/test/resources/features/sanity/web/Event.feature b/sormas-e2e-tests/src/test/resources/features/sanity/web/Event.feature index d71ca7ab167..45c496cfad3 100644 --- a/sormas-e2e-tests/src/test/resources/features/sanity/web/Event.feature +++ b/sormas-e2e-tests/src/test/resources/features/sanity/web/Event.feature @@ -1292,3 +1292,13 @@ Feature: Create events Then I Verify The Eye Icon opening the Map is enabled in the Edit Event Page And I click on the The Eye Icon located in the Edit Event Page Then I verify that the Map Container is now Visible in the Edit Event Page + + @tmsLink=SORDEV-12441 @env_de + Scenario: Hide citizenship and country of birth on Edit Event Participant Person Page + Given API: I create a new event + Then API: I check that POST call body is "OK" + And API: I check that POST call status code is 200 + Given I log in as a Admin User + Then I open the last created event via api + Then I navigate to EVENT PARTICIPANT from edit event page + And I add only required data for event participant creation for DE diff --git a/sormas-e2e-tests/src/test/resources/features/sanity/web/Persons.feature b/sormas-e2e-tests/src/test/resources/features/sanity/web/Persons.feature index 70ae9ad3db0..f7cc6473d92 100644 --- a/sormas-e2e-tests/src/test/resources/features/sanity/web/Persons.feature +++ b/sormas-e2e-tests/src/test/resources/features/sanity/web/Persons.feature @@ -294,3 +294,13 @@ Feature: Edit Persons Then I Verify The Eye Icon opening the Map is enabled in the Edit Person Page And I click on the The Eye Icon located in the Edit Person Page Then I verify that the Map Container is now Visible in the Edit Person Page + + @tmsLink=SORDEV-12441 @env_de + Scenario: Hide citizenship and country of birth on Edit Person Page + Given API: I create a new person + Then API: I check that POST call body is "OK" + And API: I check that POST call status code is 200 + Given I log in as a National User + Then I navigate to the last created via api Person page via URL + Then I check that Citizenship is not visible in Contact Information section for DE version + And I check that Country of birth is not visible in Contact Information section for DE version 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 478700e7ece..6afb0b1e1d0 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 @@ -453,4 +453,15 @@ Feature: Create travel entries And I click on Travel Entry list button Then I apply "Aktive Einreisen" to combobox on Travel Entry Directory Page And I search for first created travel entry by UUID for person in Travel Entries Directory - 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=SORDEV-12441 @env_de + Scenario: Hide citizenship and country of birth on Edit Travel Entry Person Page + Given I log in as a National User + And I click on the Entries button from navbar + And I click on the New Travel Entry button from Travel Entries directory + When I fill the required fields in a new travel entry form + And I click on Save button from the new travel entry form + And I navigate to person tab in Edit travel entry page + Then I check that Citizenship is not visible in Contact Information section for DE version + And I check that Country of birth is not visible in Contact Information section for DE version \ No newline at end of file From 4534ae4204c4be6826e15e280459e7723f9f7ac0 Mon Sep 17 00:00:00 2001 From: Maciej Paszylka Date: Thu, 8 Sep 2022 09:53:01 +0200 Subject: [PATCH 02/10] test --- .../manager/RunningConfiguration.java | 3 +- .../application/cases/EditCasePersonPage.java | 3 +- .../cases/EditCasePersonSteps.java | 33 ++++++++++--------- .../EditImmunizationPersonSteps.java | 6 ++-- .../mSers/CreateNewAggregateReportSteps.java | 5 +-- .../mSers/MSersDirectorySteps.java | 14 ++++---- 6 files changed, 34 insertions(+), 30 deletions(-) diff --git a/sormas-e2e-tests/src/main/java/org/sormas/e2etests/envconfig/manager/RunningConfiguration.java b/sormas-e2e-tests/src/main/java/org/sormas/e2etests/envconfig/manager/RunningConfiguration.java index b741a49e16e..e2550d44919 100644 --- a/sormas-e2e-tests/src/main/java/org/sormas/e2etests/envconfig/manager/RunningConfiguration.java +++ b/sormas-e2e-tests/src/main/java/org/sormas/e2etests/envconfig/manager/RunningConfiguration.java @@ -82,7 +82,8 @@ public String getSurvnetResponsible(String identifier) { .getSurvnetResponsible(); } catch (NullPointerException e) { throw new Exception( - String.format("Unable to get Survnet Responsible of Environment for market: %s", identifier)); + String.format( + "Unable to get Survnet Responsible of Environment for market: %s", identifier)); } } diff --git a/sormas-e2e-tests/src/main/java/org/sormas/e2etests/pages/application/cases/EditCasePersonPage.java b/sormas-e2e-tests/src/main/java/org/sormas/e2etests/pages/application/cases/EditCasePersonPage.java index f1e45e6b02f..421f8e0dbef 100644 --- a/sormas-e2e-tests/src/main/java/org/sormas/e2etests/pages/application/cases/EditCasePersonPage.java +++ b/sormas-e2e-tests/src/main/java/org/sormas/e2etests/pages/application/cases/EditCasePersonPage.java @@ -60,7 +60,8 @@ public class EditCasePersonPage { public static final By PASSPORT_NUMBER_INPUT = By.cssSelector("#passportNumber"); public static final By NATIONAL_HEALTH_ID_INPUT = By.cssSelector("#nationalHealthId"); public static final By COUNTRY_OF_BIRTH_LABEL_DE = By.xpath("//div[text()=\"Geburtsland\"]"); - public static final By CITIZENSHIP_LABEL_DE = By.xpath("//div[text()=\"Staatsb\u00FCrgerschaft\"]"); + public static final By CITIZENSHIP_LABEL_DE = + By.xpath("//div[text()=\"Staatsb\u00FCrgerschaft\"]"); public static final By EDUCATION_COMBOBOX = By.cssSelector("[id='educationType'] [class='v-filterselect-button']"); public static final By COMMUNITY_CONTACT_PERSON_INPUT = By.cssSelector("#details"); diff --git a/sormas-e2e-tests/src/test/java/org/sormas/e2etests/steps/web/application/cases/EditCasePersonSteps.java b/sormas-e2e-tests/src/test/java/org/sormas/e2etests/steps/web/application/cases/EditCasePersonSteps.java index a538b06cc70..1560bf7ab97 100644 --- a/sormas-e2e-tests/src/test/java/org/sormas/e2etests/steps/web/application/cases/EditCasePersonSteps.java +++ b/sormas-e2e-tests/src/test/java/org/sormas/e2etests/steps/web/application/cases/EditCasePersonSteps.java @@ -322,22 +322,23 @@ public EditCasePersonSteps( break; } }); - When( - "I check that ([^\"]*) is not visible in Contact Information section for DE version", - (String option) -> { - webDriverHelpers.waitForPageLoadingSpinnerToDisappear(10); - By selector = null; - switch (option) { - case "Citizenship": - selector = CITIZENSHIP_LABEL_DE; - break; - case "Country of birth": - selector = COUNTRY_OF_BIRTH_LABEL_DE; - break; - } - softly.assertFalse(webDriverHelpers.isElementVisibleWithTimeout(selector,3), option + " is visible!"); - softly.assertAll(); - }); + When( + "I check that ([^\"]*) is not visible in Contact Information section for DE version", + (String option) -> { + webDriverHelpers.waitForPageLoadingSpinnerToDisappear(10); + By selector = null; + switch (option) { + case "Citizenship": + selector = CITIZENSHIP_LABEL_DE; + break; + case "Country of birth": + selector = COUNTRY_OF_BIRTH_LABEL_DE; + break; + } + softly.assertFalse( + webDriverHelpers.isElementVisibleWithTimeout(selector, 3), option + " is visible!"); + softly.assertAll(); + }); When( "I set Present condition of person to {string}", (String option) -> webDriverHelpers.selectFromCombobox(PRESENT_CONDITION_COMBOBOX, option)); diff --git a/sormas-e2e-tests/src/test/java/org/sormas/e2etests/steps/web/application/immunizations/EditImmunizationPersonSteps.java b/sormas-e2e-tests/src/test/java/org/sormas/e2etests/steps/web/application/immunizations/EditImmunizationPersonSteps.java index f3a6e156afd..1319ef6c6f2 100644 --- a/sormas-e2e-tests/src/test/java/org/sormas/e2etests/steps/web/application/immunizations/EditImmunizationPersonSteps.java +++ b/sormas-e2e-tests/src/test/java/org/sormas/e2etests/steps/web/application/immunizations/EditImmunizationPersonSteps.java @@ -68,9 +68,9 @@ public EditImmunizationPersonSteps( When( "I click on Search case in Search specific case popup in immunization Link Case", - () ->{ - webDriverHelpers.waitUntilElementIsVisibleAndClickable(SEARCH_SPECIFIC_CASE_BUTTON); - webDriverHelpers.doubleClickOnWebElementBySelector(SEARCH_SPECIFIC_CASE_BUTTON); + () -> { + webDriverHelpers.waitUntilElementIsVisibleAndClickable(SEARCH_SPECIFIC_CASE_BUTTON); + webDriverHelpers.doubleClickOnWebElementBySelector(SEARCH_SPECIFIC_CASE_BUTTON); }); When( diff --git a/sormas-e2e-tests/src/test/java/org/sormas/e2etests/steps/web/application/mSers/CreateNewAggregateReportSteps.java b/sormas-e2e-tests/src/test/java/org/sormas/e2etests/steps/web/application/mSers/CreateNewAggregateReportSteps.java index 1f9c0e57ed3..98c8cd437b9 100644 --- a/sormas-e2e-tests/src/test/java/org/sormas/e2etests/steps/web/application/mSers/CreateNewAggregateReportSteps.java +++ b/sormas-e2e-tests/src/test/java/org/sormas/e2etests/steps/web/application/mSers/CreateNewAggregateReportSteps.java @@ -7,8 +7,8 @@ import static org.sormas.e2etests.pages.application.mSers.CreateNewAggreagateReportPage.DUPLICATE_DETECTION_TEXT; import static org.sormas.e2etests.pages.application.mSers.CreateNewAggreagateReportPage.EPI_WEEK_COMBOBOX_POPUP; import static org.sormas.e2etests.pages.application.mSers.CreateNewAggreagateReportPage.EPI_WEEK_INPUT_POPUP; -import static org.sormas.e2etests.pages.application.mSers.CreateNewAggreagateReportPage.POPUP_MESSAGE_WINDOW; import static org.sormas.e2etests.pages.application.mSers.CreateNewAggreagateReportPage.ERROR_MESSAGE; +import static org.sormas.e2etests.pages.application.mSers.CreateNewAggreagateReportPage.POPUP_MESSAGE_WINDOW; import static org.sormas.e2etests.pages.application.mSers.CreateNewAggreagateReportPage.REGION_COMBOBOX_POPUP; import static org.sormas.e2etests.pages.application.mSers.CreateNewAggreagateReportPage.REGION_COMBOBOX_POPUP_DIV; import static org.sormas.e2etests.pages.application.mSers.CreateNewAggreagateReportPage.SNAKE_BITE_SUSPECTED_CASES_INPUT; @@ -147,7 +147,8 @@ public CreateNewAggregateReportSteps( }); And( "^I set report period to \"([^\"]*)\" on Create a new aggregated report form$", - (String buttonName) -> webDriverHelpers.clickWebElementByText(WEEK_RADIOBUTTON, buttonName)); + (String buttonName) -> + webDriverHelpers.clickWebElementByText(WEEK_RADIOBUTTON, buttonName)); And( "^I check if Epi week filed is enabled on Create a new aggregated report form$", () -> { diff --git a/sormas-e2e-tests/src/test/java/org/sormas/e2etests/steps/web/application/mSers/MSersDirectorySteps.java b/sormas-e2e-tests/src/test/java/org/sormas/e2etests/steps/web/application/mSers/MSersDirectorySteps.java index a4c93b1e80b..bf7ca52de55 100644 --- a/sormas-e2e-tests/src/test/java/org/sormas/e2etests/steps/web/application/mSers/MSersDirectorySteps.java +++ b/sormas-e2e-tests/src/test/java/org/sormas/e2etests/steps/web/application/mSers/MSersDirectorySteps.java @@ -11,8 +11,8 @@ import static org.sormas.e2etests.pages.application.mSers.MSersDirectoryPage.EDIT_ICON; import static org.sormas.e2etests.pages.application.mSers.MSersDirectoryPage.EPI_WEEK_FROM_COMOBOX; import static org.sormas.e2etests.pages.application.mSers.MSersDirectoryPage.EPI_WEEK_TO_COMOBOX; -import static org.sormas.e2etests.pages.application.mSers.MSersDirectoryPage.FIRST_AGGREGATED_REPORT_EDIT_BUTTON; import static org.sormas.e2etests.pages.application.mSers.MSersDirectoryPage.FACILITY_COMBOBOX; +import static org.sormas.e2etests.pages.application.mSers.MSersDirectoryPage.FIRST_AGGREGATED_REPORT_EDIT_BUTTON; import static org.sormas.e2etests.pages.application.mSers.MSersDirectoryPage.GROUPING_COMBOBOX; import static org.sormas.e2etests.pages.application.mSers.MSersDirectoryPage.GROUPING_COMBOBOX_INPUT; import static org.sormas.e2etests.pages.application.mSers.MSersDirectoryPage.NEW_AGGREGATE_REPORT_BUTTON; @@ -121,12 +121,12 @@ public MSersDirectorySteps( "Cases for ARI are different!"); softly.assertAll(); }); - When( - "I delete exported report", - () -> { - String fileName = "sormas_aggregate_reports_" + LocalDate.now() + "_.csv"; - FilesHelper.deleteFile(fileName); - }); + When( + "I delete exported report", + () -> { + String fileName = "sormas_aggregate_reports_" + LocalDate.now() + "_.csv"; + FilesHelper.deleteFile(fileName); + }); When( "^I click on checkbox to display only duplicate reports$", () -> { From 1168f2bb968dc7e242f490673b8ba1a0d69c8a65 Mon Sep 17 00:00:00 2001 From: Maciej Paszylka Date: Thu, 8 Sep 2022 13:53:45 +0200 Subject: [PATCH 03/10] test --- .../application/cases/CaseDirectorySteps.java | 35 ++++++++++++++ .../cases/CaseImportExportSteps.java | 4 +- .../contacts/ContactImportExportSteps.java | 45 ++++++++++++++++++ .../application/events/EditEventSteps.java | 46 +++++++++++++++++++ .../sanity/web/CaseImportExport.feature | 17 ++++++- .../sanity/web/ContactImportExport.feature | 15 ++++++ .../sanity/web/EventImportExport.feature | 15 ++++++ 7 files changed, 174 insertions(+), 3 deletions(-) diff --git a/sormas-e2e-tests/src/test/java/org/sormas/e2etests/steps/web/application/cases/CaseDirectorySteps.java b/sormas-e2e-tests/src/test/java/org/sormas/e2etests/steps/web/application/cases/CaseDirectorySteps.java index 18f7c2c2e89..10e976a1ab9 100644 --- a/sormas-e2e-tests/src/test/java/org/sormas/e2etests/steps/web/application/cases/CaseDirectorySteps.java +++ b/sormas-e2e-tests/src/test/java/org/sormas/e2etests/steps/web/application/cases/CaseDirectorySteps.java @@ -168,6 +168,7 @@ import java.time.ZoneId; import java.time.format.DateTimeFormatter; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import java.util.Map; import java.util.UUID; @@ -1160,6 +1161,20 @@ public CaseDirectorySteps( FilesHelper.waitForFileToDownload(fileName, 20); FilesHelper.deleteFile(fileName); }); + When( + "I check if citizenship and country of birth is not present in Detailed Case export file", + () -> { + String fileName = "sormas_f\u00E4lle_" + LocalDate.now() + "_.csv"; + String[] headers = parseDetailedCaseExportHeaders(userDirPath + "/downloads/" + fileName); + FilesHelper.deleteFile(fileName); + softly.assertFalse( + Arrays.stream(headers).anyMatch("citizenship"::equals), + "Citizenship is present in file"); + softly.assertFalse( + Arrays.stream(headers).anyMatch("countryOfBirth"::equals), + "Country of birth is present in file"); + softly.assertAll(); + }); When( "I check that ([^\"]*) is visible in Pick or Create Person popup for De", (String option) -> { @@ -1459,4 +1474,24 @@ public static void writeCSVFromMapDetailedCase( log.error("IOException csvWriter: ", e); } } + + public String[] parseDetailedCaseExportHeaders(String fileName) { + List r = null; + String[] values = new String[] {}; + CSVParser csvParser = new CSVParserBuilder().withSeparator(',').build(); + try (CSVReader reader = + new CSVReaderBuilder(new FileReader(fileName)).withCSVParser(csvParser).build()) { + r = reader.readAll(); + } catch (IOException e) { + log.error("IOException parseDetailedCaseExportHeaders: {}", e.getCause()); + } catch (CsvException e) { + log.error("CsvException parseDetailedCaseExportHeaders: {}", e.getCause()); + } + try { + values = r.get(1); + } catch (NullPointerException e) { + log.error("Null pointer exception parseDetailedCaseExportHeaders: {}", e.getCause()); + } + return values; + } } diff --git a/sormas-e2e-tests/src/test/java/org/sormas/e2etests/steps/web/application/cases/CaseImportExportSteps.java b/sormas-e2e-tests/src/test/java/org/sormas/e2etests/steps/web/application/cases/CaseImportExportSteps.java index 7fa53cf08b6..923bcb25488 100644 --- a/sormas-e2e-tests/src/test/java/org/sormas/e2etests/steps/web/application/cases/CaseImportExportSteps.java +++ b/sormas-e2e-tests/src/test/java/org/sormas/e2etests/steps/web/application/cases/CaseImportExportSteps.java @@ -83,7 +83,7 @@ public CaseImportExportSteps( When( "I click on the Detailed Case Export button", () -> { - String file_name = "sormas_fälle_" + LocalDate.now().format(formatter) + "_.csv"; + String file_name = "sormas_f\u00E4lle_" + LocalDate.now().format(formatter) + "_.csv"; if (webDriverHelpers.isFileExists( Paths.get(String.format("./downloads/%s", file_name)))) { FilesHelper.deleteFile(file_name); @@ -91,7 +91,7 @@ public CaseImportExportSteps( TimeUnit.SECONDS.sleep(2); webDriverHelpers.clickOnWebElementBySelector(DETAILED_CASE_EXPORT_BUTTON); TimeUnit.SECONDS.sleep(2); - FilesHelper.waitForFileToDownload(file_name, 90); + FilesHelper.waitForFileToDownload(file_name, 15); }); When( diff --git a/sormas-e2e-tests/src/test/java/org/sormas/e2etests/steps/web/application/contacts/ContactImportExportSteps.java b/sormas-e2e-tests/src/test/java/org/sormas/e2etests/steps/web/application/contacts/ContactImportExportSteps.java index 79d902f42f9..e846293d070 100644 --- a/sormas-e2e-tests/src/test/java/org/sormas/e2etests/steps/web/application/contacts/ContactImportExportSteps.java +++ b/sormas-e2e-tests/src/test/java/org/sormas/e2etests/steps/web/application/contacts/ContactImportExportSteps.java @@ -23,6 +23,7 @@ import static org.sormas.e2etests.pages.application.cases.CaseImportExportPage.CONFIGURATION_NAME_INPUT; import static org.sormas.e2etests.pages.application.cases.CaseImportExportPage.CUSTOM_CASE_DELETE_BUTTON; import static org.sormas.e2etests.pages.application.cases.CaseImportExportPage.CUSTOM_CASE_EXPORT_DOWNLOAD_BUTTON; +import static org.sormas.e2etests.pages.application.cases.CaseImportExportPage.DETAILED_CASE_EXPORT_BUTTON; import static org.sormas.e2etests.pages.application.cases.CaseImportExportPage.EXPORT_CONFIGURATION_DATA_DISEASE_CHECKBOX; import static org.sormas.e2etests.pages.application.cases.CaseImportExportPage.NEW_EXPORT_CONFIGURATION_BUTTON; import static org.sormas.e2etests.pages.application.cases.CaseImportExportPage.NEW_EXPORT_CONFIGURATION_SAVE_BUTTON; @@ -30,6 +31,7 @@ import static org.sormas.e2etests.pages.application.contacts.ContactImportExportPage.EXPORT_CONFIGURATION_DATA_FIRST_NAME_CHECKBOX_CONTACT; import static org.sormas.e2etests.pages.application.contacts.ContactImportExportPage.EXPORT_CONFIGURATION_DATA_ID_CHECKBOX_CONTACT; import static org.sormas.e2etests.pages.application.contacts.ContactImportExportPage.EXPORT_CONFIGURATION_DATA_LAST_NAME_CHECKBOX_CONTACT; +import static org.sormas.e2etests.steps.web.application.contacts.EditContactSteps.userDirPath; import com.opencsv.CSVParser; import com.opencsv.CSVParserBuilder; @@ -44,6 +46,7 @@ import java.nio.file.Paths; import java.time.LocalDate; import java.time.format.DateTimeFormatter; +import java.util.Arrays; import java.util.List; import java.util.Locale; import java.util.concurrent.TimeUnit; @@ -54,6 +57,7 @@ import org.sormas.e2etests.enums.DiseasesValues; import org.sormas.e2etests.helpers.AssertHelpers; import org.sormas.e2etests.helpers.WebDriverHelpers; +import org.sormas.e2etests.helpers.files.FilesHelper; import org.sormas.e2etests.state.ApiState; import org.testng.Assert; import org.testng.asserts.SoftAssert; @@ -87,6 +91,11 @@ public ContactImportExportSteps( () -> { webDriverHelpers.clickOnWebElementBySelector(BASIC_CASE_EXPORT_BUTTON); }); + When( + "I click on the Detailed Contact Export button", + () -> { + webDriverHelpers.clickOnWebElementBySelector(DETAILED_CASE_EXPORT_BUTTON); + }); When( "I click on the New Export Configuration button in Custom Contact Export popup", @@ -168,6 +177,22 @@ public ContactImportExportSteps( Files.delete(path); softly.assertAll(); }); + When( + "I check if citizenship and country of birth is not present in Detailed Contact export file", + () -> { + String fileName = "sormas_kontakte_" + LocalDate.now() + "_.csv"; + FilesHelper.waitForFileToDownload(fileName, 20); + String[] headers = + parseDetailedContactExportHeaders(userDirPath + "/downloads/" + fileName); + FilesHelper.deleteFile(fileName); + softly.assertFalse( + Arrays.stream(headers).anyMatch("citizenship"::equals), + "Citizenship is present in file"); + softly.assertFalse( + Arrays.stream(headers).anyMatch("countryOfBirth"::equals), + "Country of birth is present in file"); + softly.assertAll(); + }); When( "I delete created custom contact export file", @@ -233,4 +258,24 @@ public Contact parseBasicContactExport(String fileName) { } return builder; } + + public String[] parseDetailedContactExportHeaders(String fileName) { + List r = null; + String[] values = new String[] {}; + CSVParser csvParser = new CSVParserBuilder().withSeparator(',').build(); + try (CSVReader reader = + new CSVReaderBuilder(new FileReader(fileName)).withCSVParser(csvParser).build()) { + r = reader.readAll(); + } catch (IOException e) { + log.error("IOException parseDetailedContactExportHeaders: {}", e.getCause()); + } catch (CsvException e) { + log.error("CsvException parseDetailedContactExportHeaders: {}", e.getCause()); + } + try { + values = r.get(1); + } catch (NullPointerException e) { + log.error("Null pointer exception parseDetailedContactExportHeaders: {}", e.getCause()); + } + return values; + } } diff --git a/sormas-e2e-tests/src/test/java/org/sormas/e2etests/steps/web/application/events/EditEventSteps.java b/sormas-e2e-tests/src/test/java/org/sormas/e2etests/steps/web/application/events/EditEventSteps.java index e2a2e1cad4c..5473e02f3a7 100644 --- a/sormas-e2e-tests/src/test/java/org/sormas/e2etests/steps/web/application/events/EditEventSteps.java +++ b/sormas-e2e-tests/src/test/java/org/sormas/e2etests/steps/web/application/events/EditEventSteps.java @@ -195,17 +195,26 @@ import static org.sormas.e2etests.steps.BaseSteps.locale; import com.github.javafaker.Faker; +import com.opencsv.CSVParser; +import com.opencsv.CSVParserBuilder; +import com.opencsv.CSVReader; +import com.opencsv.CSVReaderBuilder; +import com.opencsv.exceptions.CsvException; import cucumber.api.java8.En; import java.io.FileInputStream; +import java.io.FileReader; +import java.io.IOException; import java.time.LocalDate; import java.time.format.DateTimeFormatter; import java.time.format.TextStyle; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import java.util.Locale; import java.util.Random; import java.util.concurrent.TimeUnit; import javax.inject.Inject; +import lombok.extern.slf4j.Slf4j; import org.apache.poi.openxml4j.opc.OPCPackage; import org.apache.poi.xwpf.usermodel.XWPFDocument; import org.apache.poi.xwpf.usermodel.XWPFParagraph; @@ -236,6 +245,7 @@ import org.testng.Assert; import org.testng.asserts.SoftAssert; +@Slf4j public class EditEventSteps implements En { private final WebDriverHelpers webDriverHelpers; @@ -1848,6 +1858,22 @@ public EditEventSteps( () -> webDriverHelpers.clickOnWebElementBySelector( CREATE_CASE_IN_EVENT_PARTICIPANT_LIST_BUTTON)); + When( + "I check if citizenship and country of birth is not present in Detailed Event Participant export file", + () -> { + String fileName = "sormas_ereignisteilnehmer_" + LocalDate.now() + "_.csv"; + FilesHelper.waitForFileToDownload(fileName, 20); + String[] headers = + parseDetailedEventParticipantExportHeaders(userDirPath + "/downloads/" + fileName); + FilesHelper.deleteFile(fileName); + softly.assertFalse( + Arrays.stream(headers).anyMatch("citizenship"::equals), + "Citizenship is present in file"); + softly.assertFalse( + Arrays.stream(headers).anyMatch("countryOfBirth"::equals), + "Country of birth is present in file"); + softly.assertAll(); + }); } private String collectEventParticipantUuid() { @@ -2012,4 +2038,24 @@ private EventGroup collectEventGroupUuid() { private void selectEventHandoutTemplate(String templateName) { webDriverHelpers.selectFromCombobox(EVENT_HANDOUT_COMBOBOX, templateName); } + + public String[] parseDetailedEventParticipantExportHeaders(String fileName) { + List r = null; + String[] values = new String[] {}; + CSVParser csvParser = new CSVParserBuilder().withSeparator(',').build(); + try (CSVReader reader = + new CSVReaderBuilder(new FileReader(fileName)).withCSVParser(csvParser).build()) { + r = reader.readAll(); + } catch (IOException e) { + log.error("IOException parseDetailedContactExportHeaders: {}", e.getCause()); + } catch (CsvException e) { + log.error("CsvException parseDetailedContactExportHeaders: {}", e.getCause()); + } + try { + values = r.get(1); + } catch (NullPointerException e) { + log.error("Null pointer exception parseDetailedContactExportHeaders: {}", e.getCause()); + } + return values; + } } diff --git a/sormas-e2e-tests/src/test/resources/features/sanity/web/CaseImportExport.feature b/sormas-e2e-tests/src/test/resources/features/sanity/web/CaseImportExport.feature index d1d5f477a75..0e1755b2ac4 100644 --- a/sormas-e2e-tests/src/test/resources/features/sanity/web/CaseImportExport.feature +++ b/sormas-e2e-tests/src/test/resources/features/sanity/web/CaseImportExport.feature @@ -146,4 +146,19 @@ Feature: Case import and export tests And I select Responsible user data to export in existing Export Configuration for Custom Case Export Then I click Save Button from Custom Case Export Configuration When I download created custom case export file - When I check if downloaded data generated by custom case export is correct \ No newline at end of file + When I check if downloaded data generated by custom case export is correct + + @tmsLink=SORDEV-12441 @env_de + Scenario: Hide citizenship and country of birth in Detailed Case Export file + Given API: I create a new person + And API: I check that POST call body is "OK" + And API: I check that POST call status code is 200 + Given API: I create a new case + Then API: I check that POST call body is "OK" + And API: I check that POST call status code is 200 + Given I log in as a Admin User + And I click on the Cases button from navbar + Then I filter by CaseID on Case directory page + And I click on the Export case button + When I click on the Detailed Case Export button + And I check if citizenship and country of birth is not present in Detailed Case export file \ No newline at end of file diff --git a/sormas-e2e-tests/src/test/resources/features/sanity/web/ContactImportExport.feature b/sormas-e2e-tests/src/test/resources/features/sanity/web/ContactImportExport.feature index e9034acd171..2de7b119558 100644 --- a/sormas-e2e-tests/src/test/resources/features/sanity/web/ContactImportExport.feature +++ b/sormas-e2e-tests/src/test/resources/features/sanity/web/ContactImportExport.feature @@ -103,3 +103,18 @@ Feature: Contact import and export tests Then I check that displayed vaccination date is equal to "01.02.2022" And I check that displayed vaccination name is equal to "Comirnaty (COVID-19-mRNA Impfstoff)" And I close vaccination form in Edit Contact directory + + @tmsLink=SORDEV-12441 @env_de + Scenario: Hide citizenship and country of birth in Detailed Contact Export file + When API: I create a new person + Then API: I check that POST call body is "OK" + And API: I check that POST call status code is 200 + Then API: I create a new contact + Then API: I check that POST call body is "OK" + And API: I check that POST call status code is 200 + Given I log in as a Admin User + And I click on the Contacts button from navbar + Then I filter by Contact uuid + And I click on the Export contact button + Then I click on the Detailed Contact Export button + Then I check if citizenship and country of birth is not present in Detailed Contact export file diff --git a/sormas-e2e-tests/src/test/resources/features/sanity/web/EventImportExport.feature b/sormas-e2e-tests/src/test/resources/features/sanity/web/EventImportExport.feature index 01415e4f3bd..73555433b57 100644 --- a/sormas-e2e-tests/src/test/resources/features/sanity/web/EventImportExport.feature +++ b/sormas-e2e-tests/src/test/resources/features/sanity/web/EventImportExport.feature @@ -102,3 +102,18 @@ Given I log in as a Admin User When I click on the Export Event button And I click on the Detailed Event Export button Then I check if downloaded data generated by detailed event export option contains investigation start and end date columns + + + @tmsLink=SORDEV-12441 @env_de + Scenario: Hide citizenship and country of birth in Detailed Event Participant file + Given API: I create a new event + Then API: I check that POST call body is "OK" + And API: I check that POST call status code is 200 + Given I log in as a Admin User + Then I open the last created event via api + Then I navigate to EVENT PARTICIPANT from edit event page + And I add only required data for event participant creation for DE + And I navigate to EVENT PARTICIPANT from edit event page + And I click Export button in Event Participant Directory + And I click on Detailed Export button in Event Participant Directory + And I check if citizenship and country of birth is not present in Detailed Event Participant export file From 7c5e79ea83f78ed56f256ed9d70fdf6b8c9776c0 Mon Sep 17 00:00:00 2001 From: Maciej Paszylka Date: Thu, 8 Sep 2022 14:08:40 +0200 Subject: [PATCH 04/10] test --- .../src/test/resources/features/sanity/web/Persons.feature | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/sormas-e2e-tests/src/test/resources/features/sanity/web/Persons.feature b/sormas-e2e-tests/src/test/resources/features/sanity/web/Persons.feature index f7cc6473d92..fb8d8a08a34 100644 --- a/sormas-e2e-tests/src/test/resources/features/sanity/web/Persons.feature +++ b/sormas-e2e-tests/src/test/resources/features/sanity/web/Persons.feature @@ -297,10 +297,8 @@ Feature: Edit Persons @tmsLink=SORDEV-12441 @env_de Scenario: Hide citizenship and country of birth on Edit Person Page - Given API: I create a new person - Then API: I check that POST call body is "OK" - And API: I check that POST call status code is 200 Given I log in as a National User - Then I navigate to the last created via api Person page via URL + When I click on the Persons button from navbar + And I click on first person in person directory Then I check that Citizenship is not visible in Contact Information section for DE version And I check that Country of birth is not visible in Contact Information section for DE version From 4afd341ddec78931a5c62860f00f4e8119c2dc0e Mon Sep 17 00:00:00 2001 From: sergiupacurariu <62688603+sergiupacurariu@users.noreply.github.com> Date: Mon, 12 Sep 2022 10:32:05 +0300 Subject: [PATCH 05/10] #9770 - Allow editing of aggregated reports for no longer existing age groups - fix no data on empty age group --- .../ui/reports/aggregate/AggregateReportsEditLayout.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sormas-ui/src/main/java/de/symeda/sormas/ui/reports/aggregate/AggregateReportsEditLayout.java b/sormas-ui/src/main/java/de/symeda/sormas/ui/reports/aggregate/AggregateReportsEditLayout.java index 71bd196e5a1..2d7be142f95 100644 --- a/sormas-ui/src/main/java/de/symeda/sormas/ui/reports/aggregate/AggregateReportsEditLayout.java +++ b/sormas-ui/src/main/java/de/symeda/sormas/ui/reports/aggregate/AggregateReportsEditLayout.java @@ -277,6 +277,10 @@ public AggregateReportsEditLayout(Window window, boolean edit, AggregateReportDt } i++; } + } else { + if (!diseasesWithReports.get(disease).contains(null)) { + editForms.add(new AggregateReportEditForm(disease, null, true, false)); + } } } From f295474b9830f32a5abbd326f21b8831bc7445dc Mon Sep 17 00:00:00 2001 From: Levente Gal <62599627+leventegal-she@users.noreply.github.com> Date: Mon, 12 Sep 2022 11:59:51 +0300 Subject: [PATCH 06/10] #9708 - fix hibernate lazy init issues in UI module tests (#10328) * #9708 - fix hibernate lazy init issues in UI module tests * #9708 - add comment Co-authored-by: Levente Gal --- sormas-ui/src/test/resources/META-INF/persistence.xml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sormas-ui/src/test/resources/META-INF/persistence.xml b/sormas-ui/src/test/resources/META-INF/persistence.xml index 071cdc1e336..4e50057169a 100644 --- a/sormas-ui/src/test/resources/META-INF/persistence.xml +++ b/sormas-ui/src/test/resources/META-INF/persistence.xml @@ -101,7 +101,11 @@ - + + + + +