Skip to content

Commit

Permalink
*Fix crashes
Browse files Browse the repository at this point in the history
  • Loading branch information
DimitarStoyanov91 committed May 20, 2024
1 parent a0bdac4 commit 15d22ed
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 1 deletion.
6 changes: 6 additions & 0 deletions packages/widget_toolkit/example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ android {
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "pl.leancode.patrol.PatrolJUnitRunner"
testInstrumentationRunnerArguments clearPackageData: "true"
}

buildTypes {
Expand All @@ -60,6 +62,9 @@ android {
signingConfig signingConfigs.debug
}
}
testOptions {
execution "ANDROIDX_TEST_ORCHESTRATOR"
}
}

flutter {
Expand All @@ -68,4 +73,5 @@ flutter {

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
androidTestUtil "androidx.test:orchestrator:1.4.2"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package com.primeholding.example; // 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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ void main() {
final patrolBaseConfig = PatrolBaseConfig();

patrolBaseConfig.patrol('TextFieldDialog debug test', ($) async {
const testInput = 'Test Input';
const testInput = 'Test';

final editFieldsPage = EditFieldsPage($);

Expand All @@ -17,6 +17,7 @@ void main() {
await editFieldsPage.tapFirstNameDialog();
await editFieldsPage.setFirstName(testInput);
await editFieldsPage.tapSaveButton();
//Check that the keyboard is displayed
await Future.delayed(const Duration(seconds: 30));
});
}

0 comments on commit 15d22ed

Please sign in to comment.