Skip to content

Commit 612a738

Browse files
authored
chore: move e2e tests into component source dirs (#16117)
* chore: move e2e tests into component source dirs * move utils in e2e/ to src/e2e-app/ * move e2e tests to the component's src dir * update owners and uses of gulp/bazel * fix some targets I missed when renaming * move e2e test utils under @angular/cdk/testing * fix lint
1 parent df926c1 commit 612a738

File tree

113 files changed

+997
-324
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

113 files changed

+997
-324
lines changed

.circleci/config.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ jobs:
131131
- *setup_bazel_remote_execution
132132

133133
- run: bazel build src/... --build_tag_filters=-docs-package
134-
- run: bazel test src/... --build_tag_filters=-docs-package
134+
- run: bazel test src/... --build_tag_filters=-docs-package --test_tag_filters=-e2e
135135

136136
# Note: We want to save the cache in this job because the workspace cache also
137137
# includes the Bazel repository cache that will be updated in this job.
@@ -168,7 +168,7 @@ jobs:
168168
- *copy_bazel_config
169169
- *setup_bazel_remote_execution
170170

171-
- run: bazel test e2e/...
171+
- run: bazel test src/... --test_tag_filters=e2e
172172

173173
# ------------------------------------------------------------------------------------------
174174
# Job that runs the unit tests on locally installed browsers (Chrome and Firefox headless).
@@ -376,7 +376,7 @@ jobs:
376376
- run: sed -i "s/\(_ENABLE_NG_TYPE_CHECKING = \)True/\1False/g" tools/defaults.bzl
377377
# Run project tests with ngtsc and the Ivy Angular packages.
378378
- run: bazel build src/... --build_tag_filters=-docs-package --define=compile=aot
379-
- run: bazel test src/... --build_tag_filters=-docs-package --define=compile=aot
379+
- run: bazel test src/... --build_tag_filters=-docs-package --define=compile=aot --test_tag_filters=-e2e
380380

381381
# ----------------------------------------------------------------------------
382382
# Job that runs all Bazel tests against Ivy from angular/angular#master.
@@ -401,7 +401,7 @@ jobs:
401401
- run: sed -i "s/\(_ENABLE_NG_TYPE_CHECKING = \)True/\1False/g" tools/defaults.bzl
402402
# Run project tests with ngtsc and the Ivy Angular packages.
403403
- run: bazel build src/... --build_tag_filters=-docs-package --define=compile=aot
404-
- run: bazel test src/... --build_tag_filters=-docs-package --define=compile=aot
404+
- run: bazel test src/... --build_tag_filters=-docs-package --define=compile=aot --test_tag_filters=-e2e
405405

406406
# ----------------------------------------------------------------------------------------
407407
# Workflow definitions. A workflow usually groups multiple jobs together. This is useful if

.github/CODEOWNERS

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -171,38 +171,6 @@
171171
/src/dev-app/virtual-scroll/** @mmalerba
172172

173173
# E2E app
174-
/e2e/* @jelbourn
175-
/e2e/components/block-scroll-strategy-e2e.spec.ts @andrewseguin @crisbeto
176-
/e2e/components/button-e2e.spec.ts @jelbourn
177-
/e2e/components/button-toggle-e2e.spec.ts @jelbourn
178-
/e2e/components/card-e2e.spec.ts @jelbourn
179-
/e2e/components/checkbox-e2e.spec.ts @jelbourn @devversion
180-
/e2e/components/dialog-e2e.spec.ts @jelbourn @crisbeto
181-
/e2e/components/expansion-e2e.spec.ts @josephperrott @jelbourn
182-
/e2e/components/grid-list-e2e.spec.ts @jelbourn
183-
/e2e/components/icon-e2e.spec.ts @jelbourn
184-
/e2e/components/input-e2e.spec.ts @mmalerba
185-
/e2e/components/list-e2e.spec.ts @jelbourn @crisbeto @devversion
186-
/e2e/components/mdc-button-e2e.spec.ts @andrewseguin
187-
# Note to implementer: please repossess
188-
/e2e/components/mdc-card-e2e.spec.ts @mmalerba
189-
/e2e/components/mdc-checkbox-e2e.spec.ts @mmalerba
190-
/e2e/components/mdc-chips-e2e.spec.ts @mmalerba
191-
/e2e/components/mdc-menu-e2e.spec.ts @crisbeto
192-
# Note to implementer: please repossess
193-
/e2e/components/mdc-radio-e2e.spec.ts @mmalerba
194-
/e2e/components/mdc-slide-toggle-e2e.spec.ts @crisbeto
195-
/e2e/components/menu-e2e.spec.ts @crisbeto
196-
/e2e/components/progress-bar-e2e.spec.ts @jelbourn @crisbeto @josephperrott
197-
/e2e/components/progress-spinner-e2e.spec.ts @jelbourn @crisbeto @josephperrott
198-
/e2e/components/radio-e2e.spec.ts @jelbourn @devversion
199-
/e2e/components/sidenav-e2e.spec.ts @mmalerba
200-
/e2e/components/slide-toggle-e2e.spec.ts @devversion
201-
/e2e/components/stepper-e2e.spec.ts @mmalerba
202-
/e2e/components/tabs-e2e.spec.ts @andrewseguin
203-
/e2e/components/toolbar-e2e.spec.ts @devversion
204-
/e2e/components/virtual-scroll-e2e.spec.ts @mmalerba
205-
/e2e/util/** @jelbourn
206174
/src/e2e-app/* @jelbourn
207175
/src/e2e-app/block-scroll-strategy/** @andrewseguin @crisbeto
208176
/src/e2e-app/button/** @jelbourn
@@ -234,6 +202,7 @@
234202
/src/e2e-app/slide-toggle/** @devversion
235203
/src/e2e-app/stepper/** @mmalerba
236204
/src/e2e-app/tabs/** @andrewseguin
205+
/src/e2e-app/test-util/** @jelbourn
237206
/src/e2e-app/toolbar/** @devversion
238207
/src/e2e-app/virtual-scroll/** @mmalerba
239208

DEV_ENVIRONMENT.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313
To build Material in dev mode, run `gulp material:build`.
1414
To build Material in release mode, run `gulp material:build-release`
1515

16-
To bring up a local server, run `gulp serve:devapp`. This will automatically watch for changes
16+
To bring up a local server, run `yarn dev-app`. This will automatically watch for changes
1717
and rebuild. The browser should refresh automatically when changes are made.
1818

1919
### Running tests
2020

21-
To run unit tests, run `gulp test`.
22-
To run the e2e tests, run `gulp e2e`.
23-
To run lint, run `gulp lint`.
21+
To run unit tests, run `yarn test`.
22+
To run the e2e tests, run `yarn e2e`.
23+
To run lint, run `yarn lint`.

e2e/BUILD.bazel

Lines changed: 0 additions & 47 deletions
This file was deleted.

e2e/index-e2e.spec.ts

Lines changed: 0 additions & 12 deletions
This file was deleted.

e2e/tsconfig.json

Lines changed: 0 additions & 8 deletions
This file was deleted.

e2e/util/index.ts

Lines changed: 0 additions & 3 deletions
This file was deleted.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
"postinstall": "ngc -p angular-tsconfig.json",
1616
"build": "gulp build-release-packages",
1717
"dev-app": "gulp serve:devapp",
18-
"test": "bazel test //src/...",
18+
"test": "bazel test //src/... --test_tag_filters=-e2e",
1919
"lint": "gulp lint",
20-
"e2e": "bazel test //e2e/...",
20+
"e2e": "bazel test //src/... --test_tag_filters=e2e",
2121
"deploy": "gulp deploy:devapp",
2222
"webdriver-manager": "webdriver-manager",
2323
"breaking-changes": "gulp breaking-changes",

src/cdk-experimental/dialog/BUILD.bazel

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ sass_binary(
2727
)
2828

2929
ng_test_library(
30-
name = "dialog_test_sources",
31-
srcs = glob(["**/*.spec.ts"]),
30+
name = "unit_test_sources",
31+
srcs = glob(["**/*.spec.ts"], exclude = ["**/*.e2e.spec.ts"]),
3232
deps = [
3333
"@npm//@angular/common",
3434
"@npm//@angular/platform-browser",
@@ -42,6 +42,6 @@ ng_test_library(
4242

4343
ng_web_test_suite(
4444
name = "unit_tests",
45-
deps = [":dialog_test_sources"]
45+
deps = [":unit_test_sources"]
4646
)
4747

src/cdk-experimental/popover-edit/BUILD.bazel

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ ng_module(
2121
)
2222

2323
ng_test_library(
24-
name = "popover_edit_test_sources",
25-
srcs = glob(["**/*.spec.ts"]),
24+
name = "unit_test_sources",
25+
srcs = glob(["**/*.spec.ts"], exclude = ["**/*.e2e.spec.ts"]),
2626
deps = [
2727
":popover-edit",
2828
"@npm//@angular/common",
@@ -39,5 +39,5 @@ ng_test_library(
3939

4040
ng_web_test_suite(
4141
name = "unit_tests",
42-
deps = [":popover_edit_test_sources"],
42+
deps = [":unit_test_sources"],
4343
)

src/cdk-experimental/scrolling/BUILD.bazel

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package(default_visibility=["//visibility:public"])
22

3-
load("//tools:defaults.bzl", "ng_module", "ng_test_library", "ng_web_test_suite")
3+
load("@npm_angular_bazel//:index.bzl", "protractor_web_test_suite")
4+
load("//tools:defaults.bzl", "ng_module", "ng_test_library", "ng_web_test_suite", "ng_e2e_test_library")
45

56
ng_module(
67
name = "scrolling",
@@ -16,8 +17,8 @@ ng_module(
1617
)
1718

1819
ng_test_library(
19-
name = "scrolling_test_sources",
20-
srcs = glob(["**/*.spec.ts"]),
20+
name = "unit_test_sources",
21+
srcs = glob(["**/*.spec.ts"], exclude = ["**/*.e2e.spec.ts"]),
2122
deps = [
2223
"//src/cdk/scrolling",
2324
":scrolling",
@@ -26,5 +27,29 @@ ng_test_library(
2627

2728
ng_web_test_suite(
2829
name = "unit_tests",
29-
deps = [":scrolling_test_sources"]
30+
deps = [":unit_test_sources"]
31+
)
32+
33+
ng_e2e_test_library(
34+
name = "e2e_test_sources",
35+
srcs = glob(["**/*.e2e.spec.ts"]),
36+
deps = [
37+
"//src/cdk/testing/e2e",
38+
]
39+
)
40+
41+
protractor_web_test_suite(
42+
name = "e2e_tests",
43+
tags = ["e2e"],
44+
configuration = "//src/e2e-app:protractor.conf.js",
45+
on_prepare = "//src/e2e-app:start-devserver.js",
46+
server = "//src/e2e-app:devserver",
47+
deps = [
48+
":e2e_test_sources",
49+
"//src/cdk/testing/e2e",
50+
],
51+
data = [
52+
"@npm//@angular/bazel",
53+
"//tools/axe-protractor",
54+
],
3055
)

src/cdk-experimental/tsconfig-tests.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,8 @@
2727
// Include the index.ts for each secondary entry-point
2828
"./*/index.ts",
2929
"**/*.spec.ts"
30+
],
31+
"exclude": [
32+
"**/*.e2e.spec.ts"
3033
]
3134
}

src/cdk/a11y/BUILD.bazel

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ sass_binary(
3131
)
3232

3333
ng_test_library(
34-
name = "a11y_test_sources",
35-
srcs = glob(["**/*.spec.ts"]),
34+
name = "unit_test_sources",
35+
srcs = glob(["**/*.spec.ts"], exclude = ["**/*.e2e.spec.ts"]),
3636
deps = [
3737
"@npm//@angular/platform-browser",
3838
"@npm//rxjs",
@@ -46,7 +46,7 @@ ng_test_library(
4646

4747
ng_web_test_suite(
4848
name = "unit_tests",
49-
deps = [":a11y_test_sources"],
49+
deps = [":unit_test_sources"],
5050
)
5151

5252
markdown_to_html(

src/cdk/accordion/BUILD.bazel

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ ng_module(
1616
)
1717

1818
ng_test_library(
19-
name = "accordion_test_sources",
20-
srcs = glob(["**/*.spec.ts"]),
19+
name = "unit_test_sources",
20+
srcs = glob(["**/*.spec.ts"], exclude = ["**/*.e2e.spec.ts"]),
2121
deps = [
2222
"@npm//@angular/platform-browser",
2323
":accordion",
@@ -26,7 +26,7 @@ ng_test_library(
2626

2727
ng_web_test_suite(
2828
name = "unit_tests",
29-
deps = [":accordion_test_sources"],
29+
deps = [":unit_test_sources"],
3030
)
3131

3232
markdown_to_html(

src/cdk/bidi/BUILD.bazel

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ ng_module(
1414
)
1515

1616
ng_test_library(
17-
name = "bidi_test_sources",
18-
srcs = glob(["**/*.spec.ts"]),
17+
name = "unit_test_sources",
18+
srcs = glob(["**/*.spec.ts"], exclude = ["**/*.e2e.spec.ts"]),
1919
deps = [
2020
"@npm//@angular/platform-browser",
2121
":bidi"
@@ -24,7 +24,7 @@ ng_test_library(
2424

2525
ng_web_test_suite(
2626
name = "unit_tests",
27-
deps = [":bidi_test_sources"],
27+
deps = [":unit_test_sources"],
2828
)
2929

3030
markdown_to_html(

src/cdk/coercion/BUILD.bazel

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ ts_library(
1212
)
1313

1414
ts_library(
15-
name = "coercion_test_sources",
16-
srcs = glob(["**/*.spec.ts"]),
15+
name = "unit_test_sources",
16+
srcs = glob(["**/*.spec.ts"], exclude = ["**/*.e2e.spec.ts"]),
1717
deps = [
1818
"@npm//@angular/core",
1919
"@npm//@types/jasmine",
@@ -24,7 +24,7 @@ ts_library(
2424

2525
ts_web_test_suite(
2626
name = "unit_tests",
27-
deps = [":coercion_test_sources"],
27+
deps = [":unit_test_sources"],
2828
)
2929

3030
markdown_to_html(

src/cdk/collections/BUILD.bazel

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,16 @@ ng_module(
1414
)
1515

1616
ng_test_library(
17-
name = "collections_test_sources",
18-
srcs = glob(["**/*.spec.ts"]),
17+
name = "unit_test_sources",
18+
srcs = glob(["**/*.spec.ts"], exclude = ["**/*.e2e.spec.ts"]),
1919
deps = [
2020
":collections"
2121
],
2222
)
2323

2424
ng_web_test_suite(
2525
name = "unit_tests",
26-
deps = [":collections_test_sources"],
26+
deps = [":unit_test_sources"],
2727
)
2828

2929
markdown_to_html(

0 commit comments

Comments
 (0)