leancodepl / patrol

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

Is it possible to change where test_bundle.dart file can be generated through pubspec.yaml? #2298

Open famasf1 opened 3 months ago

famasf1 commented 3 months ago

I want to organized my project and move all the test into different folder. But as of right now, If i run

 patrol develop -t test/integration_test/home/home_integration_test.dart

My expectation is that Patrol will generated a new test_bundle.dart inside test folder. Which is the top-most folder inside my given parameter.

What will happen instead is Patrol will created a new folder named integration_test on the project root folder, along with file named test_bundle.dart and the file will attempted to point the import line to the given parameter -t path above. which will result in a failed test No such file or directory.

Looking at --verbose, Apparently this command sort of force running build APK and reference to this specific folder.

flutter build apk --config-only -t integration_test/test_bundle.dart

So i'm wondering if it's possible to specify where test_bundle.dart should be generated. For instance, Flutter_Gen package allow output parameter inside pubspec.yaml. Which allowed me to move all the generated asset string reference inside one specific folder upon generation through CLI and never have to worry about it again.

flutter_gen: 
  output: lib/generated
  integrations: 
    flutter_svg: true 

  assets:
    outputs: 
      package_parameter_enabled: false

Here's full log

``` Verbose mode enabled. More logs will be printed. Received test target: /Users/myMac/Documents/trade_in_mobile_app/test/integration_test/home/home_integration_test.dart Generated entrypoint /Users/myMac/Documents/trade_in_mobile_app/integration_test/test_bundle.dart for development Received iOS flavor: Techswop $ flutter --no-version-check --suppress-analytics devices --machine No device specified, using the first one (adb-SWVOFYZ9PVBAEY75-tt3xKO._adb-tls-connect._tcp.) $ flutter doctor --verbose $ flutter --suppress-analytics --no-version-check pub deps --style=list Received device: adb-SWVOFYZ9PVBAEY75-tt3xKO._adb-tls-connect._tcp. Received 10 --dart-define(s) (0 custom, 10 internal) Received internal --dart-define: PATROL_WAIT=0 Received internal --dart-define: PATROL_APP_PACKAGE_NAME=com.myapp.myapp Received internal --dart-define: PATROL_APP_BUNDLE_ID=com.myapp.myapp Received internal --dart-define: PATROL_ANDROID_APP_NAME=Techswop Received internal --dart-define: PATROL_IOS_APP_NAME=Techswop Received internal --dart-define: INTEGRATION_TEST_SHOULD_REPORT_RESULTS_TO_NATIVE=false Received internal --dart-define: PATROL_TEST_LABEL_ENABLED=true Received internal --dart-define: PATROL_HOT_RESTART=true Received internal --dart-define: PATROL_TEST_SERVER_PORT=8081 Received internal --dart-define: PATROL_APP_SERVER_PORT=8082 $ flutter build apk --config-only -t integration_test/test_bundle.dart $ flutter doctor --verbose • Building apk with entrypoint test_bundle.dart... $ ./gradlew :app:assembleDebug -Ptarget=/Users/myMac/Documents/trade_in_mobile_app/integration_test/test_bundle.dart -Pdart-defines=UEFUUk9MX1dBSVQ9MA==,UEFUUk9MX0FQUF9QQUNLQUdFX05BTUU9Y29tLnRlY2hidXNpbmVzcy50ZWNoc3dvcA==,UEFUUk9MX0FQUF9CVU5ETEVfSUQ9Y29tLnRlY2hidXNpbmVzcy50ZWNoc3dvcA==,UEFUUk9MX0FORFJPSURfQVBQX05BTUU9VGVjaHN3b3A=,UEFUUk9MX0lPU19BUFBfTkFNRT1UZWNoc3dvcA==,SU5URUdSQVRJT05fVEVTVF9TSE9VTERfUkVQT1JUX1JFU1VMVFNfVE9fTkFUSVZFPWZhbHNl,UEFUUk9MX1RFU1RfTEFCRUxfRU5BQkxFRD10cnVl,UEFUUk9MX0hPVF9SRVNUQVJUPXRydWU=,UEFUUk9MX1RFU1RfU0VSVkVSX1BPUlQ9ODA4MQ==,UEFUUk9MX0FQUF9TRVJWRVJfUE9SVD04MDgy -Papp-server-port=8082 -Ptest-server-port=8081 : > Task :gradle:compileJava NO-SOURCE : > Task :gradle:compileGroovy UP-TO-DATE : > Task :gradle:pluginDescriptors UP-TO-DATE : > Task :gradle:processResources UP-TO-DATE : > Task :gradle:classes UP-TO-DATE : > Task :gradle:jar UP-TO-DATE : > Task :app:preBuild UP-TO-DATE : > Task :app:preDebugBuild UP-TO-DATE : > Task :app:mergeDebugNativeDebugMetadata NO-SOURCE : > Task :android_id:checkKotlinGradlePluginConfigurationErrors : > Task :android_id:preBuild UP-TO-DATE : > Task :android_id:preDebugBuild UP-TO-DATE : > Task :android_id:generateDebugResValues UP-TO-DATE : > Task :android_id:generateDebugResources UP-TO-DATE : > Task :android_id:packageDebugResources UP-TO-DATE : > Task :android_id:parseDebugLocalResources UP-TO-DATE : > Task :android_id:generateDebugRFile UP-TO-DATE : > Task :android_id:compileDebugKotlin UP-TO-DATE : > Task :android_id:javaPreCompileDebug UP-TO-DATE : > Task :android_id:compileDebugJavaWithJavac NO-SOURCE : > Task :android_id:bundleLibCompileToJarDebug UP-TO-DATE : > Task :app:checkKotlinGradlePluginConfigurationErrors : : > Task :app:compileFlutterBuildDebug : : > Task :app:compileFlutterBuildDebug FAILED : : Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0. : : You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins. : : For more on this, please refer to https://docs.gradle.org/8.4/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation. : 15 actionable tasks: 3 executed, 12 up-to-date ✗ Failed to build apk with entrypoint test_bundle.dart (Gradle build failed with code 1) (7.5s) #0 AndroidTestBackend.build. (package:patrol_cli/src/android/android_test_backend.dart:77: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:47:5) #3 DevelopCommand._build (package:patrol_cli/src/commands/develop.dart:266:7) #4 DevelopCommand.run (package:patrol_cli/src/commands/develop.dart:237:5) #5 CommandRunner.runCommand (package:args/command_runner.dart:212:13) #6 PatrolCommandRunner.runCommand (package:patrol_cli/src/runner/patrol_command_runner.dart:348:18) #7 PatrolCommandRunner.run (package:patrol_cli/src/runner/patrol_command_runner.dart:292:18) #8 patrolCommandRunner (package:patrol_cli/src/runner/patrol_command_runner.dart:70:20) #9 main (file:///Users/myMac/.pub-cache/hosted/pub.dev/patrol_cli-3.1.0/bin/main.dart:6:20) ```
jBorkowska commented 2 months ago

Hi @famasf1 ! Currently we assume that all your tests are in integration_test folder, which is placed in root folder of your project. We made this simplification a while ago, but maybe we should get back to this again. Let's treat this issue as feature request