From dbfc5fcffb7e2f7d00e516aa0bf18dbfe852422f Mon Sep 17 00:00:00 2001 From: Girish Ramakrishnan Date: Thu, 18 Aug 2016 10:14:13 -0700 Subject: [PATCH] test: add TIMEOUT env var --- test/test.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/test/test.js b/test/test.js index b2fed04..7246e98 100755 --- a/test/test.js +++ b/test/test.js @@ -33,6 +33,7 @@ describe('Application life cycle test', function () { var app, reponame = 'testrepo'; var username = process.env.USERNAME; var password = process.env.PASSWORD; + var TIMEOUT = process.env.TIMEOUT || 5000; var email, token; before(function (done) { @@ -108,7 +109,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).then(function () { done(); }); + browser.wait(until.elementLocated(by.linkText('Dashboard')), TIMEOUT).then(function () { done(); }); }); it('can add public key', function (done) { @@ -119,13 +120,13 @@ 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).then(function () { done(); }); + browser.wait(until.elementLocated(by.xpath('//p[contains(text(), "added successfully!")]')), TIMEOUT).then(function () { done(); }); }); it('can create repo', function (done) { browser.get('https://' + app.fqdn); browser.findElement(by.linkText('New Repository')).click(); - browser.wait(until.elementLocated(by.xpath('//*[contains(text(), "New Repository")]')), 4000); + browser.wait(until.elementLocated(by.xpath('//*[contains(text(), "New Repository")]')), TIMEOUT); browser.findElement(by.id('repo_name')).sendKeys(reponame); browser.findElement(by.id('auto-init')).click(); browser.findElement(by.xpath('//button[contains(text(), "Create Repository")]')).click(); @@ -133,7 +134,7 @@ describe('Application life cycle test', function () { return browser.getCurrentUrl().then(function (url) { return url === 'https://' + app.fqdn + '/' + username + '/' + reponame; }); - }, 4000).then(function () { done(); }); + }, TIMEOUT).then(function () { done(); }); }); it('displays correct clone url', function (done) { @@ -205,7 +206,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).then(function () { done(); }); + browser.wait(until.elementLocated(by.linkText('Dashboard')), TIMEOUT).then(function () { done(); }); }); it('displays correct clone url', function (done) { @@ -242,7 +243,7 @@ describe('Application life cycle test', function () { browser.findElement(by.id('user_name')).sendKeys(email); browser.findElement(by.id('password')).sendKeys(password); browser.findElement(by.tagName('form')).submit(); - browser.wait(until.elementLocated(by.linkText('Dashboard')), 4000).then(function () { + browser.wait(until.elementLocated(by.linkText('Dashboard')), TIMEOUT).then(function () { execSync('cloudron uninstall --app ' + app.id, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' }); done(); });