build(bazel): upgrade benchmarks to protractor_web_test_suite for CI without local chrome (#26908)
PR Close #26908
This commit is contained in:
parent
3567e81175
commit
15e671ec5a
|
@ -1,7 +1,7 @@
|
||||||
package(default_visibility = ["//visibility:public"])
|
package(default_visibility = ["//visibility:public"])
|
||||||
|
|
||||||
load("//tools:defaults.bzl", "ng_module", "ng_rollup_bundle")
|
load("//tools:defaults.bzl", "ng_module", "ng_rollup_bundle")
|
||||||
load("//packages/bazel:index.bzl", "protractor_web_test")
|
load("//packages/bazel:index.bzl", "protractor_web_test_suite")
|
||||||
load("@build_bazel_rules_typescript//:defs.bzl", "ts_devserver")
|
load("@build_bazel_rules_typescript//:defs.bzl", "ts_devserver")
|
||||||
|
|
||||||
ng_module(
|
ng_module(
|
||||||
|
@ -50,7 +50,7 @@ ts_devserver(
|
||||||
tags = ["ivy-only"],
|
tags = ["ivy-only"],
|
||||||
)
|
)
|
||||||
|
|
||||||
protractor_web_test(
|
protractor_web_test_suite(
|
||||||
name = "perf",
|
name = "perf",
|
||||||
configuration = "//:protractor-perf.conf.js",
|
configuration = "//:protractor-perf.conf.js",
|
||||||
data = [
|
data = [
|
||||||
|
@ -64,8 +64,6 @@ protractor_web_test(
|
||||||
on_prepare = ":protractor.on_prepare.js",
|
on_prepare = ":protractor.on_prepare.js",
|
||||||
server = ":devserver",
|
server = ":devserver",
|
||||||
tags = [
|
tags = [
|
||||||
"fixme-ivy-aot",
|
|
||||||
"fixme-ivy-jit",
|
|
||||||
"ivy-only",
|
"ivy-only",
|
||||||
],
|
],
|
||||||
deps = [
|
deps = [
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package(default_visibility = ["//visibility:public"])
|
package(default_visibility = ["//visibility:public"])
|
||||||
|
|
||||||
load("//tools:defaults.bzl", "ng_module", "ng_rollup_bundle")
|
load("//tools:defaults.bzl", "ng_module", "ng_rollup_bundle")
|
||||||
load("//packages/bazel:index.bzl", "protractor_web_test")
|
load("//packages/bazel:index.bzl", "protractor_web_test_suite")
|
||||||
load("@build_bazel_rules_typescript//:defs.bzl", "ts_devserver")
|
load("@build_bazel_rules_typescript//:defs.bzl", "ts_devserver")
|
||||||
|
|
||||||
ng_module(
|
ng_module(
|
||||||
|
@ -48,7 +48,7 @@ ts_devserver(
|
||||||
tags = ["ivy-only"],
|
tags = ["ivy-only"],
|
||||||
)
|
)
|
||||||
|
|
||||||
protractor_web_test(
|
protractor_web_test_suite(
|
||||||
name = "perf",
|
name = "perf",
|
||||||
configuration = "//:protractor-perf.conf.js",
|
configuration = "//:protractor-perf.conf.js",
|
||||||
data = [
|
data = [
|
||||||
|
@ -58,8 +58,6 @@ protractor_web_test(
|
||||||
on_prepare = ":protractor.on_prepare.js",
|
on_prepare = ":protractor.on_prepare.js",
|
||||||
server = ":devserver",
|
server = ":devserver",
|
||||||
tags = [
|
tags = [
|
||||||
"fixme-ivy-aot",
|
|
||||||
"fixme-ivy-jit",
|
|
||||||
"ivy-only",
|
"ivy-only",
|
||||||
],
|
],
|
||||||
deps = [
|
deps = [
|
||||||
|
|
|
@ -5,9 +5,6 @@
|
||||||
* Use of this source code is governed by an MIT-style license that can be
|
* Use of this source code is governed by an MIT-style license that can be
|
||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const path = require('path');
|
|
||||||
|
|
||||||
const DEBUG = false;
|
const DEBUG = false;
|
||||||
|
|
||||||
const configPath = 'TMPL_config';
|
const configPath = 'TMPL_config';
|
||||||
|
@ -32,15 +29,44 @@ function setConf(conf, name, value, msg) {
|
||||||
conf[name] = value;
|
conf[name] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function mergeCapabilities(conf, capabilities) {
|
||||||
|
if (conf.capabilities) {
|
||||||
|
if (conf.capabilities.browserName === capabilities.browserName) {
|
||||||
|
// there are capabilities to merge
|
||||||
|
if (capabilities.browserName === 'chrome') {
|
||||||
|
conf.capabilities.chromeOptions = conf.capabilities.chromeOptions || {};
|
||||||
|
conf.capabilities.chromeOptions.binary = capabilities.chromeOptions.binary;
|
||||||
|
conf.capabilities.chromeOptions.args = conf.capabilities.chromeOptions.args || [];
|
||||||
|
conf.capabilities.chromeOptions.args.push(...capabilities.chromeOptions.args);
|
||||||
|
console.warn(
|
||||||
|
`Your protractor configuration specifies capabilities for browser '${conf.capabilities.browserName}'
|
||||||
|
which will be merged with capabilities provided by Bazel resulting in:`,
|
||||||
|
JSON.stringify(conf.capabilities, null, 2));
|
||||||
|
} else {
|
||||||
|
// TODO(gmagolan): implement firefox support for protractor
|
||||||
|
throw new Error(
|
||||||
|
`Unexpected browserName ${capabilities.browserName} for capabilities merging`);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.warn(
|
||||||
|
`Your protractor configuration specifies capabilities for browser '${conf.capabilities.browserName}' which will be overwritten by Bazel`);
|
||||||
|
conf.capabilities = capabilities;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
conf.capabilities = capabilities;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let conf = {};
|
let conf = {};
|
||||||
|
|
||||||
// Import the user's base protractor configuration if specified
|
// Import the user's base protractor configuration if specified
|
||||||
if (configPath) {
|
if (configPath) {
|
||||||
const baseConf = require(configPath);
|
const baseConf = require(configPath);
|
||||||
if (!baseConf.config) {
|
if (!baseConf.config) {
|
||||||
throw new Error('Invalid base protractor configration. Expected config to be exported.');
|
throw new Error('Invalid base protractor configuration. Expected config to be exported.');
|
||||||
}
|
}
|
||||||
conf = baseConf.config;
|
conf = baseConf.config;
|
||||||
|
if (DEBUG) console.info(`Base protractor configuration: ${JSON.stringify(conf, null, 2)}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Import the user's on prepare function if specified
|
// Import the user's on prepare function if specified
|
||||||
|
@ -109,8 +135,8 @@ if (process.env['WEB_TEST_METADATA']) {
|
||||||
}
|
}
|
||||||
setConf(conf, 'directConnect', true, 'is set to true for chrome');
|
setConf(conf, 'directConnect', true, 'is set to true for chrome');
|
||||||
setConf(conf, 'chromeDriver', chromeDriver, 'is determined by the browsers attribute');
|
setConf(conf, 'chromeDriver', chromeDriver, 'is determined by the browsers attribute');
|
||||||
setConf(
|
mergeCapabilities(
|
||||||
conf, 'capabilities', {
|
conf, {
|
||||||
browserName: 'chrome',
|
browserName: 'chrome',
|
||||||
chromeOptions: {
|
chromeOptions: {
|
||||||
binary: chromeBin,
|
binary: chromeBin,
|
||||||
|
@ -131,7 +157,7 @@ if (process.env['WEB_TEST_METADATA']) {
|
||||||
// }
|
// }
|
||||||
// setConf(conf, 'seleniumAddress', process.env.WEB_TEST_HTTP_SERVER.trim() + "/wd/hub", 'is
|
// setConf(conf, 'seleniumAddress', process.env.WEB_TEST_HTTP_SERVER.trim() + "/wd/hub", 'is
|
||||||
// configured by Bazel for firefox browser')
|
// configured by Bazel for firefox browser')
|
||||||
// setConf(conf, 'capabilities', {
|
// mergeCapabilities(conf, {
|
||||||
// browserName: "firefox",
|
// browserName: "firefox",
|
||||||
// 'moz:firefoxOptions': {
|
// 'moz:firefoxOptions': {
|
||||||
// binary: firefoxBin,
|
// binary: firefoxBin,
|
||||||
|
|
Loading…
Reference in New Issue