Skip to content

Commit 42c4aa7

Browse files
devversionjelbourn
authored andcommitted
build: shard component e2e tests with bazel (#15078)
Currently running the e2e tests with Bazel takes about ~6 minutes. This is pretty slow in comparison to how fast the tests ran with our gulp setup. In order to speed up the tests with Bazel by taking advantage of RBE's parallelism, we shard the e2e tests by creating a Bazel test target for each e2e spec file.
1 parent 155a0cb commit 42c4aa7

File tree

1 file changed

+22
-6
lines changed

1 file changed

+22
-6
lines changed

e2e/BUILD.bazel

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,43 @@ load("@angular//:index.bzl", "protractor_web_test_suite")
44
load("//tools:defaults.bzl", "ts_library")
55

66
ts_library(
7-
name = "e2e_specs_lib",
8-
srcs = glob(["**/*.ts"]),
7+
name = "e2e_utils_lib",
8+
srcs = glob(["util/**/*.ts"]),
99
tsconfig = ":tsconfig.json",
1010
deps = [
1111
"@matdeps//@types/jasmine",
1212
"@matdeps//protractor"
1313
]
1414
)
1515

16-
protractor_web_test_suite(
17-
name = "e2e",
16+
# For each spec file in the "components/" folder, we declare a Bazel target
17+
# that builds the JavaScript outputs for the e2e spec file.
18+
[ts_library(
19+
name = "%s_specs_lib" % spec_file,
20+
srcs = [spec_file],
21+
tsconfig = ":tsconfig.json",
22+
deps = [
23+
"@matdeps//@types/jasmine",
24+
"@matdeps//protractor",
25+
":e2e_utils_lib",
26+
]
27+
) for spec_file in glob(["components/**/*.spec.ts"])]
28+
29+
# For each spec file in the "components/" folder, we declare a Protractor web test
30+
# suite target that runs the given e2e spec against the e2e-app devserver.
31+
[protractor_web_test_suite(
32+
name = "%s_e2e" % spec_file,
1833
configuration = ":protractor.conf.js",
1934
on_prepare = ":start-devserver.js",
2035
server = "//src/e2e-app:devserver",
2136
deps = [
2237
"@matdeps//protractor",
23-
":e2e_specs_lib"
38+
":%s_specs_lib" % spec_file,
39+
":e2e_utils_lib",
2440
],
2541
data = [
2642
"@angular//packages/bazel/src/protractor/utils",
2743
"//tools/axe-protractor",
2844
],
29-
)
45+
) for spec_file in glob(["components/**/*.spec.ts"])]
3046

0 commit comments

Comments
 (0)