mirror of
https://github.com/TanelOrumaa/Estonian-ID-card-mobile-authenticator-POC.git
synced 2024-12-22 12:30:16 +02:00
rebase
This commit is contained in:
parent
a61ea0b6cc
commit
5c1f141405
@ -1,18 +1,14 @@
|
||||
package com.tarkvaraprojekt.mobileauthapp
|
||||
|
||||
import androidx.fragment.app.testing.launchFragmentInContainer
|
||||
import androidx.lifecycle.Lifecycle
|
||||
//import androidx.fragment.app.testing.launchFragmentInContainer
|
||||
import androidx.test.espresso.Espresso.onView
|
||||
import androidx.test.espresso.IdlingPolicies
|
||||
import androidx.test.espresso.NoMatchingViewException
|
||||
import androidx.test.espresso.action.ViewActions.*
|
||||
import androidx.test.espresso.assertion.ViewAssertions.matches
|
||||
import androidx.test.espresso.matcher.RootMatchers.*
|
||||
import androidx.test.espresso.matcher.ViewMatchers.*
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import androidx.test.rule.ActivityTestRule
|
||||
import org.hamcrest.CoreMatchers.`is`
|
||||
import org.hamcrest.CoreMatchers.not
|
||||
import org.junit.Assert.*
|
||||
|
||||
import org.junit.*
|
||||
import org.junit.runner.RunWith
|
||||
@ -27,8 +23,8 @@ class UC4Test {
|
||||
|
||||
@Before
|
||||
fun setUp() {
|
||||
IdlingPolicies.setMasterPolicyTimeout(1, TimeUnit.SECONDS)
|
||||
IdlingPolicies.setIdlingResourceTimeout(1, TimeUnit.SECONDS)
|
||||
IdlingPolicies.setMasterPolicyTimeout(3, TimeUnit.SECONDS)
|
||||
IdlingPolicies.setIdlingResourceTimeout(3, TimeUnit.SECONDS)
|
||||
activityActivityTestRule.activity
|
||||
.supportFragmentManager.beginTransaction()
|
||||
}
|
||||
@ -37,14 +33,30 @@ class UC4Test {
|
||||
fun tearDown() {
|
||||
}
|
||||
|
||||
@Test
|
||||
fun test() {
|
||||
fun navigateToCANView() {
|
||||
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())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun validCAN() {
|
||||
navigateToCANView()
|
||||
onView(withText(R.string.can_helper_text)).check(matches(isDisplayed()))
|
||||
onView(supportsInputMethods()).perform(typeText("123456"))
|
||||
onView(withId(R.id.next_button)).perform(click())
|
||||
onView(withText(R.string.can_status_saved)).inRoot(
|
||||
withDecorView(not(`is`(activityActivityTestRule.activity.getWindow().getDecorView())))
|
||||
).check(matches(isDisplayed()))
|
||||
onView(withText(R.string.can_delete)).perform(closeSoftKeyboard())
|
||||
|
||||
onView(withText(R.string.can_status_saved)).check(matches(isDisplayed()))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun invalidCAN() {
|
||||
navigateToCANView()
|
||||
onView(supportsInputMethods()).perform(typeText("12345"))
|
||||
onView(withText(R.string.can_helper_text)).check(matches(isDisplayed()))
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user