mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
Improve WebDriver error message (#81107)
* Add link to documentation in error message The current WebDriver message is incomplete. Add link to the documentation on WebDrivers for different browsers to help troubleshooting.
This commit is contained in:
parent
10840352ce
commit
db528a24a3
@ -109,9 +109,11 @@ class WebDriverService extends DriverService {
|
|||||||
);
|
);
|
||||||
} on Exception catch (ex) {
|
} on Exception catch (ex) {
|
||||||
throwToolExit(
|
throwToolExit(
|
||||||
'Unable to start WebDriver Session for Flutter for Web testing. \n'
|
'Unable to start WebDriver Session for Flutter for Web testing.\n'
|
||||||
'Make sure you have the correct WebDriver Server running at $driverPort. \n'
|
'Make sure you have the correct WebDriver Server running at $driverPort.\n'
|
||||||
'Make sure the WebDriver Server matches option --browser-name. \n'
|
'Make sure the WebDriver Server matches option --browser-name.\n'
|
||||||
|
'For more information see: '
|
||||||
|
'https://flutter.dev/docs/testing/integration-tests#running-in-a-browser\n'
|
||||||
'$ex'
|
'$ex'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,7 @@ import 'package:flutter_tools/src/build_info.dart';
|
|||||||
import 'package:flutter_tools/src/convert.dart';
|
import 'package:flutter_tools/src/convert.dart';
|
||||||
import 'package:flutter_tools/src/device.dart';
|
import 'package:flutter_tools/src/device.dart';
|
||||||
import 'package:flutter_tools/src/drive/drive_service.dart';
|
import 'package:flutter_tools/src/drive/drive_service.dart';
|
||||||
|
import 'package:flutter_tools/src/drive/web_driver_service.dart';
|
||||||
import 'package:flutter_tools/src/resident_runner.dart';
|
import 'package:flutter_tools/src/resident_runner.dart';
|
||||||
import 'package:flutter_tools/src/version.dart';
|
import 'package:flutter_tools/src/version.dart';
|
||||||
import 'package:flutter_tools/src/vmservice.dart';
|
import 'package:flutter_tools/src/vmservice.dart';
|
||||||
@ -454,6 +455,25 @@ void main() {
|
|||||||
);
|
);
|
||||||
await driverService.stop();
|
await driverService.stop();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
testWithoutContext('WebDriver error message includes link to documentation', () async {
|
||||||
|
const String link = 'https://flutter.dev/docs/testing/integration-tests#running-in-a-browser';
|
||||||
|
final DriverService driverService = WebDriverService(
|
||||||
|
dartSdkPath: 'dart',
|
||||||
|
processUtils: ProcessUtils(
|
||||||
|
processManager: FakeProcessManager.empty(),
|
||||||
|
logger: BufferLogger.test(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(() => driverService.startTest(
|
||||||
|
'foo.test',
|
||||||
|
<String>[],
|
||||||
|
<String, String>{},
|
||||||
|
PackageConfig(<Package>[Package('test', Uri.base)]),
|
||||||
|
browserName: 'chrome',
|
||||||
|
), throwsToolExit(message: RegExp('\nFor more information see: $link\n')));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
FlutterDriverService setUpDriverService({
|
FlutterDriverService setUpDriverService({
|
||||||
@ -517,6 +537,8 @@ class FakeDevice extends Fake implements Device {
|
|||||||
bool didUninstallApp = false;
|
bool didUninstallApp = false;
|
||||||
bool didDispose = false;
|
bool didDispose = false;
|
||||||
bool failOnce = false;
|
bool failOnce = false;
|
||||||
|
@override
|
||||||
|
final PlatformType platformType = PlatformType.web;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get name => 'test';
|
String get name => 'test';
|
||||||
|
Loading…
Reference in New Issue
Block a user