# cucumberjs-chromedriver

> integrating chromedriver with cucumberjs so you don't have to

Latest version **0.3.1** (published 2015-07-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install cucumberjs-chromedriver
pnpm add cucumberjs-chromedriver
yarn add cucumberjs-chromedriver
bun add cucumberjs-chromedriver
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.1 |
| Published | 2015-07-29 |
| First published | 2015-06-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 9 |
| Known vulnerabilities | 0 (+3 in 3 direct dependencies) |
| Install scripts | no |
| Author | Jon Hoguet |
| Maintainers | jonathan.hoguet |
| Keywords | cucumber, cucumberjs, chromedriver |

## Links

- npm: https://www.npmjs.com/package/cucumberjs-chromedriver
- Repository: https://github.com/jhoguet/cucumberjs-chromedriver
- Issues: https://github.com/jhoguet/cucumberjs-chromedriver/issues
- npm.io page: https://npm.io/package/cucumberjs-chromedriver

## Dependencies (9)

- [q](https://npm.io/package/q.md) ^1.4.1
- [wd](https://npm.io/package/wd.md) ^0.3.12
- [nopt](https://npm.io/package/nopt.md) ^3.0.2
- [chalk](https://npm.io/package/chalk.md) ^1.0.0
- [merge](https://npm.io/package/merge.md) ^1.2.0
- [cucumber](https://npm.io/package/cucumber.md) ^0.5.1
- [phantomjs](https://npm.io/package/phantomjs.md) ^1.9.17
- [portscanner](https://npm.io/package/portscanner.md) ^1.0.0
- [chromedriver](https://npm.io/package/chromedriver.md) ^2.15.1

## Recent versions

- 0.3.1 (latest) — 2015-07-29
- 0.3.0 — 2015-07-29
- 0.2.2 — 2015-07-21
- 0.2.1 — 2015-07-21
- 0.2.0 — 2015-06-21
- 0.1.1 — 2015-06-21
- 0.1.0 — 2015-06-20

## README

# cucumberjs-chromedriver

Making **local** BDD easier.

## Getting started

	npm install cucumberjs -g
	npm install cucumberjs-chromedriver --save-dev
    
create a feature `./example.feature`
```gherkin
Feature: Example feature
  As a user of cucumber.js
  I want to have documentation on cucumber
  So that I can concentrate on building awesome applications

  Scenario: Reading documentation
    When I am on the Cucumber.js GitHub repository
    Then I should see "cucumber" in the page title
```

create a world file `./local-world.js`
```js
module.exports = require('cucumberjs-chromedriver');
```
> this injects cucumberjs-chromedriver into the necessary hooks to start and stop the chromedriver. See Api for more advanced topics.

create a step file `./example.steps.js`
```js
var chai = require("chai"),
    chaiAsPromised = require('chai-as-promised');

chai.should();

chai.use(chaiAsPromised);

module.exports = function () {
    this.When(/^I am on the Cucumber.js GitHub repository$/, function () {
        return this.browser.get('./');
    });

    this.Then(/^I should see "(.*)" in the page title$/, function (title) {
        return this.browser.title().should.eventually.contain(title);
  });
};
```
notice this is requiring more npm installs (but you don't have to use chai if you don't want to)

	npm install chai --save-dev
    npm install chai-as-promised --save-dev
    
And run your tests... 

	cucumberjs example.feature -r local-world.js -r example.steps.js --contentPath=http://github.com/cucumber/cucumber-js/
    
> cucumberjs has conventions so you don't have to be so explicity, but I find them to confuse more than help... 

## Api
### What is injected into the World? 
| property       | description       |
|--------|--------|
| browser | this is a browser instance from [wd.js](https://github.com/admc/wd) |
| browser.pause() | returns a promise that will never resolve. This makes it easy to stop a test at a certain point in the workflow to manually inspect in the chromedriver browser. Ctr+C to kill the process. |
| browser.SPECIAL_KEYS | wd [Special Keys](https://github.com/admc/wd/blob/8058f745e273693ec12a6b81f54bb501c38261a4/lib/special-keys.js) so you don't need to require [wd](https://github.com/admc/wd) just for the keys|

### How do I debug what webdriver is doing?
Pass debug through the CLI `--debug` when starting `cucumberjs` and it will output webdriver debugging. 

### How do I extend the world?
```js
module.exports = function(){
	// you can pass `contentPath` or `debug` through here instead of the CLI if you want
    require('cucumberjs-chromedriver').call(this, { contentPath : 'http://localhost:8001' });

	// cache the World factory provided by `cucumberjs-chromedriver`
	var chromeDriverWorldFactory = this.World;
    // create a new WorldFactory
     this.World = function(callback){
     	// now you can do stuff before
         chromeDriverWorldFactory(function(theirWorld){
	         // or after, like extending the world
             var myWorld = Object.create(theirWorld);
             myWorld.jon = 'hoguet';
             // finally pass the world to the callback (which becomes the `this` for all scenarios)
             callback(myWorld);
         });
     };
};
```

## Running Locally
	
    npm install
    npm test

---
_Source: https://npm.io/package/cucumberjs-chromedriver · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
