feat(dev-infra): add bazel firefox browser with RBE compatibility (#38029)
Adds Firefox as browser to `dev-infra/browsers` with RBE compatibility. The default Firefox browser is not compatible similar to the default Chromium version exposed by `rules_webtesting`. The Angular Components repository will use this browser target as it enables RBE support. Also it gives us more flexibility about the Firefox version we test against. The version provided by `rules_webtesting` is very old and most likely not frequently updated (based on past experience). PR Close #38029
This commit is contained in:
parent
b00121c9a6
commit
545f1dbac9
|
@ -10,7 +10,7 @@ load("@npm_bazel_protractor//:index.bzl", "protractor_web_test_suite")
|
||||||
def benchmark_test(name, server, tags = [], **kwargs):
|
def benchmark_test(name, server, tags = [], **kwargs):
|
||||||
protractor_web_test_suite(
|
protractor_web_test_suite(
|
||||||
name = name,
|
name = name,
|
||||||
browsers = ["//dev-infra/browsers:chromium"],
|
browsers = ["//dev-infra/browsers/chromium:chromium"],
|
||||||
configuration = "//dev-infra/benchmark/component_benchmark:protractor-perf.conf.js",
|
configuration = "//dev-infra/benchmark/component_benchmark:protractor-perf.conf.js",
|
||||||
on_prepare = "//dev-infra/benchmark/component_benchmark:start-server.js",
|
on_prepare = "//dev-infra/benchmark/component_benchmark:start-server.js",
|
||||||
server = server,
|
server = server,
|
||||||
|
|
|
@ -1,78 +1,10 @@
|
||||||
# Copyright Google LLC
|
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
# you may not use this file except in compliance with the License.
|
|
||||||
# You may obtain a copy of the License at
|
|
||||||
#
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
# See the License for the specific language governing permissions and
|
|
||||||
# limitations under the License.
|
|
||||||
#
|
|
||||||
################################################################################
|
|
||||||
#
|
|
||||||
package(default_visibility = ["//visibility:public"])
|
package(default_visibility = ["//visibility:public"])
|
||||||
|
|
||||||
load("@io_bazel_rules_webtesting//web:web.bzl", "browser", "web_test_archive")
|
|
||||||
|
|
||||||
# Override of chromium web_test_archive so that the archive is selected based on platform
|
|
||||||
web_test_archive(
|
|
||||||
name = "chromium_archive",
|
|
||||||
testonly = True,
|
|
||||||
archive = select({
|
|
||||||
"@io_bazel_rules_webtesting//common/conditions:linux": "@org_chromium_chromium_amd64//file",
|
|
||||||
"@io_bazel_rules_webtesting//common/conditions:mac": "@org_chromium_chromium_macos//file",
|
|
||||||
"@io_bazel_rules_webtesting//common/conditions:windows": "@org_chromium_chromium_windows//file",
|
|
||||||
}),
|
|
||||||
extract = "build",
|
|
||||||
named_files = select({
|
|
||||||
"@io_bazel_rules_webtesting//common/conditions:linux": {"CHROMIUM": "chrome-linux/chrome"},
|
|
||||||
"@io_bazel_rules_webtesting//common/conditions:mac": {"CHROMIUM": "chrome-mac/Chromium.app/Contents/MacOS/chromium"},
|
|
||||||
"@io_bazel_rules_webtesting//common/conditions:windows": {"CHROMIUM": "chrome-win/chrome.exe"},
|
|
||||||
}),
|
|
||||||
visibility = ["//dev-infra/browsers:__subpackages__"],
|
|
||||||
)
|
|
||||||
|
|
||||||
# Override of chromedriver web_test_archive so that the archive is selected based on platform
|
|
||||||
web_test_archive(
|
|
||||||
name = "chromedriver_archive",
|
|
||||||
testonly = True,
|
|
||||||
archive = select({
|
|
||||||
"@io_bazel_rules_webtesting//common/conditions:linux": "@org_chromium_chromedriver_amd64//file",
|
|
||||||
"@io_bazel_rules_webtesting//common/conditions:mac": "@org_chromium_chromedriver_macos//file",
|
|
||||||
"@io_bazel_rules_webtesting//common/conditions:windows": "@org_chromium_chromedriver_windows//file",
|
|
||||||
}),
|
|
||||||
extract = "build",
|
|
||||||
named_files = select({
|
|
||||||
"@io_bazel_rules_webtesting//common/conditions:linux": {
|
|
||||||
"CHROMEDRIVER": "chromedriver_linux64/chromedriver",
|
|
||||||
},
|
|
||||||
"@io_bazel_rules_webtesting//common/conditions:mac": {
|
|
||||||
"CHROMEDRIVER": "chromedriver_mac64/chromedriver",
|
|
||||||
},
|
|
||||||
"@io_bazel_rules_webtesting//common/conditions:windows": {
|
|
||||||
"CHROMEDRIVER": "chromedriver_win32/chromedriver.exe",
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
visibility = ["//dev-infra/browsers:__subpackages__"],
|
|
||||||
)
|
|
||||||
|
|
||||||
browser(
|
|
||||||
name = "chromium",
|
|
||||||
metadata = "chromium.json",
|
|
||||||
visibility = ["//visibility:public"],
|
|
||||||
deps = [
|
|
||||||
":chromedriver_archive",
|
|
||||||
":chromium_archive",
|
|
||||||
"@io_bazel_rules_webtesting//go/wsl",
|
|
||||||
],
|
|
||||||
)
|
|
||||||
|
|
||||||
# Make source files available for distribution via pkg_npm
|
# Make source files available for distribution via pkg_npm
|
||||||
filegroup(
|
filegroup(
|
||||||
name = "files",
|
name = "files",
|
||||||
srcs = glob(["*"]),
|
srcs = glob(["*"]) + [
|
||||||
|
"//dev-infra/browsers/chromium:files",
|
||||||
|
"//dev-infra/browsers/firefox:files",
|
||||||
|
],
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,50 +1,87 @@
|
||||||
# Browser configuration and versioning for testing of Angular
|
# Browser configuration and versioning for testing of Angular
|
||||||
|
|
||||||
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.
|
Within the Angular organization, we use Chrome and Firefox to perform most of the local testing,
|
||||||
|
and rely on Sauce Labs and BrowserStack to do cross-browser testing on our CI.
|
||||||
|
|
||||||
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.
|
The version of Chrome used in tests within this monorepo is configured and controlled via
|
||||||
|
Bazel 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.
|
||||||
|
|
||||||
## rules_webtesting
|
## Bazel
|
||||||
|
|
||||||
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:
|
Bazel `karma_web_test_suite` and `protractor_web_test_suite` targets will use Chromium
|
||||||
|
or Firefox provisioned by `//dev-infra/browsers`. The version of Chrome and Firefox are
|
||||||
|
specified in the `chromium.bzl` and `firefox.bzl` files in `/dev-infra/browsers`.
|
||||||
|
|
||||||
1) Visit https://chromium.woolyss.com/ and note the version (commit position) of the latest stable version.
|
The process of updating the Chrome or Firefox version is not straightforward, but below
|
||||||
|
are dedicated sections for each browser.
|
||||||
|
|
||||||
For example, "Google Chrome 83.0.4103.97 (756066) • Wednesday, 3 Jun 2020". Alternately, you can look in https://omahaproxy.appspot.com/.
|
## Updating Chromium
|
||||||
|
|
||||||
|
1) Visit https://chromium.woolyss.com/ and note the version (commit position) of the latest
|
||||||
|
stable version.
|
||||||
|
|
||||||
|
For example, "Google Chrome 83.0.4103.97 (756066) • Wednesday, 3 Jun 2020". Alternatively, you
|
||||||
|
can look in https://omahaproxy.appspot.com/.
|
||||||
|
|
||||||
1) Find the closest commit position number available for each platform in chromium-browser-snapshots:
|
1) Find the closest commit position number available for each platform in chromium-browser-snapshots:
|
||||||
https://commondatastorage.googleapis.com/chromium-browser-snapshots/index.html
|
https://commondatastorage.googleapis.com/chromium-browser-snapshots/index.html
|
||||||
|
|
||||||
For example,
|
For example:
|
||||||
|
|
||||||
* https://commondatastorage.googleapis.com/chromium-browser-snapshots/index.html?prefix=Linux_x64/756066/
|
* https://commondatastorage.googleapis.com/chromium-browser-snapshots/index.html?prefix=Linux_x64/756066/
|
||||||
* https://commondatastorage.googleapis.com/chromium-browser-snapshots/index.html?prefix=Mac/756053/
|
* https://commondatastorage.googleapis.com/chromium-browser-snapshots/index.html?prefix=Mac/756053/
|
||||||
* https://commondatastorage.googleapis.com/chromium-browser-snapshots/index.html?prefix=Win/756065/
|
* https://commondatastorage.googleapis.com/chromium-browser-snapshots/index.html?prefix=Win/756065/
|
||||||
|
|
||||||
You can download the Chromium for your local platform and double check that the --version matches up with
|
You can download Chromium for your local platform and double check that the `--version` matches
|
||||||
what you expect.
|
up with what you expect.
|
||||||
|
|
||||||
For example,
|
|
||||||
|
|
||||||
|
For example:
|
||||||
``` bash
|
``` bash
|
||||||
$ ~/Downloads/chrome-mac/Chromium.app/Contents/MacOS/Chromium --version
|
$ ~/Downloads/chrome-mac/Chromium.app/Contents/MacOS/Chromium --version
|
||||||
Chromium 83.0.4103.0
|
Chromium 83.0.4103.0
|
||||||
```
|
```
|
||||||
|
|
||||||
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.
|
2) Update the chrome & chrome driver build numbers in `dev-infra/browsers/chromium/chromium.bzl`
|
||||||
|
and run either run `bazel query @org_chromium_chromium_amd64//...` to prompt Bazel to calculate
|
||||||
For example, with curl & shasum
|
the new `sha256` for each platform binary or determine the new `sha256` values manually.
|
||||||
|
|
||||||
|
Here is an example with `curl` & `shasum`:
|
||||||
``` bash
|
``` bash
|
||||||
curl https://commondatastorage.googleapis.com/chromium-browser-snapshots/Linux_x64/756066/chrome-linux.zip | shasum -a 256
|
curl https://commondatastorage.googleapis.com/chromium-browser-snapshots/Linux_x64/756066/chrome-linux.zip | shasum -a 256
|
||||||
```
|
```
|
||||||
|
|
||||||
## puppeteer
|
## Puppeteer
|
||||||
|
|
||||||
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,
|
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,
|
||||||
|
|
||||||
* `package.json`
|
* `package.json`
|
||||||
* `aio/package.json`
|
* `aio/package.json`
|
||||||
* `aio/tools/examples/shared/package.json`
|
* `aio/tools/examples/shared/package.json`
|
||||||
|
|
||||||
and their corresponding `yarn.lock` files.
|
and their corresponding `yarn.lock` files.
|
||||||
|
|
||||||
|
## Firefox
|
||||||
|
|
||||||
|
In order to update Firefox, open the `dev-infra/browsers/firefox/firefox.bzl` file and update
|
||||||
|
the repository URLs to the desired version. e.g.
|
||||||
|
|
||||||
|
```bzl
|
||||||
|
platform_http_file(
|
||||||
|
name = "org_mozilla_firefox_amd64",
|
||||||
|
licenses = ["reciprocal"], # MPL 2.0
|
||||||
|
sha256 = "bde6e020556a21561e4b8d7aaecf8db7077951f179b98ca5d0305435bc6802c9",
|
||||||
|
# Firefox v78.0
|
||||||
|
urls = ["https://ftp.mozilla.org/pub/firefox/releases/78.0/linux-x86_64/en-US/firefox-78.0.tar.bz2"],
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
|
Go to the `urls` property and update the URL by replacing all `78.0` occurrences with the
|
||||||
|
version you intend to use. Once done, do the same change for other platforms (such as `macos`).
|
||||||
|
|
||||||
|
Finally, update the `sha256`checksum of the browser archives. You can do this by downloading the
|
||||||
|
artifacts from the URLs you just updated, and then running on those files: `sha256 <path>`.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -19,78 +19,11 @@ Unlike the rules_webtesting browser_repositories, this function defines
|
||||||
separate repositories for each platform
|
separate repositories for each platform
|
||||||
"""
|
"""
|
||||||
|
|
||||||
load("@io_bazel_rules_webtesting//web/internal:platform_http_file.bzl", _platform_http_file = "platform_http_file")
|
load("//dev-infra/browsers/chromium:chromium.bzl", "define_chromium_repositories")
|
||||||
|
load("//dev-infra/browsers/firefox:firefox.bzl", "define_firefox_repositories")
|
||||||
def platform_http_file(name, licenses, sha256, urls):
|
|
||||||
"""Platform spepcific browser repository.
|
|
||||||
|
|
||||||
This works around a dificiency in io_bazel_rules_webtesting platform_http_file in that
|
|
||||||
it selects the platform when the repository rule is executed. This limits browsers
|
|
||||||
tests to run on the local user platform only. For cross-platform RBE we want a repository
|
|
||||||
to be defined per platform so the correct one can be selected.
|
|
||||||
"""
|
|
||||||
|
|
||||||
_platform_http_file(
|
|
||||||
name = name,
|
|
||||||
amd64_sha256 = sha256,
|
|
||||||
amd64_urls = urls,
|
|
||||||
licenses = licenses,
|
|
||||||
macos_sha256 = sha256,
|
|
||||||
macos_urls = urls,
|
|
||||||
windows_sha256 = sha256,
|
|
||||||
windows_urls = urls,
|
|
||||||
)
|
|
||||||
|
|
||||||
def browser_repositories():
|
def browser_repositories():
|
||||||
"""Load pinned rules_webtesting browser versions."""
|
"""Load pinned rules_webtesting browser versions."""
|
||||||
|
|
||||||
# To update to a newer version of Chromium see instructions in
|
define_chromium_repositories()
|
||||||
# https://github.com/angular/angular/blob/master/dev-infra/browsers/README.md.
|
define_firefox_repositories()
|
||||||
|
|
||||||
platform_http_file(
|
|
||||||
name = "org_chromium_chromium_amd64",
|
|
||||||
licenses = ["notice"], # BSD 3-clause (maybe more?)
|
|
||||||
sha256 = "2cfd74ee58c79d8b7aada05c899a930967e2fd8bb0186582cde02c7340863f64",
|
|
||||||
# 83.0.4103
|
|
||||||
urls = ["https://commondatastorage.googleapis.com/chromium-browser-snapshots/Linux_x64/756066/chrome-linux.zip"],
|
|
||||||
)
|
|
||||||
|
|
||||||
platform_http_file(
|
|
||||||
name = "org_chromium_chromium_macos",
|
|
||||||
licenses = ["notice"], # BSD 3-clause (maybe more?)
|
|
||||||
sha256 = "b841ec5ad03b08422d97593fc719f1c5b038703388ad65e6cd8cc8272d58958c",
|
|
||||||
# 83.0.4103
|
|
||||||
urls = ["https://commondatastorage.googleapis.com/chromium-browser-snapshots/Mac/756053/chrome-mac.zip"],
|
|
||||||
)
|
|
||||||
|
|
||||||
platform_http_file(
|
|
||||||
name = "org_chromium_chromium_windows",
|
|
||||||
licenses = ["notice"], # BSD 3-clause (maybe more?)
|
|
||||||
sha256 = "4683d7ac88dfec4b98d1da3012ecc8e42cc8c1a560a7b95589ad4cc96bf90fcb",
|
|
||||||
# 83.0.4103
|
|
||||||
urls = ["https://commondatastorage.googleapis.com/chromium-browser-snapshots/Win/756065/chrome-win.zip"],
|
|
||||||
)
|
|
||||||
|
|
||||||
platform_http_file(
|
|
||||||
name = "org_chromium_chromedriver_amd64",
|
|
||||||
licenses = ["reciprocal"], # BSD 3-clause, ICU, MPL 1.1, libpng (BSD/MIT-like), Academic Free License v. 2.0, BSD 2-clause, MIT
|
|
||||||
sha256 = "95dded16000b82e31445361da7d251ed707e027a4b61e9a3ec5fbd1cc2f62bb1",
|
|
||||||
# 83.0.4103
|
|
||||||
urls = ["https://commondatastorage.googleapis.com/chromium-browser-snapshots/Linux_x64/756066/chromedriver_linux64.zip"],
|
|
||||||
)
|
|
||||||
|
|
||||||
platform_http_file(
|
|
||||||
name = "org_chromium_chromedriver_macos",
|
|
||||||
licenses = ["reciprocal"], # BSD 3-clause, ICU, MPL 1.1, libpng (BSD/MIT-like), Academic Free License v. 2.0, BSD 2-clause, MIT
|
|
||||||
sha256 = "17260e9b2222b0c905a1861285210192baef830f4281778903e7cebb8db683cc",
|
|
||||||
# 83.0.4103
|
|
||||||
urls = ["https://commondatastorage.googleapis.com/chromium-browser-snapshots/Mac/756053/chromedriver_mac64.zip"],
|
|
||||||
)
|
|
||||||
|
|
||||||
platform_http_file(
|
|
||||||
name = "org_chromium_chromedriver_windows",
|
|
||||||
licenses = ["reciprocal"], # BSD 3-clause, ICU, MPL 1.1, libpng (BSD/MIT-like), Academic Free License v. 2.0, BSD 2-clause, MIT
|
|
||||||
sha256 = "de1423b2d69f96e451e902d686e8d471610d786c345a8de59dd1a5a436e45fc2",
|
|
||||||
# 83.0.4103
|
|
||||||
urls = ["https://commondatastorage.googleapis.com/chromium-browser-snapshots/Win/756065/chromedriver_win32.zip"],
|
|
||||||
)
|
|
||||||
|
|
|
@ -0,0 +1,78 @@
|
||||||
|
# Copyright Google LLC
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
################################################################################
|
||||||
|
#
|
||||||
|
package(default_visibility = ["//visibility:public"])
|
||||||
|
|
||||||
|
load("@io_bazel_rules_webtesting//web:web.bzl", "browser", "web_test_archive")
|
||||||
|
|
||||||
|
# Override of chromium web_test_archive so that the archive is selected based on platform
|
||||||
|
web_test_archive(
|
||||||
|
name = "chromium_archive",
|
||||||
|
testonly = True,
|
||||||
|
archive = select({
|
||||||
|
"@io_bazel_rules_webtesting//common/conditions:linux": "@org_chromium_chromium_amd64//file",
|
||||||
|
"@io_bazel_rules_webtesting//common/conditions:mac": "@org_chromium_chromium_macos//file",
|
||||||
|
"@io_bazel_rules_webtesting//common/conditions:windows": "@org_chromium_chromium_windows//file",
|
||||||
|
}),
|
||||||
|
extract = "build",
|
||||||
|
named_files = select({
|
||||||
|
"@io_bazel_rules_webtesting//common/conditions:linux": {"CHROMIUM": "chrome-linux/chrome"},
|
||||||
|
"@io_bazel_rules_webtesting//common/conditions:mac": {"CHROMIUM": "chrome-mac/Chromium.app/Contents/MacOS/chromium"},
|
||||||
|
"@io_bazel_rules_webtesting//common/conditions:windows": {"CHROMIUM": "chrome-win/chrome.exe"},
|
||||||
|
}),
|
||||||
|
visibility = ["//dev-infra/browsers:__subpackages__"],
|
||||||
|
)
|
||||||
|
|
||||||
|
# Override of chromedriver web_test_archive so that the archive is selected based on platform
|
||||||
|
web_test_archive(
|
||||||
|
name = "chromedriver_archive",
|
||||||
|
testonly = True,
|
||||||
|
archive = select({
|
||||||
|
"@io_bazel_rules_webtesting//common/conditions:linux": "@org_chromium_chromedriver_amd64//file",
|
||||||
|
"@io_bazel_rules_webtesting//common/conditions:mac": "@org_chromium_chromedriver_macos//file",
|
||||||
|
"@io_bazel_rules_webtesting//common/conditions:windows": "@org_chromium_chromedriver_windows//file",
|
||||||
|
}),
|
||||||
|
extract = "build",
|
||||||
|
named_files = select({
|
||||||
|
"@io_bazel_rules_webtesting//common/conditions:linux": {
|
||||||
|
"CHROMEDRIVER": "chromedriver_linux64/chromedriver",
|
||||||
|
},
|
||||||
|
"@io_bazel_rules_webtesting//common/conditions:mac": {
|
||||||
|
"CHROMEDRIVER": "chromedriver_mac64/chromedriver",
|
||||||
|
},
|
||||||
|
"@io_bazel_rules_webtesting//common/conditions:windows": {
|
||||||
|
"CHROMEDRIVER": "chromedriver_win32/chromedriver.exe",
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
visibility = ["//dev-infra/browsers:__subpackages__"],
|
||||||
|
)
|
||||||
|
|
||||||
|
browser(
|
||||||
|
name = "chromium",
|
||||||
|
metadata = "chromium.json",
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
|
deps = [
|
||||||
|
":chromedriver_archive",
|
||||||
|
":chromium_archive",
|
||||||
|
"@io_bazel_rules_webtesting//go/wsl",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
# Make source files available for distribution via pkg_npm
|
||||||
|
filegroup(
|
||||||
|
name = "files",
|
||||||
|
srcs = glob(["*"]),
|
||||||
|
)
|
|
@ -0,0 +1,58 @@
|
||||||
|
load("//dev-infra/browsers:platform_http_file.bzl", "platform_http_file")
|
||||||
|
|
||||||
|
"""
|
||||||
|
Defines repositories for Chromium that can be used inside Karma unit tests
|
||||||
|
and Protractor e2e tests with Bazel.
|
||||||
|
"""
|
||||||
|
|
||||||
|
def define_chromium_repositories():
|
||||||
|
# To update to a newer version of Chromium see instructions in
|
||||||
|
# https://github.com/angular/angular/blob/master/dev-infra/browsers/README.md.
|
||||||
|
|
||||||
|
platform_http_file(
|
||||||
|
name = "org_chromium_chromium_amd64",
|
||||||
|
licenses = ["notice"], # BSD 3-clause (maybe more?)
|
||||||
|
sha256 = "2cfd74ee58c79d8b7aada05c899a930967e2fd8bb0186582cde02c7340863f64",
|
||||||
|
# 83.0.4103
|
||||||
|
urls = ["https://commondatastorage.googleapis.com/chromium-browser-snapshots/Linux_x64/756066/chrome-linux.zip"],
|
||||||
|
)
|
||||||
|
|
||||||
|
platform_http_file(
|
||||||
|
name = "org_chromium_chromium_macos",
|
||||||
|
licenses = ["notice"], # BSD 3-clause (maybe more?)
|
||||||
|
sha256 = "b841ec5ad03b08422d97593fc719f1c5b038703388ad65e6cd8cc8272d58958c",
|
||||||
|
# 83.0.4103
|
||||||
|
urls = ["https://commondatastorage.googleapis.com/chromium-browser-snapshots/Mac/756053/chrome-mac.zip"],
|
||||||
|
)
|
||||||
|
|
||||||
|
platform_http_file(
|
||||||
|
name = "org_chromium_chromium_windows",
|
||||||
|
licenses = ["notice"], # BSD 3-clause (maybe more?)
|
||||||
|
sha256 = "4683d7ac88dfec4b98d1da3012ecc8e42cc8c1a560a7b95589ad4cc96bf90fcb",
|
||||||
|
# 83.0.4103
|
||||||
|
urls = ["https://commondatastorage.googleapis.com/chromium-browser-snapshots/Win/756065/chrome-win.zip"],
|
||||||
|
)
|
||||||
|
|
||||||
|
platform_http_file(
|
||||||
|
name = "org_chromium_chromedriver_amd64",
|
||||||
|
licenses = ["reciprocal"], # BSD 3-clause, ICU, MPL 1.1, libpng (BSD/MIT-like), Academic Free License v. 2.0, BSD 2-clause, MIT
|
||||||
|
sha256 = "95dded16000b82e31445361da7d251ed707e027a4b61e9a3ec5fbd1cc2f62bb1",
|
||||||
|
# 83.0.4103
|
||||||
|
urls = ["https://commondatastorage.googleapis.com/chromium-browser-snapshots/Linux_x64/756066/chromedriver_linux64.zip"],
|
||||||
|
)
|
||||||
|
|
||||||
|
platform_http_file(
|
||||||
|
name = "org_chromium_chromedriver_macos",
|
||||||
|
licenses = ["reciprocal"], # BSD 3-clause, ICU, MPL 1.1, libpng (BSD/MIT-like), Academic Free License v. 2.0, BSD 2-clause, MIT
|
||||||
|
sha256 = "17260e9b2222b0c905a1861285210192baef830f4281778903e7cebb8db683cc",
|
||||||
|
# 83.0.4103
|
||||||
|
urls = ["https://commondatastorage.googleapis.com/chromium-browser-snapshots/Mac/756053/chromedriver_mac64.zip"],
|
||||||
|
)
|
||||||
|
|
||||||
|
platform_http_file(
|
||||||
|
name = "org_chromium_chromedriver_windows",
|
||||||
|
licenses = ["reciprocal"], # BSD 3-clause, ICU, MPL 1.1, libpng (BSD/MIT-like), Academic Free License v. 2.0, BSD 2-clause, MIT
|
||||||
|
sha256 = "de1423b2d69f96e451e902d686e8d471610d786c345a8de59dd1a5a436e45fc2",
|
||||||
|
# 83.0.4103
|
||||||
|
urls = ["https://commondatastorage.googleapis.com/chromium-browser-snapshots/Win/756065/chromedriver_win32.zip"],
|
||||||
|
)
|
|
@ -0,0 +1,74 @@
|
||||||
|
# Copyright Google LLC
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
################################################################################
|
||||||
|
#
|
||||||
|
package(default_visibility = ["//visibility:public"])
|
||||||
|
|
||||||
|
load("@io_bazel_rules_webtesting//web:web.bzl", "browser", "web_test_archive")
|
||||||
|
|
||||||
|
# Override of firefox web_test_archive so that the archive is selected based on platform.
|
||||||
|
web_test_archive(
|
||||||
|
name = "firefox_archive",
|
||||||
|
testonly = True,
|
||||||
|
archive = select({
|
||||||
|
"@io_bazel_rules_webtesting//common/conditions:linux": "@org_mozilla_firefox_amd64//file",
|
||||||
|
"@io_bazel_rules_webtesting//common/conditions:mac": "@org_mozilla_firefox_macos//file",
|
||||||
|
}),
|
||||||
|
extract = "build",
|
||||||
|
named_files = select({
|
||||||
|
"@io_bazel_rules_webtesting//common/conditions:linux": {"FIREFOX": "firefox/firefox"},
|
||||||
|
"@io_bazel_rules_webtesting//common/conditions:mac": {"FIREFOX": "Firefox.app/Contents/MacOS/firefox"},
|
||||||
|
}),
|
||||||
|
visibility = ["//dev-infra/browsers:__subpackages__"],
|
||||||
|
)
|
||||||
|
|
||||||
|
# Override of geckodriver web_test_archive so that the archive is selected based on platform.
|
||||||
|
web_test_archive(
|
||||||
|
name = "geckodriver_archive",
|
||||||
|
testonly = True,
|
||||||
|
archive = select({
|
||||||
|
"@io_bazel_rules_webtesting//common/conditions:linux": "@org_mozilla_geckodriver_amd64//file",
|
||||||
|
"@io_bazel_rules_webtesting//common/conditions:mac": "@org_mozilla_geckodriver_macos//file",
|
||||||
|
}),
|
||||||
|
extract = "build",
|
||||||
|
named_files = {"GECKODRIVER": "geckodriver"},
|
||||||
|
visibility = ["//dev-infra/browsers:__subpackages__"],
|
||||||
|
)
|
||||||
|
|
||||||
|
browser(
|
||||||
|
name = "firefox",
|
||||||
|
disabled = select({
|
||||||
|
# TODO: Consider adding support for Windows. Requires a portable version of
|
||||||
|
# Firefox. Official distribution only ships with installers.
|
||||||
|
"@io_bazel_rules_webtesting//common/conditions:windows": "Firefox is not supported on Windows",
|
||||||
|
"//conditions:default": None,
|
||||||
|
}),
|
||||||
|
metadata = "firefox.json",
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
|
deps = select({
|
||||||
|
"@io_bazel_rules_webtesting//common/conditions:windows": [],
|
||||||
|
"//conditions:default": [
|
||||||
|
"@io_bazel_rules_webtesting//go/wsl",
|
||||||
|
":firefox_archive",
|
||||||
|
":geckodriver_archive",
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
|
||||||
|
# Make source files available for distribution via pkg_npm
|
||||||
|
filegroup(
|
||||||
|
name = "files",
|
||||||
|
srcs = glob(["*"]),
|
||||||
|
)
|
|
@ -0,0 +1,42 @@
|
||||||
|
load("//dev-infra/browsers:platform_http_file.bzl", "platform_http_file")
|
||||||
|
|
||||||
|
"""
|
||||||
|
Defines repositories for Firefox that can be used inside Karma unit tests
|
||||||
|
and Protractor e2e tests with Bazel.
|
||||||
|
"""
|
||||||
|
|
||||||
|
def define_firefox_repositories():
|
||||||
|
# Instructions on updating the Firefox version can be found in the `README.md` file
|
||||||
|
# next to this file.
|
||||||
|
|
||||||
|
platform_http_file(
|
||||||
|
name = "org_mozilla_firefox_amd64",
|
||||||
|
licenses = ["reciprocal"], # MPL 2.0
|
||||||
|
sha256 = "bde6e020556a21561e4b8d7aaecf8db7077951f179b98ca5d0305435bc6802c9",
|
||||||
|
# Firefox v78.0
|
||||||
|
urls = ["https://ftp.mozilla.org/pub/firefox/releases/78.0/linux-x86_64/en-US/firefox-78.0.tar.bz2"],
|
||||||
|
)
|
||||||
|
|
||||||
|
platform_http_file(
|
||||||
|
name = "org_mozilla_firefox_macos",
|
||||||
|
licenses = ["reciprocal"], # MPL 2.0
|
||||||
|
sha256 = "69a0ae139814cc314d0c5e3fd3859e0ac9de8517550d7d32b06c57022a14f49e",
|
||||||
|
# Firefox v78.0
|
||||||
|
urls = ["https://ftp.mozilla.org/pub/firefox/releases/78.0/mac/en-US/Firefox%2078.0.dmg"],
|
||||||
|
)
|
||||||
|
|
||||||
|
platform_http_file(
|
||||||
|
name = "org_mozilla_geckodriver_amd64",
|
||||||
|
licenses = ["reciprocal"], # MPL 2.0
|
||||||
|
sha256 = "d59ca434d8e41ec1e30dd7707b0c95171dd6d16056fb6db9c978449ad8b93cc0",
|
||||||
|
# Geckodriver v0.26.0
|
||||||
|
urls = ["https://github.com/mozilla/geckodriver/releases/download/v0.26.0/geckodriver-v0.26.0-linux64.tar.gz"],
|
||||||
|
)
|
||||||
|
|
||||||
|
platform_http_file(
|
||||||
|
name = "org_mozilla_geckodriver_macos",
|
||||||
|
licenses = ["reciprocal"], # MPL 2.0
|
||||||
|
sha256 = "4739ef8f8af5d89bd4a8015788b4dc45c2f5f16b2fdc001254c9a92fe7261947",
|
||||||
|
# Geckodriver v0.26.0
|
||||||
|
urls = ["https://github.com/mozilla/geckodriver/releases/download/v0.26.0/geckodriver-v0.26.0-macos.tar.gz"],
|
||||||
|
)
|
|
@ -0,0 +1,21 @@
|
||||||
|
{
|
||||||
|
"environment": "local",
|
||||||
|
"capabilities": {
|
||||||
|
"browserName": "firefox",
|
||||||
|
"moz:firefoxOptions": {
|
||||||
|
"binary": "%FILE:FIREFOX%",
|
||||||
|
"args": ["--headless"]
|
||||||
|
},
|
||||||
|
"google:wslConfig": {
|
||||||
|
"binary": "%FILE:GECKODRIVER%",
|
||||||
|
"port":"%WSLPORT:WSL%",
|
||||||
|
"args": [
|
||||||
|
"--port=%WSLPORT:WSL%",
|
||||||
|
"--host=%WSL:HOST_IP%",
|
||||||
|
"--marionette-port=%WSLPORT:MARIONETTE%"
|
||||||
|
],
|
||||||
|
"status": true,
|
||||||
|
"shutdown": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
load(
|
||||||
|
"@io_bazel_rules_webtesting//web/internal:platform_http_file.bzl",
|
||||||
|
_platform_http_file = "platform_http_file",
|
||||||
|
)
|
||||||
|
|
||||||
|
def platform_http_file(name, licenses, sha256, urls):
|
||||||
|
"""Platform specific browser repository.
|
||||||
|
|
||||||
|
This works around a deficiency in io_bazel_rules_webtesting platform_http_file in that
|
||||||
|
it selects the platform when the repository rule is executed. This limits browsers
|
||||||
|
tests to run on the local user platform only. For cross-platform RBE we want a repository
|
||||||
|
to be defined per platform so the correct one can be selected.
|
||||||
|
"""
|
||||||
|
|
||||||
|
_platform_http_file(
|
||||||
|
name = name,
|
||||||
|
amd64_sha256 = sha256,
|
||||||
|
amd64_urls = urls,
|
||||||
|
licenses = licenses,
|
||||||
|
macos_sha256 = sha256,
|
||||||
|
macos_urls = urls,
|
||||||
|
windows_sha256 = sha256,
|
||||||
|
windows_urls = urls,
|
||||||
|
)
|
|
@ -70,7 +70,7 @@ def karma_test(name, env_srcs, env_deps, env_entry_point, test_srcs, test_deps,
|
||||||
":" + name + "_env_rollup.umd",
|
":" + name + "_env_rollup.umd",
|
||||||
] + bootstrap +
|
] + bootstrap +
|
||||||
_karma_test_required_dist_files,
|
_karma_test_required_dist_files,
|
||||||
browsers = ["//dev-infra/browsers:chromium"],
|
browsers = ["//dev-infra/browsers/chromium:chromium"],
|
||||||
static_files = [
|
static_files = [
|
||||||
":assets/sample.json",
|
":assets/sample.json",
|
||||||
":assets/worker.js",
|
":assets/worker.js",
|
||||||
|
@ -93,7 +93,7 @@ def karma_test(name, env_srcs, env_deps, env_entry_point, test_srcs, test_deps,
|
||||||
":" + name + "_env_rollup.umd",
|
":" + name + "_env_rollup.umd",
|
||||||
"//packages/zone.js/bundles:zone-testing-bundle.umd.min.js",
|
"//packages/zone.js/bundles:zone-testing-bundle.umd.min.js",
|
||||||
] + _karma_test_required_dist_files,
|
] + _karma_test_required_dist_files,
|
||||||
browsers = ["//dev-infra/browsers:chromium"],
|
browsers = ["//dev-infra/browsers/chromium:chromium"],
|
||||||
config_file = "//:karma-js.conf.js",
|
config_file = "//:karma-js.conf.js",
|
||||||
configuration_env_vars = ["KARMA_WEB_TEST_MODE"],
|
configuration_env_vars = ["KARMA_WEB_TEST_MODE"],
|
||||||
data = [
|
data = [
|
||||||
|
|
|
@ -245,7 +245,7 @@ def karma_web_test_suite(name, **kwargs):
|
||||||
runtime_deps = runtime_deps,
|
runtime_deps = runtime_deps,
|
||||||
bootstrap = bootstrap,
|
bootstrap = bootstrap,
|
||||||
deps = deps,
|
deps = deps,
|
||||||
browsers = ["//dev-infra/browsers:chromium"],
|
browsers = ["//dev-infra/browsers/firefox:firefox"],
|
||||||
data = data,
|
data = data,
|
||||||
tags = tags,
|
tags = tags,
|
||||||
**kwargs
|
**kwargs
|
||||||
|
@ -282,7 +282,7 @@ def protractor_web_test_suite(**kwargs):
|
||||||
"""Default values for protractor_web_test_suite"""
|
"""Default values for protractor_web_test_suite"""
|
||||||
|
|
||||||
_protractor_web_test_suite(
|
_protractor_web_test_suite(
|
||||||
browsers = ["//dev-infra/browsers:chromium"],
|
browsers = ["//dev-infra/browsers/chromium:chromium"],
|
||||||
**kwargs
|
**kwargs
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue