- 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.
-
Please provide us steps to reproduce. Here is a quick checklist how to do it:
-
create a test config file in https://github.com/azachar/protractor-screenshoter-plugin/blob/master/spec/integrational/protractor-config such bugXX.js
-
modify the screenshot path from
.tmp/bug55
to.tmp/bugXX
-
pick a protractor's spec to run with or keep the same like in
bug55.js
-
-
duplicate a whole
describe
section from-
modify the path to the reporter
-
modify your test according to your expectations, in this case, we expected that there will be no protractor errors (thus
toBeTruthy()
). If your protractor test should fail instead, then modify expectation totoBeFalsy()
-
-
run that test, when it fails, push your changes to your fork, so we can look at your problem and reproduce it.
If you need to go deeper into testing, read the following section:
We are testing our plugin for protractor,
- 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 :)
-
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
-
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',
}]
};
- 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.
- to run jasmine tests use
npm test
after npm install
npm run setup
This will install webdrivernpm run server &
This will run selenium server
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
After cloning the project you can run tests as follows:
npm install
npm run setup
npm run server &
npm test
To run without coverage report including some debug logging use npm run testing
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.
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