|
@@ -5,6 +5,7 @@
|
|
|
var execSync = require('child_process').execSync,
|
|
|
expect = require('expect.js'),
|
|
|
path = require('path'),
|
|
|
+ superagent = require('superagent'),
|
|
|
util = require('util'),
|
|
|
webdriver = require('selenium-webdriver');
|
|
|
|
|
@@ -68,15 +69,23 @@ describe('Application life cycle test', function () {
|
|
|
}
|
|
|
|
|
|
function checkPhpMyAdmin(callback) {
|
|
|
- browser.get('https://' + app.fqdn + '/phpmyadmin');
|
|
|
+ superagent.get('https://' + app.fqdn + '/phpmyadmin').end(function (error, result) {
|
|
|
+ if (error && !error.response) return callback(error); // network error
|
|
|
|
|
|
- browser.wait(by.xpath('//h2[text()="General settings"]'), TEST_TIMEOUT)
|
|
|
- .catch(function () {
|
|
|
- // let's assume we could not login
|
|
|
+ if (result.statusCode !== 401) return callback('Expecting 401 error');
|
|
|
|
|
|
- browser.get('https://' + process.env.USERNAME + ':' + process.env.PASSWORD + '@' + app.fqdn + '/phpmyadmin');
|
|
|
+ superagent.get('https://' + app.fqdn + '/phpmyadmin')
|
|
|
+ .auth(process.env.USERNAME, process.env.PASSWORD)
|
|
|
+ .end(function (error, result) {
|
|
|
+ if (error) return callback(error);
|
|
|
|
|
|
- waitForElement(by.xpath('//h2[text()="General settings"]'), callback);
|
|
|
+ if (result.text.indexOf('.cloudron.info / mysql | phpMyAdmin') === -1) { // in the title
|
|
|
+ console.log(result.text);
|
|
|
+ return callback(new Error('could not detect phpmyadmin'));
|
|
|
+ }
|
|
|
+
|
|
|
+ callback();
|
|
|
+ });
|
|
|
});
|
|
|
}
|
|
|
|
|
@@ -103,7 +112,6 @@ describe('Application life cycle test', function () {
|
|
|
execSync(util.format('lftp sftp://%s:%s@%s:%s -e "set sftp:auto-confirm yes; cd public/; put test.php; bye"', process.env.USERNAME, process.env.PASSWORD, app.fqdn, app.portBindings.SFTP_PORT));
|
|
|
});
|
|
|
it('can get uploaded file', uploadedFileExists);
|
|
|
-
|
|
|
it('can access phpmyadmin', checkPhpMyAdmin);
|
|
|
|
|
|
it('backup app', function () {
|
|
@@ -125,6 +133,7 @@ describe('Application life cycle test', function () {
|
|
|
});
|
|
|
|
|
|
it('can get uploaded file', uploadedFileExists);
|
|
|
+ it('can access phpmyadmin', checkPhpMyAdmin);
|
|
|
|
|
|
it('uninstall app', function () {
|
|
|
execSync('cloudron uninstall --app ' + app.id, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
|