Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#8558 - Verify that Symptom Page can not be saved if a future date is set for Date of symptom onset #10204

Merged
merged 2 commits into from
Aug 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,6 @@ public class SymptomsTabPage {
public static final By DATE_OF_SYMPTOM_INPUT = By.cssSelector("#onsetDate input");
public static final By CASE_TAB = By.cssSelector("#tab-cases-data span");
public static final By SAVE_BUTTON = By.cssSelector("#commit");
public static final By NOTIFICATION_POPUP_DESCRIPTION =
By.cssSelector(".v-Notification-description");
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
import org.sormas.e2etests.helpers.WebDriverHelpers;
import org.sormas.e2etests.pages.application.NavBarPage;
import org.sormas.e2etests.state.ApiState;
import org.testng.asserts.SoftAssert;

public class SymptomsTabSteps implements En {

Expand All @@ -73,6 +74,7 @@ public SymptomsTabSteps(
WebDriverHelpers webDriverHelpers,
SymptomService symptomService,
ApiState apiState,
SoftAssert softly,
RunningConfiguration runningConfiguration) {
this.webDriverHelpers = webDriverHelpers;
String firstSymptom = "Sore throat/pharyngitis";
Expand Down Expand Up @@ -252,6 +254,25 @@ public SymptomsTabSteps(
LocalDate dateOfSymptom = LocalDate.now().minusDays(7 + numberOfDays);
fillDateOfSymptomDE(dateOfSymptom, Locale.GERMAN);
});

And(
"^I set Date of symptom onset to (\\d+) days into the future",
(Integer numberOfDays) -> {
webDriverHelpers.scrollToElement(DATE_OF_SYMPTOM_INPUT);
LocalDate dateOfSymptom = LocalDate.now().plusDays(numberOfDays);
fillDateOfSymptom(dateOfSymptom);
});

Then(
"I Verify popup message from Symptoms Tab Contains {string}",
(String expectedText) -> {
webDriverHelpers.waitUntilElementIsVisibleAndClickable(NOTIFICATION_POPUP_DESCRIPTION);
softly.assertEquals(
webDriverHelpers.getTextFromPresentWebElement(NOTIFICATION_POPUP_DESCRIPTION),
expectedText,
"Assert on notification popup went wrong");
softly.assertAll();
});
}

private void FillSymptomsData(Symptoms symptoms) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1742,3 +1742,20 @@ Feature: Case end to end tests
Then I create a new case with specific data and Bayern region
And I click on New Task from Case page
And I check that there is only user with Bayern region for task

@8558 @env_main
Scenario: Verify that Page can not be saved if a future date is set for Date of symptom onset
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 symptoms tab
Then I set Fever Symptoms to YES
And I set First Symptom as Fever
And I set Date of symptom onset to 7 days into the future
When I click on save case button in Symptoms tab
Then I Verify popup message from Symptoms Tab Contains "Date of symptom onset cannot be in the future"