aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorJohannes Zellner <johannes@cloudron.io>2020-01-05 23:55:09 +0100
committerJohannes Zellner <johannes@cloudron.io>2020-01-05 23:55:12 +0100
commita0ce51e752db8b10493a01055961299ebd283803 (patch)
tree2887308746b17aa711e50c03d2375e5375428c68 /test
parent7266acab68caddc9c648a4a0f2a4795e1f7ffaa7 (diff)
downloadSurfer-a0ce51e752db8b10493a01055961299ebd283803.tar.gz
Surfer-a0ce51e752db8b10493a01055961299ebd283803.tar.zst
Surfer-a0ce51e752db8b10493a01055961299ebd283803.zip
Add update tests
Diffstat (limited to 'test')
-rw-r--r--test/test.js62
1 files changed, 47 insertions, 15 deletions
diff --git a/test/test.js b/test/test.js
index dd2d06f..8145f17 100644
--- a/test/test.js
+++ b/test/test.js
@@ -23,7 +23,7 @@ if (!process.env.USERNAME || !process.env.PASSWORD) {
23describe('Application life cycle test', function () { 23describe('Application life cycle test', function () {
24 this.timeout(0); 24 this.timeout(0);
25 25
26 const EXEC_OPTIONS = { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' }; 26 const EXEC_ARGS = { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' };
27 const LOCATION = 'test'; 27 const LOCATION = 'test';
28 const TEST_TIMEOUT = 10000; 28 const TEST_TIMEOUT = 10000;
29 const TEST_FILE_NAME_0 = 'index.html'; 29 const TEST_FILE_NAME_0 = 'index.html';
@@ -40,6 +40,12 @@ describe('Application life cycle test', function () {
40 browser.quit(); 40 browser.quit();
41 }); 41 });
42 42
43 function getAppInfo() {
44 var inspect = JSON.parse(execSync('cloudron inspect'));
45 app = inspect.apps.filter(function (a) { return a.location === LOCATION; })[0];
46 expect(app).to.be.an('object');
47 }
48
43 function waitForElement(elem) { 49 function waitForElement(elem) {
44 return browser.wait(until.elementLocated(elem), TEST_TIMEOUT).then(function () { 50 return browser.wait(until.elementLocated(elem), TEST_TIMEOUT).then(function () {
45 return browser.wait(until.elementIsVisible(browser.findElement(elem)), TEST_TIMEOUT); 51 return browser.wait(until.elementIsVisible(browser.findElement(elem)), TEST_TIMEOUT);
@@ -126,15 +132,11 @@ describe('Application life cycle test', function () {
126 done(); 132 done();
127 } 133 }
128 134
129 xit('build app', function () { execSync('cloudron build', EXEC_OPTIONS); }); 135 xit('build app', function () { execSync('cloudron build', EXEC_ARGS); });
130 136
131 it('install app', function () { execSync(`cloudron install --location ${LOCATION}`, EXEC_OPTIONS); }); 137 it('install app', function () { execSync(`cloudron install --location ${LOCATION}`, EXEC_ARGS); });
132 138
133 it('can get app information', function () { 139 it('can get app information', getAppInfo);
134 var inspect = JSON.parse(execSync('cloudron inspect'));
135 app = inspect.apps.filter(function (a) { return a.location === LOCATION; })[0];
136 expect(app).to.be.an('object');
137 });
138 140
139 it('can login', login); 141 it('can login', login);
140 it('can cli login', cliLogin); 142 it('can cli login', cliLogin);
@@ -150,8 +152,8 @@ describe('Application life cycle test', function () {
150 it('second file is gone', checkFileIsGone.bind(null, TEST_FILE_NAME_1)); 152 it('second file is gone', checkFileIsGone.bind(null, TEST_FILE_NAME_1));
151 it('can logout', logout); 153 it('can logout', logout);
152 154
153 it('backup app', function () { execSync(`cloudron backup create --app ${app.id}`, EXEC_OPTIONS); }); 155 it('backup app', function () { execSync(`cloudron backup create --app ${app.id}`, EXEC_ARGS); });
154 it('restore app', function () { execSync(`cloudron restore --app ${app.id}`, EXEC_OPTIONS); }); 156 it('restore app', function () { execSync(`cloudron restore --app ${app.id}`, EXEC_ARGS); });
155 157
156 it('can login', login); 158 it('can login', login);
157 it('file is listed', checkFileIsListed.bind(null, TEST_FILE_NAME_0)); 159 it('file is listed', checkFileIsListed.bind(null, TEST_FILE_NAME_0));
@@ -165,16 +167,46 @@ describe('Application life cycle test', function () {
165 167
166 // ensure we don't hit NXDOMAIN in the mean time 168 // ensure we don't hit NXDOMAIN in the mean time
167 browser.get('about:blank').then(function () { 169 browser.get('about:blank').then(function () {
168 execSync(`cloudron configure --location ${LOCATION}2 --app ${app.id}`, EXEC_OPTIONS); 170 execSync(`cloudron configure --location ${LOCATION}2 --app ${app.id}`, EXEC_ARGS);
169 171
170 var inspect = JSON.parse(execSync('cloudron inspect')); 172 getAppInfo();
171 app = inspect.apps.filter(function (a) { return a.location === LOCATION + '2'; })[0]; 173
172 expect(app).to.be.an('object'); 174 done();
175 });
176 });
177
178 it('can login', login);
179 it('file is listed', checkFileIsListed.bind(null, TEST_FILE_NAME_0));
180 it('file is served up', checkFileIsPresent);
181 it('file is served up', checkIndexFileIsServedUp);
182 it('can logout', logout);
173 183
184 it('uninstall app', function (done) {
185 // ensure we don't hit NXDOMAIN in the mean time
186 browser.get('about:blank').then(function () {
187 execSync(`cloudron uninstall --app ${app.id}`, EXEC_ARGS);
174 done(); 188 done();
175 }); 189 });
176 }); 190 });
177 191
192 // test update
193 it('can install app', function () {
194 execSync(`cloudron install --appstore-id io.cloudron.surfer --location ${LOCATION}`, EXEC_ARGS);
195 });
196
197 it('can get app information', getAppInfo);
198 it('can login', login);
199 it('can cli login', cliLogin);
200 it('can upload file', uploadFile.bind(null, TEST_FILE_NAME_0));
201 it('file is listed', checkFileIsListed.bind(null, TEST_FILE_NAME_0));
202 it('file is served up', checkFileIsPresent);
203 it('file is served up', checkIndexFileIsServedUp);
204 it('can logout', logout);
205
206 it('can update', function () {
207 execSync(`cloudron update --app ${LOCATION}`, EXEC_ARGS);
208 });
209
178 it('can login', login); 210 it('can login', login);
179 it('file is listed', checkFileIsListed.bind(null, TEST_FILE_NAME_0)); 211 it('file is listed', checkFileIsListed.bind(null, TEST_FILE_NAME_0));
180 it('file is served up', checkFileIsPresent); 212 it('file is served up', checkFileIsPresent);
@@ -184,7 +216,7 @@ describe('Application life cycle test', function () {
184 it('uninstall app', function (done) { 216 it('uninstall app', function (done) {
185 // ensure we don't hit NXDOMAIN in the mean time 217 // ensure we don't hit NXDOMAIN in the mean time
186 browser.get('about:blank').then(function () { 218 browser.get('about:blank').then(function () {
187 execSync(`cloudron uninstall --app ${app.id}`, EXEC_OPTIONS); 219 execSync(`cloudron uninstall --app ${app.id}`, EXEC_ARGS);
188 done(); 220 done();
189 }); 221 });
190 }); 222 });