Skip to content
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

Unable to get the device type while running flutter driver. #219

Open
TharaniP opened this issue Nov 13, 2020 · 0 comments
Open

Unable to get the device type while running flutter driver. #219

TharaniP opened this issue Nov 13, 2020 · 0 comments

Comments

@TharaniP
Copy link

Hi mmcc007,
I am trying to get the device type using screenshots package. For that i have activated screenshots using this command: pub global activate screenshots.
And added screenshots: ^2.1.1 pub dependency in yaml file in my app.
Then added screenshots.yaml file in the root directory.

  1. screenshots.yaml:

Screen capture tests

Note: flutter driver expects a pair of files eg, main.dart and main_test.dart

tests:

  • test_driver/app.dart
  • test_driver/app_test.dart

Interim location of screenshots from tests before processing

staging: /tmp/screenshots

A list of locales supported in app

locales:

  • en-US

A list of devices to run tests on

devices:
ios:
iPhone 11 Pro Max:
frame: false
android:

Frame screenshots

frame: false

  1. app_test.dart:

import 'package:flutter_driver/flutter_driver.dart';
import 'package:screenshots/screenshots.dart';
import 'package:test/test.dart';
void main() {

group('Forward Ten4_Test_Automation', () {
FlutterDriver driver;
setUpAll(() async {

final config = Config(configPath: 'screenshots.yaml');

final screenshotsEnv = config.screenshotsEnv;
print('screenshotsEnv: $screenshotsEnv');

driver = await FlutterDriver.connect();
}
});
}

While running this command flutter drive --target=test_driver/app.dart, getting the following error:

FileSystemException: Cannot open file, path = '/tmp/screenshots/env.json' (OS Error: No such file or directory, errno = 2)

dart:io/file_impl.dart 356:9 _File.open.
package:stack_trace/src/stack_zone_specification.dart 126:26 StackZoneSpecification._registerUnaryCallback..
package:stack_trace/src/stack_zone_specification.dart 208:15 StackZoneSpecification._run
package:stack_trace/src/stack_zone_specification.dart 126:14 StackZoneSpecification._registerUnaryCallback.
dart:async/zone.dart 1198:47 _rootRunUnary
dart:async/zone.dart 1100:19 _CustomZone.runUnary
dart:async/future_impl.dart 143:18 _FutureListener.handleValue
dart:async/future_impl.dart 696:45 Future._propagateToListeners.handleValueCallback
dart:async/future_impl.dart 725:32 Future._propagateToListeners
dart:async/future_impl.dart 529:5 Future._completeWithValue
dart:async/future_impl.dart 567:7 Future._asyncCompleteWithValue.
package:stack_trace/src/stack_zone_specification.dart 208:15 StackZoneSpecification._run
package:stack_trace/src/stack_zone_specification.dart 116:48 StackZoneSpecification._registerCallback.
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.
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/isolate_patch.dart 169:5 _RawReceivePortImpl._handleMessage
===== asynchronous gap ===========================
dart:async/zone.dart 1121:19 _CustomZone.registerUnaryCallback
dart:async/future_impl.dart 280:23 Future.then
dart:io/file_impl.dart 354:60 _File.open
dart:io/file_impl.dart 527:12 _File.readAsBytes
dart:io/file_impl.dart 574:12 _File.readAsString
package:screenshots/src/config.dart 141:51 Config._retrieveEnv
package:screenshots/src/config.dart 109:42 Config.screenshotsEnv
test_driver/app_test.dart 21:37 main..
package:test_api/src/backend/declarer.dart 310:70 Declarer._setUpAll...
dart:async/future.dart 512:26 Future.forEach.
dart:async/future.dart 554:26 Future.doWhile.
package:stack_trace/src/stack_zone_specification.dart 126:26 StackZoneSpecification._registerUnaryCallback..
package:stack_trace/src/stack_zone_specification.dart 208:15 StackZoneSpecification._run
package:stack_trace/src/stack_zone_specification.dart 126:14 StackZoneSpecification._registerUnaryCallback.
dart:async/zone.dart 1198:47 _rootRunUnary
dart:async/zone.dart 1100:19 _CustomZone.runUnary
dart:async/zone.dart 1005:7 _CustomZone.runUnaryGuarded
dart:async/zone.dart 1042:26 _CustomZone.bindUnaryCallbackGuarded.
dart:async/future.dart 570:18 Future.doWhile
dart:async/future.dart 510:12 Future.forEach
package:test_api/src/backend/declarer.dart 310:24 Declarer._setUpAll..
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 309:14 Declarer._setUpAll.
package:test_api/src/backend/invoker.dart 231:15 Invoker.waitForOutstandingCallbacks.
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 228:5 Invoker.waitForOutstandingCallbacks
package:test_api/src/backend/invoker.dart 383:17 Invoker._onRun...
===== asynchronous gap ===========================
dart:async/zone.dart 1121:19 _CustomZone.registerUnaryCallback
dart:async/zone.dart 1041:22 _CustomZone.bindUnaryCallbackGuarded
dart:async/future.dart 550:34 Future.doWhile
dart:async/future.dart 510:12 Future.forEach
package:test_api/src/backend/declarer.dart 310:24 Declarer._setUpAll..
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 309:14 Declarer._setUpAll.
package:test_api/src/backend/invoker.dart 231:15 Invoker.waitForOutstandingCallbacks.
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 228:5 Invoker.waitForOutstandingCallbacks
package:test_api/src/backend/invoker.dart 383:17 Invoker._onRun...
===== asynchronous gap ===========================
dart:async/zone.dart 1121:19 _CustomZone.registerUnaryCallback
dart:async-patch/async_patch.dart 83:23 _asyncThenWrapperHelper
package:test_api/src/backend/invoker.dart Invoker._onRun...
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 370:9 Invoker._onRun..
package:test_api/src/backend/invoker.dart 415:15 Invoker._guardIfGuarded
package:test_api/src/backend/invoker.dart 369:7 Invoker._onRun.
package:stack_trace/src/chain.dart 104:24 Chain.capture.
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 102:12 Chain.capture
package:test_api/src/backend/invoker.dart 368:11 Invoker._onRun
package:test_api/src/backend/live_test_controller.dart 153:11 LiveTestController.run
dart:async/future.dart 201:37 new Future.microtask.
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.
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.
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

Expected Result: I am trying to get the device type like below while running flutter driver.

     final screenshotsEnv = await config.screenshotsEnv;
     if (screenshotsEnv['device_type'] == 'ios') { } else {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant