Skip to content

Commit

Permalink
LA-2185 initial patrol setup for android
Browse files Browse the repository at this point in the history
  • Loading branch information
KhaledNjim committed Dec 18, 2024
1 parent c15a26b commit 9271c7e
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 3 deletions.
6 changes: 6 additions & 0 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ android {
versionName flutterVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled true
testInstrumentationRunner "pl.leancode.patrol.PatrolJUnitRunner"
testInstrumentationRunnerArguments clearPackageData: "true"
}

signingConfigs {
Expand All @@ -75,6 +77,9 @@ android {
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
testOptions {
execution "ANDROIDX_TEST_ORCHESTRATOR"
}
}

flutter {
Expand All @@ -88,6 +93,7 @@ dependencies {
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
implementation 'androidx.multidex:multidex:2.0.1'
androidTestUtil "androidx.test:orchestrator:1.5.1"
}

apply plugin: 'com.google.gms.google-services'
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package app.twake.android.chat;

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 in AndroidManifest.xml in manifest/application/activity you have
// 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);
}
}
36 changes: 34 additions & 2 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "3.2.2"
dispose_scope:
dependency: transitive
description:
name: dispose_scope
sha256: "48ec38ca2631c53c4f8fa96b294c801e55c335db5e3fb9f82cede150cfe5a2af"
url: "https://pub.dev"
source: hosted
version: "2.1.0"
dynamic_color:
dependency: "direct main"
description:
Expand Down Expand Up @@ -2172,6 +2180,30 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.2.1"
patrol:
dependency: "direct dev"
description:
name: patrol
sha256: "7e7c346890fa234af948fbdf024e09e80142deef7aef572dead1001446ca853c"
url: "https://pub.dev"
source: hosted
version: "3.13.1"
patrol_finders:
dependency: transitive
description:
name: patrol_finders
sha256: "6dfa07aa951f1d769f0a736f4fd4eb63d99ef32931aaaa39e0d24126ddfe9cd9"
url: "https://pub.dev"
source: hosted
version: "2.5.1"
patrol_log:
dependency: transitive
description:
name: patrol_log
sha256: fb67013a5305cfd30a374cce3c5ea5a99613335d8cf31c250ecb0dda75deec21
url: "https://pub.dev"
source: hosted
version: "0.2.1"
permission_handler:
dependency: "direct main"
description:
Expand Down Expand Up @@ -3401,5 +3433,5 @@ packages:
source: hosted
version: "3.1.2"
sdks:
dart: ">=3.5.0-259.0.dev <4.0.0"
flutter: ">=3.19.3"
dart: ">=3.5.0 <4.0.0"
flutter: ">=3.24.0"
8 changes: 7 additions & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ dev_dependencies:
msix: ^3.6.2
translations_cleaner: ^0.0.5
mockito: 5.4.4
patrol: 3.13.1


flutter_launcher_icons:
Expand Down Expand Up @@ -325,4 +326,9 @@ dependency_overrides:

cider:
link_template:
tag: https://github.com/linagora/twake-on-matrix/releases/tag/%tag% # initial release link template
tag: https://github.com/linagora/twake-on-matrix/releases/tag/%tag% # initial release link template

patrol:
app_name: Twake Chat
android:
package_name: app.twake.android.chat

0 comments on commit 9271c7e

Please sign in to comment.