diff --git a/pkg/pub_integration/lib/src/test_browser.dart b/pkg/pub_integration/lib/src/test_browser.dart index 7882c96f97..eb89c877a2 100644 --- a/pkg/pub_integration/lib/src/test_browser.dart +++ b/pkg/pub_integration/lib/src/test_browser.dart @@ -45,13 +45,27 @@ class TestBrowser { final binaries = [ '/usr/bin/google-chrome', ]; - for (final binary in binaries) { - if (File(binary).existsSync()) return binary; - } - // sanity check for CI - if (Platform.environment['CI'] == 'true') { - throw StateError('Could not detect chrome binary while running in CI.'); + for (final binary in binaries) { + if (File(binary).existsSync()) { + // Get the local chrome's main version + final pr = await Process.run(binary, ['--version']) + .timeout(Duration(seconds: 5)); + final output = pr.stdout.toString(); + final mainVersion = output + .split(' ') + .expand((p) => p.split('.')) + .map(int.tryParse) + .whereType() + .firstOrNull; + // No version string, better not running it. + if (mainVersion == null) continue; + // Main version is after the currently supported version, will fail. + // https://github.com/xvrh/puppeteer-dart/issues/364 + if (mainVersion >= 132) continue; + + return binary; + } } // Otherwise let puppeteer download a chrome in the local .dart_tool directory: diff --git a/pkg/pub_integration/pubspec.yaml b/pkg/pub_integration/pubspec.yaml index 779b1273f1..93ee7e3514 100644 --- a/pkg/pub_integration/pubspec.yaml +++ b/pkg/pub_integration/pubspec.yaml @@ -12,7 +12,7 @@ dependencies: http: ^1.0.0 path: ^1.8.0 pub_semver: ^2.0.0 - puppeteer: 3.12.0 + puppeteer: 3.16.0 oauth2: ^2.0.0 dev_dependencies: diff --git a/pubspec.lock b/pubspec.lock index 8891b68b38..6d7fe28e4b 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -690,10 +690,10 @@ packages: dependency: transitive description: name: puppeteer - sha256: de3f921154e5d336b14cdc05b674ac3db5701a5338f3cb0042868a5146f16e67 + sha256: "7a990c68d33882b642214c351f66492d9a738afa4226a098ab70642357337fa2" url: "https://pub.dev" source: hosted - version: "3.12.0" + version: "3.16.0" retry: dependency: transitive description: