Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
2f4e3ce5
Unverified
Commit
2f4e3ce5
authored
Oct 15, 2021
by
Ian Hickson
Committed by
GitHub
Oct 15, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve error message for when you're not running chromedriver (#91789)
parent
59a6ba7c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
53 additions
and
30 deletions
+53
-30
web_driver_service.dart
packages/flutter_tools/lib/src/drive/web_driver_service.dart
+9
-9
drive_service_test.dart
...er_tools/test/general.shard/drive/drive_service_test.dart
+0
-21
web_driver_service_test.dart
...flutter_tools/test/web.shard/web_driver_service_test.dart
+44
-0
No files found.
packages/flutter_tools/lib/src/drive/web_driver_service.dart
View file @
2f4e3ce5
...
...
@@ -13,6 +13,7 @@ import 'package:package_config/package_config.dart';
import
'package:webdriver/async_io.dart'
as
async_io
;
import
'../base/common.dart'
;
import
'../base/io.dart'
;
import
'../base/logger.dart'
;
import
'../base/process.dart'
;
import
'../build_info.dart'
;
...
...
@@ -126,9 +127,9 @@ class WebDriverService extends DriverService {
@override
Future
<
int
>
startTest
(
String
testFile
,
List
<
String
>
arguments
,
Map
<
String
,
String
>
environment
,
PackageConfig
packageConfig
,
{
bool
headless
,
@required
bool
headless
,
String
chromeBinary
,
String
browserName
,
@required
String
browserName
,
bool
androidEmulator
,
int
driverPort
,
List
<
String
>
browserDimension
,
...
...
@@ -142,14 +143,13 @@ class WebDriverService extends DriverService {
desired:
getDesiredCapabilities
(
browser
,
headless
,
chromeBinary
),
spec:
async_io
.
WebDriverSpec
.
Auto
);
}
on
Exception
catch
(
ex
)
{
}
on
SocketException
catch
(
error
)
{
_logger
.
printTrace
(
'
$error
'
);
throwToolExit
(
'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 the WebDriver Server matches option --browser-name.
\n
'
'For more information see: '
'Unable to start a WebDriver session for web testing.
\n
'
'Make sure you have the correct WebDriver server (e.g. chromedriver) running at
$driverPort
.
\n
'
'For instructions on how to obtain and run a WebDriver server, see:
\n
'
'https://flutter.dev/docs/testing/integration-tests#running-in-a-browser
\n
'
'
$ex
'
);
}
...
...
@@ -331,5 +331,5 @@ Browser _browserNameToEnum(String browserName) {
case
'ios-safari'
:
return
Browser
.
iosSafari
;
case
'safari'
:
return
Browser
.
safari
;
}
throw
UnsupportedError
(
'Browser
$browserName
not supported'
);
// dead code; remove with null safety migration
throw
UnsupportedError
(
'Browser
$browserName
not supported'
);
}
packages/flutter_tools/test/general.shard/drive/drive_service_test.dart
View file @
2f4e3ce5
...
...
@@ -16,7 +16,6 @@ import 'package:flutter_tools/src/build_info.dart';
import
'package:flutter_tools/src/convert.dart'
;
import
'package:flutter_tools/src/device.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/version.dart'
;
import
'package:flutter_tools/src/vmservice.dart'
;
...
...
@@ -454,26 +453,6 @@ void main() {
);
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
(
logger:
BufferLogger
.
test
(),
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
(
'
\n
For more information see:
$link
\n
'
)));
});
}
FlutterDriverService
setUpDriverService
(
{
...
...
packages/flutter_tools/test/web.shard/web_driver_service_test.dart
0 → 100644
View file @
2f4e3ce5
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
import
'package:flutter_tools/src/base/common.dart'
;
import
'package:flutter_tools/src/base/logger.dart'
;
import
'package:flutter_tools/src/base/process.dart'
;
import
'package:flutter_tools/src/drive/web_driver_service.dart'
;
import
'package:package_config/package_config_types.dart'
;
import
'../src/common.dart'
;
import
'../src/context.dart'
;
void
main
(
)
{
testWithoutContext
(
'WebDriverService catches SocketExceptions cleanly and includes link to documentation'
,
()
async
{
final
BufferLogger
logger
=
BufferLogger
.
test
();
final
WebDriverService
service
=
WebDriverService
(
logger:
logger
,
processUtils:
ProcessUtils
(
logger:
logger
,
processManager:
FakeProcessManager
.
empty
(),
),
dartSdkPath:
'dart'
,
);
const
String
link
=
'https://flutter.dev/docs/testing/integration-tests#running-in-a-browser'
;
try
{
await
service
.
startTest
(
'foo.test'
,
<
String
>[],
<
String
,
String
>{},
PackageConfig
(<
Package
>[
Package
(
'test'
,
Uri
.
base
)]),
driverPort:
1
,
headless:
true
,
browserName:
'chrome'
,
);
fail
(
'WebDriverService did not throw as expected.'
);
}
on
ToolExit
catch
(
error
)
{
expect
(
error
.
message
,
isNot
(
contains
(
'SocketException'
)));
expect
(
error
.
message
,
contains
(
link
));
}
});
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment