Skip to content

Commit

Permalink
Merge pull request SORMAS-Foundation#12065 from SORMAS-Foundation/SOR…
Browse files Browse the repository at this point in the history
…QA-961

Sorqa 961
  • Loading branch information
rdutu-vg authored Jun 9, 2023
2 parents 43dfcca + b9dda7f commit bd300c5
Show file tree
Hide file tree
Showing 9 changed files with 110 additions and 51 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,16 @@ public static By getProcessStatusByIndex(int index) {
public static final By FIRST_PATHOGEN_LABORATORY_INPUT =
By.xpath("(//div[contains(@id, 'lab')]//input)[2]");
public static final By FIRST_RECORD_DISEASE_VARIANT = By.xpath("//table/tbody/tr[1]/td[8]");
public static final By NEW_CASE_FORM_DISEASE_VARIANT_INPUT = By.cssSelector(".popupContent #diseaseVariant input");
public static final By NEW_SAMPLE_FORM_FIRST_PATHOGEN_DISEASE_VARIANT_INPUT = By.xpath("(//div[contains(@id, 'testedDiseaseVariant')]//input)[1]");
public static final By NEW_SAMPLE_FORM_SECOND_PATHOGEN_DISEASE_VARIANT_INPUT = By.xpath("(//div[contains(@id, 'testedDiseaseVariant')]//input)[2]");
public static final By NEW_SAMPLE_FORM_LABORATORY_NAME = By.xpath("(//input[contains(@id, 'labDetails')])[1]");
public static final By NEW_SAMPLE_FORM_FIRST_PATHOGEN_LABORATORY_NAME = By.xpath("(//input[contains(@id, 'labDetails')])[2]");
public static final By NEW_SAMPLE_FORM_SECOND_PATHOGEN_LABORATORY_NAME = By.xpath("(//input[contains(@id, 'labDetails')])[3]");
public static final By NEW_CASE_FORM_DISEASE_VARIANT_INPUT =
By.cssSelector(".popupContent #diseaseVariant input");
public static final By NEW_SAMPLE_FORM_FIRST_PATHOGEN_DISEASE_VARIANT_INPUT =
By.xpath("(//div[contains(@id, 'testedDiseaseVariant')]//input)[1]");
public static final By NEW_SAMPLE_FORM_SECOND_PATHOGEN_DISEASE_VARIANT_INPUT =
By.xpath("(//div[contains(@id, 'testedDiseaseVariant')]//input)[2]");
public static final By NEW_SAMPLE_FORM_LABORATORY_NAME =
By.xpath("(//input[contains(@id, 'labDetails')])[1]");
public static final By NEW_SAMPLE_FORM_FIRST_PATHOGEN_LABORATORY_NAME =
By.xpath("(//input[contains(@id, 'labDetails')])[2]");
public static final By NEW_SAMPLE_FORM_SECOND_PATHOGEN_LABORATORY_NAME =
By.xpath("(//input[contains(@id, 'labDetails')])[3]");
}
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,7 @@ public String prepareLabNotificationFileWithTwoFacilities(
}

