backdraft
Version:
API starter kit for rapid response development. Based on Express.
200 lines (160 loc) • 5.22 kB
JavaScript
exports.run = function pagePublicIndex(tester) {
var defaultTestState = 'FAIL';
var client = new tester.webdriver.Builder()
.withCapabilities({'browserName': 'phantomjs'}).build();
suite('Without Accounts', function () {
this.timeout(0);
before(function (done) {
this.timeout(0);
done();
//client.get(tester.config.uri).then(done());
});
test('should be able to access public information.', function (done) {
client.get(tester.config.uri)
.then(function () {
return client.getTitle();
})
.then(function (title) {
title.should.equal('Startup Web App (Backdraft)');
})
.then(function () {
done();
});
});
test('should request username and password when attempting to access private information.',
function (done) {
client.get(tester.config.uri);
client.findElement(tester.webdriver.By.tagName('html')).getInnerHtml('')
.then(function (result) {
client.manage().timeouts().implicitlyWait(5000);
console.log('---' + result);
});
client.findElement(tester.webdriver.By.xpath('//h1[normalize-space()=\'Log In\']')).then(function () {
client.getText()
.then(function (result) {
console.log(result);
result.should.equal('Log In');
})
.then(function () {
done();
});
}); // jshint ignore:line
});
/*
test('should check for existing username.', function (done) {
tester.expect(defaultTestState).to.equal('PASS');
done();
});
test('should make sure a password is entered.', function (done) {
tester.expect(defaultTestState).to.equal('PASS');
done();
});
test('should require a name to be entered.', function (done) {
tester.expect(defaultTestState).to.equal('PASS');
done();
});
test('should provide a notification when account is added.', function (done) {
tester.expect(defaultTestState).to.equal('PASS');
done();
});
test('should send a notification of account creation.', function (done) {
tester.expect(defaultTestState).to.equal('PASS');
done();
});
test('should request additional details when they have not been completed.',
function (done) {
tester.expect(defaultTestState).to.equal('PASS');
done();
});
after(function (done) {
done();
});
});
suite('Existing Accounts', function () {
before(function (done) {
done();
});
test('should be able to access public information.', function (done) {
tester.expect(defaultTestState).to.equal('PASS');
done();
});
test('should request username and password when attempting to access private information.',
function (done) {
tester.expect(defaultTestState).to.equal('PASS');
done();
});
test('should request username, if password is entered.', function (done) {
tester.expect(defaultTestState).to.equal('PASS');
done();
});
test('should request password, if username is entered.', function (done) {
tester.expect(defaultTestState).to.equal('PASS');
done();
});
test('should report incorrect username and password combination, for a bad combination.',
function (done) {
tester.expect(defaultTestState).to.equal('PASS');
done();
});
test('should show success when the combination matches.', function (done) {
tester.expect(defaultTestState).to.equal('PASS');
done();
});
test('should able to access private information while logged in.', function (done) {
tester.expect(defaultTestState).to.equal('PASS');
done();
});
test('should be able to access public information while logged in.', function (done) {
tester.expect(defaultTestState).to.equal('PASS');
done();
});
test('should show success on log out.', function (done) {
tester.expect(defaultTestState).to.equal('PASS');
done();
});
test('should not be able to access private information.', function (done) {
tester.expect(defaultTestState).to.equal('PASS');
done();
});
test('should be able to access public information.', function (done) {
tester.expect(defaultTestState).to.equal('PASS');
done();
});
after(function (done) {
done();
});
});
suite('Accounts With Problems', function () {
before(function (done) {
done();
});
test('should be able to reset your password.', function (done) {
tester.expect(defaultTestState).to.equal('PASS');
done();
});
test('get a notification for reset.', function (done) {
tester.expect(defaultTestState).to.equal('PASS');
done();
});
test('should be able to supply the reset token to update a password.', function (done) {
tester.expect(defaultTestState).to.equal('PASS');
done();
});
test('should enter matching passwords.', function (done) {
tester.expect(defaultTestState).to.equal('PASS');
done();
});
test('get a notification of success.', function (done) {
tester.expect(defaultTestState).to.equal('PASS');
done();
});
test('password should be updated for the user.', function (done) {
tester.expect(defaultTestState).to.equal('PASS');
done();
});
after(function (done) {
done();
});
*/
});
};