From 7d0a1f8d8057faa74035de0cee262a46c6fbbe00 Mon Sep 17 00:00:00 2001 From: cyberta Date: Mon, 23 Jan 2023 19:47:56 +0100 Subject: setup fastlane to create screenshots for Bitmask and custom branded clients, refactor Tests accordingly and create a script and environment variables to run fastlane screenshotting without thinking --- .../bitmaskclient/base/CustomProviderTest.java | 49 ++++++++++++++++++++++ .../leap/bitmaskclient/suite/ScreenshotTest.java | 17 ++++++++ 2 files changed, 66 insertions(+) create mode 100644 app/src/androidTestCustom/java/se/leap/bitmaskclient/base/CustomProviderTest.java create mode 100644 app/src/androidTestCustom/java/se/leap/bitmaskclient/suite/ScreenshotTest.java (limited to 'app/src/androidTestCustom/java/se/leap/bitmaskclient') diff --git a/app/src/androidTestCustom/java/se/leap/bitmaskclient/base/CustomProviderTest.java b/app/src/androidTestCustom/java/se/leap/bitmaskclient/base/CustomProviderTest.java new file mode 100644 index 00000000..1a0814b6 --- /dev/null +++ b/app/src/androidTestCustom/java/se/leap/bitmaskclient/base/CustomProviderTest.java @@ -0,0 +1,49 @@ +package se.leap.bitmaskclient.base; + +import static androidx.test.espresso.Espresso.onView; +import static androidx.test.espresso.action.ViewActions.click; +import static androidx.test.espresso.assertion.ViewAssertions.matches; +import static androidx.test.espresso.matcher.RootMatchers.isDialog; +import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed; +import static androidx.test.espresso.matcher.ViewMatchers.withId; +import static androidx.test.espresso.matcher.ViewMatchers.withText; +import static utils.CustomInteractions.tryResolve; + +import androidx.test.espresso.ViewInteraction; + +import org.junit.Test; + +import se.leap.bitmaskclient.R; +import tools.fastlane.screengrab.Screengrab; + +public class CustomProviderTest extends ProviderBaseTest { + + @Test + @Override + public void test01_vpnStartTest() throws InterruptedException { + ViewInteraction mainButtonStop; + mainButtonStop = tryResolve( + onView(withId(R.id.main_button)), + matches(isDisplayed()), + 30); + Screengrab.screenshot("VPN_connected"); + + mainButtonStop.perform(click()); + Screengrab.screenshot("VPN_ask_disconnect"); + + ViewInteraction alertDialogOKbutton = tryResolve(onView(withText(android.R.string.yes)) + .inRoot(isDialog()), + matches(isDisplayed())); + alertDialogOKbutton.perform(click()); + Screengrab.screenshot("VPN_disconnected"); + + mainButtonStop.perform(click()); + Thread.sleep(50); + Screengrab.screenshot("VPN_connecting"); + } + + @Override + public boolean configureProviderIfNeeded() { + return false; + } +} \ No newline at end of file diff --git a/app/src/androidTestCustom/java/se/leap/bitmaskclient/suite/ScreenshotTest.java b/app/src/androidTestCustom/java/se/leap/bitmaskclient/suite/ScreenshotTest.java new file mode 100644 index 00000000..a19b0ffd --- /dev/null +++ b/app/src/androidTestCustom/java/se/leap/bitmaskclient/suite/ScreenshotTest.java @@ -0,0 +1,17 @@ +package se.leap.bitmaskclient.suite; + + +import androidx.test.filters.LargeTest; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; + +import se.leap.bitmaskclient.base.CustomProviderTest; + +@LargeTest +@RunWith(Suite.class) +@Suite.SuiteClasses({ + CustomProviderTest.class +}) +public class ScreenshotTest { +} -- cgit v1.2.3