Skip to content

Commit

Permalink
Improve HelpActivity TestSetup & add test for #98
Browse files Browse the repository at this point in the history
  • Loading branch information
ligi committed Aug 21, 2016
1 parent 3f5ffb1 commit a6a2383
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 37 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package org.ligi.passandroid

import android.support.test.espresso.Espresso.onView
import android.support.test.espresso.action.ViewActions.click
import android.support.test.espresso.assertion.ViewAssertions.matches
import android.support.test.espresso.matcher.ViewMatchers.*
import android.support.test.rule.ActivityTestRule
import junit.framework.Assert
import org.junit.Rule
import org.junit.Test
import org.ligi.passandroid.helper.ScreenshotTaker
import org.ligi.passandroid.steps.HelpSteps.checkThatHelpIsThere
import org.ligi.passandroid.ui.HelpActivity

class TheHelpActivity {

@get:Rule
val rule: ActivityTestRule<HelpActivity> = ActivityTestRule(HelpActivity::class.java)

@Test
fun testHelpIsThere() {
checkThatHelpIsThere()
ScreenshotTaker.takeScreenshot(rule.activity, "help")
}

@Test
fun test_that_help_finishes_on_home() {
onView(withContentDescription(R.string.abc_action_bar_up_description)).perform(click())
Assert.assertTrue(rule.activity.isFinishing)
}

@Test
fun test_that_version_is_shown() {
onView(withText("v" + BuildConfig.VERSION_NAME)).check(matches(isDisplayed()))
}
}

0 comments on commit a6a2383

Please sign in to comment.