TF-2953 Set up Patrol tests
This commit is contained in:
@@ -23,7 +23,7 @@ if (flutterVersionName == null) {
|
||||
|
||||
def flutterMinSdkVersion = localProperties.getProperty('flutter.minSdkVersion')
|
||||
if (flutterMinSdkVersion == null) {
|
||||
flutterMinSdkVersion = '19'
|
||||
flutterMinSdkVersion = '21'
|
||||
}
|
||||
|
||||
apply plugin: 'com.android.application'
|
||||
@@ -54,6 +54,8 @@ android {
|
||||
manifestPlaceholders = [
|
||||
'appAuthRedirectScheme': 'teammail.mobile'
|
||||
]
|
||||
testInstrumentationRunner "pl.leancode.patrol.PatrolJUnitRunner"
|
||||
testInstrumentationRunnerArguments clearPackageData: "true"
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
@@ -77,7 +79,15 @@ android {
|
||||
// Signing with the debug keys for now, so `flutter run --release` works.
|
||||
signingConfig signingConfigs.release
|
||||
}
|
||||
debug {
|
||||
minifyEnabled false
|
||||
}
|
||||
}
|
||||
|
||||
testOptions {
|
||||
execution "ANDROIDX_TEST_ORCHESTRATOR"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
flutter {
|
||||
@@ -90,4 +100,5 @@ dependencies {
|
||||
implementation 'androidx.work:work-runtime-ktx:2.7.0'
|
||||
implementation 'com.android.support:multidex:1.0.3'
|
||||
implementation 'androidx.window:window:1.0.0'
|
||||
androidTestUtil "androidx.test:orchestrator:1.5.0"
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.linagora.android.tmail;
|
||||
|
||||
import androidx.test.platform.app.InstrumentationRegistry;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
import org.junit.runners.Parameterized.Parameters;
|
||||
import pl.leancode.patrol.PatrolJUnitRunner;
|
||||
|
||||
@RunWith(Parameterized.class)
|
||||
public class MainActivityTest {
|
||||
@Parameters(name = "{0}")
|
||||
public static Object[] testCases() {
|
||||
PatrolJUnitRunner instrumentation = (PatrolJUnitRunner) InstrumentationRegistry.getInstrumentation();
|
||||
// replace "MainActivity.class" with "io.flutter.embedding.android.FlutterActivity.class"
|
||||
// if your AndroidManifest is using: android:name="io.flutter.embedding.android.FlutterActivity"
|
||||
instrumentation.setUp(MainActivity.class);
|
||||
instrumentation.waitForPatrolAppService();
|
||||
return instrumentation.listDartTests();
|
||||
}
|
||||
|
||||
public MainActivityTest(String dartTestName) {
|
||||
this.dartTestName = dartTestName;
|
||||
}
|
||||
|
||||
private final String dartTestName;
|
||||
|
||||
@Test
|
||||
public void runDartTest() {
|
||||
PatrolJUnitRunner instrumentation = (PatrolJUnitRunner) InstrumentationRegistry.getInstrumentation();
|
||||
instrumentation.runDartTest(dartTestName);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user