test: add TIMEOUT env var
This commit is contained in:
parent
9ea791848f
commit
dbfc5fcffb
13
test/test.js
13
test/test.js
|
@ -33,6 +33,7 @@ describe('Application life cycle test', function () {
|
||||||
var app, reponame = 'testrepo';
|
var app, reponame = 'testrepo';
|
||||||
var username = process.env.USERNAME;
|
var username = process.env.USERNAME;
|
||||||
var password = process.env.PASSWORD;
|
var password = process.env.PASSWORD;
|
||||||
|
var TIMEOUT = process.env.TIMEOUT || 5000;
|
||||||
var email, token;
|
var email, token;
|
||||||
|
|
||||||
before(function (done) {
|
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('user_name')).sendKeys(username);
|
||||||
browser.findElement(by.id('password')).sendKeys(password);
|
browser.findElement(by.id('password')).sendKeys(password);
|
||||||
browser.findElement(by.tagName('form')).submit();
|
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) {
|
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('title')).sendKeys('testkey');
|
||||||
browser.findElement(by.id('content')).sendKeys(publicKey);
|
browser.findElement(by.id('content')).sendKeys(publicKey);
|
||||||
browser.findElement(by.xpath('//button[contains(text(), "Add Key")]')).click();
|
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) {
|
it('can create repo', function (done) {
|
||||||
browser.get('https://' + app.fqdn);
|
browser.get('https://' + app.fqdn);
|
||||||
browser.findElement(by.linkText('New Repository')).click();
|
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('repo_name')).sendKeys(reponame);
|
||||||
browser.findElement(by.id('auto-init')).click();
|
browser.findElement(by.id('auto-init')).click();
|
||||||
browser.findElement(by.xpath('//button[contains(text(), "Create Repository")]')).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 browser.getCurrentUrl().then(function (url) {
|
||||||
return url === 'https://' + app.fqdn + '/' + username + '/' + reponame;
|
return url === 'https://' + app.fqdn + '/' + username + '/' + reponame;
|
||||||
});
|
});
|
||||||
}, 4000).then(function () { done(); });
|
}, TIMEOUT).then(function () { done(); });
|
||||||
});
|
});
|
||||||
|
|
||||||
it('displays correct clone url', 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('user_name')).sendKeys(username);
|
||||||
browser.findElement(by.id('password')).sendKeys(password);
|
browser.findElement(by.id('password')).sendKeys(password);
|
||||||
browser.findElement(by.tagName('form')).submit();
|
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) {
|
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('user_name')).sendKeys(email);
|
||||||
browser.findElement(by.id('password')).sendKeys(password);
|
browser.findElement(by.id('password')).sendKeys(password);
|
||||||
browser.findElement(by.tagName('form')).submit();
|
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' });
|
execSync('cloudron uninstall --app ' + app.id, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue