Skip to content

Commit

Permalink
* HSP-6460 Scenario: Person view has info cards of entities enabled i…
Browse files Browse the repository at this point in the history
…n the system

* HSP-6460 Person view has info cards of entities enabled in the system - initial commit

* HSP-6460 Person view has info cards of entities enabled in the system - initial commit 2
  • Loading branch information
mk-sgent authored Dec 21, 2023
1 parent 64fb33c commit bb5d203
Show file tree
Hide file tree
Showing 11 changed files with 245 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ public class EditCasePage {
public static final By EDIT_FIRST_TASK_BUTTON = By.cssSelector("[location='events'] #edit0");
public static final By NEW_SAMPLE_BUTTON = By.cssSelector("[id='New sample']");
public static final By SEE_SAMPLE_BUTTON = By.cssSelector("[id='See samples for this person']");
public static final By SEE_SAMPLE_BUTTON_DE =
By.cssSelector("[id='Proben f\u00FCr diese Person ansehen']");
public static final By SEE_CONTACTS_FOR_THIS_PERSON_BUTTON =
By.cssSelector("[id='See contacts for this person']");
public static final By NEW_SAMPLE_BUTTON_DE = By.cssSelector("[id='Neue Probe']");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public class EditCasePersonPage {
public static final By FIRST_NAME_INPUT = By.cssSelector("#firstName");
public static final By LAST_NAME_INPUT = By.cssSelector("#lastName");
public static final By NEW_CONTACT_BUTTON = By.xpath("//div[@id='New contact']");
public static final By NEW_CONTACT_BUTTON_DE = By.xpath("//div[@id='Neuer Kontakt']");
public static final By PRESENT_CONDITION_INPUT = By.cssSelector("#presentCondition input");
public static final By SEX_INPUT = By.cssSelector("#sex input");
public static final By SEX_COMBOBOX =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ public class CreateNewEventPage {
public static final By EVENT_IDENTIFICATION_SOURCE_COMBOBOX =
By.xpath(".//div[@id='eventIdentificationSource']//label");
public static final By RISK_LEVEL_COMBOBOX = By.cssSelector(".popupContent #riskLevel div");
public static final By SOURCE_EVENT_WINDOW_FIRST_RESULT_OPTION =
By.xpath("//div[contains(@class, 'v-grid-tablewrapper')]//tbody//tr[1]");
public static final By POPUP_SAVE_BUTTON = By.cssSelector(".popupContent #commit");
public static final By EVENT_MANAGEMENT_STATUS_OPTIONS =
By.cssSelector(".popupContent #eventManagementStatus .v-select-option label");
public static final By START_DATA_INPUT = By.cssSelector(".popupContent #startDate input");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ public class EditPersonPage {
public static final By POPUP_RESPONSIBLE_REGION_COMBOBOX = By.cssSelector("#region div");
public static final By POPUP_RESPONSIBLE_DISTRICT_COMBOBOX = By.cssSelector("#district div");
public static final By PERSON_DATA_SAVED = By.cssSelector(".v-Notification-caption");
public static final By LINK_EVENT_BUTTON = By.xpath("//div[@id='Ereignis verkn\u00FCpfen']");
public static final By PERSON_DATA_ADDED_AS_A_PARTICIPANT_MESSAGE =
By.xpath("//*[contains(text(),'The new event participant was created.')]");
public static final By SEE_EVENTS_FOR_PERSON =
Expand All @@ -109,19 +110,30 @@ public class EditPersonPage {
public static final By ERROR_INDICATOR =
By.cssSelector(".v-errorindicator.v-errorindicator-info");
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");
public static final By SEE_CONTACTS_FOR_PERSON_BUTTON = By.id("See contacts for this person");
public static final By SEE_CONTACTS_FOR_PERSON_BUTTON_DE =
By.id("Kontakte f\u00FCr diese Person ansehen");
public static final By EYE_ICON_EDIT_PERSON =
By.cssSelector("[class*='v-caption-on-top']>[class*='v-popupview']");
public static final By GPS_LATITUDE_INPUT_EDIT_PERSON = By.id("latitude");
public static final By GPS_LONGITUDE_INPUT_EDIT_PERSON = By.id("longitude");
public static final By MAP_CONTAINER_EDIT_PERSON = By.cssSelector("[class*='leaflet-container']");
public static final By EDIT_CASES_BUTTON = By.id("edit-case-0");
public static final By EDIT_CASES_ICON_BUTTON = By.cssSelector("div[id^='edit-case']");
public static final By VIEW_CASES_ICON_BUTTON = By.cssSelector("div[id^='view-case']");
public static final By EDIT_CONTACTS_BUTTON = By.id("edit-contact-0");
public static final By EDIT_CONTACTS_ICON_BUTTON = By.cssSelector("div[id^='edit-contact']");
public static final By VIEW_CONTACTS_ICON_BUTTON = By.cssSelector("div[id^='view-contact']");
public static final By EDIT_PARTICIPANT_ICON_BUTTON =
By.cssSelector("div[id^='edit-participant']");
public static final By CONFIRM_NAVIGATION_BUTTON = By.cssSelector(".popupContent #actionConfirm");
public static final By PERSON_INFORMATION_TITLE =
By.cssSelector("[location='personInformationHeadingLoc']");
public static final By EVENT_PARTICIPANTS_DATA_TAB =
By.cssSelector("#tab-events-eventparticipants");
public static final By NEW_TRAVEL_ENTRY_BUTTON_DE = By.cssSelector("[id='Neue Einreise']");
public static final By NO_TRAVEL_ENTRY_LABEL_DE =
By.xpath("//div[text()=\"Es gibt keine Einreisen f\u00FCr diese Person\"]");
public static final By IMMUNIZATION_ID_LABEL =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,17 @@
import static org.sormas.e2etests.pages.application.cases.EditCasePage.EDIT_REPORT_BUTTON;
import static org.sormas.e2etests.pages.application.cases.EditCasePage.EDIT_SAMPLE_PENCIL_BUTTON;
import static org.sormas.e2etests.pages.application.cases.EditCasePage.EYE_SAMPLE_BUTTON;
import static org.sormas.e2etests.pages.application.cases.EditCasePage.SEE_SAMPLE_BUTTON_DE;
import static org.sormas.e2etests.pages.application.cases.EditCasePage.VACCINATION_CARD_INFO_ICON;
import static org.sormas.e2etests.pages.application.contacts.EditContactPage.EDIT_VACCINATION_BUTTON;
import static org.sormas.e2etests.pages.application.contacts.EditContactPage.NUMBER_OF_TESTS_IN_SAMPLES;
import static org.sormas.e2etests.pages.application.messages.MessagesDirectoryPage.ONE_TEST_IN_SAMPLES_DE;
import static org.sormas.e2etests.pages.application.persons.EditPersonPage.EDIT_CASES_ICON_BUTTON;
import static org.sormas.e2etests.pages.application.persons.EditPersonPage.EDIT_CONTACTS_ICON_BUTTON;
import static org.sormas.e2etests.pages.application.persons.EditPersonPage.EDIT_PARTICIPANT_ICON_BUTTON;
import static org.sormas.e2etests.pages.application.persons.EditPersonPage.NEW_TRAVEL_ENTRY_BUTTON_DE;
import static org.sormas.e2etests.pages.application.persons.EditPersonPage.VIEW_CASES_ICON_BUTTON;
import static org.sormas.e2etests.pages.application.persons.EditPersonPage.VIEW_CONTACTS_ICON_BUTTON;
import static org.sormas.e2etests.pages.application.users.CreateNewUserPage.CLOSE_DIALOG_BUTTON;
import static org.sormas.e2etests.steps.web.application.messages.MessagesDirectorySteps.convertStringToChosenFormatDate;

Expand Down Expand Up @@ -203,7 +212,7 @@ public SideCardsSteps(
});

When(
"I check that number of displayed samples with {string} icon is {int} for sample on Side Card",
"I check that number of displayed samples with {string} icon is {int} for Samples Side Card",
(String icon, Integer number) -> {
switch (icon) {
case "pencil":
Expand All @@ -226,6 +235,114 @@ public SideCardsSteps(
softly.assertAll();
});

When(
"I check if Side card has available {string} button for DE",
(String button) -> {
switch (button) {
case "see sample for this person":
softly.assertTrue(
webDriverHelpers.isElementPresent(SEE_SAMPLE_BUTTON_DE),
"Element is not present");
break;
case "new travel entry":
softly.assertTrue(
webDriverHelpers.isElementPresent(NEW_TRAVEL_ENTRY_BUTTON_DE),
"Element is not present");
break;
}
softly.assertAll();
});

When(
"I check that number of displayed cases with {string} icon is {int} for Cases Side Card",
(String icon, Integer number) -> {
switch (icon) {
case "pencil":
webDriverHelpers.waitUntilIdentifiedElementIsVisibleAndClickable(
EDIT_CASES_ICON_BUTTON, 5);
softly.assertEquals(
webDriverHelpers.getNumberOfElements(EDIT_CASES_ICON_BUTTON),
number.intValue(),
"Number of displayed samples is not valid");
break;
case "eye":
webDriverHelpers.waitUntilIdentifiedElementIsVisibleAndClickable(
VIEW_CASES_ICON_BUTTON, 5);
softly.assertEquals(
webDriverHelpers.getNumberOfElements(VIEW_CASES_ICON_BUTTON),
number.intValue(),
"Number of displayed samples is not valid");
break;
}
softly.assertAll();
});

When(
"I check that number of displayed contacts with {string} icon is {int} for Contacts Side Card",
(String icon, Integer number) -> {
switch (icon) {
case "pencil":
webDriverHelpers.waitUntilIdentifiedElementIsVisibleAndClickable(
EDIT_CONTACTS_ICON_BUTTON, 5);
softly.assertEquals(
webDriverHelpers.getNumberOfElements(EDIT_CONTACTS_ICON_BUTTON),
number.intValue(),
"Number of displayed samples is not valid");
break;
case "eye":
webDriverHelpers.waitUntilIdentifiedElementIsVisibleAndClickable(
VIEW_CONTACTS_ICON_BUTTON, 5);
softly.assertEquals(
webDriverHelpers.getNumberOfElements(VIEW_CONTACTS_ICON_BUTTON),
number.intValue(),
"Number of displayed samples is not valid");
break;
}
softly.assertAll();
});

When(
"I check that number of displayed vaccinations with {string} icon is {int} for Vaccinations Side Card",
(String icon, Integer number) -> {
switch (icon) {
case "pencil":
webDriverHelpers.waitUntilIdentifiedElementIsVisibleAndClickable(
EDIT_VACCINATION_BUTTON, 5);
softly.assertEquals(
webDriverHelpers.getNumberOfElements(EDIT_VACCINATION_BUTTON),
number.intValue(),
"Number of displayed samples is not valid");
break;
case "eye":
webDriverHelpers.waitUntilIdentifiedElementIsVisibleAndClickable(
EYE_SAMPLE_BUTTON, 5);
softly.assertEquals(
webDriverHelpers.getNumberOfElements(VACCINATION_CARD_INFO_ICON),
number.intValue(),
"Number of displayed samples is not valid");
break;
}
softly.assertAll();
});

When(
"I check that number of displayed linked events with {string} icon is {int} for Events Side Card",
(String icon, Integer number) -> {
TimeUnit.SECONDS.sleep(2); // waiting for page loaded
switch (icon) {
case "pencil":
webDriverHelpers.waitUntilIdentifiedElementIsVisibleAndClickable(
EDIT_PARTICIPANT_ICON_BUTTON, 5);
softly.assertEquals(
webDriverHelpers.getNumberOfElements(EDIT_PARTICIPANT_ICON_BUTTON),
number.intValue(),
"Number of displayed samples is not valid");
break;
// place for eye icon option
}
softly.assertAll();
});

Then(
"^I check that the case has no samples on side card for DE$",
() -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,14 @@ public EditCasePersonSteps(
webDriverHelpers.waitForPageLoadingSpinnerToDisappear(40);
});

When(
"I click on New Contact button in Case Person Tab for DE",
() -> {
webDriverHelpers.waitUntilIdentifiedElementIsVisibleAndClickable(NEW_CONTACT_BUTTON_DE);
webDriverHelpers.clickOnWebElementBySelector(NEW_CONTACT_BUTTON_DE);
webDriverHelpers.waitForPageLoadingSpinnerToDisappear(40);
});

When(
"I check if saved Person data is correct",
() -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,13 @@ public CreateNewContactSteps(
webDriverHelpers.fillInWebElement(SOURCE_CASE_WINDOW_CONTACT, casesUUID.get(0));
webDriverHelpers.clickOnWebElementBySelector(SOURCE_CASE_WINDOW_SEARCH_CASE_BUTTON);
});

When(
"^I search for the last created case uuid by UI in the CHOOSE SOURCE Contact window for DE$",
() -> {
webDriverHelpers.fillInWebElement(SOURCE_CASE_WINDOW_CONTACT_DE, casesUUID.get(0));
webDriverHelpers.clickOnWebElementBySelector(SOURCE_CASE_WINDOW_SEARCH_CASE_BUTTON);
});
When(
"^I search for the last case uuid in the CHOOSE SOURCE Contact window for DE$",
() -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,11 @@
import static org.sormas.e2etests.pages.application.events.CreateNewEventPage.MULTI_DAY_EVENT_CHECKBOX;
import static org.sormas.e2etests.pages.application.events.CreateNewEventPage.NEW_EVENT_CREATED_DE_MESSAGE;
import static org.sormas.e2etests.pages.application.events.CreateNewEventPage.NEW_EVENT_CREATED_MESSAGE;
import static org.sormas.e2etests.pages.application.events.CreateNewEventPage.POPUP_SAVE_BUTTON;
import static org.sormas.e2etests.pages.application.events.CreateNewEventPage.REPORT_DATE_INPUT;
import static org.sormas.e2etests.pages.application.events.CreateNewEventPage.RISK_LEVEL_COMBOBOX;
import static org.sormas.e2etests.pages.application.events.CreateNewEventPage.SAVE_BUTTON;
import static org.sormas.e2etests.pages.application.events.CreateNewEventPage.SOURCE_EVENT_WINDOW_FIRST_RESULT_OPTION;
import static org.sormas.e2etests.pages.application.events.CreateNewEventPage.SOURCE_INSTITUTIONAL_PARTNER_COMBOBOX;
import static org.sormas.e2etests.pages.application.events.CreateNewEventPage.SOURCE_TYPE_COMBOBOX;
import static org.sormas.e2etests.pages.application.events.CreateNewEventPage.START_DATA_EVENT;
Expand Down Expand Up @@ -67,6 +69,7 @@
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
import java.util.concurrent.TimeUnit;
import javax.inject.Inject;
import lombok.extern.slf4j.Slf4j;
import org.sormas.e2etests.entities.pojo.web.Event;
Expand Down Expand Up @@ -215,6 +218,23 @@ public CreateNewEventSteps(
webDriverHelpers.clickOnWebElementBySelector(NEW_EVENT_CREATED_MESSAGE);
});

When(
"^I choose the first found result in Pick or create event window$",
() -> {
webDriverHelpers.clickOnWebElementBySelector(SOURCE_EVENT_WINDOW_FIRST_RESULT_OPTION);
webDriverHelpers.waitForRowToBeSelected(SOURCE_EVENT_WINDOW_FIRST_RESULT_OPTION);
webDriverHelpers.waitUntilElementIsVisibleAndClickable(POPUP_SAVE_BUTTON);
webDriverHelpers.clickOnWebElementBySelector(POPUP_SAVE_BUTTON);
});

When(
"^I click on SAVE button in Link Event form from Edit Person page$",
() -> {
TimeUnit.SECONDS.sleep(2); // waiting for page loaded
webDriverHelpers.waitUntilElementIsVisibleAndClickable(POPUP_SAVE_BUTTON);
webDriverHelpers.clickOnWebElementBySelector(POPUP_SAVE_BUTTON);
});

When(
"I check Multi-day event checkbox and I pick Start date and End date on Create New Event Page",
() -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
import static org.sormas.e2etests.pages.application.persons.EditPersonPage.IMMUNIZATION_STATUS_LABEL;
import static org.sormas.e2etests.pages.application.persons.EditPersonPage.INVALID_DATA_ERROR;
import static org.sormas.e2etests.pages.application.persons.EditPersonPage.LAST_NAME_INPUT;
import static org.sormas.e2etests.pages.application.persons.EditPersonPage.LINK_EVENT_BUTTON;
import static org.sormas.e2etests.pages.application.persons.EditPersonPage.MANAGEMENT_STATUS_LABEL;
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;
Expand All @@ -80,7 +81,9 @@
import static org.sormas.e2etests.pages.application.persons.EditPersonPage.REGION_INPUT;
import static org.sormas.e2etests.pages.application.persons.EditPersonPage.SALUTATION_COMBOBOX;
import static org.sormas.e2etests.pages.application.persons.EditPersonPage.SEE_CASES_FOR_PERSON_BUTTON;
import static org.sormas.e2etests.pages.application.persons.EditPersonPage.SEE_CASES_FOR_PERSON_BUTTON_DE;
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.SEX_INPUT;
import static org.sormas.e2etests.pages.application.persons.EditPersonPage.STAFF_OF_ARMED_FORCES_COMBOBOX;
Expand Down Expand Up @@ -343,13 +346,27 @@ public EditPersonSteps(
webDriverHelpers.waitUntilElementIsVisibleAndClickable(SEE_CASES_FOR_PERSON_BUTTON);
});

Then(
"I check that SEE CASES FOR THIS PERSON button appears on Edit Person page for DE",
() -> {
webDriverHelpers.waitForPageLoadingSpinnerToDisappear(150);
webDriverHelpers.waitUntilElementIsVisibleAndClickable(SEE_CASES_FOR_PERSON_BUTTON_DE);
});

Then(
"I check that SEE CONTACTS FOR THIS PERSON button appears on Edit Person page",
() -> {
webDriverHelpers.waitForPageLoadingSpinnerToDisappear(150);
webDriverHelpers.waitUntilElementIsVisibleAndClickable(SEE_CONTACTS_FOR_PERSON_BUTTON);
});

Then(
"I check that SEE CONTACTS FOR THIS PERSON button appears on Edit Person page for DE",
() -> {
webDriverHelpers.waitForPageLoadingSpinnerToDisappear(150);
webDriverHelpers.waitUntilElementIsVisibleAndClickable(SEE_CONTACTS_FOR_PERSON_BUTTON_DE);
});

Then(
"^I Verify The Eye Icon opening the Map is ([^\"]*) in the Edit Person Page",
(String elementStatus) -> {
Expand Down Expand Up @@ -412,6 +429,13 @@ public EditPersonSteps(
previousCreatedPerson = collectedPerson;
});

When(
"^I click Link Event button on Edit Person Page for DE$",
() -> {
webDriverHelpers.waitUntilElementIsVisibleAndClickable(LINK_EVENT_BUTTON);
webDriverHelpers.clickOnWebElementBySelector(LINK_EVENT_BUTTON);
});

When(
"I check if there is no travel entry assigned to Person",
() -> {
Expand Down
Loading

0 comments on commit bb5d203

Please sign in to comment.