Created
November 14, 2015 10:27
-
-
Save MattMcFarland/ea72a43eb3edb64f6b2f to your computer and use it in GitHub Desktop.
BDD - Use with Mocha, Chai, and Selenium
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Start with a webdriver instance: | |
| var | |
| baseUrl = 'localhost:8080', | |
| chai = require('chai'), | |
| assert = chai.assert, | |
| expect = chai.expect, | |
| should = chai.should(), | |
| chaiWebdriver = require('chai-webdriver'), | |
| request = require('supertest')(baseUrl), | |
| sw = require('selenium-webdriver'), | |
| driver = new sw.Builder() | |
| .withCapabilities(sw.Capabilities.phantomjs()) | |
| .build(); | |
| chai.use(chaiWebdriver(driver)); | |
| driver.get(baseUrl); | |
| describe('Connectivity\n ---------------', () => { | |
| it('connects to localhost', (done) => { | |
| request.get('/') | |
| .end((err, res) => { | |
| should.exist(res, 'failure to connect to ' + baseUrl); | |
| done(); | |
| }) | |
| }) | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment