Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
hypercubestart committed May 8, 2020
2 parents 644f357 + cfc67ac commit ee35d8a
Show file tree
Hide file tree
Showing 115 changed files with 1,168 additions and 738 deletions.
2 changes: 1 addition & 1 deletion collect_app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ dependencies {
implementation 'androidx.legacy:legacy-support-v13:1.0.0'
implementation 'androidx.browser:browser:1.2.0'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.google.android.material:material:1.1.0-alpha10'
implementation 'com.google.android.material:material:1.1.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.exifinterface:exifinterface:1.1.0'
implementation 'androidx.multidex:multidex:2.0.1'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import org.odk.collect.android.support.ResetStateRule;
import org.odk.collect.android.support.matchers.RecyclerViewMatcher;
import org.odk.collect.android.support.FormLoadingUtils;
import org.odk.collect.android.support.pages.FormHierarchyPage;

import static androidx.test.espresso.Espresso.onView;
import static androidx.test.espresso.assertion.ViewAssertions.matches;
Expand Down Expand Up @@ -63,7 +64,7 @@ public void requestingDeletionOfLastRepeat_deletesLastRepeat() {

@Test
public void requestingDeletionOfFirstRepeatInHierarchy_deletesFirstRepeat() {
FormEntryPage page = new FormEntryPage("repeatGroups", activityTestRule)
FormHierarchyPage page = new FormEntryPage("repeatGroups", activityTestRule)
.clickGoToArrow()
.clickGoUpIcon();

Expand All @@ -81,7 +82,7 @@ public void requestingDeletionOfFirstRepeatInHierarchy_deletesFirstRepeat() {

@Test
public void requestingDeletionOfMiddleRepeatInHierarchy_deletesMiddleRepeat() {
FormEntryPage page = new FormEntryPage("repeatGroups", activityTestRule)
FormHierarchyPage page = new FormEntryPage("repeatGroups", activityTestRule)
.clickGoToArrow()
.clickGoUpIcon();

Expand All @@ -99,7 +100,7 @@ public void requestingDeletionOfMiddleRepeatInHierarchy_deletesMiddleRepeat() {

@Test
public void requestingDeletionOfLastRepeatInHierarchy_deletesLastRepeat() {
FormEntryPage page = new FormEntryPage("repeatGroups", activityTestRule)
FormHierarchyPage page = new FormEntryPage("repeatGroups", activityTestRule)
.clickGoToArrow()
.clickGoUpIcon();

Expand All @@ -123,7 +124,7 @@ public void requestingDeletionOfFirstRepeatWithFieldList_deletesFirstRepeat() {
.clickGoUpIcon()
.clickOnText("repeatGroupFieldList")
.clickOnText("repeatGroupFieldList > 1")
.clickOnText("number1")
.clickOnQuestion("number1")
.deleteGroup("number1")
.assertText("2");
}
Expand All @@ -136,7 +137,7 @@ public void requestingDeletionOfMiddleRepeatWithFieldList_deletesMiddleRepeat()
.clickGoUpIcon()
.clickOnText("repeatGroupFieldList")
.clickOnText("repeatGroupFieldList > 2")
.clickOnText("number1")
.clickOnQuestion("number1")
.deleteGroup("number1")
.assertText("3");
}
Expand All @@ -149,14 +150,14 @@ public void requestingDeletionOfLastRepeatWithFieldList_deletesLastRepeat() {
.clickGoUpIcon()
.clickOnText("repeatGroupFieldList")
.clickOnText("repeatGroupFieldList > 4")
.clickOnText("number1")
.clickOnQuestion("number1")
.deleteGroup("number1")
.checkIsStringDisplayed(R.string.quit_entry);
}

@Test
public void requestingDeletionOfFirstRepeatWithFieldListInHierarchy_deletesFirstRepeat() {
FormEntryPage page = new FormEntryPage("repeatGroups", activityTestRule)
FormHierarchyPage page = new FormEntryPage("repeatGroups", activityTestRule)
.clickGoToArrow()
.clickGoUpIcon()
.clickGoUpIcon()
Expand All @@ -175,7 +176,7 @@ public void requestingDeletionOfFirstRepeatWithFieldListInHierarchy_deletesFirst

@Test
public void requestingDeletionOfMiddleRepeatWithFieldListInHierarchy_deletesMiddleRepeat() {
FormEntryPage page = new FormEntryPage("repeatGroups", activityTestRule)
FormHierarchyPage page = new FormEntryPage("repeatGroups", activityTestRule)
.clickGoToArrow()
.clickGoUpIcon()
.clickGoUpIcon()
Expand All @@ -193,7 +194,7 @@ public void requestingDeletionOfMiddleRepeatWithFieldListInHierarchy_deletesMidd

@Test
public void requestingDeletionOfLastRepeatWithFieldListInHierarchy_deletesLastRepeat() {
FormEntryPage page = new FormEntryPage("repeatGroups", activityTestRule)
FormHierarchyPage page = new FormEntryPage("repeatGroups", activityTestRule)
.clickGoToArrow()
.clickGoUpIcon()
.clickGoUpIcon()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
import org.junit.Test;
import org.junit.rules.RuleChain;
import org.odk.collect.android.R;
import org.odk.collect.android.support.pages.FormEntryPage;
import org.odk.collect.android.support.pages.MainMenuPage;
import org.odk.collect.android.regression.BaseRegressionTest;
import org.odk.collect.android.support.CopyFormRule;
import org.odk.collect.android.support.ResetStateRule;
import org.odk.collect.android.support.matchers.RecyclerViewMatcher;
import org.odk.collect.android.support.pages.FormHierarchyPage;
import org.odk.collect.android.support.pages.MainMenuPage;

import static androidx.test.espresso.Espresso.onView;
import static androidx.test.espresso.assertion.ViewAssertions.matches;
Expand Down Expand Up @@ -53,7 +53,7 @@ public void allRelevantQuestionsShouldBeVisibleInHierarchyView() {
@Test
//https://github.com/opendatakit/collect/issues/2944
public void notRelevantRepeatGroupsShouldNotBeVisibleInHierarchy() {
final FormEntryPage page = new MainMenuPage(rule)
final FormHierarchyPage page = new MainMenuPage(rule)
.startBlankForm("formHierarchy2")
.inputText("2")
.clickGoToArrow();
Expand Down Expand Up @@ -99,7 +99,7 @@ public void notRelevantRepeatGroupsShouldNotBeVisibleInHierarchy() {
@Test
//https://github.com/opendatakit/collect/issues/2936
public void repeatGroupsShouldBeVisibleAsAppropriate() {
FormEntryPage page = new MainMenuPage(rule)
FormHierarchyPage page = new MainMenuPage(rule)
.startBlankForm("formHierarchy3")
.swipeToNextQuestion()
.swipeToNextQuestion()
Expand Down Expand Up @@ -127,7 +127,7 @@ public void repeatGroupsShouldBeVisibleAsAppropriate() {
@Test
//https://github.com/opendatakit/collect/issues/2942
public void deletingLastGroupShouldNotBreakHierarchy() {
FormEntryPage page = new MainMenuPage(rule)
FormHierarchyPage page = new MainMenuPage(rule)
.startBlankForm("formHierarchy3")
.swipeToNextQuestion()
.swipeToNextQuestion()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,7 @@ public void missingFileMessage_shouldBeDisplayedIfExternalFIleIsMissing() {
.clickGoToArrow()
.clickGoUpIcon()
.clickOnElementInHierarchy(14)
.clickOnText("Source15")
.clickOnQuestion("Source15")
.assertText("File: /storage/emulated/0/odk/forms/fieldlist-updates_nocsv-media/fruits.csv is missing.")
.swipeToEndScreen()
.clickSaveAndExit();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public void dynamicGroupLabel_should_beCalculatedProperly() {
.assertText("gr1 > 1 > Person: 25")
.clickGoToArrow()
.assertText("gr1 > 1 > Person: 25")
.clickOnText("Photo")
.clickOnQuestion("Photo")
.swipeToNextQuestion()
.clickOnDoNotAddGroup()
.inputText("SecondPart")
Expand All @@ -90,7 +90,7 @@ public void dynamicGroupLabel_should_beCalculatedProperly() {
.assertText("Part1 > 1 > Xxx: SecondPart")
.clickGoToArrow()
.assertText("Part1 > 1 > Xxx: SecondPart")
.clickOnText("Date")
.clickOnQuestion("Date")
.swipeToNextQuestion()
.swipeToNextQuestion()
.clickOnDoNotAddGroupEndingForm()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public void saveIgnoreDialog_ShouldUseBothOptions() {
.startBlankForm("All widgets")
.clickGoToArrow()
.clickOnText("Image widgets")
.clickOnText("Signature widget")
.clickOnQuestion("Signature widget")
.clickWidgetButton()
.waitForRotationToEnd()
.pressBack(new SaveOrIgnoreDialog<>("Gather Signature", new FormEntryPage("All widgets", rule), rule))
Expand All @@ -69,7 +69,7 @@ public void multiClickOnPlus_ShouldDisplayIcons() {
.startBlankForm("All widgets")
.clickGoToArrow()
.clickOnText("Image widgets")
.clickOnText("Signature widget")
.clickOnQuestion("Signature widget")
.clickWidgetButton()
.waitForRotationToEnd()
.clickOnId(R.id.fab_actions)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,6 @@ public FormEntryPage assertOnPage() {
return this;
}

public FormEndPage clickJumpEndButton() {
onView(withId(R.id.jumpEndButton)).perform(click());
return new FormEndPage(formName, rule).assertOnPage();
}

public FormEntryPage swipeToNextQuestion() {
onView(withId(R.id.questionholder)).perform(swipeLeft());
return this;
Expand All @@ -66,7 +61,7 @@ public FormEndPage swipeToEndScreen() {

public ErrorDialog swipeToNextQuestionWithError() {
onView(withId(R.id.questionholder)).perform(swipeLeft());
return new ErrorDialog(rule);
return new ErrorDialog(rule).assertOnPage();
}

public FormEntryPage clickOptionsIcon() {
Expand Down Expand Up @@ -95,9 +90,9 @@ public FormEntryPage swipeToPreviousQuestion() {
return this;
}

public FormEntryPage clickGoToArrow() {
public FormHierarchyPage clickGoToArrow() {
onView(withId(R.id.menu_goto)).perform(click());
return this;
return new FormHierarchyPage(formName, rule).assertOnPage();
}

public FormEntryPage clickWidgetButton() {
Expand All @@ -122,17 +117,6 @@ public FormEntryPage deleteGroup(String questionText) {
return this;
}

public FormEntryPage deleteGroup() {
onView(withId(R.id.menu_delete_child)).perform(click());
onView(withText(R.string.delete_repeat)).perform(click());
return this;
}

public FormEntryPage clickGoUpIcon() {
onView(withId(R.id.menu_go_up)).perform(click());
return this;
}

public FormEntryPage showSpinnerMultipleDialog() {
onView(withText(getInstrumentation().getTargetContext().getString(R.string.select_answer))).perform(click());
return this;
Expand Down Expand Up @@ -211,7 +195,7 @@ public FormEntryPage checkAreNavigationButtonsNotDisplayed() {

public AddNewRepeatDialog clickPlus(String repeatName) {
onView(withId(R.id.menu_add_repeat)).perform(click());
return new AddNewRepeatDialog(repeatName, rule);
return new AddNewRepeatDialog(repeatName, rule).assertOnPage();
}

public FormEntryPage longPressOnView(int id, int index) {
Expand All @@ -232,6 +216,6 @@ public FormEntryPage removeResponse() {

public AddNewRepeatDialog swipeToNextQuestionWithRepeatGroup(String repeatName) {
onView(withId(R.id.questionholder)).perform(swipeLeft());
return new AddNewRepeatDialog(repeatName, rule);
return new AddNewRepeatDialog(repeatName, rule).assertOnPage();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
package org.odk.collect.android.support.pages;

import androidx.test.rule.ActivityTestRule;

import org.odk.collect.android.R;

import static androidx.test.espresso.Espresso.onView;
import static androidx.test.espresso.action.ViewActions.click;
import static androidx.test.espresso.assertion.ViewAssertions.matches;
import static androidx.test.espresso.matcher.ViewMatchers.isDescendantOfA;
import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed;
import static androidx.test.espresso.matcher.ViewMatchers.withId;
import static androidx.test.espresso.matcher.ViewMatchers.withText;
import static org.hamcrest.Matchers.allOf;

public class FormHierarchyPage extends Page<FormHierarchyPage> {

private final String formName;

public FormHierarchyPage(String formName, ActivityTestRule rule) {
super(rule);
this.formName = formName;
}

@Override
public FormHierarchyPage assertOnPage() {
onView(allOf(withText(formName), isDescendantOfA(withId(R.id.toolbar)))).check(matches(isDisplayed()));
return this;
}

public FormHierarchyPage clickGoUpIcon() {
onView(withId(R.id.menu_go_up)).perform(click());
return this;
}

public FormEntryPage clickPlus(String repeatName) {
onView(withId(R.id.menu_add_repeat)).perform(click());
return new FormEntryPage(formName, rule).assertOnPage();
}

public FormEntryPage clickGoToStart() {
onView(withId(R.id.jumpBeginningButton)).perform(click());
return new FormEntryPage(formName, rule).assertOnPage();
}

public FormHierarchyPage deleteGroup() {
onView(withId(R.id.menu_delete_child)).perform(click());
onView(withText(R.string.delete_repeat)).perform(click());
return this;
}

public FormEndPage clickJumpEndButton() {
onView(withId(R.id.jumpEndButton)).perform(click());
return new FormEndPage(formName, rule).assertOnPage();
}

public FormEntryPage clickOnQuestion(String questionLabel) {
clickOnText(questionLabel);
return new FormEntryPage(formName, rule);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,30 +28,9 @@ public GeneralSettingsPage assertOnPage() {
return this;
}

public GeneralSettingsPage clickOnUserInterface() {
public UserInterfacePage clickOnUserInterface() {
onData(PreferenceMatchers.withKey("user_interface")).perform(click());
return this;
}

public GeneralSettingsPage clickOnLanguage() {
onData(PreferenceMatchers.withKey("app_language")).perform(click());
return this;
}

public GeneralSettingsPage clickOnSelectedLanguage(String language) {
onView(withText(language)).perform(ViewActions.scrollTo());
onView(withText(language)).perform(click());
return this;
}

public GeneralSettingsPage clickNavigation() {
clickOnString(R.string.navigation);
return this;
}

public GeneralSettingsPage clickUseSwipesAndButtons() {
clickOnString(R.string.swipe_buttons_navigation);
return this;
return new UserInterfacePage(rule).assertOnPage();
}

public GeneralSettingsPage openFormManagement() {
Expand Down Expand Up @@ -116,11 +95,6 @@ public GeneralSettingsPage checkIfConstraintProcessingIsDisabled() {
return this;
}

public GeneralSettingsPage clickOnTheme() {
onData(PreferenceMatchers.withKey("appTheme")).perform(click());
return this;
}

public GeneralSettingsPage clickOnAutoSend() {
onData(PreferenceMatchers.withKey("autosend")).perform(click());
return this;
Expand All @@ -136,10 +110,4 @@ public GeneralSettingsPage checkIfServerOptionIsNotDisplayed() {
onView(withText("Server")).check(doesNotExist());
return this;
}

public GeneralSettingsPage clickUseNavigationButtons() {
clickOnString(R.string.buttons_navigation);
return this;
}

}
Loading

0 comments on commit ee35d8a

Please sign in to comment.