Skip to content

Commit 4d4aecb

Browse files
committed
Moved tests from FormMediaTest to ExternalSelectsTest
1 parent 12bb50d commit 4d4aecb

File tree

3 files changed

+27
-643
lines changed

3 files changed

+27
-643
lines changed

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

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
import org.junit.Rule;
44
import org.junit.Test;
55
import org.junit.rules.RuleChain;
6+
import org.odk.collect.android.storage.StoragePathProvider;
7+
import org.odk.collect.android.storage.StorageSubdirectory;
68
import org.odk.collect.android.support.rules.CollectTestRule;
79
import org.odk.collect.android.support.rules.TestRuleChain;
810

@@ -31,4 +33,29 @@ public void displaysAllChoicesFromItemsetsCSV() {
3133
.assertText("King")
3234
.assertText("Cameron");
3335
}
36+
37+
@Test
38+
public void missingFileMessage_shouldBeDisplayedIfExternalFileWithChoicesIsMissing() {
39+
String formsDirPath = new StoragePathProvider().getOdkDirPath(StorageSubdirectory.FORMS);
40+
41+
rule.startAtMainMenu()
42+
.copyForm("select_one_external.xml")
43+
.startBlankForm("cascading select test")
44+
.clickOnText("Texas")
45+
.swipeToNextQuestion("county")
46+
.assertText("File: $formsDirPath/select_one_external-media/itemsets.csv is missing.")
47+
.swipeToNextQuestion("city")
48+
.assertText("File: $formsDirPath/select_one_external-media/itemsets.csv is missing.");
49+
}
50+
51+
@Test
52+
public void missingFileMessage_shouldBeDisplayedIfExternalFileWithChoicesUsedBySearchFunctionIsMissing() {
53+
String formsDirPath = new StoragePathProvider().getOdkDirPath(StorageSubdirectory.FORMS);
54+
55+
rule.startAtMainMenu()
56+
.copyForm("search_and_select.xml")
57+
.startBlankForm("search_and_select")
58+
.assertText("File: $formsDirPath/search_and_select-media/nombre.csv is missing.")
59+
.assertText("File: $formsDirPath/search_and_select-media/nombre2.csv is missing.");
60+
}
3461
}

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

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ 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.storage.StoragePathProvider
9-
import org.odk.collect.android.storage.StorageSubdirectory
108
import org.odk.collect.android.support.rules.CollectTestRule
119
import org.odk.collect.android.support.rules.TestRuleChain.chain
1210

@@ -29,37 +27,4 @@ class FormMediaTest {
2927
.assertText("ab")
3028
.assertText("ac")
3129
}
32-
33-
@Test
34-
fun missingFileMessage_shouldBeDisplayedIfExternalFileIsMissing() {
35-
val formsDirPath = StoragePathProvider().getOdkDirPath(StorageSubdirectory.FORMS)
36-
37-
rule.startAtMainMenu()
38-
.copyForm("search_and_select.xml")
39-
.startBlankForm("search_and_select")
40-
.assertText("File: $formsDirPath/search_and_select-media/nombre.csv is missing.")
41-
.assertText("File: $formsDirPath/search_and_select-media/nombre2.csv is missing.")
42-
.swipeToEndScreen()
43-
.clickFinalize()
44-
45-
.copyForm("select_one_external.xml")
46-
.startBlankForm("cascading select test")
47-
.clickOnText("Texas")
48-
.swipeToNextQuestion("county")
49-
.assertText("File: $formsDirPath/select_one_external-media/itemsets.csv is missing.")
50-
.swipeToNextQuestion("city")
51-
.assertText("File: $formsDirPath/select_one_external-media/itemsets.csv is missing.")
52-
.swipeToEndScreen()
53-
.clickFinalize()
54-
55-
.copyForm("fieldlist-updates_nocsv.xml")
56-
.startBlankForm("fieldlist-updates")
57-
.clickGoToArrow()
58-
.clickGoUpIcon()
59-
.clickOnElementInHierarchy(14)
60-
.clickOnQuestion("Source15")
61-
.assertText("File: $formsDirPath/fieldlist-updates_nocsv-media/fruits.csv is missing.")
62-
.swipeToEndScreen()
63-
.clickFinalize()
64-
}
6530
}

0 commit comments

Comments
 (0)