Closed martin-braun closed 2 years ago
Unfortunately we can't support integration tests at this stage, as the tests are run on the device instead of the host. This means you can't run cli tools on the host from within the tests.
If they open up some kind of control channel for packages to use, then we can relook at this.
@tim-smart Thanks for the explanation, I'm still getting into Flutter tests, so I have some things that still confuse me, maybe you can give me please some advice?
binding.takeScreenshot
, but this would require to launch it for each device consecutive. My goal is to get automatic screenshots for all device types and get them uploaded to App Store / Play Store all via CodeMagic. At first I thought I run my integration_test for each device that I need the screenshots for, but maybe your package is way better for that task.
So basically:
I really wonder how this is possible, I couldn't find a good doc or blog post that utilizes your package to get this outcome.
Thanks for your time and help. I really appreciate it!
No it doesn't do the devices in parallel. I don't think flutter driver supports running tests in parallel.
If you wanted to do many devices in one go, you would need to resize the canvas for each device resolution, take a screenshot, and then frame it with the system chrome externally.
Taking a screenshot with the built in flutter methods only captures the pixels that flutter renders - which doesn't include status bar icons etc.
Taking a screenshot with the built in flutter methods only captures the pixels that flutter renders - which doesn't include status bar icons etc.
This hits the head of the nail, precisely. Thank you @tim-smart. So I will give your package a go, but I still have to launch my test for each device. Is there any guide or documentation to get your package working in codemagic or any other CI/CD software to get an idea how things need to be put together for maximum automation?
I'm not sure if codemagic supports running emulators / simulators? If yes, then creating a script similar to tools/screenshots.dart
(in this repo) should work.
@tim-smart Thanks a lot. This looks promising. The AVD Manager fails in my case with DeviceError.foreachFailure(phase: _findDevice, message: Could not find device: Nexus_5X, device: null)
though, but I will look into it tomorrow. Also, my $ANDROID_SDK_HOME
variable is unset, but my $ANDROID_HOME
is set here on MacOS with Android Studio. I have a suggestion in regards of this.
So far in my app the tests still not work, but I can see how it wants to run an app build for each iOS device I configure, so I will dig into it, it really looks like your package is the way to go, I'm excited. Also your introduction was helpful.
The new recommend test API is integration tests and it would be nice if this example should be converted to use the new API: https://github.com/flutter/flutter/tree/master/packages/integration_test