mirror of
https://github.com/TanelOrumaa/Estonian-ID-card-mobile-authenticator-POC.git
synced 2025-08-30 07:10:59 +03:00
Compare commits
2 Commits
iteration4
...
Tests
Author | SHA1 | Date | |
---|---|---|---|
|
6bb9638418 | ||
|
fc3161be51 |
@@ -44,7 +44,9 @@ dependencies {
|
|||||||
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
||||||
testImplementation 'junit:junit:4.+'
|
testImplementation 'junit:junit:4.+'
|
||||||
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
|
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
|
||||||
|
androidTestImplementation 'androidx.test:rules:1.2.0'
|
||||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
|
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
|
||||||
|
debugImplementation 'androidx.fragment:fragment-testing:1.4.0'
|
||||||
|
|
||||||
//To use activityViewModels
|
//To use activityViewModels
|
||||||
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||||
|
@@ -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()))
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,39 @@
|
|||||||
|
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 UC4Test : BaseUCTest() {
|
||||||
|
|
||||||
|
private 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(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()))
|
||||||
|
}
|
||||||
|
}
|
@@ -1 +0,0 @@
|
|||||||
#app{font-family:Avenir,Helvetica,Arial,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-align:center;color:#2c3e50}#nav{padding:30px}#nav a{font-weight:700;color:#2c3e50}#nav a.router-link-exact-active{color:#42b983}.container>div[data-v-2dcb24ca]{margin-top:2vh}.loginButton[data-v-2dcb24ca]{height:4vh;width:20vh;line-height:3vh}.loginButton>p[data-v-2dcb24ca]{font-size:3vh;text-align:center}#canvas[data-v-2dcb24ca]{height:30vh;width:30vh}nav[data-v-21165a6a]{height:5vh}div[data-v-cd8fea1a]{margin-top:2vh}
|
|
File diff suppressed because one or more lines are too long
BIN
demoBackend/src/demo-website/dist/favicon.ico
vendored
BIN
demoBackend/src/demo-website/dist/favicon.ico
vendored
Binary file not shown.
Before Width: | Height: | Size: 4.2 KiB |
1
demoBackend/src/demo-website/dist/index.html
vendored
1
demoBackend/src/demo-website/dist/index.html
vendored
@@ -1 +0,0 @@
|
|||||||
<!DOCTYPE html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="/favicon.ico"><title>demo-website</title><link href="/css/app.eb039c1f.css" rel="preload" as="style"><link href="/css/chunk-vendors.a251e031.css" rel="preload" as="style"><link href="/js/app.c2a68e49.js" rel="preload" as="script"><link href="/js/chunk-vendors.22b03028.js" rel="preload" as="script"><link href="/css/chunk-vendors.a251e031.css" rel="stylesheet"><link href="/css/app.eb039c1f.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but demo-website doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="/js/chunk-vendors.22b03028.js"></script><script src="/js/app.c2a68e49.js"></script></body></html>
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user