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

Allow forms with parse errors to be downloaded, show errors at form open time #6428

Merged
merged 19 commits into from
Oct 1, 2024
Merged
Changes from 1 commit
Commits
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 @@ -192,7 +192,7 @@ class EntityFormTest {
}

@Test
fun manualEntityFormDownload_withUnsupportedSpecVersion_completesSuccessfully() {
fun manualEntityFormDownload_withUnsupportedSpecVersion_completesSuccessfully_butThrowsAnErrorAfterOpeningIt() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need all three of these? I feel like we could maybe use our knowledge of the shared metadata parsing implementation and only test one of the paths given that these tests are so slow to run.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about that and keeping just one test, but since I didn't really favor any option, I decided to add all three. For me, the time required to run these tests has never been a significant issue, as I don’t run them in bulk locally. I always use Firebase and get results in 4-5 minutes. Additionally, we have recently removed many tests from the regression package—see the last part: #6383 so I believe we have fewer tests overall. Generally, I think it’s better to have such tests, even if they take some time to run. However, as I mentioned, I was unsure about keeping or removing them, so I'm fine with keeping just one test if that’s your preference, just let me know.

testDependencies.server.addForm("one-question-entity-registration-v2020.1.xml")

rule.withProject(testDependencies.server)
Expand All @@ -203,23 +203,29 @@ class EntityFormTest {
.clickOK(MainMenuPage())
.clickFillBlankForm()
.clickOnForm("One Question Entity Registration")
.assertTextInDialog(org.odk.collect.strings.R.string.unrecognized_entity_version)
.clickOKOnDialog(MainMenuPage())
}

@Test
fun automaticEntityFormDownload_withUnsupportedSpecVersion_completesSuccessfully() {
fun automaticEntityFormDownload_withUnsupportedSpecVersion_completesSuccessfully_butThrowsAnErrorAfterOpeningIt() {
testDependencies.server.addForm("one-question-entity-registration-v2020.1.xml")

rule.withMatchExactlyProject(testDependencies.server.url)
.clickFillBlankForm()
.clickOnForm("One Question Entity Registration")
.assertTextInDialog(org.odk.collect.strings.R.string.unrecognized_entity_version)
.clickOKOnDialog(MainMenuPage())
}

@Test
fun syncEntityFormFromDisc_withUnsupportedSpecVersion_completesSuccessfully() {
fun syncEntityFormFromDisc_withUnsupportedSpecVersion_completesSuccessfully_butThrowsAnErrorAfterOpeningIt() {
rule.startAtFirstLaunch()
.clickTryCollect()
.copyForm("one-question-entity-registration-v2020.1.xml")
.clickFillBlankForm()
.clickOnForm("One Question Entity Registration")
.assertTextInDialog(org.odk.collect.strings.R.string.unrecognized_entity_version)
.clickOKOnDialog(MainMenuPage())
}
}