leancodepl / patrol

Flutter-first UI testing framework. Ready for action!
https://patrol.leancode.co
Apache License 2.0
902 stars 137 forks source link

Unable to run single test, running all tests won't quit after last test #1667

Closed georgno closed 1 year ago

georgno commented 1 year ago

Steps to reproduce

app\build.gradle ``` def localProperties = new Properties() def localPropertiesFile = rootProject.file('local.properties') if (localPropertiesFile.exists()) { localPropertiesFile.withReader('UTF-8') { reader -> localProperties.load(reader) } } def flutterRoot = localProperties.getProperty('flutter.sdk') if (flutterRoot == null) { throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") } def flutterVersionCode = localProperties.getProperty('flutter.versionCode') if (flutterVersionCode == null) { flutterVersionCode = '1' } def flutterVersionName = localProperties.getProperty('flutter.versionName') if (flutterVersionName == null) { flutterVersionName = '1.0' } def keystoreProperties = new Properties() def keystorePropertiesFile = rootProject.file('key.properties') if (keystorePropertiesFile.exists()) { keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) } apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" apply plugin: 'com.google.gms.google-services' android { compileSdkVersion 33 compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } kotlinOptions { jvmTarget = '1.8' } sourceSets { main.java.srcDirs += 'src/main/kotlin' } defaultConfig { applicationId "de.yyyy.XXXXX" minSdkVersion 26 targetSdkVersion flutter.targetSdkVersion versionCode flutterVersionCode.toInteger() versionName flutterVersionName testInstrumentationRunner "pl.leancode.patrol.PatrolJUnitRunner" testInstrumentationRunnerArguments clearPackageData: "true" } signingConfigs { release { keyAlias keystoreProperties['keyAlias'] keyPassword keystoreProperties['keyPassword'] storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null storePassword keystoreProperties['storePassword'] } } buildTypes { release { signingConfig signingConfigs.release /* //Error: NDK is not installed ndk { debugSymbolLevel 'SYMBOL_TABLE' } */ } } testOptions { execution "ANDROIDX_TEST_ORCHESTRATOR" } } flutter { source '../..' } dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation 'com.google.firebase:firebase-messaging:20.1.0' def work_version = "2.7.1" implementation "androidx.work:work-runtime-ktx:$work_version" androidTestUtil "androidx.test:orchestrator:1.4.2" } ```
build.gradle ``` buildscript { ext.kotlin_version = '1.9.10' repositories { google() mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:7.3.1' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath 'com.google.gms:google-services:4.3.15' } } allprojects { repositories { google() mavenCentral() } } rootProject.buildDir = '../build' subprojects { project.buildDir = "${rootProject.buildDir}/${project.name}" } subprojects { project.evaluationDependsOn(':app') } tasks.register("clean", Delete) { delete rootProject.buildDir } ```

Actual results

I am unable to run a targeted test. Also if i am running all tests it won't quit after running the last test and just stay in the app without an output to the console.

Logs

