Skip to content

Instantly share code, notes, and snippets.

@fritz-gerneth
Created March 18, 2013 09:24
Show Gist options
  • Save fritz-gerneth/5185923 to your computer and use it in GitHub Desktop.
Save fritz-gerneth/5185923 to your computer and use it in GitHub Desktop.
describe('Account page', function () {
"use strict";
var driver,
createDriver = require('../lib/client').driver;
beforeEach(function (done) {
driver = createDriver();
driver.goToPage('index')
.then(function () {done(); });
});
it('Can\'t access when not logged in', function (done) {
driver.goToPage('account');
driver.getCurrentUrl().then(function (realURL) {
realURL.should.equal(driver.getUrlOfPage('login'));
}).then(done);
});
it('Can be viewed when logged in', function (done) {
driver.loginWithPassword('[email protected]', 'test12');
driver.goToPage('account');
driver.getCurrentUrl().then(function (realURL) {
realURL.should.equal(driver.getUrlOfPage('account'));
}).then(done);
});
it('By default shows profile section', function (done) {
driver.loginWithPassword('[email protected]', 'test12');
driver.goToPage('account');
driver.findElement({id: 'account-title'})
.getText()
.then(function (pageText) {
pageText.should.equal('Profile');
})
.then(done);
});
afterEach(function (done) {
driver.close();
driver.quit().then(done);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment