fix promise usage

This commit is contained in:
Girish Ramakrishnan 2017-07-20 10:11:35 -07:00
parent b413b5d43a
commit 06a75583e8
1 changed files with 37 additions and 29 deletions

View File

@ -62,17 +62,21 @@ describe('Application life cycle test', function () {
} }
function loadPage(callback) { function loadPage(callback) {
browser.manage().deleteAllCookies(); browser.manage().deleteAllCookies().then(function () {
browser.get('https://' + username + ':' + password + '@' + app.fqdn); return browser.get('https://' + username + ':' + password + '@' + app.fqdn);
pageLoaded().then(function() { }).then(function () {
return pageLoaded();
}).then(function () {
callback(); callback();
}); });
} }
function addFolder(callback) { function addFolder(callback) {
pageLoaded().then(function() { pageLoaded().then(function() {
browser.findElement(by.css('[ng-click*=addFolder]')).click(); return browser.findElement(by.css('[ng-click*=addFolder]')).click();
return visible(by.id('folderPath')).then(function() { }).then(function () {
return visible(by.id('folderPath'));
}).then(function() {
return browser.findElement(by.id('folderLabel')).sendKeys('test'); return browser.findElement(by.id('folderLabel')).sendKeys('test');
}).then(function () { }).then(function () {
return browser.findElement(by.id('folderPath')).sendKeys('/app/data/test'); return browser.findElement(by.id('folderPath')).sendKeys('/app/data/test');
@ -88,21 +92,25 @@ describe('Application life cycle test', function () {
}).then(function() { }).then(function() {
callback(); callback();
}); });
});
} }
function removeFolder(callback) { function removeFolder(callback) {
browser.get('https://' + username + ':' + password + '@' + app.fqdn); browser.get('https://' + username + ':' + password + '@' + app.fqdn).then(function () {
pageLoaded().then(function() { return pageLoaded();
browser.findElement(by.css('#folders button')).click(); }).then(function() {
setTimeout(function() { return browser.findElement(by.css('#folders button')).click();
browser.findElement(by.css('#folder-0 button[ng-click*=editFolder]')).click(); }).then(function () {
setTimeout(function() { return browser.sleep(1000); //No way to check for visibility of angular-js components
browser.findElement(by.css('[ng-click*=deleteFolder]')).click().then(function() { }).then(function () {
setTimeout(callback, 1000); //This needs to run for some time return browser.findElement(by.css('#folder-0 button[ng-click*=editFolder]')).click();
}); }).then(function () {
}, 1000); //No way to check for visibility of angular-js components return browser.sleep(1000); //No way to check for visibility of angular-js components
}, 1000); //No way to check for visibility of angular-js components }).then(function () {
return browser.findElement(by.css('[ng-click*=deleteFolder]')).click();
}).then(function () {
return browser.sleep(1000); //This needs to run for some time
}).then(function () {
callback();
}); });
} }