Giter Site home page Giter Site logo

rohanbaraskar / protractor-cucumber-framework Goto Github PK

View Code? Open in Web Editor NEW

This project forked from protractor-cucumber-framework/protractor-cucumber-framework

0.0 2.0 0.0 248 KB

Cucumber framework plugin for Protractor v3.x

License: MIT License

JavaScript 84.71% Gherkin 3.71% HTML 11.58%

protractor-cucumber-framework's Introduction

Protractor Cucumber Framework

npm-version Join the chat at https://gitter.im/protractor-cucumber-framework/protractor-cucumber-framework Build Status dependencies dev dependencies peer dependencies download-count open-issues contributors

This framework was originally part of angular/protractor and is now a separate module to decouple cucumber.js.

Install

npm install --save-dev protractor-cucumber-framework

Implementation

To implement this framework, utilize the protractor custom framework config option:

exports.config = {
  // set to "custom" instead of cucumber.
  framework: 'custom',

  // path relative to the current config file
  frameworkPath: require.resolve('protractor-cucumber-framework'),

  // require feature files
  specs: [
    'path/to/feature/files/**/*.feature' // accepts a glob
  ],

  cucumberOpts: {
    // require step definitions
    require: [
      'path/to/step/definitions/**/*.steps.js' // accepts a glob
    ]
  }
};

Passing Options to cucumberjs

All of the cucumberOpts will be passed to cucumberjs as arguments.

For example, to call cucumberjs with the --strict, --no-colors, and to specify custom formatters:

cucumberOpts: {
  strict: true,
  'no-colors': true,
  format: ['progress', 'pretty:output.txt'],
  // ...
}

The following parameters have special behavior:

  • require - globs will be expanded to multiple --require arguments
  • rerun - value is passed as an argument; for use with the rerun feature

Formatters when tests are sharded or with multi capabilities

If you have a formatter that outputs to a path and your tests are sharded or you have multi capabilities then this library will add the PID to the path to make them unique. The reason for this is multiple processes can write to the same path which ends up clobbering each other. You'll end up with 1 file per process that protractor spawns.

exports.config = {
  capabilities: {
    shardTestFiles: true,
    // ...
  },

  cucumberOpts: {
    format: 'json:results.json',
    // ...
  }
};

If there were 2 feature files then you can expect the following output files...

  results.11111.json
  results.22222.json

...where the numbers will be the actual PIDs.

Uncaught Exceptions

If your process abruptly stops with an exit code 199 then your steps most likely threw an uncaught exception. Protractor is capturing these and exiting the process in this situation. The solution is to upgrade to at least protractor version 4.0.10 and add the following to your protractor conf...

  ignoreUncaughtExceptions: true

This allows cucumber to handle the exception and record it appropriately.

Contributing

Pull requests are welcome. Commits should have an appropriate message and be squashed.

For Contributors

Ensure that the following dependencies are installed:

  • Java SDK and JRE
  • node.js
  • Google Chrome

Clone the github repository:

git clone https://github.com/protractor-cucumber-framework/protractor-cucumber-framework
cd protractor-cucumber-framework
npm install

Testing

Start a selenium server:

npm run webdriver

Start the test app that tests will be run against in a separate shell:

npm start

Run the tests in a separate shell:

npm test

For Maintainers

Releasing

  1. bump version
  2. npm publish
  3. tag release (git tag v1.0.2 && git push origin master --tags)
  4. build github release (npm i -g release && release)

protractor-cucumber-framework's People

Contributors

mattfritz avatar darrinholst avatar loicmahieu avatar a-r-o-n avatar codyray avatar sjelin avatar gitter-badger avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.