Skip to content

Commit

Permalink
Improved tests
Browse files Browse the repository at this point in the history
  • Loading branch information
grzesiek2010 committed Apr 23, 2024
1 parent 73b812b commit e66c1e9
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ import org.junit.Rule
import org.junit.Test
import org.junit.rules.RuleChain
import org.junit.runner.RunWith
import org.odk.collect.android.support.StorageUtils
import org.odk.collect.android.support.StorageUtils.getAuditLogForFirstInstance
import org.odk.collect.android.support.pages.FormEntryPage
import org.odk.collect.android.support.pages.FormHierarchyPage
import org.odk.collect.android.support.pages.IdentifyUserPromptPage
import org.odk.collect.android.support.pages.MainMenuPage
import org.odk.collect.android.support.rules.CollectTestRule
import org.odk.collect.android.support.rules.TestRuleChain
import java.io.File
import java.io.IOException

@RunWith(AndroidJUnit4::class)
Expand Down Expand Up @@ -78,13 +80,15 @@ class IdentifyUserTest {
}

@Test
fun openingForm_andPressingBack_returnsToMainMenu() {
fun openingForm_andPressingBack_returnsToMainMenuAndDoesNotLeaveAnEmptyInstanceDir() {
rule.startAtMainMenu()
.copyForm(IDENTIFY_USER_AUDIT_FORM)
.clickFillBlankForm()
.clickOnFormWithIdentityPrompt("Identify User")
.closeSoftKeyboard()
.pressBack(MainMenuPage())

assertThat(File(StorageUtils.getInstancesDirPath()).listFiles().size, equalTo(0))
}

@Test
Expand All @@ -110,12 +114,14 @@ class IdentifyUserTest {
}

@Test
fun openingForm_andPressingCloseCross_returnsToMainMenu() {
fun openingForm_andPressingCloseCross_returnsToMainMenuAndDoesNotLeaveAnEmptyInstanceDir() {
rule.startAtMainMenu()
.copyForm(IDENTIFY_USER_AUDIT_FORM)
.clickFillBlankForm()
.clickOnFormWithIdentityPrompt("Identify User")
.pressClose()

assertThat(File(StorageUtils.getInstancesDirPath()).listFiles().size, equalTo(0))
}

@Test
Expand Down

0 comments on commit e66c1e9

Please sign in to comment.