Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Cypress Borg <cborg@codeforamerica.org>
- Loading branch information
Showing
6 changed files
with
119 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
91 changes: 91 additions & 0 deletions
91
src/test/java/org/ilgcc/app/journeys/OptInJourneyTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
package org.ilgcc.app.journeys; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import org.ilgcc.app.utils.AbstractBasePageTest; | ||
import org.junit.jupiter.api.Test; | ||
|
||
public class OptInJourneyTest extends AbstractBasePageTest { | ||
|
||
@Test | ||
void shouldPreselectEmailWhenParentExperiencingHomelessnessClicksContactByEmailWithoutExistingSelectedPreference() { | ||
// Activities Screen | ||
testPage.navigateToFlowScreen("gcc/parent-home-address"); | ||
saveSubmission(getSessionSubmissionTestBuilder().withDayCareProvider() | ||
.withHomelessDetails() | ||
.build()); | ||
|
||
//parent-home-address | ||
assertThat(testPage.getTitle()).isEqualTo("What is your home address?"); | ||
testPage.clickElementById("parentHomeExperiencingHomelessness-yes"); | ||
testPage.clickContinue(); | ||
//parent-no-permanent-address | ||
assertThat(testPage.getTitle()).isEqualTo("Parent"); | ||
testPage.clickLink("Contact me by email instead."); | ||
//parent-comm-preference | ||
assertThat(testPage.getTitle()).isEqualTo("Parent Communications Preference"); | ||
assertThat(testPage.findElementById("parentContactPreferredCommunicationMethod-email").getAttribute("checked")).isEqualTo("true"); | ||
testPage.selectRadio("parentContactPreferredCommunicationMethod", "mail"); | ||
} | ||
@Test | ||
void shouldSetPreferredCommunicationToUserInputAfterUserSelectsAPreferredCommunicationMethod(){ | ||
testPage.navigateToFlowScreen("gcc/parent-home-address"); | ||
saveSubmission(getSessionSubmissionTestBuilder().withDayCareProvider() | ||
.withHomelessDetails() | ||
.build()); | ||
|
||
//parent-home-address | ||
assertThat(testPage.getTitle()).isEqualTo("What is your home address?"); | ||
testPage.clickElementById("parentHomeExperiencingHomelessness-yes"); | ||
testPage.clickContinue(); | ||
//parent-no-permanent-address | ||
assertThat(testPage.getTitle()).isEqualTo("Parent"); | ||
testPage.clickLink("Contact me by email instead."); | ||
//parent-comm-preference | ||
assertThat(testPage.getTitle()).isEqualTo("Parent Communications Preference"); | ||
assertThat(testPage.findElementById("parentContactPreferredCommunicationMethod-email").getAttribute("checked")).isEqualTo("true"); | ||
testPage.clickElementById("parentContactPreferredCommunicationMethod-mail"); | ||
testPage.clickContinue(); | ||
//parent-contact-info | ||
assertThat(testPage.getTitle()).isEqualTo("Parent Contact Info"); | ||
testPage.goBack(); | ||
assertThat(testPage.getTitle()).isEqualTo("Parent Communications Preference"); | ||
assertThat(testPage.findElementById("parentContactPreferredCommunicationMethod-mail").getAttribute("checked")).isEqualTo("true"); | ||
testPage.goBack(); | ||
//parent-no-permanent-address | ||
assertThat(testPage.getTitle()).isEqualTo("Parent"); | ||
testPage.clickLink("Contact me by email instead."); | ||
assertThat(testPage.findElementById("parentContactPreferredCommunicationMethod-mail").getAttribute("checked")).isEqualTo("true"); | ||
|
||
|
||
|
||
} | ||
@Test | ||
void shouldSelectNothingIfAParentExperiencingHomelessnessDoesNotSelectContactByEmail(){ | ||
testPage.navigateToFlowScreen("gcc/parent-home-address"); | ||
saveSubmission(getSessionSubmissionTestBuilder().withDayCareProvider() | ||
.withHomelessDetails() | ||
.build()); | ||
//parent-home-address | ||
assertThat(testPage.getTitle()).isEqualTo("What is your home address?"); | ||
testPage.clickElementById("parentHomeExperiencingHomelessness-yes"); | ||
testPage.clickContinue(); | ||
//parent-no-permanent-address | ||
assertThat(testPage.getTitle()).isEqualTo("Parent"); | ||
testPage.clickLink("I have a place to get mail"); | ||
//parent-mailing-address | ||
assertThat(testPage.getTitle()).isEqualTo("Parent Mailing Address"); | ||
testPage.enter("parentMailingStreetAddress1", "972 Mission St"); | ||
testPage.enter("parentMailingStreetAddress2", "5th floor"); | ||
testPage.enter("parentMailingCity", "San Francisco"); | ||
testPage.selectFromDropdown("parentMailingState", "CA - California"); | ||
testPage.enter("parentMailingZipCode", "94103"); | ||
testPage.clickContinue(); | ||
//parent-confirm-address | ||
assertThat(testPage.getTitle()).isEqualTo("Parent Confirm Address"); | ||
testPage.clickButton("Use this address"); | ||
//parent-comm-preference | ||
assertThat(testPage.getTitle()).isEqualTo("Parent Communications Preference"); | ||
assertThat(testPage.findElementById("parentContactPreferredCommunicationMethod-mail").getAttribute("checked")).isEqualTo(null); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters