screenshots
screenshots copied to clipboard
[Android] Last layer tree was null when screenshotting.
I'm getting this error when I execute something like this in Android:
test('enter to profile', () async {
await Future.delayed(const Duration(seconds: 10), () {});
await driver.tap(buttonGoogle);
// here I press by myself the Google account
await Future.delayed(const Duration(seconds: 25), () {});
// main screen to capture
await screenshot(driver, config, '0');
// go to profile screen
await Future.delayed(const Duration(seconds: 5), () {});
await driver.tap(buttonProfile);
await Future.delayed(const Duration(seconds: 5), () {});
await screenshot(driver, config, '1');
}, timeout: Timeout(Duration(seconds: 2020)));
The test doesn't fail if I don't include the screenshot execution.
I don't have any problem in iOS.
Trace:
E/flutter ( 7012): [ERROR:flutter/shell/common/rasterizer.cc(561)] Last layer tree was null when screenshotting.
00:43 +0 -1: Landa App enter to profile [E]
JSON-RPC error -32000: Could not capture image screenshot.
package:json_rpc_2/src/client.dart 110:62 Client.sendRequest
package:json_rpc_2/src/peer.dart 99:15 Peer.sendRequest
package:flutter_driver/src/driver/vmservice_driver.dart 361:53 VMServiceFlutterDriver.screenshot
===== asynchronous gap ===========================
dart:async/zone.dart 1121:19 _CustomZone.registerUnaryCallback
dart:async-patch/async_patch.dart 83:23 _asyncThenWrapperHelper
package:screenshots/src/capture_screen.dart 18:33 screenshot
===== asynchronous gap ===========================
dart:async/zone.dart 1121:19 _CustomZone.registerUnaryCallback
dart:async-patch/async_patch.dart 83:23 _asyncThenWrapperHelper
test_driver/app_test.dart 35:13 main.<fn>.<fn>
===== asynchronous gap ===========================
dart:async/zone.dart 1121:19 _CustomZone.registerUnaryCallback
dart:async-patch/async_patch.dart 83:23 _asyncThenWrapperHelper
test_driver/app_test.dart main.<fn>.<fn>
package:test_api/src/backend/declarer.dart 172:27 Declarer.test.<fn>.<fn>.<fn>
===== asynchronous gap ===========================
dart:async/zone.dart 1121:19 _CustomZone.registerUnaryCallback
dart:async-patch/async_patch.dart 83:23 _asyncThenWrapperHelper
package:test_api/src/backend/declarer.dart Declarer.test.<fn>.<fn>.<fn>
package:test_api/src/backend/invoker.dart 246:15 Invoker.waitForOutstandingCallbacks.<fn>
dart:async/zone.dart 1190:13 _rootRun
dart:async/zone.dart 1093:19 _CustomZone.run
dart:async/zone.dart 1630:10 _runZoned
dart:async/zone.dart 1550:10 runZoned
package:test_api/src/backend/invoker.dart 243:5 Invoker.waitForOutstandingCallbacks
package:test_api/src/backend/declarer.dart 170:33 Declarer.test.<fn>.<fn>
dart:async/zone.dart 1190:13 _rootRun
dart:async/zone.dart 1093:19 _CustomZone.run
dart:async/zone.dart 1630:10 _runZoned
dart:async/zone.dart 1550:10 runZoned
package:test_api/src/backend/declarer.dart 169:13 Declarer.test.<fn>
package:test_api/src/backend/invoker.dart 400:30 Invoker._onRun.<fn>.<fn>.<fn>.<fn>
dart:async/future.dart 174:37 new Future.<fn>
package:stack_trace/src/stack_zone_specification.dart 209:15 StackZoneSpecification._run
package:stack_trace/src/stack_zone_specification.dart 119:48 StackZoneSpecification._registerCallback.<fn>
dart:async/zone.dart 1182:47 _rootRun
dart:async/zone.dart 1093:19 _CustomZone.run
dart:async/zone.dart 997:7 _CustomZone.runGuarded
dart:async/zone.dart 1037:23 _CustomZone.bindCallbackGuarded.<fn>
package:stack_trace/src/stack_zone_specification.dart 209:15 StackZoneSpecification._run
package:stack_trace/src/stack_zone_specification.dart 119:48 StackZoneSpecification._registerCallback.<fn>
dart:async/zone.dart 1190:13 _rootRun
dart:async/zone.dart 1093:19 _CustomZone.run
dart:async/zone.dart 1021:23 _CustomZone.bindCallback.<fn>
dart:async-patch/timer_patch.dart 18:15 Timer._createTimer.<fn>
dart:isolate-patch/timer_impl.dart 397:19 _Timer._runTimers
dart:isolate-patch/timer_impl.dart 428:5 _Timer._handleMessage
dart:isolate-patch/isolate_patch.dart 168:12 _RawReceivePortImpl._handleMessage
===== asynchronous gap ===========================
dart:async/zone.dart 1114:19 _CustomZone.registerCallback
dart:async/zone.dart 1036:22 _CustomZone.bindCallbackGuarded
dart:async/timer.dart 52:45 new Timer
dart:async/timer.dart 89:9 Timer.run
dart:async/future.dart 172:11 new Future
package:test_api/src/backend/invoker.dart 399:21 Invoker._onRun.<fn>.<fn>.<fn>
dart:async/zone.dart 1190:13 _rootRun
dart:async/zone.dart 1093:19 _CustomZone.run
dart:async/zone.dart 1630:10 _runZoned
dart:async/zone.dart 1550:10 runZoned
package:test_api/src/backend/invoker.dart 387:9 Invoker._onRun.<fn>.<fn>
package:test_api/src/backend/invoker.dart 438:15 Invoker._guardIfGuarded
package:test_api/src/backend/invoker.dart 386:7 Invoker._onRun.<fn>
package:stack_trace/src/chain.dart 101:24 Chain.capture.<fn>
dart:async/zone.dart 1190:13 _rootRun
dart:async/zone.dart 1093:19 _CustomZone.run
dart:async/zone.dart 1630:10 _runZoned
dart:async/zone.dart 1550:10 runZoned
package:stack_trace/src/chain.dart 99:12 Chain.capture
package:test_api/src/backend/invoker.dart 385:11 Invoker._onRun
package:test_api/src/backend/live_test_controller.dart 152:11 LiveTestController.run
dart:async/future.dart 200:37 new Future.microtask.<fn>
dart:async/zone.dart 1182:47 _rootRun
dart:async/zone.dart 1093:19 _CustomZone.run
dart:async/zone.dart 997:7 _CustomZone.runGuarded
dart:async/zone.dart 1037:23 _CustomZone.bindCallbackGuarded.<fn>
dart:async/zone.dart 1190:13 _rootRun
dart:async/zone.dart 1093:19 _CustomZone.run
dart:async/zone.dart 997:7 _CustomZone.runGuarded
dart:async/zone.dart 1037:23 _CustomZone.bindCallbackGuarded.<fn>
dart:async/schedule_microtask.dart 41:21 _microtaskLoop
dart:async/schedule_microtask.dart 50:5 _startMicrotaskLoop
dart:isolate-patch/isolate_patch.dart 118:13 _runPendingImmediateCallback
dart:isolate-patch/timer_impl.dart 404:11 _Timer._runTimers
dart:isolate-patch/timer_impl.dart 428:5 _Timer._handleMessage
dart:isolate-patch/isolate_patch.dart 168:12 _RawReceivePortImpl._handleMessage
00:43 +0 -1: Landa App (tearDownAll)
00:43 +0 -1: Some tests failed.
Unhandled exception:
Dummy exception to set exit code.
Stopping application instance.
Driver tests failed: 255
Unhandled exception:
command failed: exitcode=255, cmd='flutter -d emulator-5554 drive test_driver/app.dart', workingDirectory=., mode=normal
#0 streamCmd (package:screenshots/src/utils.dart:405:7)
<asynchronous suspension>
#1 Screenshots.runProcessTests (package:screenshots/src/run.dart:403:13)
#2 Screenshots.runTestsOnAll (package:screenshots/src/run.dart:353:17)
<asynchronous suspension>
#3 Screenshots.run (package:screenshots/src/run.dart:127:11)
<asynchronous suspension>
#4 screenshots.<anonymous closure> (package:screenshots/src/run.dart:48:26)
#5 AppContext.run.<anonymous closure> (package:tool_base/src/base/context.dart:154:29)
#6 _rootRun (dart:async/zone.dart:1190:13)
#7 _CustomZone.run (dart:async/zone.dart:1093:19)
#8 _runZoned (dart:async/zone.dart:1630:10)
#9 runZoned (dart:async/zone.dart:1550:10)
#10 AppContext.run (package:tool_base/src/base/context.dart:153:18)
#11 runInContext (package:screenshots/src/context_runner.dart:16:24)
#12 screenshots (package:screenshots/src/run.dart:47:12)
#13 main (file:///Users/efraespada/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/screenshots-2.1.1/bin/main.dart:122:25)
<asynchronous suspension>
#14 _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:299:32)
#15 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168:12)