|
1 | 1 | # Browser configuration and versioning for testing of Angular
|
2 | 2 |
|
3 |
| -Within the Angular monorepo, we use Chrome to perform most of the local testing, and rely on Sauce Labs and BrowserStack to do cross-browser testing on our CI. |
| 3 | +Within the Angular organization, we use Chrome and Firefox to perform most of the local testing, |
| 4 | +and rely on Sauce Labs and BrowserStack to do cross-browser testing on our CI. |
4 | 5 |
|
5 |
| -The version of Chrome used in tests within this monorepo is configured and controlled via `rules_webtesting` and `puppeteer`. We manually keep the configuration of these two tools in sync to create a consistent testing environment across unit, e2e, and integration tests. |
| 6 | +The version of Chrome used in tests within this monorepo is configured and controlled via |
| 7 | +Bazel and `puppeteer`. We manually keep the configuration of these two tools in sync to |
| 8 | +create a consistent testing environment across unit, e2e, and integration tests. |
6 | 9 |
|
7 |
| -## rules_webtesting |
| 10 | +## Bazel |
8 | 11 |
|
9 |
| -Bazel `karma_web_test_suite` and `protractor_web_test_suite` targets will use Chromium provisioned by rules_webtesting. The version of chrome used is specified in the `dev-infra/browsers/browser_repositories.bzl` file. The process of updating the Chrome version in that file consists of several steps: |
| 12 | +Bazel `karma_web_test_suite` and `protractor_web_test_suite` targets will use Chromium |
| 13 | +or Firefox provisioned by `//dev-infra/browsers`. The version of Chrome and Firefox are |
| 14 | +specified in the `chromium.bzl` and `firefox.bzl` files in `/dev-infra/browsers`. |
10 | 15 |
|
11 |
| -1) Visit https://chromium.woolyss.com/ and note the version (commit position) of the latest stable version. |
| 16 | +The process of updating the Chrome or Firefox version is not straightforward, but below |
| 17 | +are dedicated sections for each browser. |
12 | 18 |
|
13 |
| - For example, "Google Chrome 83.0.4103.97 (756066) • Wednesday, 3 Jun 2020". Alternately, you can look in https://omahaproxy.appspot.com/. |
| 19 | +## Updating Chromium |
14 | 20 |
|
15 |
| -1) Find the closest commit position number available for each platform in chromium-browser-snapshots: |
16 |
| - https://commondatastorage.googleapis.com/chromium-browser-snapshots/index.html |
| 21 | +1) Visit https://chromium.woolyss.com/ and note the version (commit position) of the latest |
| 22 | +stable version. |
| 23 | + |
| 24 | +For example, "Google Chrome 83.0.4103.97 (756066) • Wednesday, 3 Jun 2020". Alternatively, you |
| 25 | +can look in https://omahaproxy.appspot.com/. |
17 | 26 |
|
18 |
| - For example, |
| 27 | +1) Find the closest commit position number available for each platform in chromium-browser-snapshots: |
| 28 | + https://commondatastorage.googleapis.com/chromium-browser-snapshots/index.html |
19 | 29 |
|
| 30 | + For example: |
20 | 31 | * https://commondatastorage.googleapis.com/chromium-browser-snapshots/index.html?prefix=Linux_x64/756066/
|
21 | 32 | * https://commondatastorage.googleapis.com/chromium-browser-snapshots/index.html?prefix=Mac/756053/
|
22 | 33 | * https://commondatastorage.googleapis.com/chromium-browser-snapshots/index.html?prefix=Win/756065/
|
23 | 34 |
|
24 |
| - You can download the Chromium for your local platform and double check that the --version matches up with |
25 |
| - what you expect. |
26 |
| - |
27 |
| - For example, |
| 35 | + You can download Chromium for your local platform and double check that the `--version` matches |
| 36 | + up with what you expect. |
28 | 37 |
|
29 |
| -``` bash |
30 |
| -$ ~/Downloads/chrome-mac/Chromium.app/Contents/MacOS/Chromium --version |
31 |
| -Chromium 83.0.4103.0 |
32 |
| -``` |
33 |
| - |
34 |
| -1) Update the chrome & chrome driver build numbers in `dev-infra/browsers/browser_repositories.bzl` and run either run `bazel query @org_chromium_chromium_amd64//...` to prompt Bazel to calculate the new sha256 for each platform binary or determine the new sha256 values manually. |
| 38 | + For example: |
| 39 | + ``` bash |
| 40 | + $ ~/Downloads/chrome-mac/Chromium.app/Contents/MacOS/Chromium --version |
| 41 | + Chromium 83.0.4103.0 |
| 42 | + ``` |
35 | 43 |
|
36 |
| - For example, with curl & shasum |
| 44 | +2) Update the chrome & chrome driver build numbers in `dev-infra/browsers/chromium/chromium.bzl` |
| 45 | +and run either run `bazel query @org_chromium_chromium_amd64//...` to prompt Bazel to calculate |
| 46 | +the new `sha256` for each platform binary or determine the new `sha256` values manually. |
37 | 47 |
|
38 |
| -``` bash |
39 |
| -curl https://commondatastorage.googleapis.com/chromium-browser-snapshots/Linux_x64/756066/chrome-linux.zip | shasum -a 256 |
40 |
| -``` |
| 48 | + Here is an example with `curl` & `shasum`: |
| 49 | + ``` bash |
| 50 | + curl https://commondatastorage.googleapis.com/chromium-browser-snapshots/Linux_x64/756066/chrome-linux.zip | shasum -a 256 |
| 51 | + ``` |
41 | 52 |
|
42 |
| -## puppeteer |
| 53 | +## Puppeteer |
43 | 54 |
|
44 |
| -Visit https://github.com/puppeteer/puppeteer/blob/master/docs/api.md to determine which version of puppeteer corresponds to the version of Chrome desired. Then update `scripts/puppeteer-chrome-versions.js` and all of the puppeteer versions throughout the repo, |
| 55 | +Visit https://github.com/puppeteer/puppeteer/blob/master/docs/api.md to determine which version |
| 56 | +of puppeteer corresponds to the version of Chrome desired. Then update |
| 57 | +`scripts/puppeteer-chrome-versions.js` and all of the puppeteer versions throughout the repo, |
45 | 58 |
|
46 | 59 | * `package.json`
|
47 | 60 | * `aio/package.json`
|
48 | 61 | * `aio/tools/examples/shared/package.json`
|
49 | 62 |
|
50 | 63 | and their corresponding `yarn.lock` files.
|
| 64 | + |
| 65 | +## Firefox |
| 66 | + |
| 67 | +In order to update Firefox, open the `dev-infra/browsers/firefox/firefox.bzl` file and update |
| 68 | +the repository URLs to the desired version. e.g. |
| 69 | + |
| 70 | +```bzl |
| 71 | +platform_http_file( |
| 72 | + name = "org_mozilla_firefox_amd64", |
| 73 | + licenses = ["reciprocal"], # MPL 2.0 |
| 74 | + sha256 = "bde6e020556a21561e4b8d7aaecf8db7077951f179b98ca5d0305435bc6802c9", |
| 75 | + # Firefox v78.0 |
| 76 | + urls = ["https://ftp.mozilla.org/pub/firefox/releases/78.0/linux-x86_64/en-US/firefox-78.0.tar.bz2"], |
| 77 | +) |
| 78 | +``` |
| 79 | + |
| 80 | +Go to the `urls` property and update the URL by replacing all `78.0` occurrences with the |
| 81 | +version you intend to use. Once done, do the same change for other platforms (such as `macos`). |
| 82 | + |
| 83 | +Finally, update the `sha256`checksum of the browser archives. You can do this by downloading the |
| 84 | +artifacts from the URLs you just updated, and then running on those files: `sha256 <path>`. |
| 85 | + |
| 86 | + |
| 87 | + |
0 commit comments