fix promise usage
This commit is contained in:
parent
b413b5d43a
commit
06a75583e8
66
test/test.js
66
test/test.js
|
@ -62,47 +62,55 @@ describe('Application life cycle test', function () {
|
|||
}
|
||||
|
||||
function loadPage(callback) {
|
||||
browser.manage().deleteAllCookies();
|
||||
browser.get('https://' + username + ':' + password + '@' + app.fqdn);
|
||||
pageLoaded().then(function() {
|
||||
browser.manage().deleteAllCookies().then(function () {
|
||||
return browser.get('https://' + username + ':' + password + '@' + app.fqdn);
|
||||
}).then(function () {
|
||||
return pageLoaded();
|
||||
}).then(function () {
|
||||
callback();
|
||||
});
|
||||
}
|
||||
|
||||
function addFolder(callback) {
|
||||
pageLoaded().then(function() {
|
||||
browser.findElement(by.css('[ng-click*=addFolder]')).click();
|
||||
return visible(by.id('folderPath')).then(function() {
|
||||
return browser.findElement(by.id('folderLabel')).sendKeys('test');
|
||||
}).then(function() {
|
||||
return browser.findElement(by.css('[ng-click*=addFolder]')).click();
|
||||
}).then(function () {
|
||||
return visible(by.id('folderPath'));
|
||||
}).then(function() {
|
||||
return browser.findElement(by.id('folderLabel')).sendKeys('test');
|
||||
}).then(function () {
|
||||
return browser.findElement(by.id('folderPath')).sendKeys('/app/data/test');
|
||||
}).then(function() {
|
||||
//Clear and re-enter the folder to avoid race with auto-completion
|
||||
return browser.findElement(by.id('folderPath')).clear();
|
||||
}).then(function() {
|
||||
}).then(function() {
|
||||
//Clear and re-enter the folder to avoid race with auto-completion
|
||||
return browser.findElement(by.id('folderPath')).clear();
|
||||
}).then(function() {
|
||||
return browser.findElement(by.id('folderPath')).sendKeys('/app/data/test');
|
||||
}).then(function() {
|
||||
return browser.findElement(by.css('[ng-click*=saveFolder]')).click();
|
||||
}).then(function() {
|
||||
return browser.wait(until.elementLocated(by.css('#folders .panel-status span[ng-switch-when=unshared]')), TEST_TIMEOUT);
|
||||
}).then(function() {
|
||||
callback();
|
||||
});
|
||||
}).then(function() {
|
||||
return browser.findElement(by.css('[ng-click*=saveFolder]')).click();
|
||||
}).then(function() {
|
||||
return browser.wait(until.elementLocated(by.css('#folders .panel-status span[ng-switch-when=unshared]')), TEST_TIMEOUT);
|
||||
}).then(function() {
|
||||
callback();
|
||||
});
|
||||
}
|
||||
|
||||
function removeFolder(callback) {
|
||||
browser.get('https://' + username + ':' + password + '@' + app.fqdn);
|
||||
pageLoaded().then(function() {
|
||||
browser.findElement(by.css('#folders button')).click();
|
||||
setTimeout(function() {
|
||||
browser.findElement(by.css('#folder-0 button[ng-click*=editFolder]')).click();
|
||||
setTimeout(function() {
|
||||
browser.findElement(by.css('[ng-click*=deleteFolder]')).click().then(function() {
|
||||
setTimeout(callback, 1000); //This needs to run for some time
|
||||
});
|
||||
}, 1000); //No way to check for visibility of angular-js components
|
||||
}, 1000); //No way to check for visibility of angular-js components
|
||||
browser.get('https://' + username + ':' + password + '@' + app.fqdn).then(function () {
|
||||
return pageLoaded();
|
||||
}).then(function() {
|
||||
return browser.findElement(by.css('#folders button')).click();
|
||||
}).then(function () {
|
||||
return browser.sleep(1000); //No way to check for visibility of angular-js components
|
||||
}).then(function () {
|
||||
return browser.findElement(by.css('#folder-0 button[ng-click*=editFolder]')).click();
|
||||
}).then(function () {
|
||||
return browser.sleep(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