diff --git a/.circleci/config.yml b/.circleci/config.yml index bf384f094b51..e279b5f8813c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -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. @@ -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). @@ -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. @@ -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 diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 2a16fd8b12b8..aa3502f15385 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -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 @@ -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 diff --git a/DEV_ENVIRONMENT.md b/DEV_ENVIRONMENT.md index 06a6d3fd25bc..bba463742432 100644 --- a/DEV_ENVIRONMENT.md +++ b/DEV_ENVIRONMENT.md @@ -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`. diff --git a/e2e/BUILD.bazel b/e2e/BUILD.bazel deleted file mode 100644 index 6c84fbc8f917..000000000000 --- a/e2e/BUILD.bazel +++ /dev/null @@ -1,47 +0,0 @@ -package(default_visibility=["//visibility:public"]) - -load("@npm_angular_bazel//:index.bzl", "protractor_web_test_suite") -load("//tools:defaults.bzl", "ts_library") - -ts_library( - name = "e2e_utils_lib", - srcs = glob(["util/**/*.ts"]), - tsconfig = ":tsconfig.json", - deps = [ - "@npm//@types/jasmine", - "@npm//protractor" - ] -) - -# For each spec file in the "components/" folder, we declare a Bazel target -# that builds the JavaScript outputs for the e2e spec file. -[ts_library( - name = "%s_specs_lib" % spec_file, - srcs = [spec_file], - tsconfig = ":tsconfig.json", - deps = [ - "@npm//@types/jasmine", - "@npm//@types/selenium-webdriver", - "@npm//protractor", - ":e2e_utils_lib", - ] - ) for spec_file in glob(["components/**/*.spec.ts"])] - -# For each spec file in the "components/" folder, we declare a Protractor web test -# suite target that runs the given e2e spec against the e2e-app devserver. -[protractor_web_test_suite( - name = "%s_e2e" % spec_file, - configuration = ":protractor.conf.js", - on_prepare = ":start-devserver.js", - server = "//src/e2e-app:devserver", - deps = [ - "@npm//protractor", - ":%s_specs_lib" % spec_file, - ":e2e_utils_lib", - ], - data = [ - "@npm//@angular/bazel", - "//tools/axe-protractor", - ], -) for spec_file in glob(["components/**/*.spec.ts"])] - diff --git a/e2e/index-e2e.spec.ts b/e2e/index-e2e.spec.ts deleted file mode 100644 index cae783b1569e..000000000000 --- a/e2e/index-e2e.spec.ts +++ /dev/null @@ -1,12 +0,0 @@ -import {browser} from 'protractor'; - -describe('hello, protractor', () => { - describe('index', () => { - - beforeAll(async () => browser.get('/')); - - it('should have a title', async () => { - expect(await browser.getTitle()).toBe('Angular Material'); - }); - }); -}); diff --git a/e2e/tsconfig.json b/e2e/tsconfig.json deleted file mode 100644 index 170ed637d77a..000000000000 --- a/e2e/tsconfig.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "compilerOptions": { - "lib": ["es2015"], - "types": [ - "jasmine" - ] - } -} diff --git a/e2e/util/index.ts b/e2e/util/index.ts deleted file mode 100644 index 2b076fee83a9..000000000000 --- a/e2e/util/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './actions'; -export * from './asserts'; -export * from './query'; diff --git a/package.json b/package.json index c6c8c369c68b..f711d0f99e75 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/cdk-experimental/dialog/BUILD.bazel b/src/cdk-experimental/dialog/BUILD.bazel index d48f18dbf450..240e4bbead88 100644 --- a/src/cdk-experimental/dialog/BUILD.bazel +++ b/src/cdk-experimental/dialog/BUILD.bazel @@ -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", @@ -42,6 +42,6 @@ ng_test_library( ng_web_test_suite( name = "unit_tests", - deps = [":dialog_test_sources"] + deps = [":unit_test_sources"] ) diff --git a/src/cdk-experimental/popover-edit/BUILD.bazel b/src/cdk-experimental/popover-edit/BUILD.bazel index 65f64f363459..ac4d35860764 100644 --- a/src/cdk-experimental/popover-edit/BUILD.bazel +++ b/src/cdk-experimental/popover-edit/BUILD.bazel @@ -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", @@ -39,5 +39,5 @@ ng_test_library( ng_web_test_suite( name = "unit_tests", - deps = [":popover_edit_test_sources"], + deps = [":unit_test_sources"], ) diff --git a/src/cdk-experimental/scrolling/BUILD.bazel b/src/cdk-experimental/scrolling/BUILD.bazel index 883da1ed1369..7c8234b1e269 100644 --- a/src/cdk-experimental/scrolling/BUILD.bazel +++ b/src/cdk-experimental/scrolling/BUILD.bazel @@ -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", @@ -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", @@ -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", + ], ) diff --git a/e2e/components/virtual-scroll-e2e.spec.ts b/src/cdk-experimental/scrolling/virtual-scroll.e2e.spec.ts similarity index 100% rename from e2e/components/virtual-scroll-e2e.spec.ts rename to src/cdk-experimental/scrolling/virtual-scroll.e2e.spec.ts diff --git a/src/cdk-experimental/tsconfig-tests.json b/src/cdk-experimental/tsconfig-tests.json index 2ad689835068..acd1ac36b8e1 100644 --- a/src/cdk-experimental/tsconfig-tests.json +++ b/src/cdk-experimental/tsconfig-tests.json @@ -27,5 +27,8 @@ // Include the index.ts for each secondary entry-point "./*/index.ts", "**/*.spec.ts" + ], + "exclude": [ + "**/*.e2e.spec.ts" ] } diff --git a/src/cdk/a11y/BUILD.bazel b/src/cdk/a11y/BUILD.bazel index 4e7416ec750c..05db3cd515db 100644 --- a/src/cdk/a11y/BUILD.bazel +++ b/src/cdk/a11y/BUILD.bazel @@ -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", @@ -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( diff --git a/src/cdk/accordion/BUILD.bazel b/src/cdk/accordion/BUILD.bazel index 01e87fe13860..a321f84c2912 100644 --- a/src/cdk/accordion/BUILD.bazel +++ b/src/cdk/accordion/BUILD.bazel @@ -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", @@ -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( diff --git a/src/cdk/bidi/BUILD.bazel b/src/cdk/bidi/BUILD.bazel index 724dfaf5be61..c960b84f7a4b 100644 --- a/src/cdk/bidi/BUILD.bazel +++ b/src/cdk/bidi/BUILD.bazel @@ -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" @@ -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( diff --git a/src/cdk/coercion/BUILD.bazel b/src/cdk/coercion/BUILD.bazel index 72fe7d7ea3ac..2e5307f5b0fb 100644 --- a/src/cdk/coercion/BUILD.bazel +++ b/src/cdk/coercion/BUILD.bazel @@ -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", @@ -24,7 +24,7 @@ ts_library( ts_web_test_suite( name = "unit_tests", - deps = [":coercion_test_sources"], + deps = [":unit_test_sources"], ) markdown_to_html( diff --git a/src/cdk/collections/BUILD.bazel b/src/cdk/collections/BUILD.bazel index 0c8a04060707..64f53e026c31 100644 --- a/src/cdk/collections/BUILD.bazel +++ b/src/cdk/collections/BUILD.bazel @@ -14,8 +14,8 @@ 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" ], @@ -23,7 +23,7 @@ ng_test_library( ng_web_test_suite( name = "unit_tests", - deps = [":collections_test_sources"], + deps = [":unit_test_sources"], ) markdown_to_html( diff --git a/src/cdk/drag-drop/BUILD.bazel b/src/cdk/drag-drop/BUILD.bazel index 1c61422d9b27..5197946c3a49 100644 --- a/src/cdk/drag-drop/BUILD.bazel +++ b/src/cdk/drag-drop/BUILD.bazel @@ -19,8 +19,8 @@ ng_module( ) ng_test_library( - name = "drag-drop_test_sources", - srcs = glob(["**/*.spec.ts"]), + name = "unit_test_sources", + srcs = glob(["**/*.spec.ts"], exclude = ["**/*.e2e.spec.ts"]), deps = [ "@npm//rxjs", "@npm//@angular/common", @@ -32,7 +32,7 @@ ng_test_library( ng_web_test_suite( name = "unit_tests", - deps = [":drag-drop_test_sources"], + deps = [":unit_test_sources"], ) markdown_to_html( diff --git a/src/cdk/keycodes/BUILD.bazel b/src/cdk/keycodes/BUILD.bazel index 97197cb44ba6..cd63ee5aa521 100644 --- a/src/cdk/keycodes/BUILD.bazel +++ b/src/cdk/keycodes/BUILD.bazel @@ -9,8 +9,8 @@ ts_library( ) ts_library( - name = "keycodes_test_sources", - srcs = glob(["**/*.spec.ts"]), + name = "unit_test_sources", + srcs = glob(["**/*.spec.ts"], exclude = ["**/*.e2e.spec.ts"]), deps = [ "@npm//@types/jasmine", "//src/cdk/testing", @@ -21,7 +21,7 @@ ts_library( ts_web_test_suite( name = "unit_tests", - deps = [":keycodes_test_sources"], + deps = [":unit_test_sources"], ) markdown_to_html( diff --git a/src/cdk/layout/BUILD.bazel b/src/cdk/layout/BUILD.bazel index f3eb9a2b4235..ddeebe24efc6 100644 --- a/src/cdk/layout/BUILD.bazel +++ b/src/cdk/layout/BUILD.bazel @@ -16,8 +16,8 @@ ng_module( ) ng_test_library( - name = "layout_test_sources", - srcs = glob(["**/*.spec.ts"]), + name = "unit_test_sources", + srcs = glob(["**/*.spec.ts"], exclude = ["**/*.e2e.spec.ts"]), deps = [ "@npm//rxjs", "//src/cdk/platform", @@ -27,7 +27,7 @@ ng_test_library( ng_web_test_suite( name = "unit_tests", - deps = [":layout_test_sources"], + deps = [":unit_test_sources"], ) markdown_to_html( diff --git a/src/cdk/observers/BUILD.bazel b/src/cdk/observers/BUILD.bazel index 71c2b88a6a0c..0664c28e804c 100644 --- a/src/cdk/observers/BUILD.bazel +++ b/src/cdk/observers/BUILD.bazel @@ -15,14 +15,14 @@ ng_module( ) ng_test_library( - name = "observers_test_sources", - srcs = glob(["**/*.spec.ts"]), + name = "unit_test_sources", + srcs = glob(["**/*.spec.ts"], exclude = ["**/*.e2e.spec.ts"]), deps = [":observers"], ) ng_web_test_suite( name = "unit_tests", - deps = [":observers_test_sources"], + deps = [":unit_test_sources"], ) markdown_to_html( diff --git a/src/cdk/overlay/BUILD.bazel b/src/cdk/overlay/BUILD.bazel index 860c1a84faff..f8dabd2b2408 100644 --- a/src/cdk/overlay/BUILD.bazel +++ b/src/cdk/overlay/BUILD.bazel @@ -1,8 +1,9 @@ package(default_visibility=["//visibility:public"]) load("@io_bazel_rules_sass//:defs.bzl", "sass_library", "sass_binary") +load("@npm_angular_bazel//:index.bzl", "protractor_web_test_suite") load("//tools:defaults.bzl", "ng_module", "ng_test_library", "ng_web_test_suite", - "markdown_to_html") + "markdown_to_html", "ng_e2e_test_library") ng_module( name = "overlay", @@ -33,8 +34,8 @@ sass_binary( ) ng_test_library( - name = "overlay_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", @@ -51,10 +52,34 @@ ng_test_library( ng_web_test_suite( name = "unit_tests", - deps = [":overlay_test_sources"], + deps = [":unit_test_sources"], static_css = ["overlay_prebuilt_scss"], ) +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", + ], +) + markdown_to_html( name = "overview", srcs = [":overlay.md"], diff --git a/e2e/components/block-scroll-strategy-e2e.spec.ts b/src/cdk/overlay/scroll/block-scroll-strategy.e2e.spec.ts similarity index 98% rename from e2e/components/block-scroll-strategy-e2e.spec.ts rename to src/cdk/overlay/scroll/block-scroll-strategy.e2e.spec.ts index 5d80f7bcc74f..ec1c15cf4a21 100644 --- a/e2e/components/block-scroll-strategy-e2e.spec.ts +++ b/src/cdk/overlay/scroll/block-scroll-strategy.e2e.spec.ts @@ -1,5 +1,5 @@ import {browser, Key, element, by} from 'protractor'; -import {getScrollPosition} from '../util/index'; +import {getScrollPosition} from '@angular/cdk/testing/e2e'; describe('scroll blocking', () => { diff --git a/src/cdk/portal/BUILD.bazel b/src/cdk/portal/BUILD.bazel index 0921898eab71..573d5250d2c1 100644 --- a/src/cdk/portal/BUILD.bazel +++ b/src/cdk/portal/BUILD.bazel @@ -13,8 +13,8 @@ ng_module( ) ng_test_library( - name = "portal_test_sources", - srcs = glob(["**/*.spec.ts"]), + name = "unit_test_sources", + srcs = glob(["**/*.spec.ts"], exclude = ["**/*.e2e.spec.ts"]), deps = [ "@npm//@angular/common", ":portal", @@ -23,7 +23,7 @@ ng_test_library( ng_web_test_suite( name = "unit_tests", - deps = [":portal_test_sources"], + deps = [":unit_test_sources"], ) markdown_to_html( diff --git a/src/cdk/schematics/BUILD.bazel b/src/cdk/schematics/BUILD.bazel index 9412908e98ed..38f217f0f524 100644 --- a/src/cdk/schematics/BUILD.bazel +++ b/src/cdk/schematics/BUILD.bazel @@ -46,13 +46,13 @@ npm_package( jasmine_node_test( name = "unit_tests", - srcs = [":schematics_test_sources"], + srcs = [":unit_test_sources"], data = [":schematics_assets", ":schematics_test_cases"], ) ts_library( - name = "schematics_test_sources", - srcs = glob(["**/*.spec.ts"], exclude = ["**/files/**/*.spec.ts"]), + name = "unit_test_sources", + srcs = glob(["**/*.spec.ts"], exclude = ["**/*.e2e.spec.ts", "**/files/**/*.spec.ts"]), deps = [ "//src/cdk/schematics/testing", "@npm//@schematics/angular", diff --git a/src/cdk/scrolling/BUILD.bazel b/src/cdk/scrolling/BUILD.bazel index 6b4593307e58..df96749f136b 100644 --- a/src/cdk/scrolling/BUILD.bazel +++ b/src/cdk/scrolling/BUILD.bazel @@ -26,8 +26,8 @@ sass_binary( ) ng_test_library( - name = "scrolling_test_sources", - srcs = glob(["**/*.spec.ts"]), + name = "unit_test_sources", + srcs = glob(["**/*.spec.ts"], exclude = ["**/*.e2e.spec.ts"]), deps = [ "@npm//rxjs", "//src/cdk/bidi", @@ -39,7 +39,7 @@ ng_test_library( ng_web_test_suite( name = "unit_tests", - deps = [":scrolling_test_sources"], + deps = [":unit_test_sources"], ) markdown_to_html( diff --git a/src/cdk/table/BUILD.bazel b/src/cdk/table/BUILD.bazel index 8b33522ae722..00fd609e7e02 100644 --- a/src/cdk/table/BUILD.bazel +++ b/src/cdk/table/BUILD.bazel @@ -19,8 +19,8 @@ ng_module( ) ng_test_library( - name = "table_test_sources", - srcs = glob(["**/*.spec.ts"]), + name = "unit_test_sources", + srcs = glob(["**/*.spec.ts"], exclude = ["**/*.e2e.spec.ts"]), deps = [ "@npm//rxjs", "//src/cdk/bidi", @@ -31,7 +31,7 @@ ng_test_library( ng_web_test_suite( name = "unit_tests", - deps = [":table_test_sources"], + deps = [":unit_test_sources"], ) markdown_to_html( diff --git a/src/cdk/testing/e2e/BUILD.bazel b/src/cdk/testing/e2e/BUILD.bazel new file mode 100644 index 000000000000..450808697ffd --- /dev/null +++ b/src/cdk/testing/e2e/BUILD.bazel @@ -0,0 +1,11 @@ +package(default_visibility=["//visibility:public"]) + +load("//tools:defaults.bzl", "ng_e2e_test_library") + +exports_files(["tsconfig-e2e.json"]) + +ng_e2e_test_library( + name = "e2e", + srcs = glob(["**/*.ts"]), + module_name = "@angular/cdk/testing/e2e" +) diff --git a/e2e/util/actions.ts b/src/cdk/testing/e2e/actions.ts similarity index 77% rename from e2e/util/actions.ts rename to src/cdk/testing/e2e/actions.ts index 572c1c7b569d..1ea20af47a08 100644 --- a/e2e/util/actions.ts +++ b/src/cdk/testing/e2e/actions.ts @@ -1,3 +1,11 @@ +/** + * @license + * Copyright Google LLC All Rights Reserved. + * + * 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 + */ + import {browser} from 'protractor'; import {getElement, FinderResult} from './query'; diff --git a/e2e/util/asserts.ts b/src/cdk/testing/e2e/asserts.ts similarity index 86% rename from e2e/util/asserts.ts rename to src/cdk/testing/e2e/asserts.ts index 3d20ae95d6e4..a26688dbff7f 100644 --- a/e2e/util/asserts.ts +++ b/src/cdk/testing/e2e/asserts.ts @@ -1,3 +1,11 @@ +/** + * @license + * Copyright Google LLC All Rights Reserved. + * + * 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 + */ + import {browser} from 'protractor'; import {getElement, FinderResult, waitForElement} from './query'; import {Point} from './actions'; diff --git a/src/cdk/testing/e2e/index.ts b/src/cdk/testing/e2e/index.ts new file mode 100644 index 000000000000..96909187f244 --- /dev/null +++ b/src/cdk/testing/e2e/index.ts @@ -0,0 +1,11 @@ +/** + * @license + * Copyright Google LLC All Rights Reserved. + * + * 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 + */ + +export * from './actions'; +export * from './asserts'; +export * from './query'; diff --git a/e2e/util/query.ts b/src/cdk/testing/e2e/query.ts similarity index 84% rename from e2e/util/query.ts rename to src/cdk/testing/e2e/query.ts index 364766922e08..2beea839b39d 100644 --- a/e2e/util/query.ts +++ b/src/cdk/testing/e2e/query.ts @@ -1,3 +1,11 @@ +/** + * @license + * Copyright Google LLC All Rights Reserved. + * + * 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 + */ + import {browser, by, element, ElementFinder} from 'protractor'; import {Point} from './actions'; diff --git a/src/cdk/text-field/BUILD.bazel b/src/cdk/text-field/BUILD.bazel index af747befd027..e950336d14d0 100644 --- a/src/cdk/text-field/BUILD.bazel +++ b/src/cdk/text-field/BUILD.bazel @@ -28,8 +28,8 @@ sass_binary( ) ng_test_library( - name = "text-field_test_sources", - srcs = glob(["**/*.spec.ts"]), + name = "unit_test_sources", + srcs = glob(["**/*.spec.ts"], exclude = ["**/*.e2e.spec.ts"]), deps = [ "@npm//@angular/forms", "@npm//@angular/platform-browser", @@ -42,7 +42,7 @@ ng_test_library( ng_web_test_suite( name = "unit_tests", - deps = [":text-field_test_sources"], + deps = [":unit_test_sources"], static_css = [":text_field_prebuilt_scss"] ) diff --git a/src/cdk/tree/BUILD.bazel b/src/cdk/tree/BUILD.bazel index 6614a41bde43..7cc8729310b4 100644 --- a/src/cdk/tree/BUILD.bazel +++ b/src/cdk/tree/BUILD.bazel @@ -19,8 +19,8 @@ ng_module( ) ng_test_library( - name = "tree_test_sources", - srcs = glob(["**/*.spec.ts"]), + name = "unit_test_sources", + srcs = glob(["**/*.spec.ts"], exclude = ["**/*.e2e.spec.ts"]), deps = [ "@npm//rxjs", "//src/cdk/collections", @@ -31,7 +31,7 @@ ng_test_library( ng_web_test_suite( name = "unit_tests", - deps = [":tree_test_sources"], + deps = [":unit_test_sources"], ) markdown_to_html( diff --git a/src/cdk/tsconfig-tests.json b/src/cdk/tsconfig-tests.json index a7d64bc5e883..765e8e3fb52f 100644 --- a/src/cdk/tsconfig-tests.json +++ b/src/cdk/tsconfig-tests.json @@ -34,6 +34,9 @@ "**/*.spec.ts" ], "exclude": [ - "**/schematics/**/*.ts" + "**/schematics/**/*.ts", + // Exclude end-to-end tests and utilities + "**/*.e2e.spec.ts", + "./testing/e2e/**" ] } diff --git a/src/e2e-app/BUILD.bazel b/src/e2e-app/BUILD.bazel index 43e839c0656f..9662d67c70f3 100644 --- a/src/e2e-app/BUILD.bazel +++ b/src/e2e-app/BUILD.bazel @@ -1,13 +1,15 @@ package(default_visibility=["//visibility:public"]) load("@io_bazel_rules_sass//:defs.bzl", "sass_binary") -load("@npm_bazel_typescript//:defs.bzl", "ts_devserver") +load("@npm_bazel_typescript//:defs.bzl", "ts_devserver", "ts_library") load("//tools:defaults.bzl", "ng_module") load("//:packages.bzl", "ANGULAR_LIBRARY_UMDS") +exports_files(["protractor.conf.js", "start-devserver.js"]) + ng_module( name = "e2e-app", - srcs = glob(["**/*.ts"]), + srcs = glob(["**/*.ts"], exclude = ["test-util/**"]), assets = glob(["**/*.html", "**/*.css"], exclude = ["index.html"]), deps = [ "@npm//@angular/core", diff --git a/e2e/protractor.conf.js b/src/e2e-app/protractor.conf.js similarity index 100% rename from e2e/protractor.conf.js rename to src/e2e-app/protractor.conf.js diff --git a/e2e/start-devserver.js b/src/e2e-app/start-devserver.js similarity index 100% rename from e2e/start-devserver.js rename to src/e2e-app/start-devserver.js diff --git a/src/material-experimental/mdc-button/BUILD.bazel b/src/material-experimental/mdc-button/BUILD.bazel index 8c4186c06b16..bf72312bc5de 100644 --- a/src/material-experimental/mdc-button/BUILD.bazel +++ b/src/material-experimental/mdc-button/BUILD.bazel @@ -1,7 +1,8 @@ package(default_visibility = ["//visibility:public"]) load("@io_bazel_rules_sass//:defs.bzl", "sass_binary", "sass_library") -load("//tools:defaults.bzl", "ng_module") +load("@npm_angular_bazel//:index.bzl", "protractor_web_test_suite") +load("//tools:defaults.bzl", "ng_module", "ng_e2e_test_library") ng_module( name = "mdc-button", @@ -64,3 +65,27 @@ sass_binary( "//src/material-experimental/mdc-helpers:mdc_scss_deps_lib", ], ) + +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", + ], +) diff --git a/e2e/components/mdc-button-e2e.spec.ts b/src/material-experimental/mdc-button/button.e2e.spec.ts similarity index 100% rename from e2e/components/mdc-button-e2e.spec.ts rename to src/material-experimental/mdc-button/button.e2e.spec.ts diff --git a/src/material-experimental/mdc-card/BUILD.bazel b/src/material-experimental/mdc-card/BUILD.bazel index 7d44288d2a59..77fc816fa3f5 100644 --- a/src/material-experimental/mdc-card/BUILD.bazel +++ b/src/material-experimental/mdc-card/BUILD.bazel @@ -1,7 +1,8 @@ package(default_visibility=["//visibility:public"]) load("@io_bazel_rules_sass//:defs.bzl", "sass_library", "sass_binary") -load("//tools:defaults.bzl", "ng_module") +load("@npm_angular_bazel//:index.bzl", "protractor_web_test_suite") +load("//tools:defaults.bzl", "ng_module", "ng_e2e_test_library") ng_module( name = "mdc-card", @@ -27,3 +28,27 @@ sass_binary( name = "card_scss", src = "card.scss", ) + +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", + ], +) diff --git a/e2e/components/mdc-card-e2e.spec.ts b/src/material-experimental/mdc-card/card.e2e.spec.ts similarity index 100% rename from e2e/components/mdc-card-e2e.spec.ts rename to src/material-experimental/mdc-card/card.e2e.spec.ts diff --git a/src/material-experimental/mdc-checkbox/BUILD.bazel b/src/material-experimental/mdc-checkbox/BUILD.bazel index fc27a5534f10..b36ae14b99cb 100644 --- a/src/material-experimental/mdc-checkbox/BUILD.bazel +++ b/src/material-experimental/mdc-checkbox/BUILD.bazel @@ -1,7 +1,8 @@ package(default_visibility=["//visibility:public"]) load("@io_bazel_rules_sass//:defs.bzl", "sass_library", "sass_binary") -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 = "mdc-checkbox", @@ -46,7 +47,7 @@ sass_binary( ng_test_library( name = "checkbox_tests_lib", - srcs = glob(["**/*.spec.ts"]), + srcs = glob(["**/*.spec.ts"], exclude = ["**/*.e2e.spec.ts"]), deps = [ ":mdc-checkbox", "@npm//@angular/platform-browser", @@ -63,3 +64,27 @@ ng_web_test_suite( ":checkbox_tests_lib", ], ) + +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", + ], +) diff --git a/e2e/components/mdc-checkbox-e2e.spec.ts b/src/material-experimental/mdc-checkbox/checkbox.e2e.spec.ts similarity index 100% rename from e2e/components/mdc-checkbox-e2e.spec.ts rename to src/material-experimental/mdc-checkbox/checkbox.e2e.spec.ts diff --git a/src/material-experimental/mdc-chips/BUILD.bazel b/src/material-experimental/mdc-chips/BUILD.bazel index 2fbd48860e04..c3cbfe036524 100644 --- a/src/material-experimental/mdc-chips/BUILD.bazel +++ b/src/material-experimental/mdc-chips/BUILD.bazel @@ -1,7 +1,8 @@ package(default_visibility=["//visibility:public"]) load("@io_bazel_rules_sass//:defs.bzl", "sass_library", "sass_binary") -load("//tools:defaults.bzl", "ng_module") +load("@npm_angular_bazel//:index.bzl", "protractor_web_test_suite") +load("//tools:defaults.bzl", "ng_module", "ng_e2e_test_library") ng_module( name = "mdc-chips", @@ -37,3 +38,27 @@ sass_binary( "//src/material-experimental/mdc-helpers:mdc_scss_deps_lib", ] ) + +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", + ], +) diff --git a/e2e/components/mdc-chips-e2e.spec.ts b/src/material-experimental/mdc-chips/chips.e2e.spec.ts similarity index 100% rename from e2e/components/mdc-chips-e2e.spec.ts rename to src/material-experimental/mdc-chips/chips.e2e.spec.ts diff --git a/src/material-experimental/mdc-menu/BUILD.bazel b/src/material-experimental/mdc-menu/BUILD.bazel index 549026711669..4e20d4fc2d44 100644 --- a/src/material-experimental/mdc-menu/BUILD.bazel +++ b/src/material-experimental/mdc-menu/BUILD.bazel @@ -1,7 +1,8 @@ package(default_visibility=["//visibility:public"]) load("@io_bazel_rules_sass//:defs.bzl", "sass_library", "sass_binary") -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 = "mdc-menu", @@ -43,7 +44,7 @@ sass_binary( ng_test_library( name = "menu_tests_lib", - srcs = glob(["**/*.spec.ts"]), + srcs = glob(["**/*.spec.ts"], exclude = ["**/*.e2e.spec.ts"]), deps = [ ":mdc-menu", "@npm//@angular/platform-browser", @@ -64,3 +65,27 @@ ng_web_test_suite( ":menu_tests_lib", ], ) + +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", + ], +) diff --git a/e2e/components/mdc-menu-e2e.spec.ts b/src/material-experimental/mdc-menu/menu.e2e.spec.ts similarity index 99% rename from e2e/components/mdc-menu-e2e.spec.ts rename to src/material-experimental/mdc-menu/menu.e2e.spec.ts index 5c2d5aa78751..4a79dddc37f3 100644 --- a/e2e/components/mdc-menu-e2e.spec.ts +++ b/src/material-experimental/mdc-menu/menu.e2e.spec.ts @@ -5,7 +5,7 @@ import { expectLocation, expectToExist, pressKeys, -} from '../util/index'; +} from '@angular/cdk/testing/e2e'; const presenceOf = ExpectedConditions.presenceOf; const not = ExpectedConditions.not; diff --git a/src/material-experimental/mdc-radio/BUILD.bazel b/src/material-experimental/mdc-radio/BUILD.bazel index 8ea919ec9630..90d8f80b05b2 100644 --- a/src/material-experimental/mdc-radio/BUILD.bazel +++ b/src/material-experimental/mdc-radio/BUILD.bazel @@ -1,7 +1,8 @@ package(default_visibility=["//visibility:public"]) load("@io_bazel_rules_sass//:defs.bzl", "sass_library", "sass_binary") -load("//tools:defaults.bzl", "ng_module") +load("@npm_angular_bazel//:index.bzl", "protractor_web_test_suite") +load("//tools:defaults.bzl", "ng_module", "ng_e2e_test_library") ng_module( name = "mdc-radio", @@ -27,3 +28,27 @@ sass_binary( name = "radio_scss", src = "radio.scss", ) + +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", + ], +) diff --git a/e2e/components/mdc-radio-e2e.spec.ts b/src/material-experimental/mdc-radio/radio.e2e.spec.ts similarity index 100% rename from e2e/components/mdc-radio-e2e.spec.ts rename to src/material-experimental/mdc-radio/radio.e2e.spec.ts diff --git a/src/material-experimental/mdc-slide-toggle/BUILD.bazel b/src/material-experimental/mdc-slide-toggle/BUILD.bazel index a6a92e1ac44e..ad574d24cfd8 100644 --- a/src/material-experimental/mdc-slide-toggle/BUILD.bazel +++ b/src/material-experimental/mdc-slide-toggle/BUILD.bazel @@ -1,7 +1,8 @@ package(default_visibility=["//visibility:public"]) load("@io_bazel_rules_sass//:defs.bzl", "sass_library", "sass_binary") -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 = "mdc-slide-toggle", @@ -43,7 +44,7 @@ sass_binary( ng_test_library( name = "slide_toggle_tests_lib", - srcs = glob(["**/*.spec.ts"]), + srcs = glob(["**/*.spec.ts"], exclude = ["**/*.e2e.spec.ts"]), deps = [ ":mdc-slide-toggle", "@npm//@angular/platform-browser", @@ -61,3 +62,27 @@ ng_web_test_suite( ":slide_toggle_tests_lib", ], ) + +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", + ], +) diff --git a/e2e/components/mdc-slide-toggle-e2e.spec.ts b/src/material-experimental/mdc-slide-toggle/slide-toggle.e2e.spec.ts similarity index 97% rename from e2e/components/mdc-slide-toggle-e2e.spec.ts rename to src/material-experimental/mdc-slide-toggle/slide-toggle.e2e.spec.ts index 6d0817f5af28..6401e51e5f0b 100644 --- a/e2e/components/mdc-slide-toggle-e2e.spec.ts +++ b/src/material-experimental/mdc-slide-toggle/slide-toggle.e2e.spec.ts @@ -1,5 +1,5 @@ import {browser, element, by, Key} from 'protractor'; -import {expectToExist} from '../util/index'; +import {expectToExist} from '@angular/cdk/testing/e2e'; describe('slide-toggle', () => { diff --git a/src/material-experimental/popover-edit/BUILD.bazel b/src/material-experimental/popover-edit/BUILD.bazel index c8684ad37b0a..329d5b0aeb09 100644 --- a/src/material-experimental/popover-edit/BUILD.bazel +++ b/src/material-experimental/popover-edit/BUILD.bazel @@ -23,8 +23,8 @@ sass_library( ) 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", @@ -41,5 +41,5 @@ ng_test_library( ng_web_test_suite( name = "unit_tests", - deps = [":popover_edit_test_sources"] + deps = [":unit_test_sources"] ) diff --git a/src/material-experimental/tsconfig-tests.json b/src/material-experimental/tsconfig-tests.json index 5b90d3a0c83d..62da588b9ccd 100644 --- a/src/material-experimental/tsconfig-tests.json +++ b/src/material-experimental/tsconfig-tests.json @@ -23,5 +23,8 @@ // Include the index.ts for each secondary entry-point "./*/index.ts", "**/*.spec.ts" + ], + "exclude": [ + "**/*.e2e.spec.ts" ] } diff --git a/src/material-moment-adapter/BUILD.bazel b/src/material-moment-adapter/BUILD.bazel index f35cdcd39565..94cb3d8f792d 100644 --- a/src/material-moment-adapter/BUILD.bazel +++ b/src/material-moment-adapter/BUILD.bazel @@ -19,8 +19,8 @@ ng_module( ) ng_test_library( - name = "moment_adapter_test_sources", - srcs = glob(["**/*.spec.ts"]), + name = "unit_test_sources", + srcs = glob(["**/*.spec.ts"], exclude = ["**/*.e2e.spec.ts"]), deps = [ "//src/material/core", "//src/material/testing", @@ -33,7 +33,7 @@ ng_web_test_suite( name = "unit_tests", deps = [ ":require-config.js", - ":moment_adapter_test_sources" + ":unit_test_sources" ], # We need to load Moment statically since it is not a named AMD module and needs to # be manually configured through "require.js" which is used by "ts_web_test_suite". diff --git a/src/material/autocomplete/BUILD.bazel b/src/material/autocomplete/BUILD.bazel index e4a9900eee8e..04234e4ae552 100644 --- a/src/material/autocomplete/BUILD.bazel +++ b/src/material/autocomplete/BUILD.bazel @@ -42,8 +42,8 @@ sass_binary( ) ng_test_library( - name = "autocomplete_test_sources", - srcs = glob(["**/*.spec.ts"]), + name = "unit_test_sources", + srcs = glob(["**/*.spec.ts"], exclude = ["**/*.e2e.spec.ts"]), deps = [ "@npm//@angular/forms", "@npm//@angular/platform-browser", @@ -62,7 +62,7 @@ ng_test_library( ng_web_test_suite( name = "unit_tests", - deps = [":autocomplete_test_sources"], + deps = [":unit_test_sources"], ) markdown_to_html( diff --git a/src/material/badge/BUILD.bazel b/src/material/badge/BUILD.bazel index 7041a27531fd..54a4bfa8c3d3 100644 --- a/src/material/badge/BUILD.bazel +++ b/src/material/badge/BUILD.bazel @@ -29,8 +29,8 @@ sass_library( ) ng_test_library( - name = "badge_test_sources", - srcs = glob(["**/*.spec.ts"]), + name = "unit_test_sources", + srcs = glob(["**/*.spec.ts"], exclude = ["**/*.e2e.spec.ts"]), deps = [ "@npm//@angular/platform-browser", "//src/material/core", @@ -40,7 +40,7 @@ ng_test_library( ng_web_test_suite( name = "unit_tests", - deps = [":badge_test_sources"], + deps = [":unit_test_sources"], ) markdown_to_html( diff --git a/src/material/bottom-sheet/BUILD.bazel b/src/material/bottom-sheet/BUILD.bazel index b0cc0109280d..397043d1f111 100644 --- a/src/material/bottom-sheet/BUILD.bazel +++ b/src/material/bottom-sheet/BUILD.bazel @@ -39,8 +39,8 @@ sass_binary( ) ng_test_library( - name = "bottom_sheet_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", @@ -55,7 +55,7 @@ ng_test_library( ng_web_test_suite( name = "unit_tests", - deps = [":bottom_sheet_test_sources"], + deps = [":unit_test_sources"], ) markdown_to_html( diff --git a/src/material/button-toggle/BUILD.bazel b/src/material/button-toggle/BUILD.bazel index 905347273d49..1cbd25410f44 100644 --- a/src/material/button-toggle/BUILD.bazel +++ b/src/material/button-toggle/BUILD.bazel @@ -1,8 +1,9 @@ package(default_visibility=["//visibility:public"]) load("@io_bazel_rules_sass//:defs.bzl", "sass_library", "sass_binary") +load("@npm_angular_bazel//:index.bzl", "protractor_web_test_suite") load("//tools:defaults.bzl", "ng_module", "ng_test_library", "ng_web_test_suite", - "markdown_to_html") + "markdown_to_html", "ng_e2e_test_library") ng_module( name = "button-toggle", @@ -35,8 +36,8 @@ sass_binary( ) ng_test_library( - name = "button_toggle_test_sources", - srcs = glob(["**/*.spec.ts"]), + name = "unit_test_sources", + srcs = glob(["**/*.spec.ts"], exclude = ["**/*.e2e.spec.ts"]), deps = [ "@npm//@angular/forms", "@npm//@angular/platform-browser", @@ -47,7 +48,31 @@ ng_test_library( ng_web_test_suite( name = "unit_tests", - deps = [":button_toggle_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", + ], ) markdown_to_html( diff --git a/e2e/components/button-toggle-e2e.spec.ts b/src/material/button-toggle/button-toggle.e2e.spec.ts similarity index 100% rename from e2e/components/button-toggle-e2e.spec.ts rename to src/material/button-toggle/button-toggle.e2e.spec.ts diff --git a/src/material/button/BUILD.bazel b/src/material/button/BUILD.bazel index d770fc2385cf..4b41cae455bd 100644 --- a/src/material/button/BUILD.bazel +++ b/src/material/button/BUILD.bazel @@ -1,8 +1,9 @@ package(default_visibility=["//visibility:public"]) load("@io_bazel_rules_sass//:defs.bzl", "sass_library", "sass_binary") +load("@npm_angular_bazel//:index.bzl", "protractor_web_test_suite") load("//tools:defaults.bzl", "ng_module", "ng_test_library", "ng_web_test_suite", - "markdown_to_html") + "markdown_to_html", "ng_e2e_test_library") ng_module( name = "button", @@ -36,8 +37,8 @@ sass_binary( ) ng_test_library( - name = "button_test_sources", - srcs = glob(["**/*.spec.ts"]), + name = "unit_test_sources", + srcs = glob(["**/*.spec.ts"], exclude = ["**/*.e2e.spec.ts"]), deps = [ "@npm//@angular/platform-browser", "//src/material/core", @@ -47,7 +48,31 @@ ng_test_library( ng_web_test_suite( name = "unit_tests", - deps = [":button_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", + ], ) markdown_to_html( diff --git a/e2e/components/button-e2e.spec.ts b/src/material/button/button.e2e.spec.ts similarity index 100% rename from e2e/components/button-e2e.spec.ts rename to src/material/button/button.e2e.spec.ts diff --git a/src/material/card/BUILD.bazel b/src/material/card/BUILD.bazel index 84e5ef0ed158..c7d7f6efa80c 100644 --- a/src/material/card/BUILD.bazel +++ b/src/material/card/BUILD.bazel @@ -1,7 +1,8 @@ package(default_visibility=["//visibility:public"]) load("@io_bazel_rules_sass//:defs.bzl", "sass_library", "sass_binary") -load("//tools:defaults.bzl", "ng_module", "markdown_to_html") +load("@npm_angular_bazel//:index.bzl", "protractor_web_test_suite") +load("//tools:defaults.bzl", "ng_module", "markdown_to_html", "ng_e2e_test_library") ng_module( name = "card", @@ -29,6 +30,30 @@ sass_binary( ], ) +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", + ], +) + markdown_to_html( name = "overview", srcs = [":card.md"], diff --git a/e2e/components/card-e2e.spec.ts b/src/material/card/card.e2e.spec.ts similarity index 100% rename from e2e/components/card-e2e.spec.ts rename to src/material/card/card.e2e.spec.ts diff --git a/src/material/checkbox/BUILD.bazel b/src/material/checkbox/BUILD.bazel index 5fe6e4698e65..fbe36a71850e 100644 --- a/src/material/checkbox/BUILD.bazel +++ b/src/material/checkbox/BUILD.bazel @@ -1,8 +1,9 @@ package(default_visibility=["//visibility:public"]) load("@io_bazel_rules_sass//:defs.bzl", "sass_library", "sass_binary") +load("@npm_angular_bazel//:index.bzl", "protractor_web_test_suite") load("//tools:defaults.bzl", "ng_module", "ng_test_library", "ng_web_test_suite", - "markdown_to_html") + "markdown_to_html", "ng_e2e_test_library") ng_module( name = "checkbox", @@ -41,8 +42,8 @@ sass_binary( ) ng_test_library( - name = "checkbox_test_sources", - srcs = glob(["**/*.spec.ts"]), + name = "unit_test_sources", + srcs = glob(["**/*.spec.ts"], exclude = ["**/*.e2e.spec.ts"]), deps = [ "@npm//@angular/forms", "@npm//@angular/platform-browser", @@ -54,7 +55,31 @@ ng_test_library( ng_web_test_suite( name = "unit_tests", - deps = [":checkbox_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", + ], ) markdown_to_html( diff --git a/e2e/components/checkbox-e2e.spec.ts b/src/material/checkbox/checkbox.e2e.spec.ts similarity index 100% rename from e2e/components/checkbox-e2e.spec.ts rename to src/material/checkbox/checkbox.e2e.spec.ts diff --git a/src/material/chips/BUILD.bazel b/src/material/chips/BUILD.bazel index 0e48ea3f0fca..f3d7c7600400 100644 --- a/src/material/chips/BUILD.bazel +++ b/src/material/chips/BUILD.bazel @@ -40,8 +40,8 @@ sass_binary( ) ng_test_library( - name = "chips_test_sources", - srcs = glob(["**/*.spec.ts"]), + name = "unit_test_sources", + srcs = glob(["**/*.spec.ts"], exclude = ["**/*.e2e.spec.ts"]), deps = [ "@npm//@angular/animations", "@npm//@angular/forms", @@ -61,7 +61,7 @@ ng_test_library( ng_web_test_suite( name = "unit_tests", - deps = [":chips_test_sources"], + deps = [":unit_test_sources"], ) markdown_to_html( diff --git a/src/material/core/BUILD.bazel b/src/material/core/BUILD.bazel index b58173cfdc45..4203b9a4f6bb 100644 --- a/src/material/core/BUILD.bazel +++ b/src/material/core/BUILD.bazel @@ -98,8 +98,8 @@ sass_binary( ################# ng_test_library( - name = "core_test_sources", - srcs = glob(["**/*.spec.ts"]), + name = "unit_test_sources", + srcs = glob(["**/*.spec.ts"], exclude = ["**/*.e2e.spec.ts"]), deps = [ "@npm//@angular/platform-browser", "//src/cdk/keycodes", @@ -112,7 +112,7 @@ ng_test_library( ng_web_test_suite( name = "unit_tests", - deps = [":core_test_sources"], + deps = [":unit_test_sources"], ) markdown_to_html( diff --git a/src/material/datepicker/BUILD.bazel b/src/material/datepicker/BUILD.bazel index 7f687ea99ff4..bb99635165ed 100644 --- a/src/material/datepicker/BUILD.bazel +++ b/src/material/datepicker/BUILD.bazel @@ -63,8 +63,8 @@ sass_binary( ) ng_test_library( - name = "datepicker_test_sources", - srcs = glob(["**/*.spec.ts"]), + name = "unit_test_sources", + srcs = glob(["**/*.spec.ts"], exclude = ["**/*.e2e.spec.ts"]), deps = [ "@npm//@angular/forms", "@npm//@angular/platform-browser", @@ -85,7 +85,7 @@ ng_test_library( ng_web_test_suite( name = "unit_tests", - deps = [":datepicker_test_sources"], + deps = [":unit_test_sources"], ) markdown_to_html( diff --git a/src/material/dialog/BUILD.bazel b/src/material/dialog/BUILD.bazel index 755a882e38fe..dde2efaf3b67 100644 --- a/src/material/dialog/BUILD.bazel +++ b/src/material/dialog/BUILD.bazel @@ -1,8 +1,9 @@ package(default_visibility=["//visibility:public"]) load("@io_bazel_rules_sass//:defs.bzl", "sass_library", "sass_binary") +load("@npm_angular_bazel//:index.bzl", "protractor_web_test_suite") load("//tools:defaults.bzl", "ng_module", "ng_test_library", "ng_web_test_suite", - "markdown_to_html") + "markdown_to_html", "ng_e2e_test_library") ng_module( name = "dialog", @@ -39,8 +40,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", @@ -56,7 +57,31 @@ ng_test_library( ng_web_test_suite( name = "unit_tests", - deps = [":dialog_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", + ], ) markdown_to_html( diff --git a/e2e/components/dialog-e2e.spec.ts b/src/material/dialog/dialog.e2e.spec.ts similarity index 98% rename from e2e/components/dialog-e2e.spec.ts rename to src/material/dialog/dialog.e2e.spec.ts index 1f8bac8c6f8c..2ac803f3ee83 100644 --- a/e2e/components/dialog-e2e.spec.ts +++ b/src/material/dialog/dialog.e2e.spec.ts @@ -5,7 +5,7 @@ import { pressKeys, clickElementAtPoint, waitForElement, -} from '../util/index'; +} from '@angular/cdk/testing/e2e'; describe('dialog', () => { beforeEach(async () => await browser.get('/dialog')); diff --git a/src/material/divider/BUILD.bazel b/src/material/divider/BUILD.bazel index e8f5273cccc7..5ecc6f744c17 100644 --- a/src/material/divider/BUILD.bazel +++ b/src/material/divider/BUILD.bazel @@ -29,8 +29,8 @@ sass_binary( ) ng_test_library( - name = "divider_test_sources", - srcs = glob(["**/*.spec.ts"]), + name = "unit_test_sources", + srcs = glob(["**/*.spec.ts"], exclude = ["**/*.e2e.spec.ts"]), deps = [ "@npm//@angular/platform-browser", ":divider", @@ -39,7 +39,7 @@ ng_test_library( ng_web_test_suite( name = "unit_tests", - deps = [":divider_test_sources"], + deps = [":unit_test_sources"], ) markdown_to_html( diff --git a/src/material/expansion/BUILD.bazel b/src/material/expansion/BUILD.bazel index d4c7e2814242..b9f6dd55f3ce 100644 --- a/src/material/expansion/BUILD.bazel +++ b/src/material/expansion/BUILD.bazel @@ -1,8 +1,9 @@ package(default_visibility=["//visibility:public"]) load("@io_bazel_rules_sass//:defs.bzl", "sass_library", "sass_binary") +load("@npm_angular_bazel//:index.bzl", "protractor_web_test_suite") load("//tools:defaults.bzl", "ng_module", "ng_test_library", "ng_web_test_suite", - "markdown_to_html") + "markdown_to_html", "ng_e2e_test_library") ng_module( name = "expansion", @@ -48,8 +49,8 @@ sass_binary( ) ng_test_library( - name = "expansion_test_sources", - srcs = glob(["**/*.spec.ts"]), + name = "unit_test_sources", + srcs = glob(["**/*.spec.ts"], exclude = ["**/*.e2e.spec.ts"]), deps = [ "@npm//@angular/platform-browser", "//src/cdk/a11y", @@ -61,7 +62,31 @@ ng_test_library( ng_web_test_suite( name = "unit_tests", - deps = [":expansion_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", + ], ) markdown_to_html( diff --git a/e2e/components/expansion-e2e.spec.ts b/src/material/expansion/expansion.e2e.spec.ts similarity index 100% rename from e2e/components/expansion-e2e.spec.ts rename to src/material/expansion/expansion.e2e.spec.ts diff --git a/src/material/grid-list/BUILD.bazel b/src/material/grid-list/BUILD.bazel index 32a3e7aad7fa..a29c8c6ccb88 100644 --- a/src/material/grid-list/BUILD.bazel +++ b/src/material/grid-list/BUILD.bazel @@ -1,8 +1,9 @@ package(default_visibility=["//visibility:public"]) load("@io_bazel_rules_sass//:defs.bzl", "sass_library", "sass_binary") +load("@npm_angular_bazel//:index.bzl", "protractor_web_test_suite") load("//tools:defaults.bzl", "ng_module", "ng_test_library", "ng_web_test_suite", - "markdown_to_html") + "markdown_to_html", "ng_e2e_test_library") ng_module( name = "grid-list", @@ -30,8 +31,8 @@ sass_binary( ) ng_test_library( - name = "grid_list_test_sources", - srcs = glob(["**/*.spec.ts"]), + name = "unit_test_sources", + srcs = glob(["**/*.spec.ts"], exclude = ["**/*.e2e.spec.ts"]), deps = [ "@npm//@angular/platform-browser", "//src/cdk/bidi", @@ -41,7 +42,31 @@ ng_test_library( ng_web_test_suite( name = "unit_tests", - deps = [":grid_list_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", + ], ) markdown_to_html( diff --git a/e2e/components/grid-list-e2e.spec.ts b/src/material/grid-list/grid-list.e2e.spec.ts similarity index 87% rename from e2e/components/grid-list-e2e.spec.ts rename to src/material/grid-list/grid-list.e2e.spec.ts index f0cec6f60e50..b3b0f1b74c55 100644 --- a/e2e/components/grid-list-e2e.spec.ts +++ b/src/material/grid-list/grid-list.e2e.spec.ts @@ -1,5 +1,5 @@ import {browser} from 'protractor'; -import {expectToExist} from '../util/index'; +import {expectToExist} from '@angular/cdk/testing/e2e'; describe('grid-list', () => { beforeEach(async () => await browser.get('/grid-list')); diff --git a/src/material/icon/BUILD.bazel b/src/material/icon/BUILD.bazel index 7f8b0644172d..7480f187e907 100644 --- a/src/material/icon/BUILD.bazel +++ b/src/material/icon/BUILD.bazel @@ -1,8 +1,9 @@ package(default_visibility=["//visibility:public"]) load("@io_bazel_rules_sass//:defs.bzl", "sass_library", "sass_binary") +load("@npm_angular_bazel//:index.bzl", "protractor_web_test_suite") load("//tools:defaults.bzl", "ng_module", "ng_test_library", "ng_web_test_suite", - "markdown_to_html") + "markdown_to_html", "ng_e2e_test_library") ng_module( name = "icon", @@ -32,8 +33,8 @@ sass_binary( ) ng_test_library( - name = "icon_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", @@ -44,7 +45,31 @@ ng_test_library( ng_web_test_suite( name = "unit_tests", - deps = [":icon_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", + ], ) markdown_to_html( diff --git a/e2e/components/icon-e2e.spec.ts b/src/material/icon/icon.e2e.spec.ts similarity index 100% rename from e2e/components/icon-e2e.spec.ts rename to src/material/icon/icon.e2e.spec.ts diff --git a/src/material/input/BUILD.bazel b/src/material/input/BUILD.bazel index b18f6823564b..99efe3e7a466 100644 --- a/src/material/input/BUILD.bazel +++ b/src/material/input/BUILD.bazel @@ -1,8 +1,9 @@ package(default_visibility=["//visibility:public"]) load("@io_bazel_rules_sass//:defs.bzl", "sass_library", "sass_binary") +load("@npm_angular_bazel//:index.bzl", "protractor_web_test_suite") load("//tools:defaults.bzl", "ng_module", "ng_test_library", "ng_web_test_suite", - "markdown_to_html") + "markdown_to_html", "ng_e2e_test_library") ng_module( name = "input", @@ -29,8 +30,8 @@ sass_library( ) ng_test_library( - name = "input_test_sources", - srcs = glob(["**/*.spec.ts"]), + name = "unit_test_sources", + srcs = glob(["**/*.spec.ts"], exclude = ["**/*.e2e.spec.ts"]), deps = [ "@npm//@angular/forms", "@npm//@angular/platform-browser", @@ -48,7 +49,31 @@ ng_test_library( ng_web_test_suite( name = "unit_tests", - deps = [":input_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", + ], ) markdown_to_html( diff --git a/e2e/components/input-e2e.spec.ts b/src/material/input/input.e2e.spec.ts similarity index 100% rename from e2e/components/input-e2e.spec.ts rename to src/material/input/input.e2e.spec.ts diff --git a/src/material/list/BUILD.bazel b/src/material/list/BUILD.bazel index 25a50ae0e9d6..124c39195a2b 100644 --- a/src/material/list/BUILD.bazel +++ b/src/material/list/BUILD.bazel @@ -1,8 +1,9 @@ package(default_visibility=["//visibility:public"]) load("@io_bazel_rules_sass//:defs.bzl", "sass_library", "sass_binary") +load("@npm_angular_bazel//:index.bzl", "protractor_web_test_suite") load("//tools:defaults.bzl", "ng_module", "ng_test_library", "ng_web_test_suite", - "markdown_to_html") + "markdown_to_html", "ng_e2e_test_library") ng_module( name = "list", @@ -40,8 +41,8 @@ sass_binary( ) ng_test_library( - name = "list_test_sources", - srcs = glob(["**/*.spec.ts"]), + name = "unit_test_sources", + srcs = glob(["**/*.spec.ts"], exclude = ["**/*.e2e.spec.ts"]), deps = [ "@npm//@angular/forms", "@npm//@angular/platform-browser", @@ -54,7 +55,31 @@ ng_test_library( ng_web_test_suite( name = "unit_tests", - deps = [":list_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", + ], ) markdown_to_html( diff --git a/e2e/components/list-e2e.spec.ts b/src/material/list/list.e2e.spec.ts similarity index 86% rename from e2e/components/list-e2e.spec.ts rename to src/material/list/list.e2e.spec.ts index 5d6881d42ada..8795501bcf67 100644 --- a/e2e/components/list-e2e.spec.ts +++ b/src/material/list/list.e2e.spec.ts @@ -1,5 +1,5 @@ import {browser} from 'protractor'; -import {expectToExist} from '../util/index'; +import {expectToExist} from '@angular/cdk/testing/e2e'; describe('list', () => { beforeEach(async () => await browser.get('/list')); diff --git a/src/material/menu/BUILD.bazel b/src/material/menu/BUILD.bazel index 38fd8ef0be4f..c7330d6a68cf 100644 --- a/src/material/menu/BUILD.bazel +++ b/src/material/menu/BUILD.bazel @@ -1,8 +1,9 @@ package(default_visibility=["//visibility:public"]) load("@io_bazel_rules_sass//:defs.bzl", "sass_library", "sass_binary") +load("@npm_angular_bazel//:index.bzl", "protractor_web_test_suite") load("//tools:defaults.bzl", "ng_module", "ng_test_library", "ng_web_test_suite", - "markdown_to_html") + "markdown_to_html", "ng_e2e_test_library") ng_module( name = "menu", @@ -41,8 +42,8 @@ sass_binary( ) ng_test_library( - name = "menu_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", @@ -59,7 +60,31 @@ ng_test_library( ng_web_test_suite( name = "unit_tests", - deps = [":menu_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", + ], ) markdown_to_html( diff --git a/e2e/components/menu-e2e.spec.ts b/src/material/menu/menu.e2e.spec.ts similarity index 99% rename from e2e/components/menu-e2e.spec.ts rename to src/material/menu/menu.e2e.spec.ts index 15cb391bcafd..96914679dda0 100644 --- a/e2e/components/menu-e2e.spec.ts +++ b/src/material/menu/menu.e2e.spec.ts @@ -5,7 +5,7 @@ import { expectLocation, expectToExist, pressKeys, -} from '../util/index'; +} from '@angular/cdk/testing/e2e'; const presenceOf = ExpectedConditions.presenceOf; const not = ExpectedConditions.not; diff --git a/src/material/paginator/BUILD.bazel b/src/material/paginator/BUILD.bazel index eea10a2a3d59..5dfb486cb6a6 100644 --- a/src/material/paginator/BUILD.bazel +++ b/src/material/paginator/BUILD.bazel @@ -34,8 +34,8 @@ sass_binary( ) ng_test_library( - name = "paginator_test_sources", - srcs = glob(["**/*.spec.ts"]), + name = "unit_test_sources", + srcs = glob(["**/*.spec.ts"], exclude = ["**/*.e2e.spec.ts"]), deps = [ "@npm//@angular/platform-browser", "//src/cdk/testing", @@ -47,7 +47,7 @@ ng_test_library( ng_web_test_suite( name = "unit_tests", - deps = [":paginator_test_sources"], + deps = [":unit_test_sources"], ) markdown_to_html( diff --git a/src/material/progress-bar/BUILD.bazel b/src/material/progress-bar/BUILD.bazel index 6fd94825b103..607dbe554ff5 100644 --- a/src/material/progress-bar/BUILD.bazel +++ b/src/material/progress-bar/BUILD.bazel @@ -1,8 +1,9 @@ package(default_visibility=["//visibility:public"]) load("@io_bazel_rules_sass//:defs.bzl", "sass_library", "sass_binary") +load("@npm_angular_bazel//:index.bzl", "protractor_web_test_suite") load("//tools:defaults.bzl", "ng_module", "ng_test_library", "ng_web_test_suite", - "markdown_to_html") + "markdown_to_html", "ng_e2e_test_library") ng_module( name = "progress-bar", @@ -35,8 +36,8 @@ sass_binary( ) ng_test_library( - name = "progress_bar_test_sources", - srcs = glob(["**/*.spec.ts"]), + name = "unit_test_sources", + srcs = glob(["**/*.spec.ts"], exclude = ["**/*.e2e.spec.ts"]), deps = [ "@npm//@angular/platform-browser", "//src/cdk/testing", @@ -46,7 +47,31 @@ ng_test_library( ng_web_test_suite( name = "unit_tests", - deps = [":progress_bar_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", + ], ) markdown_to_html( diff --git a/e2e/components/progress-bar-e2e.spec.ts b/src/material/progress-bar/progress-bar.e2e.spec.ts similarity index 92% rename from e2e/components/progress-bar-e2e.spec.ts rename to src/material/progress-bar/progress-bar.e2e.spec.ts index 280b09d44740..3c2d7ccf8a19 100644 --- a/e2e/components/progress-bar-e2e.spec.ts +++ b/src/material/progress-bar/progress-bar.e2e.spec.ts @@ -1,5 +1,5 @@ import {browser} from 'protractor'; -import {expectToExist} from '../util/index'; +import {expectToExist} from '@angular/cdk/testing/e2e'; describe('progress-bar', () => { beforeEach(async () => await browser.get('/progress-bar')); diff --git a/src/material/progress-spinner/BUILD.bazel b/src/material/progress-spinner/BUILD.bazel index 70efbec58365..b15d882953b2 100644 --- a/src/material/progress-spinner/BUILD.bazel +++ b/src/material/progress-spinner/BUILD.bazel @@ -1,8 +1,9 @@ package(default_visibility=["//visibility:public"]) load("@io_bazel_rules_sass//:defs.bzl", "sass_library", "sass_binary") +load("@npm_angular_bazel//:index.bzl", "protractor_web_test_suite") load("//tools:defaults.bzl", "ng_module", "ng_test_library", "ng_web_test_suite", - "markdown_to_html") + "markdown_to_html", "ng_e2e_test_library") ng_module( name = "progress-spinner", @@ -33,8 +34,8 @@ sass_binary( ) ng_test_library( - name = "progress_spinner_test_sources", - srcs = glob(["**/*.spec.ts"]), + name = "unit_test_sources", + srcs = glob(["**/*.spec.ts"], exclude = ["**/*.e2e.spec.ts"]), deps = [ "@npm//@angular/platform-browser", ":progress-spinner", @@ -43,7 +44,31 @@ ng_test_library( ng_web_test_suite( name = "unit_tests", - deps = [":progress_spinner_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", + ], ) markdown_to_html( diff --git a/e2e/components/progress-spinner-e2e.spec.ts b/src/material/progress-spinner/progress-spinner.e2e.spec.ts similarity index 100% rename from e2e/components/progress-spinner-e2e.spec.ts rename to src/material/progress-spinner/progress-spinner.e2e.spec.ts diff --git a/src/material/radio/BUILD.bazel b/src/material/radio/BUILD.bazel index 5b9c6b96bbcd..f746dd6fdcb5 100644 --- a/src/material/radio/BUILD.bazel +++ b/src/material/radio/BUILD.bazel @@ -1,8 +1,9 @@ package(default_visibility=["//visibility:public"]) load("@io_bazel_rules_sass//:defs.bzl", "sass_library", "sass_binary") +load("@npm_angular_bazel//:index.bzl", "protractor_web_test_suite") load("//tools:defaults.bzl", "ng_module", "ng_test_library", "ng_web_test_suite", - "markdown_to_html") + "markdown_to_html", "ng_e2e_test_library") ng_module( name = "radio", @@ -38,8 +39,8 @@ sass_binary( ) ng_test_library( - name = "radio_test_sources", - srcs = glob(["**/*.spec.ts"]), + name = "unit_test_sources", + srcs = glob(["**/*.spec.ts"], exclude = ["**/*.e2e.spec.ts"]), deps = [ "@npm//@angular/forms", "@npm//@angular/platform-browser", @@ -50,7 +51,31 @@ ng_test_library( ng_web_test_suite( name = "unit_tests", - deps = [":radio_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", + ], ) markdown_to_html( diff --git a/e2e/components/radio-e2e.spec.ts b/src/material/radio/radio.e2e.spec.ts similarity index 100% rename from e2e/components/radio-e2e.spec.ts rename to src/material/radio/radio.e2e.spec.ts diff --git a/src/material/schematics/BUILD.bazel b/src/material/schematics/BUILD.bazel index 3f53ed483676..284f3dfc05d7 100644 --- a/src/material/schematics/BUILD.bazel +++ b/src/material/schematics/BUILD.bazel @@ -43,13 +43,13 @@ npm_package( jasmine_node_test( name = "unit_tests", - srcs = [":schematics_test_sources"], + srcs = [":unit_test_sources"], data = [":schematics_assets", ":schematics_test_cases"], ) ts_library( - name = "schematics_test_sources", - srcs = glob(["**/*.spec.ts"], exclude=["ng-generate/*/files/**/*.spec.ts"]), + name = "unit_test_sources", + srcs = glob(["**/*.spec.ts"], exclude = ["**/*.e2e.spec.ts", "ng-generate/*/files/**/*.spec.ts"]), deps = [ ":schematics", "//src/cdk/schematics", diff --git a/src/material/select/BUILD.bazel b/src/material/select/BUILD.bazel index 02d3e0155a77..ece7f491d002 100644 --- a/src/material/select/BUILD.bazel +++ b/src/material/select/BUILD.bazel @@ -43,8 +43,8 @@ sass_binary( ) ng_test_library( - name = "select_test_sources", - srcs = glob(["**/*.spec.ts"]), + name = "unit_test_sources", + srcs = glob(["**/*.spec.ts"], exclude = ["**/*.e2e.spec.ts"]), deps = [ "@npm//@angular/forms", "@npm//@angular/platform-browser", @@ -64,7 +64,7 @@ ng_test_library( ng_web_test_suite( name = "unit_tests", - deps = [":select_test_sources"], + deps = [":unit_test_sources"], ) markdown_to_html( diff --git a/src/material/sidenav/BUILD.bazel b/src/material/sidenav/BUILD.bazel index 8c99c66572fd..376325c2bbdf 100644 --- a/src/material/sidenav/BUILD.bazel +++ b/src/material/sidenav/BUILD.bazel @@ -1,8 +1,9 @@ package(default_visibility=["//visibility:public"]) load("@io_bazel_rules_sass//:defs.bzl", "sass_library", "sass_binary") +load("@npm_angular_bazel//:index.bzl", "protractor_web_test_suite") load("//tools:defaults.bzl", "ng_module", "ng_test_library", "ng_web_test_suite", - "markdown_to_html") + "markdown_to_html", "ng_e2e_test_library") ng_module( name = "sidenav", @@ -41,8 +42,8 @@ sass_binary( ) ng_test_library( - name = "sidenav_test_sources", - srcs = glob(["**/*.spec.ts"]), + name = "unit_test_sources", + srcs = glob(["**/*.spec.ts"], exclude = ["**/*.e2e.spec.ts"]), deps = [ "@npm//@angular/platform-browser", "//src/cdk/a11y", @@ -57,7 +58,31 @@ ng_test_library( ng_web_test_suite( name = "unit_tests", - deps = [":sidenav_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", + ], ) markdown_to_html( diff --git a/e2e/components/sidenav-e2e.spec.ts b/src/material/sidenav/sidenav.e2e.spec.ts similarity index 100% rename from e2e/components/sidenav-e2e.spec.ts rename to src/material/sidenav/sidenav.e2e.spec.ts diff --git a/src/material/slide-toggle/BUILD.bazel b/src/material/slide-toggle/BUILD.bazel index 99c258ab978f..25b2be4121ae 100644 --- a/src/material/slide-toggle/BUILD.bazel +++ b/src/material/slide-toggle/BUILD.bazel @@ -1,8 +1,9 @@ package(default_visibility=["//visibility:public"]) load("@io_bazel_rules_sass//:defs.bzl", "sass_library", "sass_binary") +load("@npm_angular_bazel//:index.bzl", "protractor_web_test_suite") load("//tools:defaults.bzl", "ng_module", "ng_test_library", "ng_web_test_suite", - "markdown_to_html") + "markdown_to_html", "ng_e2e_test_library") ng_module( name = "slide-toggle", @@ -38,8 +39,8 @@ sass_binary( ) ng_test_library( - name = "slide_toggle_test_sources", - srcs = glob(["**/*.spec.ts"]), + name = "unit_test_sources", + srcs = glob(["**/*.spec.ts"], exclude = ["**/*.e2e.spec.ts"]), deps = [ "@npm//@angular/forms", "@npm//@angular/platform-browser", @@ -53,7 +54,31 @@ ng_test_library( ng_web_test_suite( name = "unit_tests", - deps = [":slide_toggle_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", + ], ) markdown_to_html( diff --git a/e2e/components/slide-toggle-e2e.spec.ts b/src/material/slide-toggle/slide-toggle.e2e.spec.ts similarity index 97% rename from e2e/components/slide-toggle-e2e.spec.ts rename to src/material/slide-toggle/slide-toggle.e2e.spec.ts index 531565fe4c8c..175d4031ac4f 100644 --- a/e2e/components/slide-toggle-e2e.spec.ts +++ b/src/material/slide-toggle/slide-toggle.e2e.spec.ts @@ -1,5 +1,5 @@ import {browser, element, by, Key} from 'protractor'; -import {expectToExist} from '../util/index'; +import {expectToExist} from '@angular/cdk/testing/e2e'; describe('slide-toggle', () => { diff --git a/src/material/slider/BUILD.bazel b/src/material/slider/BUILD.bazel index e0facc5081cd..92a893b0acd3 100644 --- a/src/material/slider/BUILD.bazel +++ b/src/material/slider/BUILD.bazel @@ -40,8 +40,8 @@ sass_binary( ) ng_test_library( - name = "slider_test_sources", - srcs = glob(["**/*.spec.ts"]), + name = "unit_test_sources", + srcs = glob(["**/*.spec.ts"], exclude = ["**/*.e2e.spec.ts"]), deps = [ "@npm//@angular/forms", "@npm//@angular/platform-browser", @@ -55,7 +55,7 @@ ng_test_library( ng_web_test_suite( name = "unit_tests", - deps = [":slider_test_sources"], + deps = [":unit_test_sources"], ) markdown_to_html( diff --git a/src/material/snack-bar/BUILD.bazel b/src/material/snack-bar/BUILD.bazel index 5085b427e37f..8380dfbbfe5c 100644 --- a/src/material/snack-bar/BUILD.bazel +++ b/src/material/snack-bar/BUILD.bazel @@ -46,8 +46,8 @@ sass_binary( ) ng_test_library( - name = "snack_bar_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", @@ -59,7 +59,7 @@ ng_test_library( ng_web_test_suite( name = "unit_tests", - deps = [":snack_bar_test_sources"], + deps = [":unit_test_sources"], ) markdown_to_html( diff --git a/src/material/sort/BUILD.bazel b/src/material/sort/BUILD.bazel index fedd93d2663f..a454896a68e7 100644 --- a/src/material/sort/BUILD.bazel +++ b/src/material/sort/BUILD.bazel @@ -31,8 +31,8 @@ sass_binary( ) ng_test_library( - name = "sort_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", @@ -46,7 +46,7 @@ ng_test_library( ng_web_test_suite( name = "unit_tests", - deps = [":sort_test_sources"], + deps = [":unit_test_sources"], ) markdown_to_html( diff --git a/src/material/stepper/BUILD.bazel b/src/material/stepper/BUILD.bazel index 5c32bc46a82f..f3ad2680ea3b 100644 --- a/src/material/stepper/BUILD.bazel +++ b/src/material/stepper/BUILD.bazel @@ -1,8 +1,9 @@ package(default_visibility=["//visibility:public"]) load("@io_bazel_rules_sass//:defs.bzl", "sass_library", "sass_binary") +load("@npm_angular_bazel//:index.bzl", "protractor_web_test_suite") load("//tools:defaults.bzl", "ng_module", "ng_test_library", "ng_web_test_suite", - "markdown_to_html") + "markdown_to_html", "ng_e2e_test_library") ng_module( name = "stepper", @@ -47,8 +48,8 @@ sass_binary( ) ng_test_library( - name = "stepper_test_sources", - srcs = glob(["**/*.spec.ts"]), + name = "unit_test_sources", + srcs = glob(["**/*.spec.ts"], exclude = ["**/*.e2e.spec.ts"]), deps = [ "@npm//@angular/forms", "@npm//@angular/platform-browser", @@ -66,7 +67,31 @@ ng_test_library( ng_web_test_suite( name = "unit_tests", - deps = [":stepper_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", + ], ) markdown_to_html( diff --git a/e2e/components/stepper-e2e.spec.ts b/src/material/stepper/stepper.e2e.spec.ts similarity index 95% rename from e2e/components/stepper-e2e.spec.ts rename to src/material/stepper/stepper.e2e.spec.ts index 21b691367d63..d03f84e1c204 100644 --- a/e2e/components/stepper-e2e.spec.ts +++ b/src/material/stepper/stepper.e2e.spec.ts @@ -1,7 +1,6 @@ import {browser, by, element, ElementFinder, ExpectedConditions} from 'protractor'; import {Key} from 'selenium-webdriver'; -import {pressKeys} from '../util/actions'; -import {expectFocusOn, expectToExist} from '../util/asserts'; +import {expectFocusOn, expectToExist, pressKeys} from '@angular/cdk/testing/e2e'; describe('stepper', () => { beforeEach(async () => await browser.get('/stepper')); diff --git a/src/material/table/BUILD.bazel b/src/material/table/BUILD.bazel index f61035e97d96..aa739a89e9d3 100644 --- a/src/material/table/BUILD.bazel +++ b/src/material/table/BUILD.bazel @@ -33,8 +33,8 @@ sass_binary( ) ng_test_library( - name = "table_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", @@ -47,7 +47,7 @@ ng_test_library( ng_web_test_suite( name = "unit_tests", - deps = [":table_test_sources"], + deps = [":unit_test_sources"], ) markdown_to_html( diff --git a/src/material/tabs/BUILD.bazel b/src/material/tabs/BUILD.bazel index 6b03a7f1264a..b2d96ddd0143 100644 --- a/src/material/tabs/BUILD.bazel +++ b/src/material/tabs/BUILD.bazel @@ -1,8 +1,9 @@ package(default_visibility=["//visibility:public"]) load("@io_bazel_rules_sass//:defs.bzl", "sass_library", "sass_binary") +load("@npm_angular_bazel//:index.bzl", "protractor_web_test_suite") load("//tools:defaults.bzl", "ng_module", "ng_test_library", "ng_web_test_suite", - "markdown_to_html") + "markdown_to_html", "ng_e2e_test_library") ng_module( name = "tabs", @@ -74,8 +75,8 @@ sass_binary( ) ng_test_library( - name = "tabs_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", @@ -93,7 +94,31 @@ ng_test_library( ng_web_test_suite( name = "unit_tests", - deps = [":tabs_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", + ], ) markdown_to_html( diff --git a/e2e/components/tabs-e2e.spec.ts b/src/material/tabs/tabs.e2e.spec.ts similarity index 98% rename from e2e/components/tabs-e2e.spec.ts rename to src/material/tabs/tabs.e2e.spec.ts index 459bc049e999..6fdba6c262f4 100644 --- a/e2e/components/tabs-e2e.spec.ts +++ b/src/material/tabs/tabs.e2e.spec.ts @@ -6,7 +6,7 @@ import { Key, ExpectedConditions } from 'protractor'; -import {pressKeys} from '../util/index'; +import {pressKeys} from '@angular/cdk/testing/e2e'; describe('tabs', () => { describe('basic behavior', () => { diff --git a/src/material/toolbar/BUILD.bazel b/src/material/toolbar/BUILD.bazel index 4112941f941b..16481cc6c4a3 100644 --- a/src/material/toolbar/BUILD.bazel +++ b/src/material/toolbar/BUILD.bazel @@ -1,8 +1,9 @@ package(default_visibility=["//visibility:public"]) load("@io_bazel_rules_sass//:defs.bzl", "sass_library", "sass_binary") +load("@npm_angular_bazel//:index.bzl", "protractor_web_test_suite") load("//tools:defaults.bzl", "ng_module", "ng_test_library", "ng_web_test_suite", - "markdown_to_html") + "markdown_to_html", "ng_e2e_test_library") ng_module( name = "toolbar", @@ -33,8 +34,8 @@ sass_binary( ) ng_test_library( - name = "toolbar_test_sources", - srcs = glob(["**/*.spec.ts"]), + name = "unit_test_sources", + srcs = glob(["**/*.spec.ts"], exclude = ["**/*.e2e.spec.ts"]), deps = [ "@npm//@angular/platform-browser", ":toolbar", @@ -43,7 +44,31 @@ ng_test_library( ng_web_test_suite( name = "unit_tests", - deps = [":toolbar_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", + ], ) markdown_to_html( diff --git a/e2e/components/toolbar-e2e.spec.ts b/src/material/toolbar/toolbar.e2e.spec.ts similarity index 100% rename from e2e/components/toolbar-e2e.spec.ts rename to src/material/toolbar/toolbar.e2e.spec.ts diff --git a/src/material/tooltip/BUILD.bazel b/src/material/tooltip/BUILD.bazel index b3e6cdc29875..c38b5d5b2b49 100644 --- a/src/material/tooltip/BUILD.bazel +++ b/src/material/tooltip/BUILD.bazel @@ -44,8 +44,8 @@ sass_binary( ) ng_test_library( - name = "tooltip_test_sources", - srcs = glob(["**/*.spec.ts"]), + name = "unit_test_sources", + srcs = glob(["**/*.spec.ts"], exclude = ["**/*.e2e.spec.ts"]), deps = [ "@npm//@angular/animations", "@npm//@angular/platform-browser", @@ -61,7 +61,7 @@ ng_test_library( ng_web_test_suite( name = "unit_tests", - deps = [":tooltip_test_sources"], + deps = [":unit_test_sources"], ) markdown_to_html( diff --git a/src/material/tree/BUILD.bazel b/src/material/tree/BUILD.bazel index ac5af87a434c..04066f9c9474 100644 --- a/src/material/tree/BUILD.bazel +++ b/src/material/tree/BUILD.bazel @@ -31,8 +31,8 @@ sass_binary( ) ng_test_library( - name = "tree_test_sources", - srcs = glob(["**/*.spec.ts"]), + name = "unit_test_sources", + srcs = glob(["**/*.spec.ts"], exclude = ["**/*.e2e.spec.ts"]), deps = [ "@npm//rxjs", "//src/cdk/tree", @@ -42,7 +42,7 @@ ng_test_library( ng_web_test_suite( name = "unit_tests", - deps = [":tree_test_sources"], + deps = [":unit_test_sources"], ) markdown_to_html( diff --git a/src/material/tsconfig-tests.json b/src/material/tsconfig-tests.json index 5d41e34fc59e..028df29b98e0 100644 --- a/src/material/tsconfig-tests.json +++ b/src/material/tsconfig-tests.json @@ -29,6 +29,7 @@ "index.ts" ], "exclude": [ - "**/schematics/**/*.ts" + "**/schematics/**/*.ts", + "**/*.e2e.spec.ts" ] } diff --git a/tools/defaults.bzl b/tools/defaults.bzl index 523e5c1d10d2..1169832b82b2 100644 --- a/tools/defaults.bzl +++ b/tools/defaults.bzl @@ -98,6 +98,19 @@ def ng_test_library(deps = [], tsconfig = None, **kwargs): **kwargs ) +def ng_e2e_test_library(deps = [], tsconfig = None, **kwargs): + local_deps = [ + "@npm//@types/jasmine", + "@npm//@types/selenium-webdriver", + "@npm//protractor", + ] + deps; + + ts_library( + testonly = 1, + deps = local_deps, + **kwargs + ) + def ts_web_test_suite(deps = [], srcs = [], **kwargs): _ts_web_test_suite( deps = ["//tools/rxjs:rxjs_umd_modules"] + deps, diff --git a/tools/package-tools/rollup-globals.ts b/tools/package-tools/rollup-globals.ts index 2da5ccf3d21d..4e349718b1ca 100644 --- a/tools/package-tools/rollup-globals.ts +++ b/tools/package-tools/rollup-globals.ts @@ -48,6 +48,8 @@ const rollupCdkExperimentalEntryPoints = export const rollupGlobals = { 'moment': 'moment', 'tslib': 'tslib', + 'protractor': 'protractor', + 'selenium-webdriver': 'selenium-webdriver', // MDC Web '@material/animation': 'mdc.animation', @@ -111,6 +113,8 @@ export const rollupGlobals = { ...rollupCdkExperimentalEntryPoints, ...rollupMaterialExperimentalEntryPoints, + '@angular/cdk/testing/e2e': 'ng.cdk.testing.e2e', + 'rxjs': 'rxjs', 'rxjs/operators': 'rxjs.operators', };