[web] update chrome version (#20470)

* update chrome version, should be merged after recipe changes

* changing directory to use chrome driver in LUCI

* changing directory path's order

* add cipd packages's chrome version for mac

* addressing reviewer comments

* more documentation. update readme

* remove late since it didn't build. remove distinction in paths for local and LUCI.

* addressing reviewer comments. (non-null fields needs rechanging)

* addressing reviewer comments. adding 2.6 on files missing the notation
This commit is contained in:
nturgut 2020-08-19 12:28:44 -07:00 committed by GitHub
parent 8540e001ea
commit 74d32ecdbd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 77 additions and 20 deletions

View File

@ -140,6 +140,7 @@ flutter/goldens updating the screenshots. Then update this file pointing to
the new revision.
## Developing the `felt` tool
If you are making changes in the `felt` tool itself, you need to be aware of Dart snapshots. We create a Dart snapshot of the `felt` tool to make the startup faster.
To make sure you are running the `felt` tool with your changes included, you would need to stop using the snapshot. This can be achived through the environment variable `FELT_USE_SNAPSHOT`:
@ -155,3 +156,22 @@ FELT_USE_SNAPSHOT=0 felt <command>
```
_**Note**: if `FELT_USE_SNAPSHOT` is omitted or has any value other than "false" or "0", the snapshot mode will be enabled._
## Upgrade Browser Version
Since the engine code and infra recipes do not live in the same repository there are few steps to follow in order to upgrade a browser's version. For now these instructins are most relevant to Chrome.
1. Dowload the binaries for the new browser/driver for each operaing system (macOS, linux, windows).
2. Create CIPD packages for these packages. (More documentation is available for Googlers. go/cipd-flutter-web)
3. Add the new browser version to the recipe. Do not remove the old one. This recipe will apply to all PRs as soon as it is merged. However, not all PRs will have the up to date code for a while.
4. Update the version in this repo. Do this by changing the related fields in `browser_lock.yaml` file.
5. After a few days don't forget to remove the old version from the LUCI recipe.
Note that for LUCI builders, both unit and integration tests are using the same browser.
Some useful links:
1. For Chrome downloads [link](https://commondatastorage.googleapis.com/chromium-browser-snapshots/index.html)
2. Browser and driver CIPD [packages](https://chrome-infra-packages.appspot.com/p/flutter_internal) (Note: Access rights are restricted for these packages.)
3. LUCI web [recipe](https://flutter.googlesource.com/recipes/+/refs/heads/master/recipes/web_engine.py)
4. More general reading on CIPD packages [link](https://chromium.googlesource.com/chromium/src.git/+/master/docs/cipd.md#What-is-CIPD)

View File

@ -1,11 +1,21 @@
## Driver version in use.
## For an integration test to run, the browser's major version and the driver's
## major version should be equal. Please make sure the major version of
## the binary for `chrome` is the same with `required_driver_version`.
## (Major version meaning: For a browser that has version 13.0.5, the major
## version is 13.)
## Please refer to README's `Upgrade Browser Version` section for more details
## on how to update the version number.
required_driver_version:
## Make sure the major version of the binary in `browser_lock.yaml` is the
## same for Chrome.
chrome: '84'
chrome:
# It seems Chrome can't always release from the same build for all operating
# systems, so we specify per-OS build number.
# Note: 741412 binary is for Chrome Version 82. Driver for Chrome version 83
# is not working with chrome.binary option.
Linux: 741412
Mac: 735194
Win: 768975
Linux: 768968 # Major version 84
Mac: 768985 # Major version 84
Win: 768975 # Major version 84
firefox:
version: '72.0'
edge:

View File

@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.6
import 'dart:io' as io;
import 'package:meta/meta.dart';
@ -20,19 +21,44 @@ import 'utils.dart';
///
/// This manager can be used for both macOS and Linux.
class ChromeDriverManager extends DriverManager {
ChromeDriverManager(String browser) : super(browser);
/// Directory which contains the Chrome's major version.
///
/// On LUCI we are using the CIPD packages to control Chrome binaries we use.
/// There will be multiple CIPD packages loaded at the same time. Yaml file
/// `driver_version.yaml` contains the version number we want to use.
///
/// Initialized to the current first to avoid the `Non-nullable` error.
// TODO: https://github.com/flutter/flutter/issues/53179. Local integration
// tests are still using the system Chrome.
io.Directory _browserDriverDirWithVersion;
ChromeDriverManager(String browser) : super(browser) {
final io.File lockFile = io.File(pathlib.join(
environment.webUiRootDir.path, 'dev', 'browser_lock.yaml'));
final YamlMap _configuration =
loadYaml(lockFile.readAsStringSync()) as YamlMap;
final String requiredChromeDriverVersion =
_configuration['required_driver_version']['chrome'] as String;
print('INFO: Major version for Chrome Driver $requiredChromeDriverVersion');
_browserDriverDirWithVersion = io.Directory(pathlib.join(
environment.webUiDartToolDir.path,
'drivers',
browser,
requiredChromeDriverVersion,
'${browser}driver-${io.Platform.operatingSystem.toString()}'));
}
@override
Future<void> _installDriver() async {
if (_browserDriverDir.existsSync()) {
_browserDriverDir.deleteSync(recursive: true);
if (_browserDriverDirWithVersion.existsSync()) {
_browserDriverDirWithVersion.deleteSync(recursive: true);
}
_browserDriverDir.createSync(recursive: true);
_browserDriverDirWithVersion.createSync(recursive: true);
temporaryDirectories.add(_drivers);
final io.Directory temp = io.Directory.current;
io.Directory.current = _browserDriverDir;
io.Directory.current = _browserDriverDirWithVersion;
try {
// TODO(nurhan): https://github.com/flutter/flutter/issues/53179
@ -50,17 +76,17 @@ class ChromeDriverManager extends DriverManager {
/// Driver should already exist on LUCI as a CIPD package.
@override
Future<void> _verifyDriverForLUCI() {
if (!_browserDriverDir.existsSync()) {
if (!_browserDriverDirWithVersion.existsSync()) {
throw StateError('Failed to locate Chrome driver on LUCI on path:'
'${_browserDriverDir.path}');
'${_browserDriverDirWithVersion.path}');
}
return Future<void>.value();
}
@override
Future<void> _startDriver(String driverPath) async {
Future<void> _startDriver() async {
await startProcess('./chromedriver/chromedriver', ['--port=4444'],
workingDirectory: driverPath);
workingDirectory: _browserDriverDirWithVersion.path);
print('INFO: Driver started');
}
}
@ -106,9 +132,9 @@ class FirefoxDriverManager extends DriverManager {
}
@override
Future<void> _startDriver(String driverPath) async {
Future<void> _startDriver() async {
await startProcess('./firefoxdriver/geckodriver', ['--port=4444'],
workingDirectory: driverPath);
workingDirectory: _browserDriverDir.path);
print('INFO: Driver started');
}
@ -144,7 +170,7 @@ class SafariDriverManager extends DriverManager {
}
@override
Future<void> _startDriver(String driverPath) async {
Future<void> _startDriver() async {
final SafariDriverRunner safariDriverRunner = SafariDriverRunner();
final io.Process process =
@ -184,7 +210,7 @@ abstract class DriverManager {
} else {
await _verifyDriverForLUCI();
}
await _startDriver(_browserDriverDir.path);
await _startDriver();
}
/// Always re-install since driver can change frequently.
@ -198,7 +224,7 @@ abstract class DriverManager {
Future<void> _verifyDriverForLUCI();
@protected
Future<void> _startDriver(String driverPath);
Future<void> _startDriver();
static DriverManager chooseDriver(String browser) {
if (browser == 'chrome') {

View File

@ -1,4 +1,3 @@
## Map for driver versions to use for each browser version.
## See: https://chromedriver.chromium.org/downloads
chrome:

View File

@ -1,6 +1,8 @@
// Copyright 2013 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.6
import 'dart:convert';
import 'utils.dart';