public String prepareLabNotificationFileWithTwoPathogens(
String patientFirstName,
String patientLastName) {
String patientFirstName, String patientLastName) {
DemisData demisData = runningConfiguration.getDemisData(locale);
String file = "src/main/resources/demisJsonTemplates/labNotificationTemplateTwoPathogens.json";
String json = readFileAsString(file);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,10 +273,12 @@ public void selectFromCombobox(By selector, String text) {
+ "') or starts-with(text(), '\" + text + \"') ]";
waitUntilIdentifiedElementIsVisibleAndClickable(comboboxInput);
comboboxInput.sendKeys(text);
waitUntilElementIsVisibleAndClickable(By.className("v-filterselect-suggestmenu"));
waitUntilANumberOfElementsAreVisibleAndClickable(By.xpath("//td[@role='listitem']/span"), 1);
// waitUntilElementIsVisibleAndClickable(By.className("v-filterselect-suggestmenu"));
// waitUntilANumberOfElementsAreVisibleAndClickable(By.xpath("//td[@role='listitem']/span"),
// 1);
By dropDownValueXpath = By.xpath(comboBoxItemWithText);
TimeUnit.MILLISECONDS.sleep(700);
waitUntilANumberOfElementsAreVisibleAndClickable(dropDownValueXpath, 1);
TimeUnit.SECONDS.sleep(1);
clickOnWebElementBySelector(dropDownValueXpath);
await()
.pollInterval(ONE_HUNDRED_MILLISECONDS)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -815,7 +815,9 @@ public DemisSteps(
() -> {
patientLastName = faker.name().lastName();
patientFirstName = faker.name().firstName();
String json = demisApiService.prepareLabNotificationFileWithTwoPathogens(patientFirstName, patientLastName);
String json =
demisApiService.prepareLabNotificationFileWithTwoPathogens(
patientFirstName, patientLastName);

Assert.assertTrue(
demisApiService.sendLabRequest(json, loginToken),
Expand All @@ -836,22 +838,25 @@ public DemisSteps(
And(
"I verify that disease variant for {string} pathogen is prefilled with {string} in New Sample form while processing a DEMIS LabMessage",
(String pathogen, String diseaseVariant) -> {
webDriverHelpers.waitUntilIdentifiedElementIsPresent(NEW_SAMPLE_FORM_FIRST_PATHOGEN_DISEASE_VARIANT_INPUT);
switch(pathogen) {
case "first":
softly.assertEquals(
webDriverHelpers.getValueFromWebElement(NEW_SAMPLE_FORM_FIRST_PATHOGEN_DISEASE_VARIANT_INPUT),
diseaseVariant,
"The disease variant is incorrect");
softly.assertAll();
break;
case "second":
softly.assertEquals(
webDriverHelpers.getValueFromWebElement(NEW_SAMPLE_FORM_SECOND_PATHOGEN_DISEASE_VARIANT_INPUT),
diseaseVariant,
"The disease variant is incorrect");
softly.assertAll();
break;
webDriverHelpers.waitUntilIdentifiedElementIsPresent(
NEW_SAMPLE_FORM_FIRST_PATHOGEN_DISEASE_VARIANT_INPUT);
switch (pathogen) {
case "first":
softly.assertEquals(
webDriverHelpers.getValueFromWebElement(
NEW_SAMPLE_FORM_FIRST_PATHOGEN_DISEASE_VARIANT_INPUT),
diseaseVariant,
"The disease variant is incorrect");
softly.assertAll();
break;
case "second":
softly.assertEquals(
webDriverHelpers.getValueFromWebElement(
NEW_SAMPLE_FORM_SECOND_PATHOGEN_DISEASE_VARIANT_INPUT),
diseaseVariant,
"The disease variant is incorrect");
softly.assertAll();
break;
}
});

Expand All @@ -866,12 +871,14 @@ public DemisSteps(
"^I fill \"([^\"]*)\" pathogen laboratory name with \"([^\"]*)\" in New Sample form while processing a DEMIS LabMessage$",
(String pathogen, String labName) -> {
switch (pathogen) {
case "first":
webDriverHelpers.clearAndFillInWebElement(NEW_SAMPLE_FORM_FIRST_PATHOGEN_LABORATORY_NAME, labName);
break;
case "second":
webDriverHelpers.clearAndFillInWebElement(NEW_SAMPLE_FORM_SECOND_PATHOGEN_LABORATORY_NAME, labName);
break;
case "first":
webDriverHelpers.clearAndFillInWebElement(
NEW_SAMPLE_FORM_FIRST_PATHOGEN_LABORATORY_NAME, labName);
break;
case "second":
webDriverHelpers.clearAndFillInWebElement(
NEW_SAMPLE_FORM_SECOND_PATHOGEN_LABORATORY_NAME, labName);
break;
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2674,7 +2674,8 @@ public EditCaseSteps(
And(
"^I check that the value selected from Disease variant combobox is \"([^\"]*)\" on Edit Case page$",
(String expectedDiseaseVariant) -> {
String prefilledDiseaseVariant = webDriverHelpers.getValueFromWebElement(DISEASE_VARIANT_INPUT);
String prefilledDiseaseVariant =
webDriverHelpers.getValueFromWebElement(DISEASE_VARIANT_INPUT);
softly.assertEquals(
prefilledDiseaseVariant,
expectedDiseaseVariant,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ public ContactDirectorySteps(
+ "/sormas-webdriver/#!contacts/data/"
+ apiState.getCreatedContact().getUuid();
webDriverHelpers.accessWebSite(LAST_CREATED_CONTACT_URL);
webDriverHelpers.waitUntilIdentifiedElementIsVisibleAndClickable(UUID_INPUT);
webDriverHelpers.waitUntilIdentifiedElementIsPresent(UUID_INPUT);
});
When(
"^I navigate to the last created UI contact via the url$",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -370,14 +370,14 @@ public MessagesDirectorySteps(
});

And(
"^I check if disease variant field for first record is empty in Message Directory$",
() -> {
webDriverHelpers.waitUntilIdentifiedElementIsPresent(FIRST_RECORD_DISEASE_VARIANT);
softly.assertEquals(
webDriverHelpers.getTextFromWebElement(FIRST_RECORD_DISEASE_VARIANT),
"",
"Disease variant is not empty");
softly.assertAll();
});
"^I check if disease variant field for first record is empty in Message Directory$",
() -> {
webDriverHelpers.waitUntilIdentifiedElementIsPresent(FIRST_RECORD_DISEASE_VARIANT);
softly.assertEquals(
webDriverHelpers.getTextFromWebElement(FIRST_RECORD_DISEASE_VARIANT),
"",
"Disease variant is not empty");
softly.assertAll();
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ Feature: Login with different type of users
| Community Officer |
| Hospital Informant |
| Clinician |
| Clinician |

@env_keycloak @LoginKeycloak
Scenario Outline: Login with <user> user on Keycloak Environment
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ Feature: Sharing contacts between environments tests
Then I navigate to "s2s_2" environment
Then I open the last created contact via API

@tmsLink=SORDEV-12087 @tmsLink=SORQA-961 @env_s2s_1
@tmsLink=SORDEV-12087 @env_s2s_1
Scenario: Delete a contact in target system with handing ownership
Given API: I create a new person with "Baden-Württemberg" region and "LK Alb-Donau-Kreis" district
And API: I check that POST call status code is 200
Expand Down Expand Up @@ -175,9 +175,6 @@ Feature: Sharing contacts between environments tests
And I click on the APPLY FILTERS button
And I open the first contact from contacts list
And I check if editable fields are read only for shared contact
And I check if handover card contains "Eigentümer: LK Fulda" information
And I check if handover card contains "Geteilt von: Automation ADMIN" information
And I check if handover card contains "shared with automated test" information

@tmsLink=SORDEV-12087 @env_s2s_1
Scenario: Delete a contact in source system without handing ownership
Expand Down Expand Up @@ -295,4 +292,52 @@ Feature: Sharing contacts between environments tests
Then I navigate to "s2s_2" environment
And I click on the Shares button from navbar
And I click on the The Eye Icon located in the Shares Page
And I check that first shared result has different id then deleted shared contact
And I check that first shared result has different id then deleted shared contact

@tmsLink=SORQA-961 @env_s2s_1
Scenario: Delete a contact in target system with handing ownership and check it in both systems
Given API: I create a new person with "Baden-Württemberg" region and "LK Alb-Donau-Kreis" district
And API: I check that POST call status code is 200
Given API: I create a new case with "Baden-Württemberg" region and "LK Alb-Donau-Kreis" district and "General Hospital" facility
And API: I check that POST call status code is 200
Given API: I create a new contact with "Baden-Württemberg" region and "LK Alb-Donau-Kreis" district linked to last created case
And API: I check that POST call status code is 200
Given I log in as a Admin User
Then I navigate to the last created case via the url
And I collect uuid of the case
Then I click on share case button
And I select organization to share with "s2s_2"
And I click to hand over the ownership of the case in Share popup
And I fill comment in share popup with "shared with automated test"
Then I click on share button in s2s share popup and wait for share to finish
Then I navigate to "s2s_2" environment
Given I log in as a Admin User
And I click on the Shares button from navbar
Then I accept first case in Shares Page
Then I navigate to "s2s_1" environment
Then I open the last created contact via API
Then I click on share contact button
And I click to hand over the ownership of the contact in Share popup
And I select organization to share with "s2s_2"
And I fill comment in share popup with "shared with automated test"
Then I click on share button in s2s share popup and wait for share to finish
Then I navigate to "s2s_2" environment
And I click on the Shares button from navbar
Then I accept first contact in Shares Page
And I click to accept potential duplicate in Shares Page
Then I navigate to "s2s_1" environment
Then I open the last created contact via API
Then I click on Delete button from contact
And I set Reason for deletion as "Löschen auf Anforderung der betroffenen Person nach DSGVO"
And I click on Yes option in Confirm deletion popup
And I click on the Contacts button from navbar
Then I open the last created contact via API
And I check if editable fields are read only for shared contact
And I check if handover card contains "Eigentümer: LK Fulda" information
And I check if handover card contains "Geteilt von: Automation ADMIN" information
And I check if handover card contains "shared with automated test" information
Then I navigate to "s2s_2" environment
Then I open the last created contact via API
And I check if handover card contains "Gesendet von LK Barnim" information
And I check if handover card contains "Geteilt von: Automation Admin" information
And I check if handover card contains "shared with automated test" information

0 comments on commit bd300c5

Please sign in to comment.