fix promise usage
This commit is contained in:
parent
b413b5d43a
commit
06a75583e8
44
test/test.js
44
test/test.js
|
@ -62,19 +62,23 @@ 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 browser.findElement(by.id('folderLabel')).sendKeys('test');
|
return visible(by.id('folderPath'));
|
||||||
}).then(function() {
|
}).then(function() {
|
||||||
|
return browser.findElement(by.id('folderLabel')).sendKeys('test');
|
||||||
|
}).then(function () {
|
||||||
return browser.findElement(by.id('folderPath')).sendKeys('/app/data/test');
|
return browser.findElement(by.id('folderPath')).sendKeys('/app/data/test');
|
||||||
}).then(function() {
|
}).then(function() {
|
||||||
//Clear and re-enter the folder to avoid race with auto-completion
|
//Clear and re-enter the folder to avoid race with auto-completion
|
||||||
|
@ -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();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue