Skip to content

Latest commit

 

History

History
121 lines (83 loc) · 4.51 KB

CONTRIBUTING.md

File metadata and controls

121 lines (83 loc) · 4.51 KB

Contributing

  • Your PR is more than welcome!
  • Please include always tests in your PR.
  • If you find a bug, please create a test case for it that fails first, then write your fix. If all passes on Travis, feel free to provide your PR.
  • Before publishing a PR, please format the source code and squash all your changes into one single commit.
  • Provide only one feature in one PR, do not combine more features.
  • Please update README.md if your change requires documentation.

Bug fixing

If you need to go deeper into testing, read the following section:

How to write tests for your contribution

We are testing our plugin for protractor,

  1. so we need an e2e protractor test.

There are already some e2e tests in spec/integrational/protractor that can be reused. Basically, we run sample e2e tests against http://www.angularjs.org. So if this page is changed or inaccessible our tests will fail too :(

Note: Any PR that will create a local dummy server that our sample tests will run against is welcome :)

  1. Then we need a screenshoter configuration that we will run the protractor e2e tests against. Please write your new config in spec/integrational/protractor-config\bugXXX.js

  2. Please always specify a unique directory for your new screenshoter config, so it doesn't interfere with the existing tests.

var env = require('../environment');

exports.config = {
    seleniumAddress: env.seleniumAddress,
    framework: 'jasmine2',
    specs: ['../protractor/angularjs-homepage-test.js'],
    plugins: [{
        path: '../../../index.js',

        screenshotPath: '.tmp/bugXXX',
    }]
};
  1. write your jasmine test (copy the whole describe block from existing one and modify it to your needs).

Mainly modify

  beforeAll(function() {
      runProtractorWithConfig('bugXXX.js');
  });

To check results from protractor e2e tests, simply run

node_modules/protractor/bin/protractor spec/integrational/protractor-config/bugXXX.js

Then you can tweak your jasmine test to check the correct behavior of your screenshoter bugfix or feature.

  1. to run jasmine tests use npm test after
  2. npm install
  3. npm run setup This will install webdriver
  4. npm run server & This will run selenium server

How to debug screenshoter plugin

You can debug this plugin by running protractor in a debug mode like this:

 node --inspect-brk node_modules/protractor/bin/protractor ./spec/integrational/protractor-config/default.js

NOTE Where ./spec/integrational/protractor-config/default.js is a sample e2e test. You can choose another one or write one yourself.

Then open chrome://inspect in your Chrome and press inspect on the remote target.

Here is more information how to debug protractor - https://github.com/angular/protractor/blob/master/docs/debugging.md

Running test

After cloning the project you can run tests as follows:

  1. npm install
  2. npm run setup
  3. npm run server &
  4. npm test

To run without coverage report including some debug logging use npm run testing

Committing

Please use git-cz to format your commit message.

Before committing, please check your changes with

npm run lint

and fix your code style issues.

Releasing

To deploy a new version run commands. If all tests are passed it will be published to npm on its own.

npm run release
git push --follow-tags origin master