Skip to content
Snippets Groups Projects
Commit 2bef2ac8 authored by akwizgran's avatar akwizgran
Browse files

Merge branch '1249-sign-in-screenshots' into 'master'

Screenshots for account sign-in improvements and Tor settings

See merge request briar/briar!909
parents e12601dd 8d592ad2
No related branches found
No related tags found
No related merge requests found
...@@ -3,6 +3,7 @@ package org.briarproject.briar.android.settings; ...@@ -3,6 +3,7 @@ package org.briarproject.briar.android.settings;
import android.content.Intent; import android.content.Intent;
import android.support.test.espresso.contrib.DrawerActions; import android.support.test.espresso.contrib.DrawerActions;
import android.support.test.runner.AndroidJUnit4; import android.support.test.runner.AndroidJUnit4;
import android.support.v7.widget.RecyclerView;
import android.view.Gravity; import android.view.Gravity;
import org.briarproject.briar.R; import org.briarproject.briar.R;
...@@ -17,9 +18,16 @@ import static android.support.test.espresso.Espresso.onView; ...@@ -17,9 +18,16 @@ import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.click; import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.assertion.ViewAssertions.matches; import static android.support.test.espresso.assertion.ViewAssertions.matches;
import static android.support.test.espresso.contrib.DrawerMatchers.isClosed; import static android.support.test.espresso.contrib.DrawerMatchers.isClosed;
import static android.support.test.espresso.contrib.RecyclerViewActions.scrollTo;
import static android.support.test.espresso.matcher.ViewMatchers.hasDescendant;
import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed; import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
import static android.support.test.espresso.matcher.ViewMatchers.isEnabled;
import static android.support.test.espresso.matcher.ViewMatchers.withChild;
import static android.support.test.espresso.matcher.ViewMatchers.withClassName;
import static android.support.test.espresso.matcher.ViewMatchers.withId; import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static android.support.test.espresso.matcher.ViewMatchers.withText; import static android.support.test.espresso.matcher.ViewMatchers.withText;
import static org.briarproject.briar.android.test.ViewActions.waitUntilMatches;
import static org.hamcrest.CoreMatchers.is;
@RunWith(AndroidJUnit4.class) @RunWith(AndroidJUnit4.class)
public class SettingsActivityScreenshotTest extends ScreenshotTest { public class SettingsActivityScreenshotTest extends ScreenshotTest {
...@@ -48,23 +56,75 @@ public class SettingsActivityScreenshotTest extends ScreenshotTest { ...@@ -48,23 +56,75 @@ public class SettingsActivityScreenshotTest extends ScreenshotTest {
.check(matches(isDisplayed())) .check(matches(isDisplayed()))
.perform(click()); .perform(click());
// open nav drawer and remove expiry warning
openNavDrawer(true);
screenshot("manual_dark_theme_nav_drawer");
}
@Test
public void appLock() {
// scroll down
onView(withClassName(is(RecyclerView.class.getName())))
.perform(scrollTo(hasDescendant(
// scroll down a bit more to have settings in the middle
withText(R.string.panic_setting))));
// wait for settings to get loaded and enabled
onView(withText(R.string.tor_mobile_data_title))
.perform(waitUntilMatches(isEnabled()));
// ensure app lock is displayed and enabled
onView(withText(R.string.pref_lock_title))
.check(matches(isDisplayed()))
.check(matches(isEnabled()))
.perform(click());
onView(withChild(withText(R.string.pref_lock_timeout_title)))
.check(matches(isDisplayed()))
.check(matches(isEnabled()));
screenshot("manual_app_lock");
// no more expiry warning to remove, because sharedprefs cached?
openNavDrawer(false);
screenshot("manual_app_lock_nav_drawer");
}
@Test
public void torSettings() {
// scroll down
onView(withClassName(is(RecyclerView.class.getName())))
.perform(scrollTo(hasDescendant(
// scroll down a bit more to have settings in the middle
withText(R.string.pref_lock_timeout_title))));
// wait for settings to get loaded and enabled
onView(withText(R.string.tor_network_setting))
.check(matches(isDisplayed()))
.perform(waitUntilMatches(isEnabled()));
screenshot("manual_tor_settings");
}
private void openNavDrawer(boolean expiry) {
// start main activity // start main activity
Intent i = Intent i =
new Intent(testRule.getActivity(), NavDrawerActivity.class); new Intent(testRule.getActivity(), NavDrawerActivity.class);
testRule.getActivity().startActivity(i); testRule.getActivity().startActivity(i);
// close expiry warning // close expiry warning
onView(withId(R.id.expiryWarningClose)) if (expiry) {
.check(matches(isDisplayed())); onView(withId(R.id.expiryWarningClose))
onView(withId(R.id.expiryWarningClose)) .check(matches(isDisplayed()));
.perform(click()); onView(withId(R.id.expiryWarningClose))
.perform(click());
}
// open navigation drawer // open navigation drawer
onView(withId(R.id.drawer_layout)) onView(withId(R.id.drawer_layout))
.check(matches(isClosed(Gravity.START))) .check(matches(isClosed(Gravity.START)))
.perform(DrawerActions.open()); .perform(DrawerActions.open());
screenshot("manual_dark_theme_nav_drawer");
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment