fix: harden drawer test assertions and workspace state selectors
This commit is contained in:
@@ -2,11 +2,8 @@ package space.hackenslacker.kanbn4droid.app
|
||||
|
||||
import androidx.test.core.app.ActivityScenario
|
||||
import androidx.test.espresso.Espresso.onView
|
||||
import androidx.test.espresso.ViewAction
|
||||
import androidx.test.espresso.contrib.DrawerActions
|
||||
import androidx.test.espresso.action.ViewActions.click
|
||||
import androidx.test.espresso.action.GeneralSwipeAction
|
||||
import androidx.test.espresso.action.Press
|
||||
import androidx.test.espresso.action.Swipe
|
||||
import androidx.test.espresso.action.ViewActions.longClick
|
||||
import androidx.test.espresso.action.ViewActions.replaceText
|
||||
import androidx.test.espresso.action.ViewActions.swipeDown
|
||||
@@ -20,7 +17,6 @@ import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
|
||||
import androidx.test.espresso.matcher.ViewMatchers.withId
|
||||
import androidx.test.espresso.matcher.ViewMatchers.withText
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import kotlin.math.roundToInt
|
||||
import org.junit.After
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
@@ -133,25 +129,12 @@ class BoardsFlowTest {
|
||||
|
||||
ActivityScenario.launch(BoardsActivity::class.java)
|
||||
|
||||
onView(withId(android.R.id.content)).perform(swipeFromLeftEdge())
|
||||
onView(withId(R.id.boardsDrawerLayout)).perform(DrawerActions.open())
|
||||
|
||||
onView(withText("Workspaces")).check(matches(isDisplayed()))
|
||||
onView(withText("Alpha")).check(matches(isDisplayed()))
|
||||
}
|
||||
|
||||
private fun swipeFromLeftEdge(): ViewAction {
|
||||
return GeneralSwipeAction(
|
||||
Swipe.FAST,
|
||||
{ view ->
|
||||
val x = (view.width * 0.02f).roundToInt().toFloat()
|
||||
floatArrayOf(x, view.height * 0.5f)
|
||||
},
|
||||
{ view ->
|
||||
val x = (view.width * 0.8f).roundToInt().toFloat()
|
||||
floatArrayOf(x, view.height * 0.5f)
|
||||
},
|
||||
Press.FINGER,
|
||||
)
|
||||
onView(withId(R.id.drawerWorkspacesTitle)).check(matches(isDisplayed()))
|
||||
onView(withId(R.id.drawerWorkspacesTitle)).check(matches(withText(R.string.drawer_workspaces)))
|
||||
onView(withId(R.id.drawerWorkspacesRecyclerView)).check(matches(isDisplayed()))
|
||||
onView(withId(R.id.drawerLogoutButton)).check(matches(isDisplayed()))
|
||||
}
|
||||
|
||||
private class InMemorySessionStore(
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:alpha="0.14" android:color="?attr/colorPrimary" android:state_activated="true" />
|
||||
<item android:alpha="0.14" android:color="?attr/colorPrimary" android:state_selected="true" />
|
||||
<item android:color="?attr/colorSurface" />
|
||||
</selector>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:alpha="0.70" android:color="?attr/colorPrimary" android:state_activated="true" />
|
||||
<item android:alpha="0.70" android:color="?attr/colorPrimary" android:state_selected="true" />
|
||||
<item android:alpha="0.20" android:color="?attr/colorOnSurface" />
|
||||
</selector>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:color="?attr/colorPrimary" android:state_activated="true" />
|
||||
<item android:color="?attr/colorPrimary" android:state_selected="true" />
|
||||
<item android:color="?attr/colorOnSurface" />
|
||||
</selector>
|
||||
|
||||
Reference in New Issue
Block a user