Move matcher to own file and add test for visibility of open_file in FAM
closes #164
This commit is contained in:
parent
7d5babafef
commit
d7e25ad1fd
2 changed files with 23 additions and 7 deletions
|
@ -1,25 +1,21 @@
|
|||
package org.ligi.passandroid
|
||||
|
||||
import android.annotation.TargetApi
|
||||
import android.os.Build
|
||||
import android.support.test.espresso.Espresso.onView
|
||||
import android.support.test.espresso.Espresso.pressBack
|
||||
import android.support.test.espresso.action.ViewActions.click
|
||||
import android.support.test.espresso.assertion.ViewAssertions.matches
|
||||
import android.support.test.espresso.matcher.ViewMatchers.isDisplayed
|
||||
import android.support.test.espresso.matcher.ViewMatchers.withId
|
||||
import android.view.View
|
||||
import org.hamcrest.Matcher
|
||||
import android.support.test.espresso.matcher.ViewMatchers.*
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.ligi.passandroid.R.id.pass_recyclerview
|
||||
import org.ligi.passandroid.functions.CollapsedCheck
|
||||
import org.ligi.passandroid.functions.checkThatHelpIsThere
|
||||
import org.ligi.passandroid.functions.expand
|
||||
import org.ligi.passandroid.functions.isCollapsed
|
||||
import org.ligi.passandroid.ui.PassListActivity
|
||||
import org.ligi.trulesk.TruleskActivityRule
|
||||
|
||||
fun isCollapsed(): Matcher<in View>? = CollapsedCheck() as Matcher<in View>
|
||||
|
||||
@TargetApi(14)
|
||||
class ThePassListActivity {
|
||||
|
||||
|
@ -53,4 +49,18 @@ class ThePassListActivity {
|
|||
.check(matches(isCollapsed()))
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
fun testOpenVisibleOn19plus() {
|
||||
onView(withId(R.id.fam)).perform(expand())
|
||||
|
||||
pressBack()
|
||||
|
||||
if (Build.VERSION.SDK_INT >= 19) {
|
||||
onView(withId(R.id.fab_action_open_file)).check(matches(isDisplayed()))
|
||||
} else {
|
||||
onView(withId(R.id.fab_action_open_file)).check(matches(withEffectiveVisibility(Visibility.GONE)))
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
package org.ligi.passandroid.functions
|
||||
|
||||
import android.view.View
|
||||
import org.hamcrest.Matcher
|
||||
|
||||
fun isCollapsed(): Matcher<in View>? = CollapsedCheck() as Matcher<in View>
|
Loading…
Reference in a new issue