|
@@ -46,35 +46,41 @@ describe('Application life cycle test SSO', function () {
|
|
var USER_STORY_SUBJECT = 'someteststory';
|
|
var USER_STORY_SUBJECT = 'someteststory';
|
|
var app;
|
|
var app;
|
|
|
|
|
|
- function waitForElement(elem, callback) {
|
|
|
|
- browser.wait(until.elementLocated(elem), TEST_TIMEOUT).then(function () {
|
|
|
|
- browser.wait(until.elementIsVisible(browser.findElement(elem)), TEST_TIMEOUT).then(function () {
|
|
|
|
- callback();
|
|
|
|
- });
|
|
|
|
|
|
+ function waitForElement(elem) {
|
|
|
|
+ return browser.wait(until.elementLocated(elem), TEST_TIMEOUT).then(function () {
|
|
|
|
+ return browser.wait(until.elementIsVisible(browser.findElement(elem)), TEST_TIMEOUT);
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
function login(callback) {
|
|
function login(callback) {
|
|
browser.manage().deleteAllCookies();
|
|
browser.manage().deleteAllCookies();
|
|
- browser.get('https://' + app.fqdn);
|
|
|
|
- browser.executeScript('localStorage.clear();');
|
|
|
|
- browser.executeScript('sessionStorage.clear();');
|
|
|
|
-
|
|
|
|
- browser.get('https://' + app.fqdn + '/login?next=%252Fprofile');
|
|
|
|
-
|
|
|
|
- waitForElement(by.name('username'), function () {
|
|
|
|
- browser.findElement(by.name('username')).sendKeys(process.env.USERNAME);
|
|
|
|
- browser.findElement(by.name('password')).sendKeys(process.env.PASSWORD);
|
|
|
|
- browser.findElement(by.className('login-form')).submit();
|
|
|
|
-
|
|
|
|
- waitForElement(by.xpath('//h4[text()="Your profile"]'), callback);
|
|
|
|
|
|
+ browser.get('https://' + app.fqdn).then(function () {
|
|
|
|
+ return browser.executeScript('localStorage.clear();');
|
|
|
|
+ }).then(function () {
|
|
|
|
+ browser.executeScript('sessionStorage.clear();');
|
|
|
|
+ }).then(function () {
|
|
|
|
+ browser.get('https://' + app.fqdn + '/login?next=%252Fprofile');
|
|
|
|
+ }).then(function () {
|
|
|
|
+ return waitForElement(by.name('username'));
|
|
|
|
+ }).then(function () {
|
|
|
|
+ return browser.findElement(by.name('username')).sendKeys(process.env.USERNAME);
|
|
|
|
+ }).then(function () {
|
|
|
|
+ return browser.findElement(by.name('password')).sendKeys(process.env.PASSWORD);
|
|
|
|
+ }).then(function () {
|
|
|
|
+ return browser.findElement(by.className('login-form')).submit();
|
|
|
|
+ }).then(function () {
|
|
|
|
+ return waitForElement(by.xpath('//h4[text()="Your profile"]'));
|
|
|
|
+ }).then(function () {
|
|
|
|
+ callback();
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
function userStoryExists(callback) {
|
|
function userStoryExists(callback) {
|
|
- browser.get('https://' + app.fqdn + '/project/' + process.env.USERNAME + '-' + PROJECT_NAME + '/us/1');
|
|
|
|
-
|
|
|
|
- waitForElement(by.xpath('//span[text()="' + USER_STORY_SUBJECT + '"]'), callback);
|
|
|
|
|
|
+ browser.get('https://' + app.fqdn + '/project/' + process.env.USERNAME + '-' + PROJECT_NAME + '/us/1').then(function () {
|
|
|
|
+ return waitForElement(by.xpath('//span[text()="' + USER_STORY_SUBJECT + '"]'));
|
|
|
|
+ }).then(function () {
|
|
|
|
+ callback();
|
|
|
|
+ });
|
|
}
|
|
}
|
|
|
|
|
|
function getAppInfo() {
|
|
function getAppInfo() {
|
|
@@ -86,43 +92,65 @@ describe('Application life cycle test SSO', function () {
|
|
function dismissTutorial(done) {
|
|
function dismissTutorial(done) {
|
|
browser.get('https://' + app.fqdn);
|
|
browser.get('https://' + app.fqdn);
|
|
|
|
|
|
- waitForElement(by.className('introjs-skipbutton'), function () {
|
|
|
|
- browser.findElement(by.className('introjs-skipbutton')).sendKeys(Keys.ENTER);
|
|
|
|
-
|
|
|
|
|
|
+ waitForElement(by.className('introjs-skipbutton')).then(function () {
|
|
|
|
+ return browser.findElement(by.className('introjs-skipbutton')).sendKeys(Keys.ENTER);
|
|
|
|
+ }).then(function () {
|
|
// give some time to ack
|
|
// give some time to ack
|
|
setTimeout(done, 5000);
|
|
setTimeout(done, 5000);
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
function createProject(done) {
|
|
function createProject(done) {
|
|
- browser.get('https://' + app.fqdn + '/project/new/scrum');
|
|
|
|
-
|
|
|
|
- waitForElement(by.name('project-name'), function () {
|
|
|
|
- browser.findElement(by.name('project-name')).sendKeys(PROJECT_NAME);
|
|
|
|
- browser.sleep(1000); // it needs some time to change focus!!
|
|
|
|
- browser.findElement(by.xpath('//textarea[@placeholder="Project Description"]')).sendKeys(PROJECT_DESCRIPTION);
|
|
|
|
- browser.sleep(1000);
|
|
|
|
-
|
|
|
|
- browser.findElement(by.xpath('//button[text()="Create Project"]')).click();
|
|
|
|
-
|
|
|
|
- browser.wait(until.elementLocated(by.xpath('//span[text()[contains(., "' + PROJECT_NAME + '")]]')), TEST_TIMEOUT).then(function () { done(); });
|
|
|
|
|
|
+ browser.get('https://' + app.fqdn + '/project/new/scrum').then(function () {
|
|
|
|
+ return waitForElement(by.name('project-name'));
|
|
|
|
+ }).then(function () {
|
|
|
|
+ return browser.findElement(by.name('project-name')).sendKeys(PROJECT_NAME);
|
|
|
|
+ }).then(function () {
|
|
|
|
+ return browser.sleep(1000); // it needs some time to change focus!!
|
|
|
|
+ }).then(function () {
|
|
|
|
+ return browser.findElement(by.xpath('//textarea[@placeholder="Project Description"]')).sendKeys(PROJECT_DESCRIPTION);
|
|
|
|
+ }).then(function () {
|
|
|
|
+ return browser.sleep(1000);
|
|
|
|
+ }).then(function () {
|
|
|
|
+ return browser.findElement(by.xpath('//button[text()="Create Project"]')).click();
|
|
|
|
+ }).then(function () {
|
|
|
|
+ return browser.wait(until.elementLocated(by.xpath('//span[text()[contains(., "' + PROJECT_NAME + '")]]')), TEST_TIMEOUT);
|
|
|
|
+ }).then(function () {
|
|
|
|
+ done();
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
function createUserStory(done) {
|
|
function createUserStory(done) {
|
|
- browser.get('https://' + app.fqdn + '/project/' + process.env.USERNAME + '-' + PROJECT_NAME + '/backlog');
|
|
|
|
-
|
|
|
|
- waitForElement(by.xpath('//a[@tg-check-permission="add_us"]'), function () {
|
|
|
|
|
|
+ browser.get('https://' + app.fqdn + '/project/' + process.env.USERNAME + '-' + PROJECT_NAME + '/backlog').then(function () {
|
|
|
|
+ return waitForElement(by.xpath('//a[@tg-check-permission="add_us"]'));
|
|
|
|
+ }).then(function () {
|
|
// clicks don't work with taiga
|
|
// clicks don't work with taiga
|
|
- browser.findElement(by.xpath('//a[@tg-check-permission="add_us"]')).sendKeys(Keys.ENTER);
|
|
|
|
-
|
|
|
|
- waitForElement(by.name('subject'), function () {
|
|
|
|
- browser.findElement(by.name('subject')).sendKeys(USER_STORY_SUBJECT);
|
|
|
|
-
|
|
|
|
- browser.findElement(by.xpath('//button[@title="Create"]')).sendKeys(Keys.ENTER);
|
|
|
|
|
|
+ return browser.findElement(by.xpath('//a[@tg-check-permission="add_us"]')).sendKeys(Keys.ENTER);
|
|
|
|
+ }).then(function () {
|
|
|
|
+ return waitForElement(by.name('subject'));
|
|
|
|
+ }).then(function () {
|
|
|
|
+ return browser.findElement(by.name('subject')).sendKeys(USER_STORY_SUBJECT);
|
|
|
|
+ }).then(function () {
|
|
|
|
+ return browser.findElement(by.xpath('//button[@title="Create"]')).sendKeys(Keys.ENTER);
|
|
|
|
+ }).then(function () {
|
|
|
|
+ return waitForElement(by.xpath('//span[text()[contains(., "' + USER_STORY_SUBJECT + '")]]'));
|
|
|
|
+ }).then(function () {
|
|
|
|
+ done();
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
|
|
- waitForElement(by.xpath('//span[text()[contains(., "' + USER_STORY_SUBJECT + '")]]'), done);
|
|
|
|
- });
|
|
|
|
|
|
+ function deleteProject(done) {
|
|
|
|
+ browser.get('https://' + app.fqdn + '/project/' + process.env.USERNAME + '-' + PROJECT_NAME + '/admin/project-profile/details').then(function () {
|
|
|
|
+ return waitForElement(by.className('delete-project'));
|
|
|
|
+ }).then(function () {
|
|
|
|
+ return browser.findElement(by.className('delete-project')).click();
|
|
|
|
+ }).then(function () {
|
|
|
|
+ return waitForElement(by.xpath('//a[@title="Yes, I\'m really sure"]'));
|
|
|
|
+ }).then(function () {
|
|
|
|
+ return browser.findElement(by.xpath('//a[@title="Yes, I\'m really sure"]')).click();
|
|
|
|
+ }).then(function () {
|
|
|
|
+ // give some time to redirect
|
|
|
|
+ setTimeout(done, 5000);
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
@@ -161,20 +189,7 @@ describe('Application life cycle test SSO', function () {
|
|
it('can login', login);
|
|
it('can login', login);
|
|
it('user story is still present', userStoryExists);
|
|
it('user story is still present', userStoryExists);
|
|
|
|
|
|
- it('can delete project', function (done) {
|
|
|
|
- browser.get('https://' + app.fqdn + '/project/' + process.env.USERNAME + '-' + PROJECT_NAME + '/admin/project-profile/details');
|
|
|
|
-
|
|
|
|
- waitForElement(by.className('delete-project'), function () {
|
|
|
|
- browser.findElement(by.className('delete-project')).click();
|
|
|
|
-
|
|
|
|
- waitForElement(by.xpath('//a[@title="Yes, I\'m really sure"]'), function () {
|
|
|
|
- browser.findElement(by.xpath('//a[@title="Yes, I\'m really sure"]')).click();
|
|
|
|
-
|
|
|
|
- // give some time to redirect
|
|
|
|
- setTimeout(done, 5000);
|
|
|
|
- });
|
|
|
|
- });
|
|
|
|
- });
|
|
|
|
|
|
+ it('can delete project', deleteProject);
|
|
|
|
|
|
it('uninstall app', function () {
|
|
it('uninstall app', 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' });
|