Skip to content

Commit

Permalink
Merge pull request #6383 from grzesiek2010/regressionPart4
Browse files Browse the repository at this point in the history
Removed the regression test package [Final part]
  • Loading branch information
seadowg authored Nov 11, 2024
2 parents 90d41ae + 544a712 commit 193dd38
Show file tree
Hide file tree
Showing 22 changed files with 242 additions and 2,174 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,15 @@ class CatchFormDesignExceptionsTest {
.rotateToLandscape(FormEntryPage("g6Error"))
.assertTextDoesNotExist(org.odk.collect.strings.R.string.error_occured)
}

@Test
fun typeMismatchErrorMessage_shouldBeDisplayedWhenItOccurs() {
rule.startAtMainMenu()
.copyForm("validate.xml")
.startBlankForm("validate")
.longPressOnQuestion("year")
.removeResponse()
.swipeToNextQuestionWithError(false)
.checkIsTextDisplayedOnDialog("The value \"-01-01\" can't be converted to a date.")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ public void instanceOfEncryptedForm_cantBeViewedAfterSending() {
.assertOnPage();
}

//TestCase47
@Test
public void instanceOfEncryptedFormWithoutInstanceID_failsFinalizationWithMessage() {
rule.startAtMainMenu()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
* @see <a href="https://getodk.github.io/xforms-spec/#secondary-instances---external">External secondary instances</a>
*/

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

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
package org.odk.collect.android.feature.formentry

import org.junit.Rule
import org.junit.Test
import org.junit.rules.RuleChain
import org.odk.collect.android.storage.StoragePathProvider
import org.odk.collect.android.storage.StorageSubdirectory
import org.odk.collect.android.support.rules.CollectTestRule
import org.odk.collect.android.support.rules.TestRuleChain.chain

/**
* This tests the "External selects" feature of XLSForms. This will often be referred to as "fast
* external itemsets".
*
* @see [External selects](https://xlsform.org/en/.external-selects)
*/
class ExternalSelectsTest {
private var rule: CollectTestRule = CollectTestRule()

@get:Rule
val copyFormChain: RuleChain = chain()
.around(rule)

@Test
fun displaysAllChoicesFromItemsetsCSV() {
rule.startAtMainMenu()
.copyForm("selectOneExternal.xml", listOf("selectOneExternal-media/itemsets.csv"))
.startBlankForm("selectOneExternal")
.clickOnText("Texas")
.swipeToNextQuestion("county")
.assertText("King")
.assertText("Cameron")
}

@Test
fun missingFileMessage_shouldBeDisplayedIfExternalFileWithChoicesIsMissing() {
val formsDirPath = StoragePathProvider().getOdkDirPath(StorageSubdirectory.FORMS)

rule.startAtMainMenu()
.copyForm("select_one_external.xml")
.startBlankForm("cascading select test")
.clickOnText("Texas")
.swipeToNextQuestion("county")
.assertText("File: $formsDirPath/select_one_external-media/itemsets.csv is missing.")
.swipeToNextQuestion("city")
.assertText("File: $formsDirPath/select_one_external-media/itemsets.csv is missing.")
}

@Test
fun missingFileMessage_shouldBeDisplayedIfExternalFileWithChoicesUsedBySearchFunctionIsMissing() {
val formsDirPath = StoragePathProvider().getOdkDirPath(StorageSubdirectory.FORMS)

rule.startAtMainMenu()
.copyForm("search_and_select.xml")
.startBlankForm("search_and_select")
.assertText("File: $formsDirPath/search_and_select-media/nombre.csv is missing.")
.assertText("File: $formsDirPath/search_and_select-media/nombre2.csv is missing.")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -225,4 +225,17 @@ public void hierachyView_shouldNotChangeAfterScreenRotation() {
.rotateToLandscape(new FormHierarchyPage("Repeat Group"))
.checkIfElementInHierarchyMatchesToText("Group Name", 0);
}

@Test
public void theListOfQuestionsShouldBeScrolledToTheLastDisplayedQuestionAfterOpeningTheHierarchy() {
rule.startAtMainMenu()
.copyForm("manyQ.xml")
.startBlankForm("manyQ")
.swipeToNextQuestion("t2")
.swipeToNextQuestion("n1")
.clickGoToArrow()
.assertText("n1")
.assertTextDoesNotExist("t1")
.assertTextDoesNotExist("t2");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,22 @@ import org.junit.Rule
import org.junit.Test
import org.junit.rules.RuleChain
import org.junit.runner.RunWith
import org.odk.collect.android.support.rules.FormEntryActivityTestRule
import org.odk.collect.android.support.rules.CollectTestRule
import org.odk.collect.android.support.rules.TestRuleChain.chain

@RunWith(AndroidJUnit4::class)
class FormMediaTest {

private val rule = FormEntryActivityTestRule()
private val rule = CollectTestRule()

@get:Rule
val ruleChain: RuleChain = chain()
.around(rule)
val ruleChain: RuleChain = chain().around(rule)

@Test
fun loadingFormWithZippedMedia_unzipsIntoMediaDirectory() {
rule.setUpProjectAndCopyForm("external_select_10.xml", listOf("external_data_10.zip"))
.fillNewForm("external_select_10.xml", "external select 10")
rule.startAtMainMenu()
.copyForm("external_select_10.xml", listOf("external_data_10.zip"))
.startBlankForm("external select 10")
.clickOnText("a")
.swipeToNextQuestion("Second")
.assertText("aa")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class FormNavigationTest {
var copyFormChain: RuleChain = TestRuleChain.chain()
.around(rule)

@Test // TestCase14
@Test
fun showsAndHidesButtonsCorrectlyOnEachScreen() {
rule.startAtMainMenu()
.copyForm("two-question.xml")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
package org.odk.collect.android.feature.formentry

import androidx.test.ext.junit.runners.AndroidJUnit4
import org.junit.Rule
import org.junit.Test
import org.junit.rules.RuleChain
import org.junit.runner.RunWith
import org.odk.collect.android.support.rules.CollectTestRule
import org.odk.collect.android.support.rules.TestRuleChain

@RunWith(AndroidJUnit4::class)
class SearchAppearancesTest {
private val rule = CollectTestRule()

@get:Rule
val ruleChain: RuleChain = TestRuleChain.chain().around(rule)

@Test
fun searchFunctionFetchesChoicesForSelectOneFromCSVFile() {
rule.startAtMainMenu()
.copyForm("different-search-appearances.xml", listOf("fruits.csv"))
.startBlankForm("different-search-appearances")
.assertTexts("Mango", "Oranges", "Strawberries")
}

@Test
fun searchAppearanceEnablesFilteringChoicesForSelectOne() {
rule.startAtMainMenu()
.copyForm("different-search-appearances.xml", listOf("fruits.csv"))
.startBlankForm("different-search-appearances")
.clickGoToArrow()
.clickOnQuestion("Static select one with search appearance")
.inputText("w")
.closeSoftKeyboard()
.assertTexts("Wolf", "Warthog")
.assertTextsDoNotExist("Racoon", "Rabbit")
}

@Test
fun autocompleteAppearanceEnablesFilteringChoicesForSelectOne() {
rule.startAtMainMenu()
.copyForm("different-search-appearances.xml", listOf("fruits.csv"))
.startBlankForm("different-search-appearances")
.clickGoToArrow()
.clickOnQuestion("Static select one with autocomplete appearance")
.inputText("r")
.closeSoftKeyboard()
.assertTexts("Warthog", "Raccoon", "Rabbit")
.assertTextDoesNotExist("Wolf")
}

@Test
fun searchFunctionCanBeCombinedWithSearchAppearanceForSelectOne() {
rule.startAtMainMenu()
.copyForm("different-search-appearances.xml", listOf("fruits.csv"))
.startBlankForm("different-search-appearances")
.clickGoToArrow()
.clickOnQuestion("Select one from a CSV using search() appearance/function and search appearance")
.inputText("r")
.closeSoftKeyboard()
.assertTexts("Oranges", "Strawberries")
.assertTextDoesNotExist("Mango")
}

@Test
fun searchFunctionCanBeCombinedWithAutocompleteAppearanceForSelectOne() {
rule.startAtMainMenu()
.copyForm("different-search-appearances.xml", listOf("fruits.csv"))
.startBlankForm("different-search-appearances")
.clickGoToArrow()
.clickOnQuestion("Select one from a CSV using search() appearance/function and autocomplete appearance")
.inputText("n")
.closeSoftKeyboard()
.assertTexts("Mango", "Oranges")
.assertTextDoesNotExist("Strawberries")
}

@Test
fun searchFunctionFetchesChoicesForSelectMultipleFromCSVFile() {
rule.startAtMainMenu()
.copyForm("different-search-appearances.xml", listOf("fruits.csv"))
.startBlankForm("different-search-appearances")
.clickGoToArrow()
.clickOnQuestion("Select multiple from a CSV using search() appearance/function")
.assertTexts("Mango", "Oranges", "Strawberries")
}

@Test
fun searchAppearanceEnablesFilteringChoicesForSelectMultiple() {
rule.startAtMainMenu()
.copyForm("different-search-appearances.xml", listOf("fruits.csv"))
.startBlankForm("different-search-appearances")
.clickGoToArrow()
.clickOnQuestion("Static select multiple with search appearance")
.inputText("w")
.closeSoftKeyboard()
.assertTexts("Wolf", "Warthog")
.assertTextsDoNotExist("Racoon", "Rabbit")
}

@Test
fun autocompleteAppearanceEnablesFilteringChoicesForSelectMultiple() {
rule.startAtMainMenu()
.copyForm("different-search-appearances.xml", listOf("fruits.csv"))
.startBlankForm("different-search-appearances")
.clickGoToArrow()
.clickOnQuestion("Static select multiple with autocomplete appearance")
.inputText("r")
.closeSoftKeyboard()
.assertTexts("Warthog", "Raccoon", "Rabbit")
.assertTextDoesNotExist("Wolf")
}

@Test
fun searchFunctionCanBeCombinedWithSearchAppearanceForSelectMultiple() {
rule.startAtMainMenu()
.copyForm("different-search-appearances.xml", listOf("fruits.csv"))
.startBlankForm("different-search-appearances")
.clickGoToArrow()
.clickOnQuestion("Select multiple from a CSV using search() appearance/function and search appearance")
.inputText("r")
.closeSoftKeyboard()
.assertTexts("Oranges", "Strawberries")
.assertTextDoesNotExist("Mango")
}

@Test
fun searchFunctionCanBeCombinedWithAutocompleteAppearanceForSelectMultiple() {
rule.startAtMainMenu()
.copyForm("different-search-appearances.xml", listOf("fruits.csv"))
.startBlankForm("different-search-appearances")
.clickGoToArrow()
.clickOnQuestion("Select multiple from a CSV using search() appearance/function and autocomplete appearance")
.inputText("n")
.closeSoftKeyboard()
.assertTexts("Mango", "Oranges")
.assertTextDoesNotExist("Strawberries")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class FormMetadataSettingsTest {
.assertTexts("Chino", "664615", "[email protected]", installIDProvider.installID)
}

@Test // Issue number NODK-238 TestCase4 TestCase5
@Test
fun settingServerUsername_usedAsFallbackForMetadataUsername() {
rule.startAtMainMenu()
.copyForm("metadata.xml")
Expand Down
Loading

0 comments on commit 193dd38

Please sign in to comment.