Skip to content

Commit 193dd38

Browse files
authored
Merge pull request getodk#6383 from grzesiek2010/regressionPart4
Removed the regression test package [Final part]
2 parents 90d41ae + 544a712 commit 193dd38

22 files changed

+242
-2174
lines changed

collect_app/src/androidTest/java/org/odk/collect/android/feature/formentry/CatchFormDesignExceptionsTest.kt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,15 @@ class CatchFormDesignExceptionsTest {
5656
.rotateToLandscape(FormEntryPage("g6Error"))
5757
.assertTextDoesNotExist(org.odk.collect.strings.R.string.error_occured)
5858
}
59+
60+
@Test
61+
fun typeMismatchErrorMessage_shouldBeDisplayedWhenItOccurs() {
62+
rule.startAtMainMenu()
63+
.copyForm("validate.xml")
64+
.startBlankForm("validate")
65+
.longPressOnQuestion("year")
66+
.removeResponse()
67+
.swipeToNextQuestionWithError(false)
68+
.checkIsTextDisplayedOnDialog("The value \"-01-01\" can't be converted to a date.")
69+
}
5970
}

collect_app/src/androidTest/java/org/odk/collect/android/feature/formentry/EncryptedFormTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ public void instanceOfEncryptedForm_cantBeViewedAfterSending() {
7575
.assertOnPage();
7676
}
7777

