Last active
December 31, 2015 04:09
-
-
Save beresmate/7932485 to your computer and use it in GitHub Desktop.
Runs a simple webdriver test via Mocha
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
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