Skip to content

Commit

Permalink
config: patrol integrate with android,ios,macos
Browse files Browse the repository at this point in the history
  • Loading branch information
seilylook committed Mar 13, 2024
1 parent 0db5730 commit 37c06dc
Show file tree
Hide file tree
Showing 24 changed files with 1,108 additions and 15 deletions.
12 changes: 11 additions & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ android {
compileSdkVersion flutter.compileSdkVersion
ndkVersion flutter.ndkVersion

testOptions {
execution "ANDROIDX_TEST_ORCHESTRATOR"
}


compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
Expand All @@ -49,6 +54,9 @@ android {
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "pl.leancode.patrol.PatrolJUnitRunner"
testInstrumentationRunnerArguments clearPackageData: "true"

}

buildTypes {
Expand All @@ -64,4 +72,6 @@ flutter {
source '../..'
}

dependencies {}
dependencies {
androidTestUtil "androidx.test:orchestrator:1.4.2"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package com.example.tunefun_front; // replace "com.example.myapp" with your app's package

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);
}
}
File renamed without changes.
30 changes: 30 additions & 0 deletions integration_test/example_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import 'dart:io';

import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';
import 'package:patrol/patrol.dart';

void main() {
patrolTest(
'counter state is the same after going to home and switching apps',
($) async {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();

// Replace later with your app's main widget
await $.pumpWidgetAndSettle(
MaterialApp(
home: Scaffold(
appBar: AppBar(title: const Text('app')),
backgroundColor: Colors.blue,
),
),
);

expect($('app'), findsOneWidget);
if (!Platform.isMacOS) {
await $.native.pressHome();
}
},
);
}
83 changes: 83 additions & 0 deletions integration_test/test_bundle.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ target 'Runner' do
target 'RunnerTests' do
inherit! :search_paths
end

target 'RunnerUITests' do
inherit! :complete
end
end

post_install do |installer|
Expand Down
10 changes: 5 additions & 5 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ PODS:
- Firebase/Messaging (10.20.0):
- Firebase/CoreOnly
- FirebaseMessaging (~> 10.20.0)
- firebase_core (2.25.5):
- firebase_core (2.25.4):
- Firebase/CoreOnly (= 10.20.0)
- Flutter
- firebase_messaging (14.7.17):
- firebase_messaging (14.7.16):
- Firebase/Messaging (= 10.20.0)
- firebase_core
- Flutter
Expand Down Expand Up @@ -130,8 +130,8 @@ SPEC CHECKSUMS:
CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99
device_info_plus: c6fb39579d0f423935b0c9ce7ee2f44b71b9fce6
Firebase: 10c8cb12fb7ad2ae0c09ffc86cd9c1ab392a0031
firebase_core: c8628c7ce80f79439149549052bff22f6784fbf5
firebase_messaging: 6ea1e266713728834610c2bc380084a01b1b555d
firebase_core: a46c312d8bae4defa3d009b2aa7b5b413aeb394e
firebase_messaging: e7062cef946e12f93b42abea96937004f8d914d6
FirebaseCore: 28045c1560a2600d284b9c45a904fe322dc890b6
FirebaseCoreInternal: efeeb171ac02d623bdaefe121539939821e10811
FirebaseInstallations: 390ea1d10a4d02b20c965cbfd527ee9b3b412acb
Expand All @@ -147,6 +147,6 @@ SPEC CHECKSUMS:
patrol: 3e21d514020dbee24b3e3383caac9e8e051292ac
PromisesObjC: c50d2056b5253dadbd6c2bea79b0674bd5a52fa4

PODFILE CHECKSUM: a57f30d18f102dd3ce366b1d62a55ecbef2158e5
PODFILE CHECKSUM: 0b25cf511934e20b19acdc39cdaef593fb6e25cc

COCOAPODS: 1.14.3
Loading

0 comments on commit 37c06dc

Please sign in to comment.