Reenable some tests

This commit is contained in:
ligi 2015-11-15 21:33:29 +01:00
parent 8f1fbe7a77
commit 2cf7dba695
4 changed files with 27 additions and 13 deletions

View file

@ -106,7 +106,7 @@ dependencies {
provided 'org.glassfish:javax.annotation:10.0-b28'
androidTestApt "com.google.dagger:dagger-compiler:${DAGGER_VERSION}"
androidTestApt "com.google.dagger:dagger-compiler:${DAGGER_VERSION}"
androidTestCompile 'com.android.support:support-v4:23.1.1'
androidTestCompile 'com.android.support:support-annotations:23.1.1'
@ -114,6 +114,13 @@ dependencies {
androidTestCompile 'com.android.support.test:rules:0.4.1'
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.1'
androidTestCompile('com.android.support.test.espresso:espresso-contrib:2.2.1') {
// http://stackoverflow.com/questions/30578243/why-would-adding-espresso-contrib-cause-an-inflateexception
exclude group: 'com.android.support', module: 'appcompat'
exclude group: 'com.android.support', module: 'support-v4'
exclude module: 'recyclerview-v7'
}
androidTestCompile 'com.squareup.spoon:spoon-client:1.2.0'
androidTestCompile 'com.squareup.assertj:assertj-android:1.1.1'

View file

@ -10,6 +10,7 @@ import org.ligi.passandroid.ui.PassListActivity;
import java.util.ArrayList;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.assertion.ViewAssertions.matches;
import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
@ -31,12 +32,13 @@ public class TheEmptyPassList extends BaseIntegration<PassListActivity> {
@MediumTest
public void testEmptyViewIsThereWhenThereAreNoPasses() {
Spoon.screenshot(getActivity(), "empty_view");
onView(withId(R.id.emptyView)).check(matches(isDisplayed()));
onView(withId(R.id.emptyView)).check(matches(isDisplayed()));
}
/*@MediumTest
@MediumTest
public void testHelpGoesToHelp() {
onView(withId(R.id.menu_help)).perform(click());
onView(withId(R.id.help_tv)).check(matches(isDisplayed()));
}*/
}
}

View file

@ -7,9 +7,14 @@ import com.squareup.spoon.Spoon;
import org.ligi.passandroid.ui.HelpActivity;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.assertion.ViewAssertions.matches;
import static android.support.test.espresso.matcher.ViewMatchers.isClickable;
import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
import static android.support.test.espresso.matcher.ViewMatchers.withContentDescription;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.Matchers.allOf;
public class TheHelpActivity extends BaseIntegration<HelpActivity> {
@ -30,12 +35,9 @@ public class TheHelpActivity extends BaseIntegration<HelpActivity> {
Spoon.screenshot(getActivity(), "help");
}
/*
depends on this: http://stackoverflow.com/questions/23985181/click-home-icon-with-espresso
@SmallTest
public void test_that_help_finishes_on_home() {
onView(withId(android.R.id.home)).perform(click());
onView(allOf(withContentDescription(containsString("Navigate up")), isClickable())).perform(click());
assertTrue(getActivity().isFinishing());
}
*/
}

View file

@ -10,6 +10,7 @@ import org.ligi.passandroid.ui.PassListActivity;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.assertion.ViewAssertions.matches;
import static android.support.test.espresso.contrib.DrawerActions.open;
import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static org.hamcrest.CoreMatchers.not;
@ -48,13 +49,15 @@ public class ThePassListActivity extends BaseIntegration<PassListActivity> {
onView(withId(R.id.left_drawer)).check(matches(not(isDisplayed())));
}
/*
@MediumTest
public void testThatNavigationDrawerOpens() {
//onView(withId(android.R.id.home)).perform(click());
//onView(withId(R.id.left_drawer)).check(matches(isDisplayed()));
onView(withId(R.id.drawer_layout)).perform(open());
onView(withId(R.id.left_drawer)).check(matches(isDisplayed()));
Spoon.screenshot(getActivity(), "open_drawer");
}
*/
}