diff --git a/test/test.js b/test/test.js index 10d6d56..f000b6a 100755 --- a/test/test.js +++ b/test/test.js @@ -31,11 +31,14 @@ describe('Application life cycle test', function () { var SeleniumServer = require('selenium-webdriver/remote').SeleniumServer; server = new SeleniumServer(seleniumJar.path, { port: 4444 }); server.start(); + + done(); }); - after(function () { + after(function (done) { browser.quit(); server.stop(); + done(); }); var LOCATION = 'test' + Date.now(); @@ -73,8 +76,7 @@ describe('Application life cycle test', function () { browser.findElement(by.id('user_name')).sendKeys(username); browser.findElement(by.id('password')).sendKeys(password); browser.findElement(by.tagName('form')).submit(); - browser.wait(until.elementLocated(by.linkText('Dashboard')), 4000); - done(); + browser.wait(until.elementLocated(by.linkText('Dashboard')), 4000).then(done); }); it('can add public key', function (done) { @@ -85,8 +87,7 @@ describe('Application life cycle test', function () { browser.findElement(by.id('title')).sendKeys('testkey'); browser.findElement(by.id('content')).sendKeys(publicKey); browser.findElement(by.xpath('//button[contains(text(), "Add Key")]')).click(); - browser.wait(until.elementLocated(by.xpath('p[contains(text(), "added successfully!")]')), 4000); - done(); + browser.wait(until.elementLocated(by.xpath('p[contains(text(), "added successfully!")]')), 4000).then(done); }); it('can create repo', function (done) { @@ -100,8 +101,7 @@ describe('Application life cycle test', function () { return browser.getCurrentUrl().then(function (url) { return url === 'https://' + app.fqdn + '/' + username + '/' + reponame; }); - }, 4000); - done(); + }, 4000).then(done); }); it('displays correct clone url', function (done) {