I have written three simple integration tests that are located in a test directory. I run work on Windows and I use an Android emulator. They always fail on Codemagic (macOS Standard VM, 2.3GHz Quad Core / 8GB). I don't know why but it uses this flag to run the tests:
flutter test --machine
And even with the
--machine flag the tests run perfectly on my machine.
Now here are the logs when running on my machine:
{"protocolVersion":"0.1.1","runnerVersion":null,"pid":17888,"type":"start","time":0}
{"suite":{"id":0,"platform":"vm","path":"D:\\delivery\\organia-app\\test\\app_test.dart"},"type":"suite","time":0}
{"test":{"id":1,"name":"loading D:\\delivery\\organia-app\\test\\app_test.dart","suiteID":0,"groupIDs":[],"metadata":{"skip":false,"skipReason":null},"line":null,"column":null,"url":null},"type":"testStart","time":1}
{"count":1,"time":11,"type":"allSuites"}
[{"event":"test.startedProcess","params":{"observatoryUri":null}}]
{"testID":1,"result":"success","skipped":false,"hidden":true,"type":"testDone","time":2818}
{"group":{"id":2,"suiteID":0,"parentID":null,"name":"","metadata":{"skip":false,"skipReason":null},"testCount":3,"line":null,"column":null,"url":null},"type":"group","time":2824}
{"group":{"id":3,"suiteID":0,"parentID":2,"name":"Tests","metadata":{"skip":false,"skipReason":null},"testCount":3,"line":11,"column":3,"url":"file:///D:/delivery/organia-app/test/app_test.dart"},"type":"group","time":2825}
{"test":{"id":4,"name":"Tests Bottom Tab bar navigation","suiteID":0,"groupIDs":[2,3],"metadata":{"skip":false,"skipReason":null},"line":153,"column":5,"url":"package:flutter_test/src/widget_tester.dart","root_line":12,"root_column":5,"root_url":"file:///D:/delivery/organia-app/test/app_test.dart"},"type":"testStart","time":2826}
{"testID":4,"messageType":"print","message":"Error loading AssetManifest.json, e: Unable to load asset: AssetManifest.json","type":"print","time":3843}
{"testID":4,"result":"success","skipped":false,"hidden":false,"type":"testDone","time":4769}
{"test":{"id":5,"name":"Tests Register Test","suiteID":0,"groupIDs":[2,3],"metadata":{"skip":false,"skipReason":null},"line":153,"column":5,"url":"package:flutter_test/src/widget_tester.dart","root_line":25,"root_column":5,"root_url":"file:///D:/delivery/organia-app/test/app_test.dart"},"type":"testStart","time":4770}
{"testID":5,"result":"success","skipped":false,"hidden":false,"type":"testDone","time":7083}
{"test":{"id":6,"name":"Tests Login Test","suiteID":0,"groupIDs":[2,3],"metadata":{"skip":false,"skipReason":null},"line":153,"column":5,"url":"package:flutter_test/src/widget_tester.dart","root_line":53,"root_column":5,"root_url":"file:///D:/delivery/organia-app/test/app_test.dart"},"type":"testStart","time":7084}
{"testID":6,"result":"success","skipped":false,"hidden":false,"type":"testDone","time":9332}
{"test":{"id":7,"name":"(tearDownAll)","suiteID":0,"groupIDs":[2],"metadata":{"skip":false,"skipReason":null},"line":42,"column":5,"url":"package:integration_test/integration_test.dart","root_line":8,"root_column":40,"root_url":"file:///D:/delivery/organia-app/test/app_test.dart"},"type":"testStart","time":9332}
{"testID":7,"messageType":"print","message":"Warning: integration_test plugin was not detected.","type":"print","time":9338}
{"testID":7,"messageType":"print","message":"","type":"print","time":9339}
{"testID":7,"messageType":"print","message":"If you're running the tests with `flutter drive`, please make sure your tests","type":"print","time":9339}
{"testID":7,"messageType":"print","message":"are in the `integration_test/` directory of your package and use","type":"print","time":9339}
{"testID":7,"messageType":"print","message":"`flutter test $path_to_test` to run it instead.","type":"print","time":9340}
{"testID":7,"messageType":"print","message":"","type":"print","time":9340}
{"testID":7,"messageType":"print","message":"If you're running the tests with Android instrumentation or XCTest, this means","type":"print","time":9340}
{"testID":7,"messageType":"print","message":"that you are not capturing test results properly! See the following link for","type":"print","time":9340}
{"testID":7,"messageType":"print","message":"how to set up the integration_test plugin:","type":"print","time":9341}
{"testID":7,"messageType":"print","message":"","type":"print","time":9341}
{"testID":7,"messageType":"print","message":"https://flutter.dev/docs/testing/integration-tests#testing-on-firebase-test-lab","type":"print","time":9341}
{"testID":7,"messageType":"print","message":"","type":"print","time":9342}
{"testID":7,"result":"success","skipped":false,"hidden":true,"type":"testDone","time":9342}
{"success":true,"type":"done","time":9384}
And here is the Codemagic log:
== QA ==
> flutter analyze
Running "flutter pub get" in clone... 1,971ms
Analyzing clone...
No issues found! (ran in 25.4s)
> flutter test --machine
{"protocolVersion":"0.1.1","runnerVersion":null,"pid":2616,"type":"start","time":0}
{"suite":{"id":0,"platform":"vm","path":"/Users/builder/clone/test/app_test.dart"},"type":"suite","time":1}
{"test":{"id":1,"name":"loading /Users/builder/clone/test/app_test.dart","suiteID":0,"groupIDs":[],"metadata":{"skip":false,"skipReason":null},"line":null,"column":null,"url":null},"type":"testStart","time":3}
{"count":1,"time":16,"type":"allSuites"}
[{"event":"test.startedProcess","params":{"observatoryUri":null}}]
{"testID":1,"result":"success","skipped":false,"hidden":true,"type":"testDone","time":25585}
{"group":{"id":2,"suiteID":0,"parentID":null,"name":"","metadata":{"skip":false,"skipReason":null},"testCount":3,"line":null,"column":null,"url":null},"type":"group","time":25595}
{"group":{"id":3,"suiteID":0,"parentID":2,"name":"Navigation Tests","metadata":{"skip":false,"skipReason":null},"testCount":3,"line":11,"column":3,"url":"file:///Users/builder/clone/test/app_test.dart"},"type":"group","time":25596}
{"test":{"id":4,"name":"Navigation Tests Bottom Tab bar navigation","suiteID":0,"groupIDs":[2,3],"metadata":{"skip":false,"skipReason":null},"line":153,"column":5,"url":"package:flutter_test/src/widget_tester.dart","root_line":12,"root_column":5,"root_url":"file:///Users/builder/clone/test/app_test.dart"},"type":"testStart","time":25596}
{"testID":4,"messageType":"print","message":"══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞════════════════════════════════════════════════════","type":"print","time":26162}
{"testID":4,"messageType":"print","message":"The following MissingPluginException was thrown running a test:","type":"print","time":26163}
{"testID":4,"messageType":"print","message":"MissingPluginException(No implementation found for method getApplicationDocumentsDirectory on","type":"print","time":26163}
{"testID":4,"messageType":"print","message":"channel plugins.flutter.io/path_provider_macos)","type":"print","time":26163}
{"testID":4,"messageType":"print","message":"","type":"print","time":26163}
{"testID":4,"messageType":"print","message":"When the exception was thrown, this was the stack:","type":"print","time":26163}
{"testID":4,"messageType":"print","message":"#0 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:175:7)","type":"print","time":26163}
{"testID":4,"messageType":"print","message":"<asynchronous suspension>","type":"print","time":26163}
{"testID":4,"messageType":"print","message":"<asynchronous suspension>","type":"print","time":26164}
{"testID":4,"messageType":"print","message":"(elided one frame from package:stack_trace)","type":"print","time":26164}
{"testID":4,"messageType":"print","message":"","type":"print","time":26165}
{"testID":4,"messageType":"print","message":"The test description was:","type":"print","time":26165}
{"testID":4,"messageType":"print","message":" Bottom Tab bar navigation","type":"print","time":26165}
{"testID":4,"messageType":"print","message":"════════════════════════════════════════════════════════════════════════════════════════════════════","type":"print","time":26165}
{"testID":4,"error":"Test failed. See exception logs above.\nThe test description was: Bottom Tab bar navigation","stackTrace":"","isFailure":false,"type":"error","time":26175}
{"testID":4,"error":"'package:flutter_test/src/binding.dart': Failed assertion: line 1649 pos 12: '_pendingFrame == null': is not true.","stackTrace":"dart:core _AssertionError._throwNew\npackage:flutter_test/src/binding.dart 1649:12 LiveTestWidgetsFlutterBinding.postTest\n","isFailure":false,"type":"error","time":26207}
{"testID":4,"result":"error","skipped":false,"hidden":false,"type":"testDone","time":26207}
{"test":{"id":5,"name":"Navigation Tests Register Test","suiteID":0,"groupIDs":[2,3],"metadata":{"skip":false,"skipReason":null},"line":153,"column":5,"url":"package:flutter_test/src/widget_tester.dart","root_line":25,"root_column":5,"root_url":"file:///Users/builder/clone/test/app_test.dart"},"type":"testStart","time":26208}
{"testID":5,"error":"'package:flutter_test/src/binding.dart': Failed assertion: line 1624 pos 12: '!inTest': is not true.","stackTrace":"dart:core _AssertionError._throwNew\npackage:flutter_test/src/binding.dart 1624:12 LiveTestWidgetsFlutterBinding.runTest\npackage:integration_test/integration_test.dart 223:17 IntegrationTestWidgetsFlutterBinding.runTest\npackage:flutter_test/src/widget_tester.dart 163:24 testWidgets.<fn>\n","isFailure":false,"type":"error","time":26216}
{"testID":5,"error":"'package:flutter_test/src/binding.dart': Failed assertion: line 1648 pos 12: '!_expectingFrame': is not true.","stackTrace":"dart:core _AssertionError._throwNew\npackage:flutter_test/src/binding.dart 1648:12 LiveTestWidgetsFlutterBinding.postTest\n","isFailure":false,"type":"error","time":26220}
{"testID":5,"result":"error","skipped":false,"hidden":false,"type":"testDone","time":26220}
{"test":{"id":6,"name":"Navigation Tests Login Test","suiteID":0,"groupIDs":[2,3],"metadata":{"skip":false,"skipReason":null},"line":153,"column":5,"url":"package:flutter_test/src/widget_tester.dart","root_line":53,"root_column":5,"root_url":"file:///Users/builder/clone/test/app_test.dart"},"type":"testStart","time":26221}
{"testID":4,"messageType":"print","message":"══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞════════════════════════════════════════════════════","type":"print","time":26247}
{"testID":4,"messageType":"print","message":"The following TestFailure was thrown running a test (but after the test had completed):","type":"print","time":26247}
{"testID":4,"messageType":"print","message":"Expected: exactly one matching node in the widget tree","type":"print","time":26247}
{"testID":4,"messageType":"print","message":" Actual: _WidgetIconFinder:<zero widgets with icon \"IconData(U+0F8BD)\" (ignoring offstage widgets)>","type":"print","time":26248}
{"testID":4,"messageType":"print","message":" Which: means none were found but one was expected","type":"print","time":26248}
{"testID":4,"messageType":"print","message":"","type":"print","time":26248}
{"testID":4,"messageType":"print","message":"When the exception was thrown, this was the stack:","type":"print","time":26248}
{"testID":4,"messageType":"print","message":"#0 fail (package:test_api/src/expect/expect.dart:137:31)","type":"print","time":26249}
{"testID":4,"messageType":"print","message":"#1 _expect (package:test_api/src/expect/expect.dart:132:3)","type":"print","time":26249}
{"testID":4,"messageType":"print","message":"#2 expect (package:test_api/src/expect/expect.dart:46:3)","type":"print","time":26249}
{"testID":4,"messageType":"print","message":"#3 expect (package:flutter_test/src/widget_tester.dart:455:16)","type":"print","time":26250}
{"testID":4,"messageType":"print","message":"#4 main.<anonymous closure>.<anonymous closure> (file:///Users/builder/clone/test/app_test.dart:15:7)","type":"print","time":26250}
{"testID":4,"messageType":"print","message":"<asynchronous suspension>","type":"print","time":26250}
{"testID":4,"messageType":"print","message":"<asynchronous suspension>","type":"print","time":26251}
{"testID":4,"messageType":"print","message":"(elided one frame from package:stack_trace)","type":"print","time":26251}
{"testID":4,"messageType":"print","message":"════════════════════════════════════════════════════════════════════════════════════════════════════","type":"print","time":26251}
{"testID":6,"error":"'package:flutter_test/src/binding.dart': Failed assertion: line 1624 pos 12: '!inTest': is not true.","stackTrace":"dart:core _AssertionError._throwNew\npackage:flutter_test/src/binding.dart 1624:12 LiveTestWidgetsFlutterBinding.runTest\npackage:integration_test/integration_test.dart 223:17 IntegrationTestWidgetsFlutterBinding.runTest\npackage:flutter_test/src/widget_tester.dart 163:24 testWidgets.<fn>\n","isFailure":false,"type":"error","time":26264}
{"testID":6,"result":"error","skipped":false,"hidden":false,"type":"testDone","time":26265}
{"test":{"id":7,"name":"(tearDownAll)","suiteID":0,"groupIDs":[2],"metadata":{"skip":false,"skipReason":null},"line":42,"column":5,"url":"package:integration_test/integration_test.dart","root_line":8,"root_column":40,"root_url":"file:///Users/builder/clone/test/app_test.dart"},"type":"testStart","time":26266}
{"testID":7,"messageType":"print","message":"Warning: integration_test plugin was not detected.","type":"print","time":26321}
{"testID":7,"messageType":"print","message":"","type":"print","time":26321}
{"testID":7,"messageType":"print","message":"If you're running the tests with `flutter drive`, please make sure your tests","type":"print","time":26322}
{"testID":7,"messageType":"print","message":"are in the `integration_test/` directory of your package and use","type":"print","time":26322}
{"testID":7,"messageType":"print","message":"`flutter test $path_to_test` to run it instead.","type":"print","time":26323}
{"testID":7,"messageType":"print","message":"","type":"print","time":26323}
{"testID":7,"messageType":"print","message":"If you're running the tests with Android instrumentation or XCTest, this means","type":"print","time":26323}
{"testID":7,"messageType":"print","message":"that you are not capturing test results properly! See the following link for","type":"print","time":26323}
{"testID":7,"messageType":"print","message":"how to set up the integration_test plugin:","type":"print","time":26324}
{"testID":7,"messageType":"print","message":"","type":"print","time":26324}
{"testID":7,"messageType":"print","message":"https://flutter.dev/docs/testing/integration-tests#testing-on-firebase-test-lab","type":"print","time":26324}
{"testID":7,"messageType":"print","message":"","type":"print","time":26324}
{"testID":7,"result":"success","skipped":false,"hidden":true,"type":"testDone","time":26326}
{"success":false,"type":"done","time":26368}
QA failed :|
Flutter test run failed.
== QA failed, ending build ==
Build failed :|
Test run failed: Flutter test run failed.
from the log your error is this one (you can find it in Codemagic UI too)
MissingPluginException(No implementation found for method getApplicationDocumentsDirectory on channel plugins.flutter.io/path_provider_macos)
Seems you need to fix your unit tests that using path_provider package since they can't be run on macOS. Maybe this link https://pub.dev/packages/path_provider#testing will be helpful