Logs ``` PS C:\Users\georg\projects\android\XXXXX> patrol test --target ./integration_test/example_test.dart --verbose You're using Patrol CLI 2.0, which has breaking changes. Read the migration guide at https://patrol.leancode.co/v2. Disable this warning by setting the PATROL_MIGRATED environment variable. Verbose mode enabled. More logs will be printed. Received 1 test target(s) Received test target: C:\Users\georg\projects\android\XXXXX\./integration_test/example_test.dart Generated entrypoint C:\Users\georg\projects\android\XXXXX\integration_test\test_bundle.dart with 1 bundled test(s) $ flutter --no-version-check devices --machine No device specified, using the first one (HMYHBELBLZNRMN75) Received 1 device(s) to run on Received device: HMYHBELBLZNRMN75 Received 7 --dart-define(s) (0 custom, 7 internal) Received internal --dart-define: PATROL_WAIT=0 Received internal --dart-define: PATROL_APP_PACKAGE_NAME=de.yyyy.XXXXX Received internal --dart-define: PATROL_APP_BUNDLE_ID=de.yyyy.XXXXX Received internal --dart-define: PATROL_ANDROID_APP_NAME=XXXXX Received internal --dart-define: PATROL_IOS_APP_NAME=XXXXX Received internal --dart-define: INTEGRATION_TEST_SHOULD_REPORT_RESULTS_TO_NATIVE=false Received internal --dart-define: PATROL_TEST_LABEL_ENABLED=true • Building apk with entrypoint test_bundle.dart... $ .\gradlew.bat :app:assembleDebug -Ptarget=C:\Users\georg\projects\android\XXXXX\integration_test\test_bundle.dart -Pdart-defines=UEFUUk9MX1dBSVQ9MA==,UEFUUk9MX0FQUF9 QQUNLQUdFX05BTUU9ZGUueml4aW8uY2FubmF4YW4=,UEFUUk9MX0FQUF9CVU5ETEVfSUQ9ZGUueml4aW8ucWx1bWJ1cw==,UEFUUk9MX0FORFJPSURfQVBQX05BTUU9UWx1bWJ1cw==,UEFUUk9MX0lPU19BUFBfTkFNRT1RbHVtYnVz,SU5URUdSQVRJT05fVEVTVF9TSE9VTERfUkVQT1JUX1JFU1VMVFNfVE9fTkFUSVZFPWZhbHNl,UEFUUk9MX1RFU1RfTEFCRUxfRU5BQkxFRD10cnVl : > Task :app:preBuild UP-TO-DATE : > Task :app:preDebugBuild UP-TO-DATE : > Task :app:mergeDebugNativeDebugMetadata NO-SOURCE : : > Task :app:compileFlutterBuildDebug FAILED Invalid depfile: C:\Users\georg\projects\android\XXXXX\.dart_tool\flutter_build\739597521ca7ed34087162eb24228ecb\kernel_snapshot.d Invalid depfile: C:\Users\georg\projects\android\XXXXX\.dart_tool\flutter_build\739597521ca7ed34087162eb24228ecb\kernel_snapshot.d Unhandled exception: FileSystemException(uri=c:/Users/georg/projects/android/XXXXX/integration_test/example_test.dart; message=StandardFileSystem only supports file:* and data:* URIs) #0 StandardFileSystem.entityForUri (package:front_end/src/api_prototype/standard_file_system.dart:34:7) #1 IncrementalCompiler._initializeExperimentalInvalidation (package:front_end/src/fasta/incremental_compiler.dart:1268:56) #2 IncrementalCompiler.computeDelta. (package:front_end/src/fasta/incremental_compiler.dart:325:17) #3 IncrementalCompiler.compile (package:vm/incremental_compiler.dart:75:50) #4 FrontendCompiler.compile (package:frontend_server/frontend_server.dart:604:11) #5 starter (package:frontend_server/starter.dart:102:12) #6 main (file:///C:/b/s/w/ir/x/w/sdk/pkg/frontend_server/bin/frontend_server_starter.dart:13:14) Target kernel_snapshot failed: Exception FAILURE: Build failed with an exception. * Where: Script 'C:\Users\georg\flutter\packages\flutter_tools\gradle\src\main\groovy\flutter.groovy' line: 1297 * What went wrong: Execution failed for task ':app:compileFlutterBuildDebug'. > Process 'command 'C:\Users\georg\flutter\bin\flutter.bat'' finished with non-zero exit value 1 * Try: > Run with --stacktrace option to get the stack trace. > Run with --info or --debug option to get more log output. > Run with --scan to get full insights. * Get more help at https://help.gradle.org BUILD FAILED in 3s : : Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0. : : You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins. : : See https://docs.gradle.org/7.4/userguide/command_line_interface.html#sec:command_line_warnings : 1 actionable task: 1 executed ✗ Failed to build apk with entrypoint test_bundle.dart (Gradle build failed with code 1) (4.1s) Exception: Gradle build failed with code 1 #0 AndroidTestBackend.build. (package:patrol_cli/src/android/android_test_backend.dart:67:9) #1 DisposeScope.run (package:dispose_scope/src/dispose_scope.dart:46:7) #2 AndroidTestBackend.build (package:patrol_cli/src/android/android_test_backend.dart:42:5) #3 TestCommand._build (package:patrol_cli/src/commands/test.dart:230:7) #4 TestCommand.run (package:patrol_cli/src/commands/test.dart:167:5) #5 CommandRunner.runCommand (package:args/command_runner.dart:212:13) #6 PatrolCommandRunner.runCommand (package:patrol_cli/src/runner/patrol_command_runner.dart:320:18) #7 PatrolCommandRunner.run (package:patrol_cli/src/runner/patrol_command_runner.dart:264:18) #8 patrolCommandRunner (package:patrol_cli/src/runner/patrol_command_runner.dart:76:20) #9 main (file:///C:/Users/georg/AppData/Local/Pub/Cache/hosted/pub.dev/patrol_cli-2.1.2/bin/main.dart:6:20) See the logs above to learn what happened. Also consider running with --verbose. If the logs still aren't useful, then it's a bug - please report it. Exception: Gradle build failed with code 1 #0 AndroidTestBackend.build. (package:patrol_cli/src/android/android_test_backend.dart:67:9) #1 DisposeScope.run (package:dispose_scope/src/dispose_scope.dart:46:7) #2 AndroidTestBackend.build (package:patrol_cli/src/android/android_test_backend.dart:42:5) #3 TestCommand._build (package:patrol_cli/src/commands/test.dart:230:7) #4 TestCommand.run (package:patrol_cli/src/commands/test.dart:167:5) #5 CommandRunner.runCommand (package:args/command_runner.dart:212:13) #6 PatrolCommandRunner.runCommand (package:patrol_cli/src/runner/patrol_command_runner.dart:320:18) #7 PatrolCommandRunner.run (package:patrol_cli/src/runner/patrol_command_runner.dart:264:18) #8 patrolCommandRunner (package:patrol_cli/src/runner/patrol_command_runner.dart:76:20) #9 main (file:///C:/Users/georg/AppData/Local/Pub/Cache/hosted/pub.dev/patrol_cli-2.1.2/bin/main.dart:6:20) ```

