|
@@ -20,7 +20,8 @@ var execSync = require('child_process').execSync,
|
|
|
webdriver = require('selenium-webdriver');
|
|
|
|
|
|
var by = require('selenium-webdriver').By,
|
|
|
- until = require('selenium-webdriver').until;
|
|
|
+ until = require('selenium-webdriver').until,
|
|
|
+ Key = require('selenium-webdriver').Key;
|
|
|
|
|
|
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
|
|
|
|
|
@@ -28,7 +29,7 @@ describe('Application life cycle test', function () {
|
|
|
this.timeout(0);
|
|
|
var firefox = require('selenium-webdriver/firefox');
|
|
|
var server, browser = new firefox.Driver();
|
|
|
- var LOCATION = 'wptest';
|
|
|
+ var LOCATION = 'wptest3';
|
|
|
var app;
|
|
|
var username = process.env.USERNAME;
|
|
|
var password = process.env.PASSWORD;
|
|
@@ -76,12 +77,25 @@ describe('Application life cycle test', function () {
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- xit('can login', function (done) {
|
|
|
- browser.get('https://' + app.fqdn + '/user/login');
|
|
|
- browser.findElement(by.id('user_name')).sendKeys(username);
|
|
|
- browser.findElement(by.id('password')).sendKeys(password);
|
|
|
+ it('can login', function (done) {
|
|
|
+ browser.get('https://' + app.fqdn + '/wp-login.php');
|
|
|
+ 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.linkText('Dashboard')), 4000).then(function () { done(); });
|
|
|
+ browser.wait(until.elementLocated(by.xpath('//h1[text()="Dashboard"]')), 4000).then(function () { done(); });
|
|
|
+ });
|
|
|
+
|
|
|
+ it('is an admin dashboard', function (done) {
|
|
|
+ browser.wait(until.elementLocated(by.xpath('//div[@class="wp-menu-name" and contains(text(), "Plugins")]')), 4000).then(function () { done(); });
|
|
|
+ });
|
|
|
+
|
|
|
+ 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"]')), 4000);
|
|
|
+ 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.")]')), 4000).then(function () { done(); });
|
|
|
});
|
|
|
|
|
|
it('can restart app', function (done) {
|
|
@@ -89,6 +103,11 @@ describe('Application life cycle test', function () {
|
|
|
done();
|
|
|
});
|
|
|
|
|
|
+ it('can see updated post', function (done) {
|
|
|
+ browser.get('https://' + app.fqdn);
|
|
|
+ browser.findElement(by.xpath('//*[text()="Hello Cloudron!"]')).then(function () { done(); });
|
|
|
+ });
|
|
|
+
|
|
|
it('backup app', function () {
|
|
|
execSync('cloudron backup --app ' + app.id, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
|
|
|
});
|
|
@@ -97,6 +116,19 @@ describe('Application life cycle test', function () {
|
|
|
execSync('cloudron restore --app ' + app.id, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
|
|
|
});
|
|
|
|
|
|
+ it('can see updated post', function (done) {
|
|
|
+ browser.get('https://' + app.fqdn);
|
|
|
+ browser.findElement(by.xpath('//*[text()="Hello Cloudron!"]')).then(function () { done(); });
|
|
|
+ });
|
|
|
+
|
|
|
+ it('can login', function (done) {
|
|
|
+ browser.get('https://' + app.fqdn + '/wp-login.php');
|
|
|
+ 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"]')), 4000).then(function () { done(); });
|
|
|
+ });
|
|
|
+
|
|
|
it('move to different location', function () {
|
|
|
browser.manage().deleteAllCookies();
|
|
|
execSync('cloudron install --location ' + LOCATION + '2', { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
|
|
@@ -105,12 +137,17 @@ describe('Application life cycle test', function () {
|
|
|
expect(app).to.be.an('object');
|
|
|
});
|
|
|
|
|
|
- xit('can login', function (done) {
|
|
|
- browser.get('https://' + app.fqdn + '/user/login');
|
|
|
- browser.findElement(by.id('user_name')).sendKeys(username);
|
|
|
- browser.findElement(by.id('password')).sendKeys(password);
|
|
|
+ it('can see updated post', function (done) {
|
|
|
+ browser.get('https://' + app.fqdn);
|
|
|
+ browser.findElement(by.xpath('//*[text()="Hello Cloudron!"]')).then(function () { done(); });
|
|
|
+ });
|
|
|
+
|
|
|
+ it('can login', function (done) {
|
|
|
+ browser.get('https://' + app.fqdn + '/wp-login.php');
|
|
|
+ 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.linkText('Dashboard')), 4000).then(function () { done(); });
|
|
|
+ browser.wait(until.elementLocated(by.xpath('//h1[text()="Dashboard"]')), 4000).then(function () { done(); });
|
|
|
});
|
|
|
|
|
|
it('uninstall app', function () {
|