Created
August 20, 2016 22:14
-
-
Save dunn/84309e5ba444d85d33cab925c3f9bbb1 to your computer and use it in GitHub Desktop.
This file contains 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
const Nightmare = require('nightmare'); | |
const assert = require('assert'); | |
const util = require('util'); | |
require('mocha-generators').install(); | |
if (!process.env['BT_CONFIG_DIR']) | |
process.env['BT_CONFIG_DIR'] = `${__dirname}/config`; | |
const user = process.env['BT_TEST_USER']; | |
const pass = process.env['BT_TEST_PASS']; | |
describe('signup and login', () => { | |
it('signs up via Twitter with default settings', function*() { | |
const nm = Nightmare(); | |
yield nm.goto('http://localhost:3000') | |
.wait('.container-fluid') | |
.click('form[action*="/auth/twitter"] [type=submit]') | |
.wait('.auth') | |
.type('form[action*="https://api.twitter.com/oauth/authenticate"] [name="session[username_or_email]"]', user) | |
.type('form[action*="https://api.twitter.com/oauth/authenticate"] [name="session[password]"]', pass) | |
.click('form[action*="https://api.twitter.com/oauth/authenticate"] [type=submit]') | |
.wait('.container-fluid') | |
.evaluate(() => { | |
return [ | |
document.querySelector('.container-fluid p:nth-child(4) input').checked, | |
document.querySelector('.container-fluid p:nth-child(5) input').checked, | |
document.querySelector('.container-fluid p:nth-child(6) input').checked, | |
document.querySelector('.container-fluid p:nth-child(7) input').checked | |
]; | |
}) | |
.end() | |
.then((value) => { | |
assert.equal(value, [false, false, false, true]); | |
}); | |
}) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment