angular/protractor — pull request #47 by jamestalmage (2013-08-17 02:30:50+00:00)
Title: Mocha/Chai Promise Adapter -- Proof of Concept

Fixes #35

I put this together fairly quickly, but I wanted to run it by the protractor team before I invested more time. It makes use of my [promise-testing](https://github.com/promise-testing/promise-testing) library to provide a [Chai.js](http://chaijs.com) adapter for expectations on webdriver promises, very similar to the existing Jasmine implementation.

All the relevant files are in the `mochachaiwd` directory. `onMocha.js` and `index.js` are modified copies of files with the same name elsewhere in the project. I recommend using a file comparison tool to see what I actually changed (it's really only a few lines).

After cloning, switch to the `mocha-proof-of-concept` branch and then:
```
npm install
./bin/install_selenium_standalone
./bin/start_selenium_standalone
```
Once selenium is up and running, then:
```
npm run-script testMocha
```

This is not ready for primetime yet. To get there it needs:
- [ ] Integration with the cli (some way for the cli to infer mocha vs jasmine)
- [ ] Appropriate configuration options in the conf file
- [ ] `mochachaiwd/index.js` is a hacked copy of `jasminewd/index.js`. There is plenty of duplicate code that could easily be eliminated.
- [ ] [promise-testing](https://github.com/promise-testing/promise-testing) doesn't account for promises as expectations (`expect(promiseA).to.equal(promiseB)`). This will be harder to patch in Chai than it was Jasmine, since Chai allows such long promise chains (`expect({a:10}).property('a').to.be.at.least(6)`). I will add the feature there (possibly include a hook for customizing how promises are detected - which protractor could use to detect webdriver promises).

**Thanks for for a great tool guys!**