Skip to content

Commit 2d61960

Browse files
authored
Use correct ChromeDriver (#325)
ChromeDriver no longer supports a range of Chrome versions :( Figure out the correct version of ChromeDriver to download and use that one. Fix an issue where we were reusing the chrome profile from the Travis cache. Also add a timeout for waiting for the Chrome DevTools connection.
1 parent dc0a613 commit 2d61960

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

.travis.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@ before_install:
99
- "export CHROMEDRIVER_BINARY=/usr/bin/google-chrome"
1010
- "export CHROMEDRIVER_ARGS=--no-sandbox"
1111
- "/usr/bin/google-chrome --version"
12+
- "export CHROME_LATEST_VERSION=$(/usr/bin/google-chrome --version | cut -d' ' -f3 | cut -d'.' -f1)"
13+
- "export CHROME_DRIVER_VERSION=$(wget -qO- https://chromedriver.storage.googleapis.com/LATEST_RELEASE_$CHROME_LATEST_VERSION)"
1214
- "export DISPLAY=:99.0"
1315
- "sh -e /etc/init.d/xvfb start"
14-
- "wget http://chromedriver.storage.googleapis.com/2.40/chromedriver_linux64.zip"
15-
- unzip chromedriver_linux64.zip
16+
- "wget https://chromedriver.storage.googleapis.com/$CHROME_DRIVER_VERSION/chromedriver_linux64.zip"
17+
- "unzip chromedriver_linux64.zip"
1618
- "export PATH=$PATH:$PWD"
1719

1820
jobs:
@@ -60,4 +62,5 @@ branches:
6062
cache:
6163
directories:
6264
- "$HOME/.pub-cache"
63-
- example/.dart_tool
65+
- example/.dart_tool/build
66+
- example/.dart_tool/pub

webdev/lib/src/serve/chrome.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,10 @@ class Chrome {
8787
await process.stderr
8888
.transform(utf8.decoder)
8989
.transform(const LineSplitter())
90-
.firstWhere((line) => line.startsWith('DevTools listening'));
90+
.firstWhere((line) => line.startsWith('DevTools listening'))
91+
.timeout(Duration(seconds: 60),
92+
onTimeout: () =>
93+
throw Exception('Unable to connect to Chrome DevTools.'));
9194

9295
return _connect(Chrome._(
9396
port,

0 commit comments

Comments
 (0)