2.1.1 • Published 5 years ago

eslint-plugin-protractor v2.1.1

Weekly downloads
8,598
License
MIT
Repository
github
Last release
5 years ago

eslint-plugin-protractor

npm version npm downloads Build Status

semantic-release Commitizen friendly Join the chat at https://gitter.im/alecxe/eslint-plugin-protractor Maintenance Status

Code Climate Package Quality Coverage Status js-standard-style

ESLint rules for Protractor

This plugin would not only help catch common Protractor-specific errors early, follow the best practices for writing Protractor tests, but would also help maintaining good and reliable element locators.

The plugin would be of the most help if configured to run in your IDE of choice on the fly.

Example

This gif shows integration of ESLint with eslint-plugin-protractor into WebStorm IDE. Find out more at WebStorm ESLint configuration.

Installation

Install ESLint and this plugin either locally or globally.

$ npm install eslint --save-dev
$ npm install eslint-plugin-protractor --save-dev

Usage

  1. Install eslint-plugin-protractor as a dev-dependency:

    npm install --save-dev eslint-plugin-protractor
  2. Enable the plugin by adding it to your .eslintrc:

    plugins:
      - protractor

Rules

There are various types of rules implemented in the plugin. Here is a rough categorization.

Correct Protractor API usage and Common Errors

Locating Elements

Style Guide Recommendations and Best Practices

Here is a table with all the available rules sorted by the default error level:

RuleDefault Error LevelAuto-fixableOptions
missing-perform2 (Error)
no-browser-pause2
correct-chaining2Yes
no-invalid-selectors2
no-array-finder-methods2
valid-locator-type2
no-compound-classes2
no-get-inner-outer-html2
no-get-raw-id2
missing-wait-message1 (Warning)
no-browser-sleep1
no-by-xpath1
no-describe-selectors1
no-angular-classes1
use-angular-locators1
no-angular-attributes1
no-bootstrap-classes1
use-simple-repeaters1
no-shadowing1
use-first-last1Yes
no-get-in-it1
array-callback-return1
no-absolute-url1
no-get-location-abs-url1
no-expect-in-po1requires plugin "settings"
no-promise-in-if1
no-execute-script1requires plugin "settings"
no-repetitive-locators1
no-repetitive-selectors1
use-count-method1
valid-by-id1
valid-by-tagname1
limit-selector-depth1number of nodes (default 5)
bare-element-finders1
empty-script1
use-promise-all0 (Turned off)
by-css-shortcut0
no-browser-driver0

For example, the missing-perform rule is enabled by default and will cause ESLint to throw an error (with an exit code of 1) when triggered.

The requires plugin "settings" note indicates that a rule needs the plugin to have configured settings in your ESLint config. For example, no-execute-script rule expects configured paths to either spec, or page object files, or both.

You may customise each rule by adding a value in your .eslintrc rules property:

plugins:
  - protractor
rules:
  protractor/missing-perform: 0

See configuring rules for more information.

Recommended configuration

This plugin export a recommended configuration that enforce good practices.

To enable this configuration use the extends property in your .eslintrc config file:

{
  "plugins": [
    "protractor"
  ],
  "extends": "plugin:protractor/recommended"
}

See ESLint documentation for more information about extending configuration files.

Author

© 2016-infinity Alexander Afanasyev and contributors.

License

Licensed under the MIT license.

2.1.1

5 years ago

2.1.0

5 years ago

2.0.0

5 years ago

1.41.1

5 years ago

1.41.0

6 years ago

1.40.2

6 years ago

1.40.1

6 years ago

1.40.0

7 years ago

1.39.0

7 years ago

1.38.0

7 years ago

1.37.0

7 years ago

1.36.0

7 years ago

1.35.1

7 years ago

1.35.0

7 years ago

1.34.2

7 years ago

1.34.1

7 years ago

1.34.0

7 years ago

1.33.0

7 years ago

1.32.0

7 years ago

1.31.0

7 years ago

1.30.0

7 years ago

1.29.1

7 years ago

1.29.0

7 years ago

1.28.0

8 years ago

1.27.1

8 years ago

1.27.0

8 years ago

1.26.0

8 years ago

1.25.0

8 years ago

1.24.2

8 years ago

1.24.1

8 years ago

1.24.0

8 years ago

1.23.0

8 years ago

1.22.0

8 years ago

1.21.0

8 years ago

1.20.0

8 years ago

1.19.0

8 years ago

1.18.0

8 years ago

1.17.2

8 years ago

1.17.1

8 years ago

1.17.0

8 years ago

1.16.0

8 years ago

1.15.0

8 years ago

1.14.0

8 years ago

1.13.1

8 years ago

1.13.0

8 years ago

1.12.0

8 years ago

1.11.2

8 years ago

1.11.1

8 years ago

1.11.0

8 years ago

1.10.2

8 years ago

1.10.1

8 years ago

1.10.0

8 years ago

1.9.1

8 years ago

1.9.0

8 years ago

1.8.1

8 years ago

1.8.0

8 years ago

1.7.0

8 years ago

1.6.0

8 years ago

1.5.0

8 years ago

1.4.0

8 years ago

1.3.0

8 years ago

1.2.0

8 years ago

1.1.1

8 years ago

1.1.0

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago