Skip to content

Commit 1f40b7d

Browse files
authored
docs(cdk/testing): Clean up references to the now deprecated ProtractorHarnessEnvironment (#24307)
* docs(cdk/testing): Clean up references to the now deprecated ProtractorHarnessEnvironemnt * fix(cdk/testing): fix spelling
1 parent ebc3e10 commit 1f40b7d

File tree

4 files changed

+17
-16
lines changed

4 files changed

+17
-16
lines changed

CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -5535,4 +5535,4 @@ You can view a beta version of the docs at https://beta-angular-material-io.fire
55355535

55365536
# Changes Prior to 7.0.0
55375537

5538-
To view changes that occurred prior to 7.0.0, see [CHANGELOG_ARCHIVE.md](https://github.com/angular/components/blob/master/CHANGELOG_ARCHIVE.md).
5538+
To view changes that occurred prior to 7.0.0, see [CHANGELOG_ARCHIVE.md](https://github.com/angular/components/blob/master/CHANGELOG_ARCHIVE.md).

guides/using-component-harnesses.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@ The following sections will illustrate these benefits in more detail.
2828
## Which kinds of tests can use harnesses?
2929

3030
The Angular CDK's component harnesses are designed to work in multiple different test environments.
31-
Support currently includes Angular's Testbed environment in Karma unit tests and Protractor
31+
Support currently includes Angular's Testbed environment in Karma unit tests and Selenium WebDriver
3232
end-to-end (e2e) tests. You can also support additional environments by creating custom extensions
3333
of the CDK's `HarnessEnvironment` and `TestElement` classes.
3434

3535
## Getting started
3636

3737
The foundation for all test harnesses lives in `@angular/cdk/testing`. Start by importing either
38-
`TestbedHarnessEnvironment` or `ProtractorHarnessEnvironment` based on whether you're writing a
38+
`TestbedHarnessEnvironment` or `SeleniumWebDriverHarnessEnvironment` based on whether you're writing a
3939
unit test or an e2e test. From the `HarnessEnvironment`, you can get a `HarnessLoader` instance,
4040
which you will use to load Angular Material component harnesses. For example, if we're writing unit
4141
tests for a `UserProfile` component, the code might look like this:
@@ -64,8 +64,8 @@ different paths.
6464
- `@angular/cdk/testing` contains symbols that are shared regardless of the environment your tests
6565
are in.
6666
- `@angular/cdk/testing/testbed` contains symbols that are used only in Karma tests.
67-
- `@angular/cdk/testing/protractor` (not shown above) contains symbols that are used only in
68-
Protractor tests.
67+
- `@angular/cdk/testing/selenium-webdriver` (not shown above) contains symbols that are used only in
68+
Selenium WebDriver tests.
6969
7070
## Loading an Angular Material harness
7171

src/cdk/testing/protractor/protractor-harness-environment.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ const defaultEnvironmentOptions: ProtractorHarnessEnvironmentOptions = {
2727

2828
/**
2929
* A `HarnessEnvironment` implementation for Protractor.
30-
* @deprecated
30+
* @deprecated As of v13.0.0, this environment no longer works, as it is not
31+
* compatible with the new [Angular Package Format](https://angular.io/guide/angular-package-format).
3132
* @breaking-change 13.0.0
3233
*/
3334
export class ProtractorHarnessEnvironment extends HarnessEnvironment<ElementFinder> {

src/cdk/testing/test-harnesses.md

+10-10
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,12 @@ matches the harness class to instances of the component in the DOM. Beyond that,
4444
given harness is specific to its corresponding component; refer to the component's documentation to
4545
learn how to use a specific harness.
4646

47-
#### Using `TestbedHarnessEnvironment` and `ProtractorHarnessEnvironment`
47+
#### Using `TestbedHarnessEnvironment` and `SeleniumWebDriverHarnessEnvironment`
4848

4949
These classes correspond to different implementations of the component harness system with bindings
5050
for specific test environments. Any given test must only import _one_ of these classes. Karma-based
51-
unit tests should use the `TestbedHarnessEnvironment`, while Protractor-based end-to-end tests
52-
should use the `ProtractorHarnessEnvironment`. Additional environments require custom bindings; see
51+
unit tests should use the `TestbedHarnessEnvironment`, while Selenium WebDriver-based end-to-end tests
52+
should use the `SeleniumWebDriverHarnessEnvironment`. Additional environments require custom bindings; see
5353
[API for harness environment authors](#api-for-harness-environment-authors) for more information on
5454
alternate test environments.
5555

@@ -107,13 +107,13 @@ it('loads harnesses', async () => {
107107
});
108108
```
109109

110-
`ProtractorHarnessEnvironment` has an API that offers a single static method:
110+
`SeleniumWebDriverHarnessEnvironment` has an API that offers a single static method:
111111

112112
| Method | Description |
113113
| ------ | ----------- |
114114
| `loader(): HarnessLoader` | Gets a `HarnessLoader` instance for the current HTML document, rooted at the document's root element. |
115115

116-
Since Protractor does not deal with fixtures, the API in this environment is simpler. The
116+
Since Selenium WebDriver does not deal with fixtures, the API in this environment is simpler. The
117117
`HarnessLoader` returned by the `loader()` method should be sufficient for loading all necessary
118118
`ComponentHarness` instances.
119119

@@ -304,7 +304,7 @@ The functions created with the locator methods described above all return `TestE
304304
| `dispatchEvent(name: string, data?: Record<string, EventData>): Promise<void>;` | Dispatches an event with a particular name. |
305305

306306
`TestElement` is an abstraction designed to work across different test environments (Karma,
307-
Protractor, etc). When using harnesses, you should perform all DOM interaction via this interface.
307+
Selenium WebDriver, etc). When using harnesses, you should perform all DOM interaction via this interface.
308308
Other means of accessing DOM elements (e.g. `document.querySelector`) will not work in all test
309309
environments.
310310

@@ -574,7 +574,7 @@ may need to explicitly wait for tasks outside `NgZone`, as this does not happen
574574

575575
Harness environment authors are developers who want to add support for using component harnesses in
576576
additional testing environments. Out-of-the-box, Angular CDK's component harnesses can be used in
577-
Protractor E2E tests and Karma unit tests. Developers can support additional environments by
577+
Selenium WebDriver E2E tests and Karma unit tests. Developers can support additional environments by
578578
creating custom implementations of `TestElement` and `HarnessEnvironment`.
579579

580580
#### Creating a `TestElement` implementation for the environment
@@ -583,7 +583,7 @@ The first step in adding support for a new testing environment is to create a `T
583583
implementation. The `TestElement` interface serves as an environment-agnostic representation of a
584584
DOM element; it lets harnesses interact with DOM elements regardless of the underlying environment.
585585
Because some environments don't support interacting with DOM elements synchronously
586-
(e.g. webdriver), all of the `TestElement` methods are asynchronous, returning a `Promise` with the
586+
(e.g. WebDriver), all of the `TestElement` methods are asynchronous, returning a `Promise` with the
587587
result of the operation.
588588

589589
| Method | Description |
@@ -616,7 +616,7 @@ maintain a mapping from `TestKey` codes to the codes used in the particular test
616616
The
617617
[`UnitTestElement`](https://github.com/angular/components/blob/master/src/cdk/testing/testbed/unit-test-element.ts#L57)
618618
and
619-
[`ProtractorElement`](https://github.com/angular/components/blob/master/src/cdk/testing/protractor/protractor-element.ts#L67)
619+
[`SeleniumWebDriverElement`](https://github.com/angular/components/blob/master/src/cdk/testing/selenium-webdriver/selenium-web-driver-element.ts#L22)
620620
implementations in Angular CDK serve as good examples of implementations of this interface.
621621

622622
#### Creating a `HarnessEnvironemnt` implementation for the environment
@@ -654,7 +654,7 @@ require arguments to be passed. (e.g. the `loader` method on `TestbedHarnessEnvi
654654
The
655655
[`TestbedHarnessEnvironment`](https://github.com/angular/components/blob/master/src/cdk/testing/testbed/testbed-harness-environment.ts#L20)
656656
and
657-
[`ProtractorHarnessEnvironment`](https://github.com/angular/components/blob/master/src/cdk/testing/protractor/protractor-harness-environment.ts#L16)
657+
[`SeleniumWebDriverHarnessEnvironment`](https://github.com/angular/components/blob/master/src/cdk/testing/selenium-webdriver/selenium-web-driver-harness-environment.ts#L71)
658658
implementations in Angular CDK serve as good examples of implementations of this interface.
659659

660660
#### Handling auto change detection status

0 commit comments

Comments
 (0)