78-
//TestCase47
7978
@Test
8079
public void instanceOfEncryptedFormWithoutInstanceID_failsFinalizationWithMessage() {
8180
rule.startAtMainMenu()

collect_app/src/androidTest/java/org/odk/collect/android/feature/formentry/ExternalSecondaryInstanceTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
* @see <a href="https://getodk.github.io/xforms-spec/#secondary-instances---external">External secondary instances</a>
2121
*/
2222

23-
// Issue number NODK-377
2423
@RunWith(AndroidJUnit4.class)
2524
public class ExternalSecondaryInstanceTest {
2625

collect_app/src/androidTest/java/org/odk/collect/android/feature/formentry/ExternalSelectsTest.java

Lines changed: 0 additions & 34 deletions
This file was deleted.
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
package org.odk.collect.android.feature.formentry
2+
3+
import org.junit.Rule
4+
import org.junit.Test
5+
import org.junit.rules.RuleChain
6+
import org.odk.collect.android.storage.StoragePathProvider
7+
import org.odk.collect.android.storage.StorageSubdirectory
8+
import org.odk.collect.android.support.rules.CollectTestRule
9+
import org.odk.collect.android.support.rules.TestRuleChain.chain
10+
11+
/**
12+
* This tests the "External selects" feature of XLSForms. This will often be referred to as "fast
13+
* external itemsets".
14+
*
15+
* @see [External selects](https://xlsform.org/en/.external-selects)
16+
*/
17+
class ExternalSelectsTest {
18+
private var rule: CollectTestRule = CollectTestRule()
19+
20+
@get:Rule
21+
val copyFormChain: RuleChain = chain()
22+
.around(rule)
23+
24+
@Test
25+
fun displaysAllChoicesFromItemsetsCSV() {
26+
rule.startAtMainMenu()
27+
.copyForm("selectOneExternal.xml", listOf("selectOneExternal-media/itemsets.csv"))
28+
.startBlankForm("selectOneExternal")
29+
.clickOnText("Texas")
30+
.swipeToNextQuestion("county")
31+
.assertText("King")
32+
.assertText("Cameron")
33+
}
34+
35+
@Test
36+
fun missingFileMessage_shouldBeDisplayedIfExternalFileWithChoicesIsMissing() {
37+
val formsDirPath = StoragePathProvider().getOdkDirPath(StorageSubdirectory.FORMS)
38+
39+
rule.startAtMainMenu()
40+
.copyForm("select_one_external.xml")
41+
.startBlankForm("cascading select test")
42+
.clickOnText("Texas")
43+
.swipeToNextQuestion("county")
44+
.assertText("File: $formsDirPath/select_one_external-media/itemsets.csv is missing.")
45+
.swipeToNextQuestion("city")
46+
.assertText("File: $formsDirPath/select_one_external-media/itemsets.csv is missing.")
47+
}
48+
49+
@Test
50+
fun missingFileMessage_shouldBeDisplayedIfExternalFileWithChoicesUsedBySearchFunctionIsMissing() {
51+
val formsDirPath = StoragePathProvider().getOdkDirPath(StorageSubdirectory.FORMS)
52+
53+
rule.startAtMainMenu()
54+
.copyForm("search_and_select.xml")
55+
.startBlankForm("search_and_select")
56+
.assertText("File: $formsDirPath/search_and_select-media/nombre.csv is missing.")
57+
.assertText("File: $formsDirPath/search_and_select-media/nombre2.csv is missing.")
58+
}
59+
}

collect_app/src/androidTest/java/org/odk/collect/android/feature/formentry/FormHierarchyTest.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,4 +225,17 @@ public void hierachyView_shouldNotChangeAfterScreenRotation() {
225225
.rotateToLandscape(new FormHierarchyPage("Repeat Group"))
226226
.checkIfElementInHierarchyMatchesToText("Group Name", 0);
227227
}
228+
229+
@Test
230+
public void theListOfQuestionsShouldBeScrolledToTheLastDisplayedQuestionAfterOpeningTheHierarchy() {
231+
rule.startAtMainMenu()
232+
.copyForm("manyQ.xml")
233+
.startBlankForm("manyQ")
234+
.swipeToNextQuestion("t2")
235+
.swipeToNextQuestion("n1")
236+
.clickGoToArrow()
237+
.assertText("n1")
238+
.assertTextDoesNotExist("t1")
239+
.assertTextDoesNotExist("t2");
240+
}
228241
}

collect_app/src/androidTest/java/org/odk/collect/android/feature/formentry/FormMediaTest.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,22 @@ import org.junit.Rule
55
import org.junit.Test
66
import org.junit.rules.RuleChain
77
import org.junit.runner.RunWith
8-
import org.odk.collect.android.support.rules.FormEntryActivityTestRule
8+
import org.odk.collect.android.support.rules.CollectTestRule
99
import org.odk.collect.android.support.rules.TestRuleChain.chain
1010

1111
@RunWith(AndroidJUnit4::class)
1212
class FormMediaTest {
1313

14-
private val rule = FormEntryActivityTestRule()
14+
private val rule = CollectTestRule()
1515

1616
@get:Rule
17-
val ruleChain: RuleChain = chain()
18-
.around(rule)
17+
val ruleChain: RuleChain = chain().around(rule)
1918

2019
@Test
2120
fun loadingFormWithZippedMedia_unzipsIntoMediaDirectory() {
22-
rule.setUpProjectAndCopyForm("external_select_10.xml", listOf("external_data_10.zip"))
23-
.fillNewForm("external_select_10.xml", "external select 10")
21+
rule.startAtMainMenu()
22+
.copyForm("external_select_10.xml", listOf("external_data_10.zip"))
23+
.startBlankForm("external select 10")
2424
.clickOnText("a")
2525
.swipeToNextQuestion("Second")
2626
.assertText("aa")

collect_app/src/androidTest/java/org/odk/collect/android/feature/formentry/FormNavigationTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class FormNavigationTest {
3232
var copyFormChain: RuleChain = TestRuleChain.chain()
3333
.around(rule)
3434

35-
@Test // TestCase14
35+
@Test
3636
fun showsAndHidesButtonsCorrectlyOnEachScreen() {
3737
rule.startAtMainMenu()
3838
.copyForm("two-question.xml")
Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
package org.odk.collect.android.feature.formentry
2+
3+
import androidx.test.ext.junit.runners.AndroidJUnit4
4+
import org.junit.Rule
5+
import org.junit.Test
6+
import org.junit.rules.RuleChain
7+
import org.junit.runner.RunWith
8+
import org.odk.collect.android.support.rules.CollectTestRule
9+
import org.odk.collect.android.support.rules.TestRuleChain
10+
11+
@RunWith(AndroidJUnit4::class)
12+
class SearchAppearancesTest {
13+
private val rule = CollectTestRule()
14+
15+
@get:Rule
16+
val ruleChain: RuleChain = TestRuleChain.chain().around(rule)
17+
18+
@Test
19+
fun searchFunctionFetchesChoicesForSelectOneFromCSVFile() {
20+
rule.startAtMainMenu()
21+
.copyForm("different-search-appearances.xml", listOf("fruits.csv"))
22+
.startBlankForm("different-search-appearances")
23+
.assertTexts("Mango", "Oranges", "Strawberries")
24+
}
25+
26+
@Test
27+
fun searchAppearanceEnablesFilteringChoicesForSelectOne() {
28+
rule.startAtMainMenu()
29+
.copyForm("different-search-appearances.xml", listOf("fruits.csv"))
30+
.startBlankForm("different-search-appearances")
31+
.clickGoToArrow()
32+
.clickOnQuestion("Static select one with search appearance")
33+
.inputText("w")
34+
.closeSoftKeyboard()
35+
.assertTexts("Wolf", "Warthog")
36+
.assertTextsDoNotExist("Racoon", "Rabbit")
37+
}
38+
39+
@Test
40+
fun autocompleteAppearanceEnablesFilteringChoicesForSelectOne() {
41+
rule.startAtMainMenu()
42+
.copyForm("different-search-appearances.xml", listOf("fruits.csv"))
43+
.startBlankForm("different-search-appearances")
44+
.clickGoToArrow()
45+
.clickOnQuestion("Static select one with autocomplete appearance")
46+
.inputText("r")
47+
.closeSoftKeyboard()
48+
.assertTexts("Warthog", "Raccoon", "Rabbit")
49+
.assertTextDoesNotExist("Wolf")
50+
}
51+
52+
@Test
53+
fun searchFunctionCanBeCombinedWithSearchAppearanceForSelectOne() {
54+
rule.startAtMainMenu()
55+
.copyForm("different-search-appearances.xml", listOf("fruits.csv"))
56+
.startBlankForm("different-search-appearances")
57+
.clickGoToArrow()
58+
.clickOnQuestion("Select one from a CSV using search() appearance/function and search appearance")
59+
.inputText("r")
60+
.closeSoftKeyboard()
61+
.assertTexts("Oranges", "Strawberries")
62+
.assertTextDoesNotExist("Mango")
63+
}
64+
65+
@Test
66+
fun searchFunctionCanBeCombinedWithAutocompleteAppearanceForSelectOne() {
67+
rule.startAtMainMenu()
68+
.copyForm("different-search-appearances.xml", listOf("fruits.csv"))
69+
.startBlankForm("different-search-appearances")
70+
.clickGoToArrow()
71+
.clickOnQuestion("Select one from a CSV using search() appearance/function and autocomplete appearance")
72+
.inputText("n")
73+
.closeSoftKeyboard()
74+
.assertTexts("Mango", "Oranges")
75+
.assertTextDoesNotExist("Strawberries")
76+
}
77+
78+
@Test
79+
fun searchFunctionFetchesChoicesForSelectMultipleFromCSVFile() {
80+
rule.startAtMainMenu()
81+
.copyForm("different-search-appearances.xml", listOf("fruits.csv"))
82+
.startBlankForm("different-search-appearances")
83+
.clickGoToArrow()
84+
.clickOnQuestion("Select multiple from a CSV using search() appearance/function")
85+
.assertTexts("Mango", "Oranges", "Strawberries")
86+
}
87+
88+
@Test
89+
fun searchAppearanceEnablesFilteringChoicesForSelectMultiple() {
90+
rule.startAtMainMenu()
91+
.copyForm("different-search-appearances.xml", listOf("fruits.csv"))
92+
.startBlankForm("different-search-appearances")
93+
.clickGoToArrow()
94+
.clickOnQuestion("Static select multiple with search appearance")
95+
.inputText("w")
96+
.closeSoftKeyboard()
97+
.assertTexts("Wolf", "Warthog")
98+
.assertTextsDoNotExist("Racoon", "Rabbit")
99+
}
100+
101+
@Test
102+
fun autocompleteAppearanceEnablesFilteringChoicesForSelectMultiple() {
103+
rule.startAtMainMenu()
104+
.copyForm("different-search-appearances.xml", listOf("fruits.csv"))
105+
.startBlankForm("different-search-appearances")
106+
.clickGoToArrow()
107+
.clickOnQuestion("Static select multiple with autocomplete appearance")
108+
.inputText("r")
109+
.closeSoftKeyboard()
110+
.assertTexts("Warthog", "Raccoon", "Rabbit")
111+
.assertTextDoesNotExist("Wolf")
112+
}
113+
114+
@Test
115+
fun searchFunctionCanBeCombinedWithSearchAppearanceForSelectMultiple() {
116+
rule.startAtMainMenu()
117+
.copyForm("different-search-appearances.xml", listOf("fruits.csv"))
118+
.startBlankForm("different-search-appearances")
119+
.clickGoToArrow()
120+
.clickOnQuestion("Select multiple from a CSV using search() appearance/function and search appearance")
121+
.inputText("r")
122+
.closeSoftKeyboard()
123+
.assertTexts("Oranges", "Strawberries")
124+
.assertTextDoesNotExist("Mango")
125+
}
126+
127+
@Test
128+
fun searchFunctionCanBeCombinedWithAutocompleteAppearanceForSelectMultiple() {
129+
rule.startAtMainMenu()
130+
.copyForm("different-search-appearances.xml", listOf("fruits.csv"))
131+
.startBlankForm("different-search-appearances")
132+
.clickGoToArrow()
133+
.clickOnQuestion("Select multiple from a CSV using search() appearance/function and autocomplete appearance")
134+
.inputText("n")
135+
.closeSoftKeyboard()
136+
.assertTexts("Mango", "Oranges")
137+
.assertTextDoesNotExist("Strawberries")
138+
}
139+
}

collect_app/src/androidTest/java/org/odk/collect/android/feature/settings/FormMetadataSettingsTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ class FormMetadataSettingsTest {
8585
.assertTexts("Chino", "664615", "[email protected]", installIDProvider.installID)
8686
}
8787

88-
@Test // Issue number NODK-238 TestCase4 TestCase5
88+
@Test
8989
fun settingServerUsername_usedAsFallbackForMetadataUsername() {
9090
rule.startAtMainMenu()
9191
.copyForm("metadata.xml")

0 commit comments

Comments
 (0)