Patrol version

dev_dependencies:
integration_test:
sdk: flutter
patrol: ^2.2.3

Patrol Doctor output

Patrol Doctor output ``` PS C:\Users\georg\projects\android\XXXXX> patrol doctor You're using Patrol CLI 2.0, which has breaking changes. Read the migration guide at https://patrol.leancode.co/v2. Disable this warning by setting the PATROL_MIGRATED environment variable. Patrol CLI version: 2.1.2 Program adb found in C:\Users\georg\AppData\Local\Android\sdk\platform-tools\adb.exe Env var $ANDROID_HOME set to C:\Users\georg\AppData\Local\Android\sdk ```

Flutter Doctor output

Flutter Doctor output ``` PS C:\Users\georg\projects\android\XXXXX> flutter doctor -v [√] Flutter (Channel stable, 3.13.1, on Microsoft Windows [Version 10.0.22621.2134], locale en-DE) • Flutter version 3.13.1 on channel stable at C:\Users\georg\flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision e1e47221e8 (7 days ago), 2023-08-22 21:43:18 -0700 • Engine revision b20183e040 • Dart version 3.1.0 • DevTools version 2.25.0 [√] Windows Version (Installed version of Windows is version 10 or higher) [√] Android toolchain - develop for Android devices (Android SDK version 34.0.0) • Android SDK at C:\Users\georg\AppData\Local\Android\sdk • Platform android-34, build-tools 34.0.0 • ANDROID_HOME = C:\Users\georg\AppData\Local\Android\sdk • Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java • Java version OpenJDK Runtime Environment (build 17.0.6+0-b2043.56-10027231) • All Android licenses accepted. [√] Chrome - develop for the web • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe [!] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.7.3) • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community • Visual Studio Community 2022 version 17.7.34024.191 X Visual Studio is missing necessary components. Please re-run the Visual Studio installer for the "Desktop development with C++" workload, and include these components: MSVC v142 - VS 2019 C++ x64/x86 build tools - If there are multiple build tool versions available, install the latest C++ CMake tools for Windows Windows 10 SDK [√] Android Studio (version 2022.3) • Android Studio at C:\Program Files\Android\Android Studio • Flutter plugin can be installed from: https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: https://plugins.jetbrains.com/plugin/6351-dart • android-studio-dir = C:\Program Files\Android\Android Studio • Java version OpenJDK Runtime Environment (build 17.0.6+0-b2043.56-10027231) [√] IntelliJ IDEA Ultimate Edition (version 2023.2) • IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA 2023.2.0 • Flutter plugin can be installed from: https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: https://plugins.jetbrains.com/plugin/6351-dart [√] Connected device (4 available) • RMX3151 (mobile) • HMYHBELBLZNRMN75 • android-arm64 • Android 13 (API 33) • Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.22621.2134] • Chrome (web) • chrome • web-javascript • Google Chrome 116.0.5845.111 • Edge (web) • edge • web-javascript • Microsoft Edge 116.0.1938.62 [√] Network resources • All expected network resources are available. ! Doctor found issues in 1 category. ```
amitkumar-mobile commented 1 year ago

Yes same issue happening for me as well , if i am running all tests it won't quit after running the last test and just stay in the app without an output to the console. Team , please fix this on priority

georgno commented 1 year ago

Hey guys an update:

One issue I had was exactly issue https://github.com/leancodepl/patrol/issues/1428. So never start it with the autocompleted path on windows but use integration_test\example_test.dart don't put the .\ in front of the path!

Second issue that it didn't stop after the last test was an issue on all my tests. I last used an old patrol version and since then you can't have multiple tests in one file as stated here https://github.com/leancodepl/patrol/discussions/1672

github-actions[bot] commented 12 months ago

This issue has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar problem, please file a new issue. Make sure to follow the template and provide all the information necessary to reproduce the issue.