From 1d259bd51cd0c39adcfa3c5f784117f420a8b944 Mon Sep 17 00:00:00 2001 From: Torsten Grote Date: Wed, 29 Aug 2018 10:51:58 -0300 Subject: [PATCH 1/3] Screenshots for Sign-in improvements Screenshots for #1249 --- .../SettingsActivityScreenshotTest.java | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/briar-android/src/androidTest/java/org/briarproject/briar/android/settings/SettingsActivityScreenshotTest.java b/briar-android/src/androidTest/java/org/briarproject/briar/android/settings/SettingsActivityScreenshotTest.java index 192680bd7..0da387952 100644 --- a/briar-android/src/androidTest/java/org/briarproject/briar/android/settings/SettingsActivityScreenshotTest.java +++ b/briar-android/src/androidTest/java/org/briarproject/briar/android/settings/SettingsActivityScreenshotTest.java @@ -3,6 +3,7 @@ package org.briarproject.briar.android.settings; import android.content.Intent; import android.support.test.espresso.contrib.DrawerActions; import android.support.test.runner.AndroidJUnit4; +import android.support.v7.widget.RecyclerView; import android.view.Gravity; import org.briarproject.briar.R; @@ -17,9 +18,15 @@ 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.DrawerMatchers.isClosed; +import static android.support.test.espresso.contrib.RecyclerViewActions.scrollToPosition; 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.withText; +import static org.briarproject.briar.android.test.ViewActions.waitUntilMatches; +import static org.hamcrest.CoreMatchers.is; @RunWith(AndroidJUnit4.class) public class SettingsActivityScreenshotTest extends ScreenshotTest { @@ -67,4 +74,26 @@ public class SettingsActivityScreenshotTest extends ScreenshotTest { screenshot("manual_dark_theme_nav_drawer"); } + @Test + public void appLock() { + // scroll down + onView(withClassName(is(RecyclerView.class.getName()))) + .perform(scrollToPosition(13)); + + // 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"); + } + } From 055c381cc9d0861729da0f036191413604615fec Mon Sep 17 00:00:00 2001 From: Torsten Grote Date: Wed, 29 Aug 2018 17:08:37 -0300 Subject: [PATCH 2/3] Take a screenshot of the Navigation Drawer with lock action --- .../SettingsActivityScreenshotTest.java | 42 ++++++++++++------- 1 file changed, 27 insertions(+), 15 deletions(-) diff --git a/briar-android/src/androidTest/java/org/briarproject/briar/android/settings/SettingsActivityScreenshotTest.java b/briar-android/src/androidTest/java/org/briarproject/briar/android/settings/SettingsActivityScreenshotTest.java index 0da387952..b0e144d61 100644 --- a/briar-android/src/androidTest/java/org/briarproject/briar/android/settings/SettingsActivityScreenshotTest.java +++ b/briar-android/src/androidTest/java/org/briarproject/briar/android/settings/SettingsActivityScreenshotTest.java @@ -55,21 +55,8 @@ public class SettingsActivityScreenshotTest extends ScreenshotTest { .check(matches(isDisplayed())) .perform(click()); - // start main activity - Intent i = - new Intent(testRule.getActivity(), NavDrawerActivity.class); - testRule.getActivity().startActivity(i); - - // close expiry warning - onView(withId(R.id.expiryWarningClose)) - .check(matches(isDisplayed())); - onView(withId(R.id.expiryWarningClose)) - .perform(click()); - - // open navigation drawer - onView(withId(R.id.drawer_layout)) - .check(matches(isClosed(Gravity.START))) - .perform(DrawerActions.open()); + // open nav drawer and remove expiry warning + openNavDrawer(true); screenshot("manual_dark_theme_nav_drawer"); } @@ -94,6 +81,31 @@ public class SettingsActivityScreenshotTest extends ScreenshotTest { .check(matches(isEnabled())); screenshot("manual_app_lock"); + + // no more expiry warning to remove, because sharedprefs cached? + openNavDrawer(false); + + screenshot("manual_app_lock_nav_drawer"); + } + + private void openNavDrawer(boolean expiry) { + // start main activity + Intent i = + new Intent(testRule.getActivity(), NavDrawerActivity.class); + testRule.getActivity().startActivity(i); + + // close expiry warning + if (expiry) { + onView(withId(R.id.expiryWarningClose)) + .check(matches(isDisplayed())); + onView(withId(R.id.expiryWarningClose)) + .perform(click()); + } + + // open navigation drawer + onView(withId(R.id.drawer_layout)) + .check(matches(isClosed(Gravity.START))) + .perform(DrawerActions.open()); } } From 8d592ad2eeaf0bc8019a7f41a3049d07d8793d4c Mon Sep 17 00:00:00 2001 From: Torsten Grote Date: Mon, 3 Sep 2018 18:03:57 -0300 Subject: [PATCH 3/3] Take screenshot of Tor settings --- .../SettingsActivityScreenshotTest.java | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/briar-android/src/androidTest/java/org/briarproject/briar/android/settings/SettingsActivityScreenshotTest.java b/briar-android/src/androidTest/java/org/briarproject/briar/android/settings/SettingsActivityScreenshotTest.java index b0e144d61..34621c394 100644 --- a/briar-android/src/androidTest/java/org/briarproject/briar/android/settings/SettingsActivityScreenshotTest.java +++ b/briar-android/src/androidTest/java/org/briarproject/briar/android/settings/SettingsActivityScreenshotTest.java @@ -18,7 +18,8 @@ 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.DrawerMatchers.isClosed; -import static android.support.test.espresso.contrib.RecyclerViewActions.scrollToPosition; +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.isEnabled; import static android.support.test.espresso.matcher.ViewMatchers.withChild; @@ -65,7 +66,9 @@ public class SettingsActivityScreenshotTest extends ScreenshotTest { public void appLock() { // scroll down onView(withClassName(is(RecyclerView.class.getName()))) - .perform(scrollToPosition(13)); + .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)) @@ -88,6 +91,22 @@ public class SettingsActivityScreenshotTest extends ScreenshotTest { 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 Intent i =