docs: Remove Protractor test from CI examples (#41733)

Protractor tests are no longer included in new projects starting from
Angular version 12.

PR Close #41733
This commit is contained in:
Keen Yee Liau 2021-04-20 16:53:26 -07:00 committed by Jessica Janiuk
parent e0fb18a133
commit 64567d3d39
1 changed files with 4 additions and 26 deletions

View File

@ -173,7 +173,6 @@ jobs:
paths: paths:
- "node_modules" - "node_modules"
- run: npm run test -- --no-watch --no-progress --browsers=ChromeHeadlessCI - run: npm run test -- --no-watch --no-progress --browsers=ChromeHeadlessCI
- run: npm run e2e -- --protractor-config=e2e/protractor-ci.conf.js
``` ```
This configuration caches `node_modules/` and uses [`npm run`](https://docs.npmjs.com/cli/run-script) to run CLI commands, because `@angular/cli` is not installed globally. This configuration caches `node_modules/` and uses [`npm run`](https://docs.npmjs.com/cli/run-script) to run CLI commands, because `@angular/cli` is not installed globally.
@ -207,7 +206,6 @@ install:
script: script:
- npm run test -- --no-watch --no-progress --browsers=ChromeHeadlessCI - npm run test -- --no-watch --no-progress --browsers=ChromeHeadlessCI
- npm run e2e -- --protractor-config=e2e/protractor-ci.conf.js
``` ```
This does the same things as the CircleCI configuration, except that Travis doesn't come with Chrome, so use Chromium instead. This does the same things as the CircleCI configuration, except that Travis doesn't come with Chrome, so use Chromium instead.
@ -260,7 +258,6 @@ test:
- export CHROME_BIN=/usr/bin/google-chrome - export CHROME_BIN=/usr/bin/google-chrome
script: script:
- npm run test -- --no-watch --no-progress --browsers=ChromeHeadlessCI - npm run test -- --no-watch --no-progress --browsers=ChromeHeadlessCI
- npm run e2e -- --protractor-config=e2e/protractor-ci.conf.js
``` ```
This configuration caches `node_modules/` in the `install` job and re-uses the cached `node_modules/` in the `test` job. This configuration caches `node_modules/` in the `install` job and re-uses the cached `node_modules/` in the `test` job.
@ -297,7 +294,6 @@ jobs:
- name: Test - name: Test
run: | run: |
npm test -- --no-watch --no-progress --browsers=ChromeHeadlessCI npm test -- --no-watch --no-progress --browsers=ChromeHeadlessCI
npm run e2e -- --protractor-config=e2e/protractor-ci.conf.js
``` ```
Step 3: [Sign up for GitHub](https://github.com/join) and [add your project](https://github.com/new). You'll need to push a new commit to trigger a build. Step 3: [Sign up for GitHub](https://github.com/join) and [add your project](https://github.com/new). You'll need to push a new commit to trigger a build.
@ -308,10 +304,9 @@ Step 4: Commit your changes and push them to your repository.
### Configure CLI for CI testing in Chrome ### Configure CLI for CI testing in Chrome
When the CLI commands `ng test` and `ng e2e` are generally running the CI tests in your environment, you might still need to adjust your configuration to run the Chrome browser tests. While the CLI command `ng test` is generally running the CI tests in your environment, you might still need to adjust your configuration to run the Chrome browser tests.
There are configuration files for both the [Karma JavaScript test runner](https://karma-runner.github.io/latest/config/configuration-file.html) There is a configuration file for the [Karma JavaScript test runner](https://karma-runner.github.io/latest/config/configuration-file.html),
and [Protractor](https://www.protractortest.org/#/api-overview) end-to-end testing tool,
which you must adjust to start Chrome without sandboxing. which you must adjust to start Chrome without sandboxing.
We'll be using [Headless Chrome](https://developers.google.com/web/updates/2017/04/headless-chrome#cli) in these examples. We'll be using [Headless Chrome](https://developers.google.com/web/updates/2017/04/headless-chrome#cli) in these examples.
@ -327,25 +322,10 @@ customLaunchers: {
}, },
``` ```
* In the root folder of your e2e tests project, create a new file named `protractor-ci.conf.js`. This new file extends the original `protractor.conf.js`. Now you can run the following command to use the `--no-sandbox` flag:
```
const config = require('./protractor.conf').config;
config.capabilities = {
browserName: 'chrome',
chromeOptions: {
args: ['--headless', '--no-sandbox']
}
};
exports.config = config;
```
Now you can run the following commands to use the `--no-sandbox` flag:
<code-example language="sh" class="code-shell"> <code-example language="sh" class="code-shell">
ng test --no-watch --no-progress --browsers=ChromeHeadlessCI ng test --no-watch --no-progress --browsers=ChromeHeadlessCI
ng e2e --protractor-config=e2e/protractor-ci.conf.js
</code-example> </code-example>
<div class="alert is-helpful"> <div class="alert is-helpful">
@ -367,5 +347,3 @@ After you've set up your app for testing, you may find the following testing gu
* [Testing pipes](guide/testing-pipes)&mdash;find out how to test attribute directives. * [Testing pipes](guide/testing-pipes)&mdash;find out how to test attribute directives.
* [Debugging tests](guide/test-debugging)&mdash;uncover common testing bugs. * [Debugging tests](guide/test-debugging)&mdash;uncover common testing bugs.
* [Testing utility APIs](guide/testing-utility-apis)&mdash;get familiar with Angular testing features. * [Testing utility APIs](guide/testing-utility-apis)&mdash;get familiar with Angular testing features.