Fix config level completion on device
This commit is contained in:
@@ -12,6 +12,7 @@ import androidx.test.core.app.ActivityScenario
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import androidx.test.platform.app.InstrumentationRegistry
|
||||
import java.io.File
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
@@ -48,10 +49,27 @@ class GitRepositoryRuntimeInstrumentedTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun configLevelCompletesThroughUiWithArbitraryValues() {
|
||||
launchFreshApp().use {
|
||||
submitTerminalCommand("git init")
|
||||
waitForExercise(configLevel())
|
||||
|
||||
submitTerminalCommand("git config user.name githug")
|
||||
submitTerminalCommand("git config user.email xxx@yy.com")
|
||||
|
||||
waitForLevelCompletion(nextLevel = addLevel())
|
||||
}
|
||||
}
|
||||
|
||||
private fun launchFreshApp(): ActivityScenario<MainActivity> {
|
||||
val context = InstrumentationRegistry.getInstrumentation().targetContext
|
||||
File(context.applicationInfo.dataDir, "files").deleteRecursively()
|
||||
File(context.filesDir, "githug-sandboxes").deleteRecursively()
|
||||
File(context.applicationInfo.dataDir, "cache").deleteRecursively()
|
||||
runBlocking {
|
||||
GameProgressStore(context.applicationContext).saveProgress(emptySet(), activeLevelId = null)
|
||||
GameProgressStore(context.applicationContext).saveShowHelpOnStart(showHelpOnStart = true)
|
||||
}
|
||||
val scenario = ActivityScenario.launch(MainActivity::class.java)
|
||||
waitForExercise(initLevel())
|
||||
return scenario
|
||||
|
||||
Reference in New Issue
Block a user