mirror of
https://github.com/deltachat/deltachat-android.git
synced 2025-10-03 17:59:39 +02:00
Don't let the doze dialog make the tests fail
This commit is contained in:
parent
b495b847f4
commit
dfb13ca7a4
2 changed files with 17 additions and 13 deletions
|
@ -1,5 +1,6 @@
|
|||
package com.b44t.messenger;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
@ -62,16 +63,29 @@ public class TestUtils {
|
|||
Intent intent =
|
||||
Intent.makeMainActivity(
|
||||
new ComponentName(getInstrumentation().getTargetContext(), ConversationListActivity.class));
|
||||
TestUtils.createOfflineAccount();
|
||||
createOfflineAccount();
|
||||
prepare();
|
||||
return new ActivityScenarioRule<>(intent);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public static <T extends Activity> ActivityScenarioRule<T> getOnlineActivityRule(Class<T> activityClass) {
|
||||
Context context = getInstrumentation().getTargetContext();
|
||||
AccountManager.getInstance().beginAccountCreation(context);
|
||||
prepare();
|
||||
return new ActivityScenarioRule<>(new Intent(getInstrumentation().getTargetContext(), activityClass));
|
||||
}
|
||||
|
||||
private static void prepare() {
|
||||
Prefs.setBooleanPreference(getInstrumentation().getTargetContext(), Prefs.DOZE_ASKED_DIRECTLY, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform action of waiting for a certain view within a single root view
|
||||
*
|
||||
* @param matcher Generic Matcher used to find our view
|
||||
*/
|
||||
static ViewAction searchFor(Matcher<View> matcher) {
|
||||
private static ViewAction searchFor(Matcher<View> matcher) {
|
||||
return new ViewAction() {
|
||||
|
||||
public Matcher<View> getConstraints() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue