diff --git a/androidTest/com/b44t/messenger/TestUtils.java b/androidTest/com/b44t/messenger/TestUtils.java index 1eb61642e..a7e4ffd95 100644 --- a/androidTest/com/b44t/messenger/TestUtils.java +++ b/androidTest/com/b44t/messenger/TestUtils.java @@ -59,11 +59,13 @@ public class TestUtils { } @NonNull - public static ActivityScenarioRule getOfflineActivityRule() { + public static ActivityScenarioRule getOfflineActivityRule(boolean useExistingChats) { Intent intent = Intent.makeMainActivity( new ComponentName(getInstrumentation().getTargetContext(), ConversationListActivity.class)); - createOfflineAccount(); + if (!useExistingChats) { + createOfflineAccount(); + } prepare(); return new ActivityScenarioRule<>(intent); } diff --git a/androidTest/com/b44t/messenger/uibenchmarks/EnterChatsBenchmark.java b/androidTest/com/b44t/messenger/uibenchmarks/EnterChatsBenchmark.java index 1856ce30d..f47ca71b9 100644 --- a/androidTest/com/b44t/messenger/uibenchmarks/EnterChatsBenchmark.java +++ b/androidTest/com/b44t/messenger/uibenchmarks/EnterChatsBenchmark.java @@ -44,7 +44,7 @@ public class EnterChatsBenchmark { private final static String TAG = EnterChatsBenchmark.class.getSimpleName(); @Rule - public ActivityScenarioRule activityRule = TestUtils.getOfflineActivityRule(); + public ActivityScenarioRule activityRule = TestUtils.getOfflineActivityRule(USE_EXISTING_CHATS); @Test public void createAndEnter10FilledChats() { @@ -70,7 +70,9 @@ public class EnterChatsBenchmark { @Test public void enterFilledChat() { - createChatAndGoBack("Group #1", true, "Hello!", "Some links: https://testrun.org", "And a command: /help"); + if (!USE_EXISTING_CHATS) { + createChatAndGoBack("Group #1", true, "Hello!", "Some links: https://testrun.org", "And a command: /help"); + } String[] times = new String[50]; for (int i = 0; i < times.length; i++) { diff --git a/androidTest/com/b44t/messenger/uitests/offline/ForwardingTest.java b/androidTest/com/b44t/messenger/uitests/offline/ForwardingTest.java index 80fb164e4..14108a951 100644 --- a/androidTest/com/b44t/messenger/uitests/offline/ForwardingTest.java +++ b/androidTest/com/b44t/messenger/uitests/offline/ForwardingTest.java @@ -43,7 +43,7 @@ public class ForwardingTest { } @Rule - public ActivityScenarioRule activityRule = TestUtils.getOfflineActivityRule(); + public ActivityScenarioRule activityRule = TestUtils.getOfflineActivityRule(false); @Before public void createChats() { diff --git a/androidTest/com/b44t/messenger/uitests/offline/SharingTest.java b/androidTest/com/b44t/messenger/uitests/offline/SharingTest.java index d84d265a3..7e8b38e4b 100644 --- a/androidTest/com/b44t/messenger/uitests/offline/SharingTest.java +++ b/androidTest/com/b44t/messenger/uitests/offline/SharingTest.java @@ -48,7 +48,7 @@ public class SharingTest { private static int createdGroupId; @Rule - public ActivityScenarioRule activityRule = TestUtils.getOfflineActivityRule(); + public ActivityScenarioRule activityRule = TestUtils.getOfflineActivityRule(false); @Before public void createGroup() {