-
Notifications
You must be signed in to change notification settings - Fork 149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for Flutter Web Apps in Patrol #733
Comments
Hi @appbieger, it's great to hear that Patrol works for you :) And thanks for raising this feature request. Patrol basically consists of 2 components:
The former depends only on pure Flutter, so I see no reason why it shouldn't work on Flutter Web. (That said, I haven't got much experience with UI tests on Flutter Web, so I might be missing something) The latter depends on the underlying platform frameworks (UIAutomator2 for Android and XCUITest for iOS), and I don't know how it relates to the web. Is it already possible to tap a browser-default popup with Flutter finders on web? FWIW, my project lead (@mateuszwojtczak) and I evaluated how Patrol could support Flutter Web some time ago and it seemed to be possible, but we're currently focusing exclusively on mobile. That said, if you'd like to share some useful info or contribute, we're more than happy :) |
Having web support would be amazing. We already use the default flutter integration testing, but patrol is much better. I am trying to do a bundled_test for the web, but it says no devices attached. Is it possible to add chrome as a device? |
Unfortunately, it's not. Currently, we have iOS and Android hardcoded, and other platforms are simply ignored. It can be changed quite easily, but web is not our priority right now. Out of curiosity, what specific Patrol features do you want to use on the Web? |
The main attraction towards patrol for the web is the removing the huge amount of boilerplate code and support for the bundling of tests with one run of the app. |
If you only want to use this feature, then you're good to go :) Patrol basically consists of 2 main features: custom finders and native automation. The first depends only on Flutter itself, so you can it use everywhere where Flutter runs. If you're only using custom finders, then you can run your tests with
This is also possible to do on the web. |
The documented example requires the use of |
Yeah, because we're currently focused on mobile only, so it makes sense to include such instructions. Sorry about the confusion. If you want to run it on the web, you can just do run it with |
Just for reference for other web users, we can still use bundled testing as per the Patrol Documentation and Custom Finders:
|
Running my tests (don't use any @jaxnz did you need to call
Is I assumed, one needs to set |
Generally I think this is a very important feature as otherwise one would have to write the same tests using I was a bit surprised to be honest that nothing regarding web is written in the patrol README or documentation, as I would assume most users would switch from already written stock |
Use [`package:patrol`](https://pub.dev/packages/patrol) for integration/e2e tests for Android. The biggest benefit is that each test can run from a completely clean state, which is not possible with the `integration_test` package. Because of this we shouldn't have the issues with e.g. the auth state being kept for each test (or logging out and back in which breaks stuff). For other platforms I kept our old tests (renamed to `integration_test/integration_test_old.dart`): * Web should theoretically work as long as no native interaction is used, but I couldn't set it up practically. There is an [open issue for web ](leancodepl/patrol#733) in their repo. * iOS should work, but I couldn't get it running. * macOS is never mentioned, so I don't know if it's possible to run tests for mac. From https://patrol.leancode.co/: > Patrol lets you [access native features of the platform](https://patrol.leancode.co/native/overview) that the Flutter app is running on. Finally, you can interact with permission dialogs, notifications, WebViews, change device settings, toggle Wi-Fi, and much more – and you can code this very easily in plain Dart. > > Patrol also provides a [new custom finder system](https://patrol.leancode.co/finders/overview) that extends Flutter's default finders, making them shorter and easier to understand. Patrol's custom finders, coupled with [Hot Restart](https://patrol.leancode.co/cli-commands/develop), make writing integration tests dramatically faster, easier and more fun! Command to running the tests: ``` patrol build android \ --flavor prod \ --dart-define [email protected] \ --dart-define USER_1_PASSWORD=foobar \ -t integration_test/app_test.dart ```
Use [`package:patrol`](https://pub.dev/packages/patrol) for integration/e2e tests for Android. The biggest benefit is that each test can run from a completely clean state, which is not possible with the `integration_test` package. Because of this we shouldn't have the issues with e.g. the auth state being kept for each test (or logging out and back in which breaks stuff). For other platforms I kept our old tests (renamed to `integration_test/integration_test_old.dart`): * Web should theoretically work as long as no native interaction is used, but I couldn't set it up practically. There is an [open issue for web ](leancodepl/patrol#733) in their repo. * iOS should work, but I couldn't get it running. * macOS is never mentioned, so I don't know if it's possible to run tests for mac. From https://patrol.leancode.co/: > Patrol lets you [access native features of the platform](https://patrol.leancode.co/native/overview) that the Flutter app is running on. Finally, you can interact with permission dialogs, notifications, WebViews, change device settings, toggle Wi-Fi, and much more – and you can code this very easily in plain Dart. > > Patrol also provides a [new custom finder system](https://patrol.leancode.co/finders/overview) that extends Flutter's default finders, making them shorter and easier to understand. Patrol's custom finders, coupled with [Hot Restart](https://patrol.leancode.co/cli-commands/develop), make writing integration tests dramatically faster, easier and more fun! Command to running the tests: ``` patrol build android \ --flavor prod \ --dart-define [email protected] \ --dart-define USER_1_PASSWORD=foobar \ -t integration_test/app_test.dart ```
@Jonas-Sander hi , does it mean you can run integration test on on my end it's open a browser to your integration but not simulating , no error in console after all and all testing is passed here is my command to run my integration test:
|
I usually run them in headless mode. I tried |
@jaxnz Cou you explain this more? In my this doesn't work because flutter drive \
--driver=test_driver/integration_test.dart \
--target=integration_test/test_bundle.dart \
-d chrome Error:
|
I have an iOS and Android project that uses Patrol for testing. We are now working on a web port of the project and would like to use our existing Patrol tests for the web version as well. However, as far as I understand, it is currently not possible to use any subset of our tests on the web version because Patrol does not support Flutter Web Apps.
Is there a possibility that Patrol will support Flutter Web Apps in the near future? This would be a huge help for our project and would greatly improve our testing workflow. Thank you for considering this request.
The text was updated successfully, but these errors were encountered: