|
@@ -102,6 +102,52 @@ describe('Application life cycle test', function () {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+ function editPost(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();
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ function uploadMedia(done) {
|
|
|
+ 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();
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ function checkMedia(done) {
|
|
|
+ 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();
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
xit('build app', function () {
|
|
|
execSync('cloudron build', { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
|
|
|
});
|
|
@@ -156,54 +202,11 @@ describe('Application life cycle test', function () {
|
|
|
browser.wait(until.elementLocated(by.xpath('//div[@class="wp-menu-name" and contains(text(), "Plugins")]')), TIMEOUT).then(function () { done(); });
|
|
|
});
|
|
|
|
|
|
- it('can edit', 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').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();
|
|
|
- });
|
|
|
- });
|
|
|
-
|
|
|
+ it('can edit', editPost);
|
|
|
+ it('can upload media', uploadMedia);
|
|
|
var mediaLink;
|
|
|
|
|
|
- it('can see media', function (done) {
|
|
|
- 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();
|
|
|
- });
|
|
|
- });
|
|
|
-
|
|
|
+ it('can see media', checkMedia);
|
|
|
it('has correct htaccess', checkHtaccess);
|
|
|
it('can access permalink', checkPermalink);
|
|
|
|
|
@@ -286,5 +289,27 @@ describe('Application life cycle test', function () {
|
|
|
it('uninstall app (no sso)', function () {
|
|
|
execSync('cloudron uninstall --app ' + app.id, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
|
|
|
});
|
|
|
+
|
|
|
+ // test update
|
|
|
+ it('can install app', function () {
|
|
|
+ execSync('cloudron install --new --wait --appstore-id org.wordpress.cloudronapp --location ' + LOCATION, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
|
|
|
+ var inspect = JSON.parse(execSync('cloudron inspect'));
|
|
|
+ app = inspect.apps.filter(function (a) { return a.location === LOCATION; })[0];
|
|
|
+ expect(app).to.be.an('object');
|
|
|
+ });
|
|
|
+ it('can login', login.bind(null, username, password));
|
|
|
+ it('can edit', editPost);
|
|
|
+ it('can upload media', uploadMedia);
|
|
|
+
|
|
|
+ it('can update', function () {
|
|
|
+ execSync('cloudron install --wait --app ' + LOCATION, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
|
|
|
+ });
|
|
|
+ it('can see updated post', checkPost);
|
|
|
+ it('can see media', checkMedia);
|
|
|
+ it('can access permalink', checkPermalink);
|
|
|
+
|
|
|
+ it('uninstall app', function () {
|
|
|
+ execSync('cloudron uninstall --app ' + app.id, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
|
|
|
+ });
|
|
|
});
|
|
|
|