|
@@ -55,12 +55,20 @@ describe('Application life cycle test', function () {
|
|
|
});
|
|
|
|
|
|
function login(username, password, done) {
|
|
|
- browser.get('https://' + app.fqdn + '/wp-login.php').then(function () {
|
|
|
- browser.sleep(2000); // there seems to be some javascript that gives auto-focus to username
|
|
|
- browser.findElement(by.id('user_login')).sendKeys(username);
|
|
|
- browser.findElement(by.id('user_pass')).sendKeys(password);
|
|
|
- browser.findElement(by.tagName('form')).submit();
|
|
|
- browser.wait(until.elementLocated(by.xpath('//h1[text()="Dashboard"]')), TIMEOUT).then(function () { done(); });
|
|
|
+ browser.manage().deleteAllCookies().then(function () {
|
|
|
+ return browser.get('https://' + app.fqdn + '/wp-login.php');
|
|
|
+ }).then(function () {
|
|
|
+ return browser.sleep(2000); // there seems to be some javascript that gives auto-focus to username
|
|
|
+ }).then(function () {
|
|
|
+ return browser.findElement(by.id('user_login')).sendKeys(username);
|
|
|
+ }).then(function () {
|
|
|
+ return browser.findElement(by.id('user_pass')).sendKeys(password);
|
|
|
+ }).then(function () {
|
|
|
+ return browser.findElement(by.tagName('form')).submit();
|
|
|
+ }).then(function () {
|
|
|
+ return browser.wait(until.elementLocated(by.xpath('//h1[text()="Dashboard"]')), TIMEOUT);
|
|
|
+ }).then(function () {
|
|
|
+ done();
|
|
|
});
|
|
|
}
|
|
|
|
|
@@ -71,8 +79,11 @@ describe('Application life cycle test', function () {
|
|
|
}
|
|
|
|
|
|
function checkPermalink(done) {
|
|
|
- browser.get('https://' + app.fqdn + '/hello-world');
|
|
|
- browser.findElement(by.xpath('//h1[text()="Hello Cloudron!"]')).then(function () { done(); });
|
|
|
+ browser.get('https://' + app.fqdn + '/hello-world').then(function () {
|
|
|
+ return browser.findElement(by.xpath('//h1[text()="Hello Cloudron!"]'));
|
|
|
+ }).then(function () {
|
|
|
+ done();
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
function checkMedia(done) {
|
|
@@ -84,8 +95,11 @@ describe('Application life cycle test', function () {
|
|
|
}
|
|
|
|
|
|
function checkPost(done) {
|
|
|
- browser.get('https://' + app.fqdn);
|
|
|
- browser.wait(until.elementLocated(by.xpath('//h3/a[text()="Hello Cloudron!"]')), TIMEOUT).then(function () { done(); });
|
|
|
+ browser.get('https://' + app.fqdn).then(function () {
|
|
|
+ return browser.wait(until.elementLocated(by.xpath('//h3/a[text()="Hello Cloudron!"]')), TIMEOUT);
|
|
|
+ }).then(function () {
|
|
|
+ done();
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
xit('build app', function () {
|
|
@@ -143,34 +157,47 @@ describe('Application life cycle test', function () {
|
|
|
});
|
|
|
|
|
|
it('can edit', function (done) {
|
|
|
- browser.get('https://' + app.fqdn + '/wp-admin/post.php?post=1&action=edit');
|
|
|
- browser.wait(until.elementLocated(by.xpath('//input[@id="title"]')), TIMEOUT);
|
|
|
- browser.findElement(by.xpath('//input[@id="title"]')).sendKeys(Key.chord(Key.CONTROL, 'a'));
|
|
|
- browser.findElement(by.xpath('//input[@id="title"]')).sendKeys('Hello Cloudron!');
|
|
|
- browser.findElement(by.xpath('//input[@id="publish"]')).click();
|
|
|
- browser.wait(until.elementLocated(by.xpath('//*[contains(text(), "Post updated.")]')), TIMEOUT).then(function () { done(); });
|
|
|
+ browser.get('https://' + app.fqdn + '/wp-admin/post.php?post=1&action=edit').then(function () {
|
|
|
+ return browser.wait(until.elementLocated(by.xpath('//input[@id="title"]')), TIMEOUT);
|
|
|
+ }).then(function () {
|
|
|
+ return browser.findElement(by.xpath('//input[@id="title"]')).sendKeys(Key.chord(Key.CONTROL, 'a'));
|
|
|
+ }).then(function () {
|
|
|
+ return browser.findElement(by.xpath('//input[@id="title"]')).sendKeys('Hello Cloudron!');
|
|
|
+ }).then(function () {
|
|
|
+ return browser.findElement(by.xpath('//input[@id="publish"]')).click();
|
|
|
+ }).then(function () {
|
|
|
+ return browser.wait(until.elementLocated(by.xpath('//*[contains(text(), "Post updated.")]')), TIMEOUT);
|
|
|
+ }).then(function () {
|
|
|
+ done();
|
|
|
+ });
|
|
|
});
|
|
|
|
|
|
it('can upload media', function (done) {
|
|
|
- browser.get('https://' + app.fqdn + '/wp-admin/media-new.php?browser-uploader');
|
|
|
- browser.wait(until.elementLocated(by.id('async-upload')), TIMEOUT).then(function () {
|
|
|
- browser.findElement(by.xpath('//input[@id="async-upload" and @type="file"]')).sendKeys(path.resolve(__dirname, '../logo.png'));
|
|
|
- browser.findElement(by.id('html-upload')).click();
|
|
|
-
|
|
|
- browser.wait(function () {
|
|
|
+ browser.get('https://' + app.fqdn + '/wp-admin/media-new.php?browser-uploader').then(function () {
|
|
|
+ return browser.wait(until.elementLocated(by.id('async-upload')), TIMEOUT);
|
|
|
+ }).then(function () {
|
|
|
+ return browser.findElement(by.xpath('//input[@id="async-upload" and @type="file"]')).sendKeys(path.resolve(__dirname, '../logo.png'));
|
|
|
+ }).then(function () {
|
|
|
+ return browser.findElement(by.id('html-upload')).click();
|
|
|
+ }).then(function () {
|
|
|
+ return browser.wait(function () {
|
|
|
return browser.getCurrentUrl().then(function (url) {
|
|
|
return url === 'https://' + app.fqdn + '/wp-admin/upload.php';
|
|
|
});
|
|
|
- }, TIMEOUT).then(function () { done(); });
|
|
|
+ }, TIMEOUT);
|
|
|
+ }).then(function () {
|
|
|
+ done();
|
|
|
});
|
|
|
});
|
|
|
|
|
|
var mediaLink;
|
|
|
|
|
|
it('can see media', function (done) {
|
|
|
- browser.get('https://' + app.fqdn + '/wp-admin/upload.php?item=5'); // there's got to be a better way..
|
|
|
- browser.wait(until.elementLocated(by.xpath('//*[text()="Attachment Details"]')), TIMEOUT);
|
|
|
- browser.findElement(by.xpath('//img[@class="details-image"]')).getAttribute('src').then(function (srcLink) {
|
|
|
+ browser.get('https://' + app.fqdn + '/wp-admin/upload.php?item=5').then(function () { // there's got to be a better way..
|
|
|
+ return browser.wait(until.elementLocated(by.xpath('//*[text()="Attachment Details"]')), TIMEOUT);
|
|
|
+ }).then(function () {
|
|
|
+ return browser.findElement(by.xpath('//img[@class="details-image"]')).getAttribute('src');
|
|
|
+ }).then(function (srcLink) {
|
|
|
console.log('media is located at ', srcLink);
|
|
|
mediaLink = srcLink;
|
|
|
done();
|
|
@@ -238,7 +265,7 @@ describe('Application life cycle test', function () {
|
|
|
});
|
|
|
|
|
|
// No SSO
|
|
|
- it('install app', function () {
|
|
|
+ it('install app (no sso)', function () {
|
|
|
execSync('cloudron install --new --wait --no-sso --location ' + LOCATION, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
|
|
|
});
|
|
|
|
|
@@ -250,13 +277,13 @@ describe('Application life cycle test', function () {
|
|
|
expect(app).to.be.an('object');
|
|
|
});
|
|
|
|
|
|
- it('can login', login.bind(null, 'admin', 'changeme'));
|
|
|
+ it('can login (no sso)', login.bind(null, 'admin', 'changeme'));
|
|
|
|
|
|
- it('is an admin dashboard', function (done) {
|
|
|
+ it('is an admin dashboard (no sso)', function (done) {
|
|
|
browser.wait(until.elementLocated(by.xpath('//div[@class="wp-menu-name" and contains(text(), "Plugins")]')), TIMEOUT).then(function () { done(); });
|
|
|
});
|
|
|
|
|
|
- it('uninstall app', function () {
|
|
|
+ it('uninstall app (no sso)', function () {
|
|
|
execSync('cloudron uninstall --app ' + app.id, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
|
|
|
});
|
|
|
});
|