Skip to content

Instantly share code, notes, and snippets.

@beresmate
Last active December 31, 2015 04:09
Show Gist options
  • Save beresmate/7932485 to your computer and use it in GitHub Desktop.
Save beresmate/7932485 to your computer and use it in GitHub Desktop.
Runs a simple webdriver test via Mocha
describe('After the user logs in', function () {
// setting the timeout for the suite
this.timeout(30000);
// get the existing sessionId from the environment variables,
// and attach our browser to it
before(function (done) {
var sessionId = process.env.sessionId,
browser = wd.promiseChainRemote();
browser.attach(sessionId, done);
});
// if we specifiy an argument, then the function will be async,
// and have to call the callback, once it's finished
after(function (done) {
browser.quit(done);
});
it('the profile icon should appear', function (next) {
this.timeout(25000);
browser
.get('http://gawker.com/')
.waitForElementByCss('.js_login_link', 15000)
.click()
.waitForElementByCss('.js_burner_login', 5000)
.click()
.waitForElementByCss('.js_screen_name', 5000)
.type('testUserName')
.waitForElementByCss('.js_token', 5000)
.type('myStrongPassword82')
.waitForElementByCss('.js_submit', 1000)
.click()
.waitForElementByCss('.js_profile-link', 4000)
.isDisplayed(function (err, displayed) {
// make our assertion, and don't forget to call 'next' to signal the end of the test
assert.equal(displayed, true);
next(err);
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment