Skip to content

Commit

Permalink
qa-auto/HSP-6554 [Samples] Filter for 'Person samples' with 'All acti…
Browse files Browse the repository at this point in the history
…ve and archived samples' and 'Deleted samples' filters

* HSP-6554 [Samples] Filter for 'Person samples' with 'All active and archived samples' and 'Deleted samples' filters -initial commit

* HSP-6554 [Samples] Filter for 'Person samples' with 'All active and archived samples' and 'Deleted samples' filters -removed print method

* HSP-6554 [Samples] Filter for 'Person samples' with 'All active and archived samples' and 'Deleted samples' filters -removed unnecessary code

* HSP-6554 [Samples] Filter for 'Person samples' with 'All active and archived samples' and 'Deleted samples' filters - add additional filters rule
  • Loading branch information
mk-sgent authored Jan 26, 2024
1 parent 8f99cb0 commit 91093cc
Show file tree
Hide file tree
Showing 8 changed files with 102 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,19 @@ public class EventParticipantsPage {
By.cssSelector(".v-window [location='sex'] [role='combobox'] div");
public static final By SEX_COMBOBOX_REQUIRED =
By.xpath("//div[@id='sex' and contains(@class, 'v-required v-filterselect-required')]");
public static final By PICK_OR_CASE_PERSON_POPUP =
By.xpath("//*[contains(text(),'Pick or Create a Case')]");
public static final By PICK_OR_CREATE_PERSON_POPUP =
By.xpath("//*[contains(text(),'Pick or create person')]");
public static final By PICK_OR_CREATE_CONTACT_POPUP =
By.xpath("//*[contains(text(),'Pick or create contact')]");
public static final By CREATE_NEW_PERSON_RADIO_BUTTON =
By.xpath("//label[contains(text(),'Create a new person')]");
public static final By CREATE_NEW_CASE_RADIO_BUTTON =
By.xpath("//label[contains(text(),'Create a new case')]");
public static final By EVENT_PARTICIPANTS_TAB = By.id("tab-events-eventparticipants");
public static final By PICK_OR_CREATE_POPUP_SAVE_BUTTON = By.cssSelector("#commit");
public static final By PICK_OR_CASE_POPUP_SAVE_BUTTON = By.cssSelector(".popupContent #commit");
public static final By ERROR_MESSAGE_TEXT = By.cssSelector("p.v-Notification-description");
public static final By DISCARD_BUTTON = By.id("discard");
public static final By APPLY_FILTERS_BUTTON = By.id("actionApplyFilters");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

public class EditPersonPage {
public static final By UUID_INPUT = By.cssSelector("#uuid");
public static final By NEW_CASE_BUTTON = By.cssSelector("div[id^='New case']");
public static final By USER_INFORMATION =
By.cssSelector(".v-slot.v-slot-h2.v-slot-vspace-top-none.v-slot-primary");
public static final By FIRST_NAME_INPUT = By.id("firstName");
Expand Down Expand Up @@ -109,6 +110,7 @@ public class EditPersonPage {
By.cssSelector(".v-Notification.error.v-Notification-error");
public static final By ERROR_INDICATOR =
By.cssSelector(".v-errorindicator.v-errorindicator-info");
public static final By SEE_SAMPLES_FOR_PERSON_BUTTON = By.id("See samples for this person");
public static final By SEE_CASES_FOR_PERSON_BUTTON = By.id("See cases for this person");
public static final By SEE_CASES_FOR_PERSON_BUTTON_DE =
By.id("F\u00E4lle f\u00FCr diese Person ansehen");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ public class SamplesDirectoryPage {
By.cssSelector("[id='pathogenTestResult'] [class='v-filterselect-button']");
public static final By SAMPLE_GRID_RESULTS_ROWS =
By.cssSelector("[class='v-grid-tablewrapper'] tbody>tr");
public static final By RELEVANCE_STATUS_FILTER_COMBOBOX =
By.cssSelector("[id='relevanceStatusFilter'] [class='v-filterselect-button']");
public static final By SPECIMEN_CONDITION_SEARCH_COMBOBOX =
By.cssSelector("[id='specimenCondition'] [class='v-filterselect-button']");
public static final By LABORATORY_SEARCH_COMBOBOX =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@
import static org.sormas.e2etests.pages.application.entries.EditTravelEntryPage.DISCARD_TASK_BUTTON;
import static org.sormas.e2etests.pages.application.entries.TravelEntryPage.NEW_PERSON_RADIOBUTTON_DE;
import static org.sormas.e2etests.pages.application.entries.TravelEntryPage.PICK_OR_CREATE_PERSON_HEADER_DE;
import static org.sormas.e2etests.pages.application.events.EventParticipantsPage.CREATE_NEW_CASE_RADIO_BUTTON;
import static org.sormas.e2etests.pages.application.events.EventParticipantsPage.PICK_OR_CASE_PERSON_POPUP;
import static org.sormas.e2etests.pages.application.events.EventParticipantsPage.PICK_OR_CASE_POPUP_SAVE_BUTTON;
import static org.sormas.e2etests.pages.application.persons.PersonDirectoryPage.SEARCH_PERSON_BY_FREE_TEXT;
import static org.sormas.e2etests.pages.application.shares.EditSharesPage.SHARE_UUID_CASE_TITLE;
import static org.sormas.e2etests.steps.web.application.cases.EditCaseSteps.aCase;
Expand Down Expand Up @@ -572,8 +575,18 @@ public CreateNewCaseSteps(
webDriverHelpers.waitForPageLoadingSpinnerToDisappear(20);
webDriverHelpers.waitUntilElementIsVisibleAndClickable(EditCasePage.REPORT_DATE_INPUT);
webDriverHelpers.clickOnWebElementBySelector(CASE_SAVED_POPUP);
});

TimeUnit.SECONDS.sleep(2);
When(
"^I create a new case for the same person$",
() -> {
fillAllCaseFieldsForTheSamePerson(caze);
webDriverHelpers.waitUntilIdentifiedElementIsVisibleAndClickable(CONFIRM_BUTTON_POPUP);
webDriverHelpers.clickOnWebElementBySelector(CONFIRM_BUTTON_POPUP);
if (webDriverHelpers.isElementVisibleWithTimeout(PICK_OR_CASE_PERSON_POPUP, 15)) {
webDriverHelpers.clickOnWebElementBySelector(CREATE_NEW_CASE_RADIO_BUTTON);
webDriverHelpers.clickOnWebElementBySelector(PICK_OR_CASE_POPUP_SAVE_BUTTON);
}
});

Then(
Expand Down Expand Up @@ -1847,6 +1860,21 @@ private void fillAllCaseFields(Case caze) {
fillPlaceDescription(caze.getPlaceDescription());
}

private void fillAllCaseFieldsForTheSamePerson(Case caze) {
selectCaseOrigin(caze.getCaseOrigin());
fillDisease(caze.getDisease());
selectResponsibleRegion(caze.getResponsibleRegion());
selectResponsibleDistrict(caze.getResponsibleDistrict());
selectResponsibleCommunity(caze.getResponsibleCommunity());
selectPlaceOfStay(caze.getPlaceOfStay());
selectPresentConditionOfPerson(caze.getPresentConditionOfPerson());
fillDateOfSymptomOnset(caze.getDateOfSymptomOnset(), Locale.ENGLISH);
fillPrimaryPhoneNumber(caze.getPrimaryPhoneNumber());
fillPrimaryEmailAddress(caze.getPrimaryEmailAddress());
fillDateOfReport(caze.getDateOfReport(), Locale.ENGLISH);
fillPlaceDescription(caze.getPlaceDescription());
}

private void fillAllCaseFieldsWithSpecificRegion(Case caze, String region) {
selectCaseOrigin(caze.getCaseOrigin());
fillDisease(caze.getDisease());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
import static org.sormas.e2etests.pages.application.persons.EditPersonPage.MAP_CONTAINER_EDIT_PERSON;
import static org.sormas.e2etests.pages.application.persons.EditPersonPage.MEANS_OF_IMMUNIZATION_LABEL;
import static org.sormas.e2etests.pages.application.persons.EditPersonPage.NAMES_OF_GUARDIANS_INPUT;
import static org.sormas.e2etests.pages.application.persons.EditPersonPage.NEW_CASE_BUTTON;
import static org.sormas.e2etests.pages.application.persons.EditPersonPage.NO_TRAVEL_ENTRY_LABEL_DE;
import static org.sormas.e2etests.pages.application.persons.EditPersonPage.PERSON_CONTACT_DETAILS_CONTACT_INFORMATION_INPUT;
import static org.sormas.e2etests.pages.application.persons.EditPersonPage.PERSON_CONTACT_DETAILS_TYPE_OF_DETAILS_INPUT;
Expand All @@ -85,6 +86,7 @@
import static org.sormas.e2etests.pages.application.persons.EditPersonPage.SEE_CONTACTS_FOR_PERSON_BUTTON;
import static org.sormas.e2etests.pages.application.persons.EditPersonPage.SEE_CONTACTS_FOR_PERSON_BUTTON_DE;
import static org.sormas.e2etests.pages.application.persons.EditPersonPage.SEE_EVENTS_FOR_PERSON;
import static org.sormas.e2etests.pages.application.persons.EditPersonPage.SEE_SAMPLES_FOR_PERSON_BUTTON;
import static org.sormas.e2etests.pages.application.persons.EditPersonPage.SEX_INPUT;
import static org.sormas.e2etests.pages.application.persons.EditPersonPage.STAFF_OF_ARMED_FORCES_COMBOBOX;
import static org.sormas.e2etests.pages.application.persons.EditPersonPage.STREET_INPUT;
Expand Down Expand Up @@ -272,6 +274,12 @@ public EditPersonSteps(
webDriverHelpers.waitForPageLoadingSpinnerToDisappear(150);
webDriverHelpers.clickOnWebElementBySelector(SEE_CASES_FOR_PERSON_BUTTON);
});
Then(
"I click on See Samples for this Person button from Edit Person page",
() -> {
webDriverHelpers.waitForPageLoadingSpinnerToDisappear(150);
webDriverHelpers.clickOnWebElementBySelector(SEE_SAMPLES_FOR_PERSON_BUTTON);
});
Then(
"I check if data of created immunization is in Immunization tab on Edit Person Page",
() -> {
Expand Down Expand Up @@ -396,6 +404,13 @@ public EditPersonSteps(
// webDriverHelpers.waitForPageLoadingSpinnerToDisappear(150);
});

Then(
"I click on NEW CASE button from Edit Person page",
() -> {
webDriverHelpers.waitUntilIdentifiedElementIsVisibleAndClickable(NEW_CASE_BUTTON);
webDriverHelpers.clickOnWebElementBySelector(NEW_CASE_BUTTON);
});

Then(
"I click on Edit Case button from Cases card on Edit Person page",
() -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,13 @@ public EditSampleSteps(
() -> {
webDriverHelpers.scrollToElement(DELETE_SAMPLE_BUTTON);
webDriverHelpers.clickOnWebElementBySelector(DELETE_SAMPLE_BUTTON);
webDriverHelpers.waitUntilIdentifiedElementIsVisibleAndClickable(
DELETE_SAMPLE_REASON_POPUP);
webDriverHelpers.selectFromCombobox(
DELETE_SAMPLE_REASON_POPUP, "Entity created without legal reason");
webDriverHelpers.clickOnWebElementBySelector(SAMPLE_DELETION_POPUP_YES_BUTTON);
webDriverHelpers.waitUntilIdentifiedElementIsPresent(SAMPLE_SEARCH_INPUT);
if (webDriverHelpers.isElementPresent(SAMPLE_SEARCH_INPUT))
webDriverHelpers.waitUntilIdentifiedElementIsPresent(SAMPLE_SEARCH_INPUT);
});

When(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import static org.sormas.e2etests.pages.application.samples.SamplesDirectoryPage.LABORATORY_SEARCH_COMBOBOX;
import static org.sormas.e2etests.pages.application.samples.SamplesDirectoryPage.PENDING_TEST_TABLE_RESULTS;
import static org.sormas.e2etests.pages.application.samples.SamplesDirectoryPage.POSITIVE_TEST_TABLE_RESULTS;
import static org.sormas.e2etests.pages.application.samples.SamplesDirectoryPage.RELEVANCE_STATUS_FILTER_COMBOBOX;
import static org.sormas.e2etests.pages.application.samples.SamplesDirectoryPage.RESET_FILTER_BUTTON;
import static org.sormas.e2etests.pages.application.samples.SamplesDirectoryPage.SAMPLE_CLASIFICATION_SEARCH_COMBOBOX;
import static org.sormas.e2etests.pages.application.samples.SamplesDirectoryPage.SAMPLE_DISEASE_SEARCH_COMBOBOX;
Expand Down Expand Up @@ -175,6 +176,12 @@ public SamplesDirectorySteps(
SPECIMEN_CONDITION_SEARCH_COMBOBOX, specimenCondition);
});

When(
"I select {string} Relevance Status option among the filter options",
(String relevanceStatus) -> {
webDriverHelpers.selectFromCombobox(RELEVANCE_STATUS_FILTER_COMBOBOX, relevanceStatus);
});

When(
"I select Case classification filter value with value for case classification of the last created via API Case in Sample Directory",
() -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,41 @@ Feature: Sample filter functionality
And I select "Versandt" filter from quick filter for DE version
And I select "Erhalten" filter from quick filter for DE version
And I select "An ein anderes Labor weitergeleitet" filter from quick filter for DE version
And I click on reset filters button from Sample Directory
And I click on reset filters button from Sample Directory

@tmsLink=HSP-6554 @env_main
Scenario: [Samples] Filter for 'Person samples' with 'All active and archived samples' and 'Deleted samples' filters
Given I log in as a Admin User
And I click on the Cases button from navbar
And I click on the NEW CASE button
When I create a new case with specific data
And I click on New Sample
And I create a new Sample with alternate purpose
And I save the created sample
And I click on New Sample
And I create a new Sample with alternate purpose
And I save the created sample
Then I click on the Archive case button and confirm popup
And I navigate to case person tab
Then I collect person UUID from Edit Case Person page
And I click on NEW CASE button from Edit Person page
When I create a new case for the same person
And I click on New Sample
And I create a new Sample with alternate purpose
And I save the created sample
And I click on New Sample
And I create a new Sample with alternate purpose
And I save the created sample
When I click on edit Sample
Then I delete the sample
When I click on the Persons button from navbar
And I open the last new created person by UI in person directory
Then I click on See Samples for this Person button from Edit Person page
And I select "Active samples" Relevance Status option among the filter options
And I check that number of displayed sample results is 1
And I select "Archived samples" Relevance Status option among the filter options
And I check that number of displayed sample results is 2
And I select "Deleted samples" Relevance Status option among the filter options
And I check that number of displayed sample results is 1
And I select "All active and archived samples" Relevance Status option among the filter options
And I check that number of displayed sample results is 3

0 comments on commit 91093cc

Please sign in to comment.