Skip to content
This repository has been archived by the owner on Jul 29, 2024. It is now read-only.

Commit

Permalink
chore(plugins): Split first party plugins into seperate repos
Browse files Browse the repository at this point in the history
  • Loading branch information
sjelin committed Nov 16, 2015
1 parent 7015010 commit ac1e21e
Show file tree
Hide file tree
Showing 41 changed files with 34 additions and 4,450 deletions.
166 changes: 33 additions & 133 deletions docs/plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,7 @@ The `plugins` folder contains default plugins for Protractor.
##In this document:
* [Using Plugins](/docs/plugins.md#using-plugins)
* [Writing Plugins](/docs/plugins.md#writing-plugins)
* Default Plugins
* [Accessibility Plugin](/docs/plugins.md#accessibility-plugin)
* [ngHint Plugin](/docs/plugins.md#nghint-plugin)
* [Timeline Plugin](/docs/plugins.md#timeline-plugin)
* [Console Plugin](/docs/plugins.md#console-plugin-chrome-only)
* [First Party Plugins](/docs/plugins.md#first-party-plugins)
* [Community Plugins](/docs/plugins.md#community-plugins)

Using Plugins
Expand Down Expand Up @@ -290,145 +286,49 @@ exports.addWarning(message, options);
If you specify any of these properties in your plugin file, they will be
overwritten.

Accessibility Plugin
--------------------
Protractor comes with support for two accessibility testing options:
* Accessibility Developer Tools
* Tenon.io

Protractor will run each set of audits (depending on your configuration) on your existing end-to-end
tests to ensure your site is free of obvious errors. In this kind of testing, there is no concept of
"warnings"–only pass or fail. In your configuration, you can decide whether warnings should
pass or fail your build.

To understand how each of these tools can be used, see this support matrix:

| Testing Library | Pricing | API Key | External Request | No. of Tests | Info |
|--------------------------------------|-------------------------------------------|---------|------------------|--------------|-------------------------------------------------------------------------|
| Chrome Accessibility Developer Tools | Free | No | No | 14 | [Github](https://github.com/GoogleChrome/accessibility-developer-tools) |
| Tenon.io | Free limited accounts, paid subscriptions | Yes | Yes | 63 | [Tenon.io](http://tenon.io/) |

Protractor now supports the [Accessibility Developer Tools](https://github.com/GoogleChrome/accessibility-developer-tools), the same audit library used by the [Chrome browser extension](https://chrome.google.com/webstore/detail/accessibility-developer-t/fpkknkljclfencbdbgkenhalefipecmb?hl=en). Protractor
[runs an audit](https://github.com/GoogleChrome/accessibility-developer-tools/wiki/Audit-Rules)
locally by injecting the Dev Tools script into WebDriver pages, and it can diagnose issues including
missing labels, incorrect ARIA attributes and color contrast. This is a great starting point if
you can't send source code over the wire through an API.

[Tenon.io](http://www.tenon.io) has a more robust set of tests to help you find
accessibility issues, but it requires [registering](http://tenon.io/register.php) for an API key
and making an external request for each test, which may not work for everyone. Some people use
Tenon with introspection services like ngrok or localtunnel to securely
test local web servers. Protractor takes the [options you provide](http://tenon.io/documentation/understanding-request-parameters.php) in the plugin configuration and sends them
with the page source to the Tenon API. One limitation of this approach is that all scripts must be reachable from the page source as a string, for example, by using a CDN.
For projects with an MIT license, Tenon is free but with a limited
daily API limit. Paid subscriptions are available for enterprise and commercial projects.

Enable this plugin in your config file:
```js
// Chrome Accessibility Dev Tools only:
exports.config = {
...
plugins: [{
chromeA11YDevTools: {
treatWarningsAsFailures: true
},
path: 'node_modules/protractor/plugins/accessibility'
}]
}
```
```js
// Tenon.io only:
exports.config = {
...
plugins: [{
tenonIO: {
options: {
// See http://tenon.io/documentation/understanding-request-parameters.php
// options.src will be added by the test.
},
printAll: false, // whether the plugin should log API response
},
chromeA11YDevTools: true,
path: 'node_modules/protractor/plugins/accessibility'
}]
}
```

ngHint Plugin
-------------
ngHint adds run-time hinting to AngularJS projects. This plugin bubbles those hints up to the
command line so they can be used in automated testing.

You enable this plugin in your config file:
```js
exports.config = {
plugins: [{
path: 'node_modules/protractor/plugins/ngHint',

asTests: {Boolean},
excludeURLs: {(String|RegExp)[]}
}]
};
```
`asTests` specifies if the plugin should generate passed/failed test results
based on the ngHint output or instead log the results to the console.
Defaults to true.

`excludeURLs` specifies a list of URLs for which ngHint results should be
ignored. Defaults to []

Timeline Plugin
---------------
This plugin gathers test timeline information from the protractor test process, the selenium
client logs (if available), and sauce labs (if available), and presents the output visually.
This improves understanding of where latency issues are in tests.
First Party Plugins
-------------------

To enable the Timeline plugin, set it up in your config file:
```js
exports.config = {
plugins: [{
path: 'node_modules/protractor/plugins/timeline/index.js',
* Accessibility Plugin

// Output json and html will go in this folder.
outdir: 'timelines',
The accessibility plugin runs a set of accessibility audits on your webapp.
It is published at the npm module [`protractor-accessibility-plugin`]
(https://www.npmjs.com/package/protractor-accessibility-plugin) and stored at
the github repo [angular/protractor-accessibility-plugin]
(https://github.com/angular/protractor-accessibility-plugin).

// Optional - if sauceUser and sauceKey are specified, logs from
// SauceLabs will also be parsed after test invocation.
sauceUser: 'Jane',
sauceKey: 'abcdefg'
}],
// other configuration settings
};
```
* Timeline Plugin

The timeline plugin gathers test timeline information from various sources and
presents the output visually. This improves understanding of where latency
issues are in tests. It is published at the npm module
[`protractor-timeline-plugin`]
(https://www.npmjs.com/package/protractor-timeline-plugin) and stored at the
github repo [angular/protractor-timeline-plugin]
(https://github.com/angular/protractor-timeline-plugin).

Console Plugin (Chrome only)
----------------------------
* ngHint Plugin

This plugin checks the browser log after each test for warnings and errors. It
can be configured to fail a test if either is detected. There is also an
optional exclude parameter which accepts both regex and strings. Any log
matching the exclude parameter will not fail the test or be logged to the
console. A false setting to logWarnings also overrides the failOnWarning setting.
The ngHint plugin uses [Angular Hint](https://github.com/angular/angular-hint)
to generate run-time hinting and then turns these hints into Protractor tests.
It is published at the npm module [`protractor-ng-hint-plugin`]
(https://www.npmjs.com/package/protractor-ng-hint-plugin) and stored at the
github repo [angular/protractor-ng-hint-plugin]
(https://github.com/angular/protractor-ng-hint-plugin).

```js
exports.config = {
plugins: [{
path: 'node_modules/protractor/plugins/console',
failOnWarning: {Boolean} (Default - false),
failOnError: {Boolean} (Default - true),
logWarnings: {Boolean} (Default - true),
exclude: {Array of strings and regex} (Default - [])
}]
};
```
* Console Plugin (Chrome Only)

Note that this plugin's behavior is undefined on browsers other than Chrome.
Firefox users have reported flaky results.
The console plugin checks the browser log after each test for warnings and
errors. It is published at the npm module [`protractor-console-plugin`]
(https://www.npmjs.com/package/protractor-console-plugin) and stored at the
github repo [angular/protractor-console-plugin]
(https://github.com/angular/protractor-console-plugin).

Community Plugins
-----------------

This list is here for reference and the plugins included are not developed or mantained by protractor's team by any means. If you find any issues with this plugins please report them to the corresponding plugin developer.
This list is here for reference and the plugins included are not developed or
mantained by protractor's team by any means. If you find any issues with this
plugins please report them to the corresponding plugin developer.

* [Protractor testability plugin](https://github.com/alfonso-presa/protractor-testability-plugin): this plugins enables synchronous testing with protractor for features that are not developed using the services provided by AngularJS, preventing the need of additional waits coded in the tests. This happens for example if you have WebSockets communication with the server or for web applications built with frameworks different than AngularJS.
1 change: 0 additions & 1 deletion plugins/README.md

This file was deleted.

Loading

0 comments on commit ac1e21e

Please sign in to comment.