mirror of
https://github.com/TanelOrumaa/Estonian-ID-card-mobile-authenticator-POC.git
synced 2024-12-23 04:50:17 +02:00
Add invalidCAN test to UC4 test case and rebase
This commit is contained in:
parent
bf87eb1c07
commit
8d5a55c00e
@ -1,9 +1,9 @@
|
|||||||
package com.tarkvaraprojekt.mobileauthapp
|
package com.tarkvaraprojekt.mobileauthapp
|
||||||
|
|
||||||
import androidx.fragment.app.testing.launchFragmentInContainer
|
import androidx.fragment.app.testing.launchFragmentInContainer
|
||||||
import androidx.lifecycle.Lifecycle
|
|
||||||
import androidx.test.espresso.Espresso.onView
|
import androidx.test.espresso.Espresso.onView
|
||||||
import androidx.test.espresso.IdlingPolicies
|
import androidx.test.espresso.IdlingPolicies
|
||||||
|
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.RootMatchers.*
|
import androidx.test.espresso.matcher.RootMatchers.*
|
||||||
@ -12,7 +12,6 @@ import androidx.test.ext.junit.runners.AndroidJUnit4
|
|||||||
import androidx.test.rule.ActivityTestRule
|
import androidx.test.rule.ActivityTestRule
|
||||||
import org.hamcrest.CoreMatchers.`is`
|
import org.hamcrest.CoreMatchers.`is`
|
||||||
import org.hamcrest.CoreMatchers.not
|
import org.hamcrest.CoreMatchers.not
|
||||||
import org.junit.Assert.*
|
|
||||||
|
|
||||||
import org.junit.*
|
import org.junit.*
|
||||||
import org.junit.runner.RunWith
|
import org.junit.runner.RunWith
|
||||||
@ -27,8 +26,8 @@ class UC4Test {
|
|||||||
|
|
||||||
@Before
|
@Before
|
||||||
fun setUp() {
|
fun setUp() {
|
||||||
IdlingPolicies.setMasterPolicyTimeout(1, TimeUnit.SECONDS)
|
IdlingPolicies.setMasterPolicyTimeout(3, TimeUnit.SECONDS)
|
||||||
IdlingPolicies.setIdlingResourceTimeout(1, TimeUnit.SECONDS)
|
IdlingPolicies.setIdlingResourceTimeout(3, TimeUnit.SECONDS)
|
||||||
activityActivityTestRule.activity
|
activityActivityTestRule.activity
|
||||||
.supportFragmentManager.beginTransaction()
|
.supportFragmentManager.beginTransaction()
|
||||||
}
|
}
|
||||||
@ -37,14 +36,36 @@ class UC4Test {
|
|||||||
fun tearDown() {
|
fun tearDown() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
fun navigateToCANView() {
|
||||||
fun test() {
|
|
||||||
onView(withId(R.id.menu_settings_option)).perform(click())
|
onView(withId(R.id.menu_settings_option)).perform(click())
|
||||||
|
try {
|
||||||
|
// Delete existing CAN
|
||||||
|
onView(withText(R.string.can_delete)).perform(click())
|
||||||
|
} catch (ignore: NoMatchingViewException) {}
|
||||||
|
|
||||||
onView(withId(R.id.can_menu_action)).perform(click())
|
onView(withId(R.id.can_menu_action)).perform(click())
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun validCAN() {
|
||||||
|
navigateToCANView()
|
||||||
onView(supportsInputMethods()).perform(typeText("123456"))
|
onView(supportsInputMethods()).perform(typeText("123456"))
|
||||||
onView(withId(R.id.next_button)).perform(click())
|
onView(withId(R.id.next_button)).perform(click())
|
||||||
|
|
||||||
onView(withText(R.string.can_status_saved)).inRoot(
|
onView(withText(R.string.can_status_saved)).inRoot(
|
||||||
withDecorView(not(`is`(activityActivityTestRule.activity.getWindow().getDecorView())))
|
withDecorView(not(`is`(activityActivityTestRule.activity.getWindow().getDecorView())))
|
||||||
).check(matches(isDisplayed()))
|
).check(matches(isDisplayed()))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun invalidCAN() {
|
||||||
|
navigateToCANView()
|
||||||
|
onView(supportsInputMethods()).perform(typeText("12345"))
|
||||||
|
onView(withId(R.id.next_button)).perform(click())
|
||||||
|
|
||||||
|
onView(withText(R.string.length_can)).inRoot(
|
||||||
|
withDecorView(not(`is`(activityActivityTestRule.activity.getWindow().getDecorView())))
|
||||||
|
).check(matches(isDisplayed()))
|
||||||
|
onView(withId(R.id.next_button)).check(matches(isDisplayed()))
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user