Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed the regression test package [Final part] #6383

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
f9f0e66
Moved sortByDialog_ShouldBeTranslatedAndDisplayProperIcons to a separ…
grzesiek2010 Aug 29, 2024
d39df19
Moved question_ShouldBeVisibleOnTheTopOfHierarchy to FormHierarchyTest
grzesiek2010 Aug 29, 2024
ecc8aa9
Removed redundant noDataLost_ShouldRememberAnswersForMultiSelectWidget
grzesiek2010 Aug 29, 2024
aad0ab0
Moved missingFileMessage_shouldBeDisplayedIfExternalFileIsMissing to …
grzesiek2010 Aug 29, 2024
a892f8f
Removed redundant predicateWarning_ShouldBeAbleToFillTheForm
grzesiek2010 Aug 29, 2024
2e3e5de
Removed redundant when_chooseAnswer_should_beVisibleInNextQuestion
grzesiek2010 Aug 29, 2024
9b9ae80
Moved typeMismatchErrorMessage_shouldBeDisplayedWhenItOccurs to a sep…
grzesiek2010 Feb 23, 2024
379db29
Removed redundant questions_shouldHavePrefilledValue
grzesiek2010 Aug 29, 2024
9244e28
Removed redundant answers_shouldBeAutoFilled
grzesiek2010 Aug 29, 2024
3597098
Moved values_ShouldBeRandom to a separate class
grzesiek2010 Feb 23, 2024
fe647b0
Moved searchAppearance_ShouldDisplayWhenSearchAppearanceIsSpecified t…
grzesiek2010 Feb 23, 2024
9fb95a0
Removed redundant answers_ShouldBeSuggestedInComplianceWithSelectedLe…
grzesiek2010 Aug 29, 2024
7980fbb
Removed FillBlankFormTest with its last test
grzesiek2010 Aug 29, 2024
bd98282
Added missing import
grzesiek2010 Feb 23, 2024
5229580
Removed redundant comments
grzesiek2010 Aug 29, 2024
2bc6b3a
Removed redundant BlankFormListTest
grzesiek2010 Nov 6, 2024
12bb50d
Moved typeMismatchErrorMessage_shouldBeDisplayedWhenItOccurs to Catch…
grzesiek2010 Nov 6, 2024
4d4aecb
Moved tests from FormMediaTest to ExternalSelectsTest
grzesiek2010 Nov 6, 2024
232dadc
Converted ExternalSelectsTest to kotlin
grzesiek2010 Nov 6, 2024
cc5c840
Removed redundant FormCalculationsTest
grzesiek2010 Nov 6, 2024
e484e2e
Split the test into smaller ones
grzesiek2010 Nov 8, 2024
544a712
Added missing value
grzesiek2010 Nov 8, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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