patrol icon indicating copy to clipboard operation
patrol copied to clipboard

To solve the wait for {app_id) to idle, we should remove the "FLUTTER_TARGET" Flag, how to avoid this?

Open radyhaggag opened this issue 10 months ago • 2 comments

Now, i have 4 flavors, each flavors has a seperate main_{flavor}.dart file, so if i removed this flag FLUTTER_TARGET How can i set the correct target?

If i run the following command flutter build ios --config-only i should pass the flavor like flutter build ios --config-only --flavor uitest

but this will make all the targets is the same target, and this wrong.

So how can i solve this problem?

radyhaggag avatar Feb 02 '25 18:02 radyhaggag

Hi @radyhaggag. When running Patrol tests, actual entry point/target of the app is test_bundle.dart. This is a generated wrapper that handles all the Patrol-specific operations before and after running your tests. Setting the FLUTTER_TARGET variable for a given flavor causes tests run on that flavor to start from the specified FLUTTER_TARGET instead of test_bundle.dart. This results in the process hanging during test execution. If you want to run test on uitest flavor, what you have to do is pass --flavor uitests (or set it in pubspec.yaml patrol section) and use at the beginning of your test, use "flavor specific" startup method to run the app.

piotruela avatar Feb 06 '25 16:02 piotruela

Hi @radyhaggag. When running Patrol tests, actual entry point/target of the app is test_bundle.dart. This is a generated wrapper that handles all the Patrol-specific operations before and after running your tests. Setting the FLUTTER_TARGET variable for a given flavor causes tests run on that flavor to start from the specified FLUTTER_TARGET instead of test_bundle.dart. This results in the process hanging during test execution. If you want to run test on uitest flavor, what you have to do is pass --flavor uitests (or set it in pubspec.yaml patrol section) and use at the beginning of your test, use "flavor specific" startup method to run the app.

Yes i know that, i specify the flavor and everything run fine, but the problem that i want to set the target to a specific main file to run in ci/cd like upload to app-store connect and so on.

Currently i solved the problem from my side, when i run the tests in ci cd, i created a dart script to remove the Flutter target from the project in the workflow.

But i think if you can find a better solution to help the developers to deal with this problem faster will be good point.

And thanks for your efforts and thanks for patrol developers this is a great tool to use.

radyhaggag avatar Feb 09 '25 13:02 radyhaggag

Hi @radyhaggag. When running Patrol tests, actual entry point/target of the app is test_bundle.dart. This is a generated wrapper that handles all the Patrol-specific operations before and after running your tests. Setting the FLUTTER_TARGET variable for a given flavor causes tests run on that flavor to start from the specified FLUTTER_TARGET instead of test_bundle.dart. This results in the process hanging during test execution. If you want to run test on uitest flavor, what you have to do is pass --flavor uitests (or set it in pubspec.yaml patrol section) and use at the beginning of your test, use "flavor specific" startup method to run the app.

Yes i know that, i specify the flavor and everything run fine, but the problem that i want to set the target to a specific main file to run in ci/cd like upload to app-store connect and so on.

Currently i solved the problem from my side, when i run the tests in ci cd, i created a dart script to remove the Flutter target from the project in the workflow.

But i think if you can find a better solution to help the developers to deal with this problem faster will be good point.

And thanks for your efforts and thanks for patrol developers this is a great tool to use.

@radyhaggag - how did you solve it? I have a similar problem in my project and after simply removing the FLUTTER_TARGET result in test just hanging on the patrol test execution. iOS app is started but there is nothing happening (a test is a very simple one, with an assertion after starting the app). We are using multiple main.dart files and also multiple iOS schemes.

The project is already in development for quite a while, but the goal now is to start covering regression end-to-end tests and I am stuck at integrating patrol into it.

Regards!

matnicpon avatar Aug 06 '25 06:08 matnicpon

Same!. I have 2 flavors, each flavor will have the different configures including different main entry. Flavor files (xconfig): dev.xcconfig

  • FLUTTER_TARGET=main_dev.dart

prod.xcconfig

  • FLUTTER_TARGET=main_prod.dart

After i run command:

  1. patrol test It stops here: Runner[32106:240994] [TraitCollection] Class CKBrowserSwitcherViewController overrides the -traitCollection getter, which is not supported. If you're trying to override traits, you must use the appropriate API. t = nans Setting up automation session t = nans Wait for com.upbet.staging to idle
  2. patrol develop It only runs the test till i press R to hot restart.

I dont know why it happened because the Generated.xcconfig from xcode clearly show that ... FLUTTER_TARGET=/Users/mac/Documents/AC_Project/upcoz-mobile/integration_test/test_bundle.dart ...

maxakak1998 avatar Aug 07 '25 04:08 maxakak1998

@maxakak1998 Calling flutter build ios --config-only --flavor dev -t lib/main_dev.dart doesn't help?

pdenert avatar Aug 07 '25 11:08 pdenert

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.

github-actions[bot] avatar Aug 23 '25 09:08 github-actions[bot]