mirror of
https://github.com/TanelOrumaa/Estonian-ID-card-mobile-authenticator-POC.git
synced 2024-12-22 04:20:16 +02:00
Added UC12Test
This commit is contained in:
parent
fc3161be51
commit
6bb9638418
@ -0,0 +1,30 @@
|
|||||||
|
package com.tarkvaraprojekt.mobileauthapp
|
||||||
|
|
||||||
|
//import androidx.fragment.app.testing.launchFragmentInContainer
|
||||||
|
import androidx.test.espresso.IdlingPolicies
|
||||||
|
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||||
|
import androidx.test.rule.ActivityTestRule
|
||||||
|
|
||||||
|
import org.junit.*
|
||||||
|
import org.junit.runner.RunWith
|
||||||
|
import java.util.concurrent.TimeUnit
|
||||||
|
|
||||||
|
@RunWith(AndroidJUnit4::class)
|
||||||
|
open class BaseUCTest {
|
||||||
|
@get:Rule
|
||||||
|
var activityActivityTestRule: ActivityTestRule<MainActivity> = ActivityTestRule(
|
||||||
|
MainActivity::class.java
|
||||||
|
)
|
||||||
|
|
||||||
|
@Before
|
||||||
|
fun setUp() {
|
||||||
|
IdlingPolicies.setMasterPolicyTimeout(3, TimeUnit.SECONDS)
|
||||||
|
IdlingPolicies.setIdlingResourceTimeout(3, TimeUnit.SECONDS)
|
||||||
|
activityActivityTestRule.activity
|
||||||
|
.supportFragmentManager.beginTransaction()
|
||||||
|
}
|
||||||
|
|
||||||
|
@After
|
||||||
|
fun tearDown() {
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,50 @@
|
|||||||
|
package com.tarkvaraprojekt.mobileauthapp
|
||||||
|
|
||||||
|
import androidx.test.espresso.Espresso.onView
|
||||||
|
import androidx.test.espresso.NoMatchingViewException
|
||||||
|
import androidx.test.espresso.action.ViewActions.*
|
||||||
|
import androidx.test.espresso.assertion.ViewAssertions.matches
|
||||||
|
import androidx.test.espresso.matcher.ViewMatchers.*
|
||||||
|
|
||||||
|
import org.junit.*
|
||||||
|
|
||||||
|
class UC12Test : BaseUCTest() {
|
||||||
|
|
||||||
|
private fun navigateToPINView() {
|
||||||
|
onView(withId(R.id.menu_settings_option)).perform(click())
|
||||||
|
try {
|
||||||
|
// Delete existing PIN
|
||||||
|
onView(withText(R.string.pin1_delete)).perform(click())
|
||||||
|
} catch (ignore: NoMatchingViewException) {}
|
||||||
|
|
||||||
|
onView(withId(R.id.pin_menu_action)).perform(click())
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun validPIN() {
|
||||||
|
navigateToPINView()
|
||||||
|
onView(withText(R.string.pin_helper_text)).check(matches(isDisplayed()))
|
||||||
|
onView(supportsInputMethods()).perform(typeText("0000"))
|
||||||
|
onView(withText(R.string.continue_button)).perform(click())
|
||||||
|
|
||||||
|
onView(withText(R.string.pin_status_saved)).check(matches(isDisplayed()))
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun tooShortPIN() {
|
||||||
|
navigateToPINView()
|
||||||
|
onView(supportsInputMethods()).perform(typeText("000"))
|
||||||
|
onView(withText(R.string.continue_button)).perform(click())
|
||||||
|
|
||||||
|
onView(withText(R.string.pin_helper_text)).check(matches(isDisplayed()))
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun tooLongPIN() {
|
||||||
|
navigateToPINView()
|
||||||
|
onView(supportsInputMethods()).perform(typeText("0".repeat(13)))
|
||||||
|
onView(withText(R.string.continue_button)).perform(click())
|
||||||
|
|
||||||
|
onView(withText(R.string.pin_helper_text)).check(matches(isDisplayed()))
|
||||||
|
}
|
||||||
|
}
|
@ -1,39 +1,16 @@
|
|||||||
package com.tarkvaraprojekt.mobileauthapp
|
package com.tarkvaraprojekt.mobileauthapp
|
||||||
|
|
||||||
//import androidx.fragment.app.testing.launchFragmentInContainer
|
|
||||||
import androidx.test.espresso.Espresso.onView
|
import androidx.test.espresso.Espresso.onView
|
||||||
import androidx.test.espresso.IdlingPolicies
|
|
||||||
import androidx.test.espresso.NoMatchingViewException
|
import androidx.test.espresso.NoMatchingViewException
|
||||||
import androidx.test.espresso.action.ViewActions.*
|
import androidx.test.espresso.action.ViewActions.*
|
||||||
import androidx.test.espresso.assertion.ViewAssertions.matches
|
import androidx.test.espresso.assertion.ViewAssertions.matches
|
||||||
import androidx.test.espresso.matcher.ViewMatchers.*
|
import androidx.test.espresso.matcher.ViewMatchers.*
|
||||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
|
||||||
import androidx.test.rule.ActivityTestRule
|
|
||||||
|
|
||||||
import org.junit.*
|
import org.junit.*
|
||||||
import org.junit.runner.RunWith
|
|
||||||
import java.util.concurrent.TimeUnit
|
|
||||||
|
|
||||||
@RunWith(AndroidJUnit4::class)
|
class UC4Test : BaseUCTest() {
|
||||||
class UC4Test {
|
|
||||||
@get:Rule
|
|
||||||
var activityActivityTestRule: ActivityTestRule<MainActivity> = ActivityTestRule(
|
|
||||||
MainActivity::class.java
|
|
||||||
)
|
|
||||||
|
|
||||||
@Before
|
private fun navigateToCANView() {
|
||||||
fun setUp() {
|
|
||||||
IdlingPolicies.setMasterPolicyTimeout(3, TimeUnit.SECONDS)
|
|
||||||
IdlingPolicies.setIdlingResourceTimeout(3, TimeUnit.SECONDS)
|
|
||||||
activityActivityTestRule.activity
|
|
||||||
.supportFragmentManager.beginTransaction()
|
|
||||||
}
|
|
||||||
|
|
||||||
@After
|
|
||||||
fun tearDown() {
|
|
||||||
}
|
|
||||||
|
|
||||||
fun navigateToCANView() {
|
|
||||||
onView(withId(R.id.menu_settings_option)).perform(click())
|
onView(withId(R.id.menu_settings_option)).perform(click())
|
||||||
try {
|
try {
|
||||||
// Delete existing CAN
|
// Delete existing CAN
|
||||||
|
Loading…
Reference in New Issue
Block a user