@@ -8,15 +8,11 @@ import 'dart:io' as io;
88
99import 'package:file/file.dart' ;
1010import 'package:flutter_plugin_tools/src/common/core.dart' ;
11- import 'package:flutter_plugin_tools/src/common/package_looping_command.dart' ;
1211import 'package:flutter_plugin_tools/src/common/process_runner.dart' ;
1312
1413import 'process_runner_apis.dart' ;
1514import 'tizen_sdk.dart' ;
1615
17- export 'package:flutter_plugin_tools/src/common/package_looping_command.dart'
18- show PackageResult, RunState;
19-
2016/// A reference to a Tizen device (either physical or emulator) that can run
2117/// Flutter applications.
2218///
@@ -114,24 +110,19 @@ class Device {
114110
115111 /// Runs integration test in [workingDir] .
116112 ///
117- /// [workingDir] must be a valid exisiting flutter directory where
118- /// `flutter pub get` has already been ran succesfully. For an app project,
113+ /// [workingDir] must be a valid existing Flutter project directory where
114+ /// `flutter pub get` has already been run succesfully. For an app project,
119115 /// [workingDir] is the app's source root. For a plugin project, [workingDir]
120116 /// is one of the example directories.
121117 ///
122- /// If test doesn't finish after [timeout] , it's considered a failure and the
123- /// function will return [PackageResult.fail] with time expired log.
124- ///
125- /// Returns [PackageResult.success] when every test passes succesfully,
126- /// otherwise returns [PackageResult.fail] . Never returns [PackageResult.skip]
127- /// nor [PackageResult.exclude] .
128- Future <PackageResult > runIntegrationTest (
118+ /// Returns null if all tests have passed successfully before [timeout] ,
119+ /// otherwise returns a string with the error details.
120+ Future <String ?> runIntegrationTest (
129121 Directory workingDir,
130122 Duration timeout,
131123 ) async {
132124 if (! isConnected) {
133- return PackageResult .fail (
134- < String > ['Device $name ($profile ) is not connected.' ]);
125+ return 'Device $name ($profile ) is not connected.' ;
135126 }
136127
137128 final io.Process process = await _processRunner.start (
@@ -166,30 +157,27 @@ class Device {
166157 // guarantee that all buffered outputs of the process have returned.
167158 await completer.future;
168159
169- final List < String > errors = < String > [] ;
160+ String ? error ;
170161 if (timedOut) {
171- errors. add ( 'Timeout expired. The test may need more time to finish. '
162+ error = 'Timeout expired. The test may need more time to finish. '
172163 'If you expect the test to finish before timeout, check if the tests '
173164 'require device screen to be awake or if they require manually '
174- 'clicking the UI button for permissions.' ) ;
165+ 'clicking the UI button for permissions.' ;
175166 } else if (lastLine.startsWith ('No tests ran' )) {
176- errors. add (
177- 'Missing integration tests (use --exclude if this is intentional).' ) ;
167+ error =
168+ 'Missing integration tests (use --exclude if this is intentional).' ;
178169 } else if (lastLine.startsWith ('No devices found' )) {
179- errors. add ( 'Device was disconnected during test.' ) ;
170+ error = 'Device was disconnected during test.' ;
180171 } else {
181172 final RegExpMatch ? match = _logPattern.firstMatch (lastLine);
182173 if (match == null || match.group (2 ) == null ) {
183- throw Exception ( 'Log message is not parsed correctly.' ) ;
174+ error = 'Could not parse the log output.' ;
184175 } else if (! match.group (2 )! .startsWith ('All tests passed!' )) {
185- errors. add ( 'flutter-tizen test integration_test failed, see the output '
186- 'above for details.' ) ;
176+ error = 'flutter-tizen test integration_test failed, see the output '
177+ 'above for details.' ;
187178 }
188179 }
189-
190- return errors.isEmpty
191- ? PackageResult .success ()
192- : PackageResult .fail (errors);
180+ return error;
193181 }
194182}
195183
@@ -240,6 +228,7 @@ class EmulatorDevice extends Device {
240228 final io.ProcessResult result =
241229 _processRunner.runSync (_tizenSdk.emCli.path, < String > ['list-vm' ]);
242230 if (result.exitCode != 0 ) {
231+ print ('Error: Unable to list available emulators.' );
243232 throw ToolExit (result.exitCode);
244233 }
245234
@@ -377,7 +366,7 @@ class EmulatorDevice extends Device {
377366 Future <void > _poll (
378367 FutureOr <bool > Function () function, {
379368 Duration interval = const Duration (seconds: 1 ),
380- Duration timeout = const Duration (minutes: 10 ),
369+ Duration timeout = const Duration (minutes: 5 ),
381370 }) async {
382371 final DateTime start = DateTime .now ();
383372 while (DateTime .now ().difference (start) <= timeout) {
@@ -390,7 +379,7 @@ class EmulatorDevice extends Device {
390379 }
391380
392381 @override
393- Future <PackageResult > runIntegrationTest (
382+ Future <String ? > runIntegrationTest (
394383 Directory workingDir,
395384 Duration timeout,
396385 ) async {
0 commit comments