increase coverage

This commit is contained in:
Raffaele Mignone 2020-01-23 17:37:02 +01:00
parent 7a40c6f36a
commit 794f80224a
Signed by: norangebit
GPG Key ID: F5255658CB220573
4 changed files with 124 additions and 9 deletions

View File

@ -24,6 +24,10 @@ android {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
debug {
testCoverageEnabled = true
}
}
packagingOptions {
exclude 'META-INF/atomicfu.kotlin_module'

View File

@ -1,13 +1,11 @@
package it.unisannio.ding.ids.wedroid.app.view
import androidx.test.espresso.Espresso.closeSoftKeyboard
import androidx.test.espresso.Espresso.onView
import androidx.test.espresso.action.ViewActions.click
import androidx.test.espresso.action.ViewActions.swipeDown
import androidx.test.espresso.action.ViewActions.swipeLeft
import androidx.test.espresso.action.ViewActions.*
import androidx.test.espresso.assertion.ViewAssertions.matches
import androidx.test.espresso.contrib.RecyclerViewActions
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
import androidx.test.espresso.matcher.ViewMatchers.withId
import androidx.test.espresso.matcher.ViewMatchers.*
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.LargeTest
import androidx.test.rule.ActivityTestRule
@ -24,19 +22,80 @@ class BoardsListsActivityTest {
@get:Rule
val activityRule = ActivityTestRule(BoardsListsActivity::class.java)
fun swipeLeftToDelete() {
@Test
fun openBoard() {
onView(withId(R.id.boardList))
.perform(
RecyclerViewActions.actionOnItemAtPosition<BoardsListAdapter.BoardViewHolder>(
0, swipeLeft()
0, click()
)
)
onView(withId(R.id.getLists))
.check(matches(isDisplayed()))
}
@Test
fun openBoardLists() {
onView(withId(R.id.boardList))
.perform(
RecyclerViewActions.actionOnItemAtPosition<BoardsListAdapter.BoardViewHolder>(
0, click()
)
)
onView(withId(R.id.getLists))
.perform(click())
onView(withId(R.id.synchronize))
.check(matches(isDisplayed()))
}
@Test
fun addNewCard() {
onView(withId(R.id.boardList))
.perform(
RecyclerViewActions.actionOnItemAtPosition<BoardsListAdapter.BoardViewHolder>(
0, click()
)
)
onView(withId(R.id.getLists))
.perform(click())
onView(withId(R.id.buttonAddCard))
.perform(click())
onView(withId(R.id.edittext))
.perform(typeText("card test"))
closeSoftKeyboard()
onView(withText("OK"))
.perform(click())
onView(withId(R.id.synchronize))
.check(matches(isDisplayed()))
}
@Test
fun synchronizeBoard() {
onView(withId(R.id.boardList))
.perform(
RecyclerViewActions.actionOnItemAtPosition<BoardsListAdapter.BoardViewHolder>(
1, click()
)
)
onView(withId(R.id.getLists))
.perform(click())
onView(withId(R.id.synchronize))
.perform(click())
}
@Test
fun pullToRefresh() {
onView(withId(R.id.pullToRefresh))
.perform(swipeDown())
}
@Test
@ -48,5 +107,45 @@ class BoardsListsActivityTest {
.check(matches(isDisplayed()))
}
@Test
fun newPrivateBoard() {
onView(withId(R.id.fab))
.perform(click())
onView(withId(R.id.newBoardName))
.perform(typeText("test private-board"))
closeSoftKeyboard()
onView(withId(R.id.newBoardDone))
.perform(click())
onView(withId(R.id.fab))
.check(matches(isDisplayed()))
}
@Test
fun newPublicBoard() {
onView(withId(R.id.fab))
.perform(click())
onView(withId(R.id.newBoardName))
.perform(typeText("test public-board"))
closeSoftKeyboard()
onView(withId(R.id.newBoardPermission))
.perform(click())
onView(withId(R.id.newBoardDone))
.perform(click())
onView(withId(R.id.fab))
.check(matches(isDisplayed()))
}
@Test
fun cancelNewBoard() {
onView(withId(R.id.fab))
.perform(click())
onView(withId(R.id.newBoardCancel))
.perform()
}
}

View File

@ -84,4 +84,17 @@ class LoginActivityTest {
.inRoot(withDecorView(not(activityRule.activity.window.decorView)))
.check(matches(isDisplayed()))
}
@Test
fun loginWithWrongInstance(){
onView(withId(R.id.instanceServer))
.perform(typeText("https://duckduckgo.com"))
onView(withId(R.id.username))
.perform(typeText("username"))
onView(withId(R.id.password))
.perform(typeText("password"))
closeSoftKeyboard()
onView(withId(R.id.button))
.perform(click())
}
}

View File

@ -32,6 +32,5 @@ class NewBoardActivityTest {
.inRoot(withDecorView(not(activityRule.activity.window.decorView)))
.check(matches(isDisplayed()))
}
}