add bad login test

This commit is contained in:
Girish Ramakrishnan 2018-02-26 18:07:00 -08:00
parent 5ca914f8d3
commit 72d3757c51
3 changed files with 13 additions and 3 deletions

View File

@ -5,7 +5,7 @@
"description": "file://DESCRIPTION.md", "description": "file://DESCRIPTION.md",
"changelog": "file://CHANGELOG", "changelog": "file://CHANGELOG",
"tagline": "Decentralized file synchronization", "tagline": "Decentralized file synchronization",
"version": "1.0.0", "version": "1.0.0-1",
"healthCheckPath": "/healthcheck", "healthCheckPath": "/healthcheck",
"httpPort": 8000, "httpPort": 8000,
"addons": { "addons": {

View File

@ -9,6 +9,7 @@
"author": "", "author": "",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"chromedriver": "^2.31.0",
"ejs": "^2.4.2", "ejs": "^2.4.2",
"expect.js": "^0.3.1", "expect.js": "^0.3.1",
"mkdirp": "^0.5.1", "mkdirp": "^0.5.1",
@ -16,7 +17,6 @@
"rimraf": "^2.5.3", "rimraf": "^2.5.3",
"selenium-server-standalone-jar": "^2.53.1", "selenium-server-standalone-jar": "^2.53.1",
"selenium-webdriver": "^2.53.1", "selenium-webdriver": "^2.53.1",
"superagent": "^1.4.0", "superagent": "^1.8.5"
"chromedriver": "^2.31.0"
} }
} }

View File

@ -4,6 +4,7 @@
var execSync = require('child_process').execSync, var execSync = require('child_process').execSync,
expect = require('expect.js'), expect = require('expect.js'),
superagent = require('superagent'),
path = require('path'), path = require('path'),
webdriver = require('selenium-webdriver'); webdriver = require('selenium-webdriver');
@ -61,6 +62,14 @@ describe('Application life cycle test', function () {
}); });
} }
function invalidPassword(callback) {
superagent.get('https://' + app.fqdn).auth(username, password + 'x').end(function (error, result) {
expect(result.status).to.eql(401);
callback();
});
}
function loadPage(callback) { function loadPage(callback) {
browser.manage().deleteAllCookies().then(function () { browser.manage().deleteAllCookies().then(function () {
return browser.get('https://' + username + ':' + encodeURIComponent(password) + '@' + app.fqdn).then(function () { return browser.get('https://' + username + ':' + encodeURIComponent(password) + '@' + app.fqdn).then(function () {
@ -135,6 +144,7 @@ describe('Application life cycle test', function () {
expect(app).to.be.an('object'); expect(app).to.be.an('object');
}); });
it('fails with invalid password', invalidPassword);
it('can load page', loadPage); it('can load page', loadPage);
it('can add folder', addFolder); it('can add folder', addFolder);