53 lines
1.5 KiB
Kotlin
53 lines
1.5 KiB
Kotlin
package it.unisannio.ding.ids.wedroid.app.view
|
|
|
|
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.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.ext.junit.runners.AndroidJUnit4
|
|
import androidx.test.filters.LargeTest
|
|
import androidx.test.rule.ActivityTestRule
|
|
import it.unisannio.ding.ids.wedroid.app.R
|
|
import it.unisannio.ding.ids.wedroid.app.view.adapter.BoardsListAdapter
|
|
import org.junit.Rule
|
|
import org.junit.Test
|
|
import org.junit.runner.RunWith
|
|
|
|
@RunWith(AndroidJUnit4::class)
|
|
@LargeTest
|
|
class BoardsListsActivityTest {
|
|
|
|
@get:Rule
|
|
val activityRule = ActivityTestRule(BoardsListsActivity::class.java)
|
|
|
|
fun swipeLeftToDelete() {
|
|
onView(withId(R.id.boardList))
|
|
.perform(
|
|
RecyclerViewActions.actionOnItemAtPosition<BoardsListAdapter.BoardViewHolder>(
|
|
0, swipeLeft()
|
|
)
|
|
)
|
|
}
|
|
|
|
fun pullToRefresh() {
|
|
onView(withId(R.id.pullToRefresh))
|
|
.perform(swipeDown())
|
|
|
|
}
|
|
|
|
@Test
|
|
fun openNewBoardActivity() {
|
|
onView(withId(R.id.fab))
|
|
.perform(click())
|
|
|
|
onView(withId(R.id.newBoardName))
|
|
.check(matches(isDisplayed()))
|
|
}
|
|
|
|
}
|
|
|