Created
October 24, 2019 08:38
-
-
Save malvinstn/d96e40cd70ac1bb2f41f0402a8a8f3df to your computer and use it in GitHub Desktop.
Sample integration test with FakeAppUpdateManager to validate in app update implementation.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
fun testImmediateUpdate_Completes() { | |
// Setup immediate update. | |
fakeAppUpdateManager.partiallyAllowedUpdateType = AppUpdateType.IMMEDIATE | |
fakeAppUpdateManager.setUpdateAvailable(2) | |
ActivityScenario.launch(MainActivity::class.java) | |
// Validate that immediate update is prompted to the user. | |
assertTrue(fakeAppUpdateManager.isImmediateFlowVisible) | |
// Simulate user's and download behavior. | |
fakeAppUpdateManager.userAcceptsUpdate() | |
fakeAppUpdateManager.downloadStarts() | |
fakeAppUpdateManager.downloadCompletes() | |
// Validate that update is completed and app is restarted. | |
assertTrue(fakeAppUpdateManager.isInstallSplashScreenVisible) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment