-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci(bank-sdk): Introduce new test and resource classes.
- Loading branch information
Showing
9 changed files
with
294 additions
and
89 deletions.
There are no files selected for viewing
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
36 changes: 36 additions & 0 deletions
36
...ndroidTest/java/net/gini/android/bank/sdk/exampleapp/ui/resources/SimpleIdlingResource.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package net.gini.android.bank.sdk.exampleapp.ui.resources | ||
import androidx.test.espresso.IdlingResource | ||
|
||
class SimpleIdlingResource(private val waitTime: Long) : IdlingResource { | ||
|
||
@Volatile | ||
private var isIdleNow = true | ||
private var callback: IdlingResource.ResourceCallback? = null | ||
|
||
override fun getName() = SimpleIdlingResource::class.java.name | ||
|
||
override fun isIdleNow() = isIdleNow | ||
|
||
override fun registerIdleTransitionCallback(callback: IdlingResource.ResourceCallback) { | ||
this.callback = callback | ||
} | ||
|
||
fun setIdleState(isIdleNow: Boolean) { | ||
this.isIdleNow = isIdleNow | ||
if (isIdleNow && callback != null) { | ||
callback!!.onTransitionToIdle() | ||
} | ||
} | ||
|
||
fun waitForIdle() { | ||
isIdleNow = false | ||
Thread { | ||
try { | ||
Thread.sleep(waitTime) | ||
} catch (e: InterruptedException) { | ||
e.printStackTrace() | ||
} | ||
setIdleState(true) | ||
}.start() | ||
} | ||
} |
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
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
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
62 changes: 62 additions & 0 deletions
62
...src/androidTest/java/net/gini/android/bank/sdk/exampleapp/ui/testcases/HelpScreenTests.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package net.gini.android.bank.sdk.exampleapp.ui.testcases | ||
|
||
import android.Manifest | ||
import androidx.test.ext.junit.rules.activityScenarioRule | ||
import androidx.test.rule.GrantPermissionRule | ||
import net.gini.android.bank.sdk.exampleapp.ui.MainActivity | ||
import net.gini.android.bank.sdk.exampleapp.ui.screens.CaptureScreen | ||
import net.gini.android.bank.sdk.exampleapp.ui.screens.HelpScreen | ||
import net.gini.android.bank.sdk.exampleapp.ui.screens.MainScreen | ||
import net.gini.android.bank.sdk.exampleapp.ui.screens.OnboardingScreen | ||
import org.junit.Rule | ||
import org.junit.Test | ||
|
||
/** | ||
* Test class for help screen flow. | ||
* | ||
* Jira link for test case: [https://ginis.atlassian.net/browse/PM-23](https://ginis.atlassian.net/browse/PM-23) | ||
*/ | ||
class HelpScreenTests { | ||
|
||
@get:Rule | ||
val activityRule = activityScenarioRule<MainActivity>() | ||
|
||
@get: Rule | ||
val grantPermissionRule: GrantPermissionRule = | ||
GrantPermissionRule.grant(Manifest.permission.CAMERA) | ||
|
||
private val mainScreen = MainScreen() | ||
private val onboardingScreen = OnboardingScreen() | ||
private val captureScreen = CaptureScreen() | ||
private val helpScreen = HelpScreen() | ||
|
||
@Test | ||
fun test2_verifyHelpItemTipsForBestResult() { | ||
mainScreen.clickPhotoPaymentButton() | ||
onboardingScreen.clickSkipButton() | ||
captureScreen.clickHelpButton() | ||
helpScreen.assertTipsForBestResultsExists() | ||
helpScreen.clickTipsForBestResults() | ||
helpScreen.clickBackButton() | ||
} | ||
|
||
@Test | ||
fun test3_verifyHelpItemSupportedFormats() { | ||
mainScreen.clickPhotoPaymentButton() | ||
onboardingScreen.clickSkipButton() | ||
captureScreen.clickHelpButton() | ||
helpScreen.assertSupportedFormatsExists() | ||
helpScreen.clickSupportedFormats() | ||
helpScreen.clickBackButton() | ||
} | ||
|
||
@Test | ||
fun test4_verifyHelpItemImportDocuments() { | ||
mainScreen.clickPhotoPaymentButton() | ||
onboardingScreen.clickSkipButton() | ||
captureScreen.clickHelpButton() | ||
helpScreen.assertImportDocsExists() | ||
helpScreen.clickImportDocs() | ||
helpScreen.clickBackButton() | ||
} | ||
} |
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
Oops, something went wrong.