aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJohannes Zellner <johannes@cloudron.io>2017-02-10 10:30:20 +0100
committerJohannes Zellner <johannes@cloudron.io>2017-02-10 10:30:20 +0100
commit1c3b94a7b3bf08403450c59930c93491aa843a6d (patch)
tree0d19043ddb0682fd4e2bb9df02282945f9864cfe
parente4ad4c422b58f9c7c9c4e36a6e8942d7a1901e96 (diff)
downloadSurfer-1c3b94a7b3bf08403450c59930c93491aa843a6d.tar.gz
Surfer-1c3b94a7b3bf08403450c59930c93491aa843a6d.tar.zst
Surfer-1c3b94a7b3bf08403450c59930c93491aa843a6d.zip
Fix tests
-rw-r--r--test/test.js11
1 files changed, 8 insertions, 3 deletions
diff --git a/test/test.js b/test/test.js
index f0d8207..3386596 100644
--- a/test/test.js
+++ b/test/test.js
@@ -5,6 +5,7 @@
5var execSync = require('child_process').execSync, 5var execSync = require('child_process').execSync,
6 expect = require('expect.js'), 6 expect = require('expect.js'),
7 path = require('path'), 7 path = require('path'),
8 util = require('util'),
8 fs = require('fs'), 9 fs = require('fs'),
9 superagent = require('superagent'), 10 superagent = require('superagent'),
10 webdriver = require('selenium-webdriver'); 11 webdriver = require('selenium-webdriver');
@@ -111,10 +112,14 @@ describe('Application life cycle test', function () {
111 }); 112 });
112 } 113 }
113 114
115 function cliLogin(done) {
116 execSync(util.format('%s login %s --username %s --password %s', path.join(__dirname, '/../cli/surfer.js'), app.fqdn, process.env.USERNAME, process.env.PASSWORD), { stdio: 'inherit' } );
117 done();
118 }
119
114 function uploadFile(name, done) { 120 function uploadFile(name, done) {
115 // File upload can't be tested with selenium, since the file input is not visible and thus can't be interacted with :-( 121 // File upload can't be tested with selenium, since the file input is not visible and thus can't be interacted with :-(
116 122
117 fs.writeFileSync(process.env.HOME + '/.surfer.json', JSON.stringify({ server: 'https://' + app.fqdn, username: process.env.USERNAME, password: process.env.PASSWORD }));
118 execSync(path.join(__dirname, '/../cli/surfer.js') + ' put ' + path.join(__dirname, name), { stdio: 'inherit' } ); 123 execSync(path.join(__dirname, '/../cli/surfer.js') + ' put ' + path.join(__dirname, name), { stdio: 'inherit' } );
119 done(); 124 done();
120 } 125 }
@@ -136,6 +141,7 @@ describe('Application life cycle test', function () {
136 }); 141 });
137 142
138 it('can login', login); 143 it('can login', login);
144 it('can cli login', cliLogin);
139 it('can upload file', uploadFile.bind(null, TEST_FILE_NAME_0)); 145 it('can upload file', uploadFile.bind(null, TEST_FILE_NAME_0));
140 it('file is listed', checkFileIsListed.bind(null, TEST_FILE_NAME_0)); 146 it('file is listed', checkFileIsListed.bind(null, TEST_FILE_NAME_0));
141 it('file is served up', checkFileIsPresent); 147 it('file is served up', checkFileIsPresent);
@@ -143,7 +149,6 @@ describe('Application life cycle test', function () {
143 it('can upload second file', uploadFile.bind(null, TEST_FILE_NAME_1)); 149 it('can upload second file', uploadFile.bind(null, TEST_FILE_NAME_1));
144 it('file is listed', checkFileIsListed.bind(null, TEST_FILE_NAME_1)); 150 it('file is listed', checkFileIsListed.bind(null, TEST_FILE_NAME_1));
145 it('can delete second file with cli', function (done) { 151 it('can delete second file with cli', function (done) {
146 fs.writeFileSync(process.env.HOME + '/.surfer.json', JSON.stringify({ server: 'https://' + app.fqdn, username: process.env.USERNAME, password: process.env.PASSWORD }));
147 execSync(path.join(__dirname, '/../cli/surfer.js') + ' del ' + TEST_FILE_NAME_1, { stdio: 'inherit' } ); 152 execSync(path.join(__dirname, '/../cli/surfer.js') + ' del ' + TEST_FILE_NAME_1, { stdio: 'inherit' } );
148 done(); 153 done();
149 }); 154 });
@@ -167,7 +172,7 @@ describe('Application life cycle test', function () {
167 172
168 it('move to different location', function () { 173 it('move to different location', function () {
169 browser.manage().deleteAllCookies(); 174 browser.manage().deleteAllCookies();
170 execSync('cloudron install --location ' + LOCATION + '2 --app ' + app.id, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' }); 175 execSync('cloudron configure --location ' + LOCATION + '2 --app ' + app.id, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
171 var inspect = JSON.parse(execSync('cloudron inspect')); 176 var inspect = JSON.parse(execSync('cloudron inspect'));
172 app = inspect.apps.filter(function (a) { return a.location === LOCATION + '2'; })[0]; 177 app = inspect.apps.filter(function (a) { return a.location === LOCATION + '2'; })[0];
173 expect(app).to.be.an('object'); 178 expect(app).to.be.an('object');