mirror of
https://github.com/moparisthebest/k-9
synced 2024-12-25 00:58:50 -05:00
Fix Espresso tests
This commit is contained in:
parent
4f8fc5bc5b
commit
704cb35d7e
@ -0,0 +1,28 @@
|
||||
package com.fsck.k9.activity.setup;
|
||||
|
||||
|
||||
import com.fsck.k9.mail.ConnectionSecurity;
|
||||
import com.google.android.apps.common.testing.ui.espresso.matcher.BoundedMatcher;
|
||||
import org.hamcrest.Description;
|
||||
import org.hamcrest.Matcher;
|
||||
|
||||
import static com.google.android.apps.common.testing.testrunner.util.Checks.checkNotNull;
|
||||
|
||||
|
||||
public class ConnectionSecurityHolderMatcher {
|
||||
public static Matcher<Object> is(final ConnectionSecurity connectionSecurity) {
|
||||
checkNotNull(connectionSecurity);
|
||||
return new BoundedMatcher<Object, ConnectionSecurityHolder>(ConnectionSecurityHolder.class) {
|
||||
@Override
|
||||
public boolean matchesSafely(ConnectionSecurityHolder connectionSecurityHolder) {
|
||||
return connectionSecurityHolder.connectionSecurity == connectionSecurity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void describeTo(Description description) {
|
||||
description.appendText("connection security is: ");
|
||||
description.appendText(connectionSecurity.name());
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
@ -3,6 +3,7 @@ package com.fsck.k9.endtoend.pages;
|
||||
import com.fsck.k9.R;
|
||||
import com.fsck.k9.mail.ConnectionSecurity;
|
||||
|
||||
import static com.fsck.k9.activity.setup.ConnectionSecurityHolderMatcher.is;
|
||||
import static com.google.android.apps.common.testing.ui.espresso.Espresso.onData;
|
||||
import static com.google.android.apps.common.testing.ui.espresso.Espresso.onView;
|
||||
import static com.google.android.apps.common.testing.ui.espresso.action.ViewActions.clearText;
|
||||
@ -13,9 +14,6 @@ import static com.google.android.apps.common.testing.ui.espresso.assertion.ViewA
|
||||
import static com.google.android.apps.common.testing.ui.espresso.matcher.ViewMatchers.isClickable;
|
||||
import static com.google.android.apps.common.testing.ui.espresso.matcher.ViewMatchers.withId;
|
||||
import static com.google.android.apps.common.testing.ui.espresso.matcher.ViewMatchers.withText;
|
||||
import static org.hamcrest.Matchers.allOf;
|
||||
import static org.hamcrest.Matchers.instanceOf;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
|
||||
public class IncomingServerSettingsPage extends AbstractPage {
|
||||
|
||||
@ -31,7 +29,7 @@ public class IncomingServerSettingsPage extends AbstractPage {
|
||||
onView(withId(R.id.account_security_type))
|
||||
.perform(scrollTo())
|
||||
.perform(click());
|
||||
onData(allOf(is(instanceOf(ConnectionSecurity.class)), is(security))).perform(click());
|
||||
onData(is(security)).perform(click());
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,7 @@ package com.fsck.k9.endtoend.pages;
|
||||
import com.fsck.k9.R;
|
||||
import com.fsck.k9.mail.ConnectionSecurity;
|
||||
|
||||
import static com.fsck.k9.activity.setup.ConnectionSecurityHolderMatcher.is;
|
||||
import static com.google.android.apps.common.testing.ui.espresso.Espresso.onData;
|
||||
import static com.google.android.apps.common.testing.ui.espresso.Espresso.onView;
|
||||
import static com.google.android.apps.common.testing.ui.espresso.action.ViewActions.clearText;
|
||||
@ -10,9 +11,6 @@ import static com.google.android.apps.common.testing.ui.espresso.action.ViewActi
|
||||
import static com.google.android.apps.common.testing.ui.espresso.action.ViewActions.scrollTo;
|
||||
import static com.google.android.apps.common.testing.ui.espresso.action.ViewActions.typeText;
|
||||
import static com.google.android.apps.common.testing.ui.espresso.matcher.ViewMatchers.withId;
|
||||
import static org.hamcrest.Matchers.allOf;
|
||||
import static org.hamcrest.Matchers.instanceOf;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
|
||||
|
||||
public class OutgoingServerSettingsPage extends AbstractPage {
|
||||
@ -30,7 +28,7 @@ public class OutgoingServerSettingsPage extends AbstractPage {
|
||||
onView(withId(R.id.account_security_type))
|
||||
.perform(scrollTo())
|
||||
.perform(click());
|
||||
onData(allOf(is(instanceOf(ConnectionSecurity.class)), is(security))).perform(click());
|
||||
onData(is(security)).perform(click());
|
||||
return this;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user