Skip to content

Commit

Permalink
chore: move e2e tests into component source dirs (#16117)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
mmalerba authored and josephperrott committed Jun 10, 2019
1 parent df926c1 commit 033a4f7
Show file tree
Hide file tree
Showing 113 changed files with 997 additions and 324 deletions.
8 changes: 4 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ jobs:
- *setup_bazel_remote_execution

- run: bazel build src/... --build_tag_filters=-docs-package
- run: bazel test src/... --build_tag_filters=-docs-package
- run: bazel test src/... --build_tag_filters=-docs-package --test_tag_filters=-e2e

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

- run: bazel test e2e/...
- run: bazel test src/... --test_tag_filters=e2e

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

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

# ----------------------------------------------------------------------------------------
# Workflow definitions. A workflow usually groups multiple jobs together. This is useful if
Expand Down
33 changes: 1 addition & 32 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -171,38 +171,6 @@
/src/dev-app/virtual-scroll/** @mmalerba

# E2E app
/e2e/* @jelbourn
/e2e/components/block-scroll-strategy-e2e.spec.ts @andrewseguin @crisbeto
/e2e/components/button-e2e.spec.ts @jelbourn
/e2e/components/button-toggle-e2e.spec.ts @jelbourn
/e2e/components/card-e2e.spec.ts @jelbourn
/e2e/components/checkbox-e2e.spec.ts @jelbourn @devversion
/e2e/components/dialog-e2e.spec.ts @jelbourn @crisbeto
/e2e/components/expansion-e2e.spec.ts @josephperrott @jelbourn
/e2e/components/grid-list-e2e.spec.ts @jelbourn
/e2e/components/icon-e2e.spec.ts @jelbourn
/e2e/components/input-e2e.spec.ts @mmalerba
/e2e/components/list-e2e.spec.ts @jelbourn @crisbeto @devversion
/e2e/components/mdc-button-e2e.spec.ts @andrewseguin
# Note to implementer: please repossess
/e2e/components/mdc-card-e2e.spec.ts @mmalerba
/e2e/components/mdc-checkbox-e2e.spec.ts @mmalerba
/e2e/components/mdc-chips-e2e.spec.ts @mmalerba
/e2e/components/mdc-menu-e2e.spec.ts @crisbeto
# Note to implementer: please repossess
/e2e/components/mdc-radio-e2e.spec.ts @mmalerba
/e2e/components/mdc-slide-toggle-e2e.spec.ts @crisbeto
/e2e/components/menu-e2e.spec.ts @crisbeto
/e2e/components/progress-bar-e2e.spec.ts @jelbourn @crisbeto @josephperrott
/e2e/components/progress-spinner-e2e.spec.ts @jelbourn @crisbeto @josephperrott
/e2e/components/radio-e2e.spec.ts @jelbourn @devversion
/e2e/components/sidenav-e2e.spec.ts @mmalerba
/e2e/components/slide-toggle-e2e.spec.ts @devversion
/e2e/components/stepper-e2e.spec.ts @mmalerba
/e2e/components/tabs-e2e.spec.ts @andrewseguin
/e2e/components/toolbar-e2e.spec.ts @devversion
/e2e/components/virtual-scroll-e2e.spec.ts @mmalerba
/e2e/util/** @jelbourn
/src/e2e-app/* @jelbourn
/src/e2e-app/block-scroll-strategy/** @andrewseguin @crisbeto
/src/e2e-app/button/** @jelbourn
Expand Down Expand Up @@ -234,6 +202,7 @@
/src/e2e-app/slide-toggle/** @devversion
/src/e2e-app/stepper/** @mmalerba
/src/e2e-app/tabs/** @andrewseguin
/src/e2e-app/test-util/** @jelbourn
/src/e2e-app/toolbar/** @devversion
/src/e2e-app/virtual-scroll/** @mmalerba

Expand Down
8 changes: 4 additions & 4 deletions DEV_ENVIRONMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
To build Material in dev mode, run `gulp material:build`.
To build Material in release mode, run `gulp material:build-release`

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

### Running tests

To run unit tests, run `gulp test`.
To run the e2e tests, run `gulp e2e`.
To run lint, run `gulp lint`.
To run unit tests, run `yarn test`.
To run the e2e tests, run `yarn e2e`.
To run lint, run `yarn lint`.
47 changes: 0 additions & 47 deletions e2e/BUILD.bazel

This file was deleted.

12 changes: 0 additions & 12 deletions e2e/index-e2e.spec.ts

This file was deleted.

8 changes: 0 additions & 8 deletions e2e/tsconfig.json

This file was deleted.

3 changes: 0 additions & 3 deletions e2e/util/index.ts

This file was deleted.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
"postinstall": "ngc -p angular-tsconfig.json",
"build": "gulp build-release-packages",
"dev-app": "gulp serve:devapp",
"test": "bazel test //src/...",
"test": "bazel test //src/... --test_tag_filters=-e2e",
"lint": "gulp lint",
"e2e": "bazel test //e2e/...",
"e2e": "bazel test //src/... --test_tag_filters=e2e",
"deploy": "gulp deploy:devapp",
"webdriver-manager": "webdriver-manager",
"breaking-changes": "gulp breaking-changes",
Expand Down
6 changes: 3 additions & 3 deletions src/cdk-experimental/dialog/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ sass_binary(
)

ng_test_library(
name = "dialog_test_sources",
srcs = glob(["**/*.spec.ts"]),
name = "unit_test_sources",
srcs = glob(["**/*.spec.ts"], exclude = ["**/*.e2e.spec.ts"]),
deps = [
"@npm//@angular/common",
"@npm//@angular/platform-browser",
Expand All @@ -42,6 +42,6 @@ ng_test_library(

ng_web_test_suite(
name = "unit_tests",
deps = [":dialog_test_sources"]
deps = [":unit_test_sources"]
)

6 changes: 3 additions & 3 deletions src/cdk-experimental/popover-edit/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ ng_module(
)

ng_test_library(
name = "popover_edit_test_sources",
srcs = glob(["**/*.spec.ts"]),
name = "unit_test_sources",
srcs = glob(["**/*.spec.ts"], exclude = ["**/*.e2e.spec.ts"]),
deps = [
":popover-edit",
"@npm//@angular/common",
Expand All @@ -39,5 +39,5 @@ ng_test_library(

ng_web_test_suite(
name = "unit_tests",
deps = [":popover_edit_test_sources"],
deps = [":unit_test_sources"],
)
33 changes: 29 additions & 4 deletions src/cdk-experimental/scrolling/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package(default_visibility=["//visibility:public"])

load("//tools:defaults.bzl", "ng_module", "ng_test_library", "ng_web_test_suite")
load("@npm_angular_bazel//:index.bzl", "protractor_web_test_suite")
load("//tools:defaults.bzl", "ng_module", "ng_test_library", "ng_web_test_suite", "ng_e2e_test_library")

ng_module(
name = "scrolling",
Expand All @@ -16,8 +17,8 @@ ng_module(
)

ng_test_library(
name = "scrolling_test_sources",
srcs = glob(["**/*.spec.ts"]),
name = "unit_test_sources",
srcs = glob(["**/*.spec.ts"], exclude = ["**/*.e2e.spec.ts"]),
deps = [
"//src/cdk/scrolling",
":scrolling",
Expand All @@ -26,5 +27,29 @@ ng_test_library(

ng_web_test_suite(
name = "unit_tests",
deps = [":scrolling_test_sources"]
deps = [":unit_test_sources"]
)

ng_e2e_test_library(
name = "e2e_test_sources",
srcs = glob(["**/*.e2e.spec.ts"]),
deps = [
"//src/cdk/testing/e2e",
]
)

protractor_web_test_suite(
name = "e2e_tests",
tags = ["e2e"],
configuration = "//src/e2e-app:protractor.conf.js",
on_prepare = "//src/e2e-app:start-devserver.js",
server = "//src/e2e-app:devserver",
deps = [
":e2e_test_sources",
"//src/cdk/testing/e2e",
],
data = [
"@npm//@angular/bazel",
"//tools/axe-protractor",
],
)
File renamed without changes.
3 changes: 3 additions & 0 deletions src/cdk-experimental/tsconfig-tests.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,8 @@
// Include the index.ts for each secondary entry-point
"./*/index.ts",
"**/*.spec.ts"
],
"exclude": [
"**/*.e2e.spec.ts"
]
}
6 changes: 3 additions & 3 deletions src/cdk/a11y/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ sass_binary(
)

ng_test_library(
name = "a11y_test_sources",
srcs = glob(["**/*.spec.ts"]),
name = "unit_test_sources",
srcs = glob(["**/*.spec.ts"], exclude = ["**/*.e2e.spec.ts"]),
deps = [
"@npm//@angular/platform-browser",
"@npm//rxjs",
Expand All @@ -46,7 +46,7 @@ ng_test_library(

ng_web_test_suite(
name = "unit_tests",
deps = [":a11y_test_sources"],
deps = [":unit_test_sources"],
)

markdown_to_html(
Expand Down
6 changes: 3 additions & 3 deletions src/cdk/accordion/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ ng_module(
)

ng_test_library(
name = "accordion_test_sources",
srcs = glob(["**/*.spec.ts"]),
name = "unit_test_sources",
srcs = glob(["**/*.spec.ts"], exclude = ["**/*.e2e.spec.ts"]),
deps = [
"@npm//@angular/platform-browser",
":accordion",
Expand All @@ -26,7 +26,7 @@ ng_test_library(

ng_web_test_suite(
name = "unit_tests",
deps = [":accordion_test_sources"],
deps = [":unit_test_sources"],
)

markdown_to_html(
Expand Down
6 changes: 3 additions & 3 deletions src/cdk/bidi/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ ng_module(
)

ng_test_library(
name = "bidi_test_sources",
srcs = glob(["**/*.spec.ts"]),
name = "unit_test_sources",
srcs = glob(["**/*.spec.ts"], exclude = ["**/*.e2e.spec.ts"]),
deps = [
"@npm//@angular/platform-browser",
":bidi"
Expand All @@ -24,7 +24,7 @@ ng_test_library(

ng_web_test_suite(
name = "unit_tests",
deps = [":bidi_test_sources"],
deps = [":unit_test_sources"],
)

markdown_to_html(
Expand Down
6 changes: 3 additions & 3 deletions src/cdk/coercion/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ ts_library(
)

ts_library(
name = "coercion_test_sources",
srcs = glob(["**/*.spec.ts"]),
name = "unit_test_sources",
srcs = glob(["**/*.spec.ts"], exclude = ["**/*.e2e.spec.ts"]),
deps = [
"@npm//@angular/core",
"@npm//@types/jasmine",
Expand All @@ -24,7 +24,7 @@ ts_library(

ts_web_test_suite(
name = "unit_tests",
deps = [":coercion_test_sources"],
deps = [":unit_test_sources"],
)

markdown_to_html(
Expand Down
6 changes: 3 additions & 3 deletions src/cdk/collections/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ ng_module(
)

ng_test_library(
name = "collections_test_sources",
srcs = glob(["**/*.spec.ts"]),
name = "unit_test_sources",
srcs = glob(["**/*.spec.ts"], exclude = ["**/*.e2e.spec.ts"]),
deps = [
":collections"
],
)

ng_web_test_suite(
name = "unit_tests",
deps = [":collections_test_sources"],
deps = [":unit_test_sources"],
)

markdown_to_html(
Expand Down
Loading

0 comments on commit 033a4f7

Please sign in to comment.