From c0933ab67f29036016e9c3b25fece1feffdfc177 Mon Sep 17 00:00:00 2001 From: Johannes Zellner Date: Sun, 11 Oct 2020 15:26:50 +0200 Subject: [PATCH] Update test deps and remove obsolete ones --- test/package-lock.json | 225 ++++------------------------------------- test/package.json | 9 +- test/test.js | 180 ++++++++++++++------------------- 3 files changed, 95 insertions(+), 319 deletions(-) diff --git a/test/package-lock.json b/test/package-lock.json index cc0f30d..d6c193c 100644 --- a/test/package-lock.json +++ b/test/package-lock.json @@ -52,9 +52,9 @@ "integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==" }, "@types/node": { - "version": "14.6.3", - "resolved": "https://registry.npmjs.org/@types/node/-/node-14.6.3.tgz", - "integrity": "sha512-pC/hkcREG6YfDfui1FBmj8e20jFU5Exjw4NYDm8kEdrW+mOh0T1Zve8DWKnS7ZIZvgncrctcNCXF4Q2I+loyww==" + "version": "14.11.8", + "resolved": "https://registry.npmjs.org/@types/node/-/node-14.11.8.tgz", + "integrity": "sha512-KPcKqKm5UKDkaYPTuXSx8wEP7vE9GnuaXIZKijwRYcePpZFDVuy2a57LarFKiORbHOuTOOwYzxVxcUzsh2P2Pw==" }, "@types/yauzl": { "version": "2.9.1", @@ -74,11 +74,11 @@ }, "dependencies": { "debug": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", - "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.2.0.tgz", + "integrity": "sha512-IX2ncY78vDTjZMFUdmsvIRFY2Cf4FnD0wRs+nQwJU8Lu99/tPFdb0VybiiMTPe3I6rQmwsqQqRBvxU+bZ/I8sg==", "requires": { - "ms": "^2.1.1" + "ms": "2.1.2" } }, "ms": { @@ -148,16 +148,6 @@ "is-string": "^1.0.4" } }, - "async": { - "version": "0.9.2", - "resolved": "https://registry.npmjs.org/async/-/async-0.9.2.tgz", - "integrity": "sha1-rqdNXmHB+JlhO/ZL2mbUx48v0X0=" - }, - "asynckit": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" - }, "axios": { "version": "0.19.2", "resolved": "https://registry.npmjs.org/axios/-/axios-0.19.2.tgz", @@ -208,16 +198,6 @@ "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==" }, - "chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, "chokidar": { "version": "3.4.2", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.4.2.tgz", @@ -234,9 +214,9 @@ } }, "chromedriver": { - "version": "85.0.0", - "resolved": "https://registry.npmjs.org/chromedriver/-/chromedriver-85.0.0.tgz", - "integrity": "sha512-Noinnkl9gRsfC1EYA5trcOVf9r/P6JJnWf+mU6KZS3xLjV9x/o71VZ+gqRl3oSI4PnTGnqYRISZFQk/teYVTRg==", + "version": "86.0.0", + "resolved": "https://registry.npmjs.org/chromedriver/-/chromedriver-86.0.0.tgz", + "integrity": "sha512-byLJWhAfuYOmzRYPDf4asJgGDbI4gJGHa+i8dnQZGuv+6WW1nW1Fg+8zbBMOfLvGn7sKL41kVdmCEVpQHn9oyg==", "requires": { "@testim/chrome-version": "^1.0.7", "axios": "^0.19.2", @@ -300,29 +280,11 @@ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" }, - "combined-stream": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", - "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", - "requires": { - "delayed-stream": "~1.0.0" - } - }, - "component-emitter": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz", - "integrity": "sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg==" - }, "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" }, - "cookiejar": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/cookiejar/-/cookiejar-2.1.2.tgz", - "integrity": "sha512-Mw+adcfzPxcPeI+0WlvRrr/3lGVO0bD75SxX6811cxSh1Wbxx7xZBGK1eVtDf6si8rg2lhnUjsVLMFMfbRIuwA==" - }, "core-util-is": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", @@ -369,11 +331,6 @@ "slash": "^3.0.0" } }, - "delayed-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" - }, "diff": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", @@ -387,14 +344,6 @@ "path-type": "^4.0.0" } }, - "ejs": { - "version": "3.1.5", - "resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.5.tgz", - "integrity": "sha512-dldq3ZfFtgVTJMLjOe+/3sROTzALlL9E34V4/sDtUd/KlBSS0s6U1/+WPE1B4sj9CXHJpL1M6rhNJnc9Wbal9w==", - "requires": { - "jake": "^10.6.1" - } - }, "emoji-regex": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", @@ -462,11 +411,6 @@ "is-symbol": "^1.0.2" } }, - "escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" - }, "esprima": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", @@ -489,11 +433,11 @@ }, "dependencies": { "debug": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", - "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.2.0.tgz", + "integrity": "sha512-IX2ncY78vDTjZMFUdmsvIRFY2Cf4FnD0wRs+nQwJU8Lu99/tPFdb0VybiiMTPe3I6rQmwsqQqRBvxU+bZ/I8sg==", "requires": { - "ms": "^2.1.1" + "ms": "2.1.2" } }, "ms": { @@ -516,11 +460,6 @@ "picomatch": "^2.2.1" } }, - "fast-safe-stringify": { - "version": "2.0.7", - "resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.0.7.tgz", - "integrity": "sha512-Utm6CdzT+6xsDk2m8S6uL8VHxNwI6Jub+e9NYTcAms28T84pTa25GJQV9j0CY0N1rM8hK4x6grpF2BQf+2qwVA==" - }, "fastq": { "version": "1.8.0", "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.8.0.tgz", @@ -537,14 +476,6 @@ "pend": "~1.2.0" } }, - "filelist": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/filelist/-/filelist-1.0.1.tgz", - "integrity": "sha512-8zSK6Nu0DQIC08mUC46sWGXi+q3GGpKydAG36k+JDba6VRpkevvOWUW5a/PhShij4+vHT9M+ghgG7eM+a9JDUQ==", - "requires": { - "minimatch": "^3.0.4" - } - }, "fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", @@ -578,21 +509,6 @@ "debug": "=3.1.0" } }, - "form-data": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.0.tgz", - "integrity": "sha512-CKMFDglpbMi6PyN+brwB9Q/GOw0eAnsrEZDgcsH5Krhz5Od/haKHAX0NmQfha2zPPz0JpWzA7GJHGSnvCRLWsg==", - "requires": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.8", - "mime-types": "^2.1.12" - } - }, - "formidable": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/formidable/-/formidable-1.2.2.tgz", - "integrity": "sha512-V8gLm+41I/8kguQ4/o1D3RIHRmhYFG4pnNyonvua+40rqcEmT4+V71yaZ3B457xbbgCsCfjSPi65u/W6vK1U5Q==" - }, "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -676,11 +592,6 @@ "function-bind": "^1.1.1" } }, - "has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=" - }, "has-symbols": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.1.tgz", @@ -701,11 +612,11 @@ }, "dependencies": { "debug": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", - "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.2.0.tgz", + "integrity": "sha512-IX2ncY78vDTjZMFUdmsvIRFY2Cf4FnD0wRs+nQwJU8Lu99/tPFdb0VybiiMTPe3I6rQmwsqQqRBvxU+bZ/I8sg==", "requires": { - "ms": "^2.1.1" + "ms": "2.1.2" } }, "ms": { @@ -885,17 +796,6 @@ "iterate-iterator": "^1.0.1" } }, - "jake": { - "version": "10.8.2", - "resolved": "https://registry.npmjs.org/jake/-/jake-10.8.2.tgz", - "integrity": "sha512-eLpKyrfG3mzvGE2Du8VoPbeSkRry093+tyNjdYaBbJS9v17knImYGNXQCUV0gLxQtF82m3E8iRb/wdSQZLoq7A==", - "requires": { - "async": "0.9.x", - "chalk": "^2.4.2", - "filelist": "^1.0.1", - "minimatch": "^3.0.4" - } - }, "js-yaml": { "version": "3.14.0", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.0.tgz", @@ -991,11 +891,6 @@ "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==" }, - "methods": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", - "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=" - }, "micromatch": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.2.tgz", @@ -1005,24 +900,6 @@ "picomatch": "^2.0.5" } }, - "mime": { - "version": "2.4.6", - "resolved": "https://registry.npmjs.org/mime/-/mime-2.4.6.tgz", - "integrity": "sha512-RZKhC3EmpBchfTGBVb8fb+RL2cWyw/32lshnsETttkBAyAUXSGHxbEJWWRXc751DrIxG1q04b8QwMbAwkRPpUA==" - }, - "mime-db": { - "version": "1.44.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.44.0.tgz", - "integrity": "sha512-/NOTfLrsPBVeH7YtFPgsVWveuL+4SjjYxaQ1xtM1KMFj7HdxlBlxeyNLzhyJVx7r4rZGJAZ/6lkKCitSc/Nmpg==" - }, - "mime-types": { - "version": "2.1.27", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.27.tgz", - "integrity": "sha512-JIhqnCasI9yD+SsmkquHBxTSEuZdQX5BuQnS2Vc7puQQQ+8yiP5AY5uWhpdv4YL4VM5c6iliiYWPgJ/nJQLp7w==", - "requires": { - "mime-db": "1.44.0" - } - }, "minimatch": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", @@ -1230,11 +1107,6 @@ "once": "^1.3.1" } }, - "qs": { - "version": "6.9.4", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.9.4.tgz", - "integrity": "sha512-A1kFqHekCTM7cz0udomYUoYNWjBebHm/5wzU/XqrBRBNWectVH0QIiN+NEcZ0Dte5hvzHwbr8+XQmguPhJ6WdQ==" - }, "randombytes": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", @@ -1303,11 +1175,6 @@ "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==" }, - "selenium-server-standalone-jar": { - "version": "3.141.59", - "resolved": "https://registry.npmjs.org/selenium-server-standalone-jar/-/selenium-server-standalone-jar-3.141.59.tgz", - "integrity": "sha512-gh7LagmKMkthQZo0q9qrDSWy+ISYnCUhOUW6IyRQIMGdg8Os/uMfChTDO17DYzxKmNIDx/h6+yfBj34QYALycw==" - }, "selenium-webdriver": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/selenium-webdriver/-/selenium-webdriver-3.6.0.tgz", @@ -1329,11 +1196,6 @@ } } }, - "semver": { - "version": "7.3.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz", - "integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==" - }, "serialize-javascript": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-4.0.0.tgz", @@ -1410,57 +1272,6 @@ "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.0.1.tgz", "integrity": "sha512-VTyMAUfdm047mwKl+u79WIdrZxtFtn+nBxHeb844XBQ9uMNTuTHdx2hc5RiAJYqwTj3wc/xe5HLSdJSkJ+WfZw==" }, - "superagent": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/superagent/-/superagent-6.1.0.tgz", - "integrity": "sha512-OUDHEssirmplo3F+1HWKUrUjvnQuA+nZI6i/JJBdXb5eq9IyEQwPyPpqND+SSsxf6TygpBEkUjISVRN4/VOpeg==", - "requires": { - "component-emitter": "^1.3.0", - "cookiejar": "^2.1.2", - "debug": "^4.1.1", - "fast-safe-stringify": "^2.0.7", - "form-data": "^3.0.0", - "formidable": "^1.2.2", - "methods": "^1.1.2", - "mime": "^2.4.6", - "qs": "^6.9.4", - "readable-stream": "^3.6.0", - "semver": "^7.3.2" - }, - "dependencies": { - "debug": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", - "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", - "requires": { - "ms": "^2.1.1" - } - }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" - }, - "readable-stream": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", - "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", - "requires": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - } - } - } - }, - "supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "requires": { - "has-flag": "^3.0.0" - } - }, "tcp-port-used": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/tcp-port-used/-/tcp-port-used-1.0.1.tgz", diff --git a/test/package.json b/test/package.json index 29deb22..ab5702b 100644 --- a/test/package.json +++ b/test/package.json @@ -9,14 +9,9 @@ "author": "", "license": "ISC", "dependencies": { - "chromedriver": "^85.0.0", - "ejs": "^3.1.5", + "chromedriver": "^86.0.0", "expect.js": "^0.3.1", - "mkdirp": "^1.0.4", "mocha": "^8.1.3", - "rimraf": "^3.0.2", - "selenium-server-standalone-jar": "^3.141.59", - "selenium-webdriver": "^3.6.0", - "superagent": "^6.1.0" + "selenium-webdriver": "^3.6.0" } } diff --git a/test/test.js b/test/test.js index 64691fb..67ec4ec 100644 --- a/test/test.js +++ b/test/test.js @@ -1,5 +1,10 @@ #!/usr/bin/env node +/* global describe */ +/* global before */ +/* global after */ +/* global it */ + 'use strict'; require('chromedriver'); @@ -7,43 +12,37 @@ require('chromedriver'); var execSync = require('child_process').execSync, expect = require('expect.js'), path = require('path'), - webdriver = require('selenium-webdriver'); + { Builder, By, Key, until } = require('selenium-webdriver'), + { Options } = require('selenium-webdriver/chrome'); -var by = require('selenium-webdriver').By, - until = require('selenium-webdriver').until, - Key = require('selenium-webdriver').Key, - Builder = require('selenium-webdriver').Builder; - -var bucket = 'cloudrontestbucket'; - -process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'; describe('Application life cycle test', function () { this.timeout(0); - var server, browser = new Builder().forBrowser('chrome').build(); + const LOCATION = 'test'; + const TEST_TIMEOUT = 10000; + const EXEC_ARGS = { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' }; + const BUCKET = 'cloudrontestbucket'; - before(function (done) { - var seleniumJar= require('selenium-server-standalone-jar'); - var SeleniumServer = require('selenium-webdriver/remote').SeleniumServer; - server = new SeleniumServer(seleniumJar.path, { port: 4444 }); - server.start(); - - done(); - }); - - after(function (done) { - browser.quit(); - server.stop(); - done(); - }); - - var LOCATION = 'test'; - var TEST_TIMEOUT = 10000; var app; + var browser; + + before(function () { + browser = new Builder().forBrowser('chrome').setChromeOptions(new Options().windowSize({ width: 1280, height: 1024 })).build(); + }); + + after(function () { + browser.quit(); + }); + + function getAppInfo() { + var inspect = JSON.parse(execSync('cloudron inspect')); + app = inspect.apps.filter(function (a) { return a.location.indexOf(LOCATION) === 0; })[0]; + expect(app).to.be.an('object'); + } function pageLoaded() { - return browser.wait(until.elementLocated(by.className('page-load pl-0 pl-1')), TEST_TIMEOUT); + return browser.wait(until.elementLocated(By.className('page-load pl-0 pl-1')), TEST_TIMEOUT); } function visible(selector) { @@ -55,16 +54,16 @@ describe('Application life cycle test', function () { function login(accessKey, secretKey, callback) { browser.manage().deleteAllCookies(); browser.get('https://' + app.fqdn).then(function () { - return visible(by.id('accessKey')); + return visible(By.id('accessKey')); }).then(function () { - return browser.findElement(by.id('accessKey')).sendKeys(accessKey); + return browser.findElement(By.id('accessKey')).sendKeys(accessKey); }).then(function () { - return browser.findElement(by.id('secretKey')).sendKeys(secretKey); + return browser.findElement(By.id('secretKey')).sendKeys(secretKey); }).then(function () { - // return browser.findElement(by.className('lw-btn')).click(); - return browser.findElement(by.tagName('form')).submit(); + // return browser.findElement(By.className('lw-btn')).click(); + return browser.findElement(By.tagName('form')).submit(); }).then(function () { - return browser.wait(until.elementLocated(by.id('top-right-menu')), TEST_TIMEOUT); + return browser.wait(until.elementLocated(By.id('top-right-menu')), TEST_TIMEOUT); }).then(function () { callback(); }); @@ -74,23 +73,23 @@ describe('Application life cycle test', function () { browser.get('https://' + app.fqdn); pageLoaded().then(function () { - return visible(by.id('top-right-menu')); + return visible(By.id('top-right-menu')); }).then(function () { - return browser.findElement(by.id('top-right-menu')).click(); + return browser.findElement(By.id('top-right-menu')).click(); }).then(function () { if (app.manifest.version === '1.137.0') { - return visible(by.xpath('//*[text()="Sign Out "]')); + return visible(By.xpath('//*[text()="Sign Out "]')); } else { - return visible(by.xpath('//*[contains(text(), "Logout")]')); + return visible(By.xpath('//*[contains(text(), "Logout")]')); } }).then(function () { if (app.manifest.version === '1.137.0') { - return browser.findElement(by.xpath('//*[text()="Sign Out "]')).click(); + return browser.findElement(By.xpath('//*[text()="Sign Out "]')).click(); } else { - return browser.findElement(by.xpath('//*[contains(text(),"Logout")]')).click(); + return browser.findElement(By.xpath('//*[contains(text(),"Logout")]')).click(); } }).then(function () { - return browser.wait(until.elementLocated(by.id('accessKey')), TEST_TIMEOUT); + return browser.wait(until.elementLocated(By.id('accessKey')), TEST_TIMEOUT); }).then(function () { callback(); }); @@ -100,23 +99,23 @@ describe('Application life cycle test', function () { browser.get('https://' + app.fqdn); pageLoaded().then(function () { - return visible(by.className('fa-plus')); + return visible(By.className('fa-plus')); }).then(function () { - return browser.findElement(by.className('fa-plus')).click(); + return browser.findElement(By.className('fa-plus')).click(); }).then(function () { const c = 'fa-hdd'; - return visible(by.className(c)); + return visible(By.className(c)); }).then(function () { const c = 'fa-hdd'; - return browser.findElement(by.className(c)).click(); + return browser.findElement(By.className(c)).click(); }).then(function () { - return visible(by.xpath('//*[@class="modal-body"]/form/div/input')); + return visible(By.xpath('//*[@class="modal-body"]/form/div/input')); }).then(function () { - return browser.findElement(by.xpath('//*[@class="modal-body"]/form/div/input')).sendKeys(bucket); + return browser.findElement(By.xpath('//*[@class="modal-body"]/form/div/input')).sendKeys(BUCKET); }).then(function () { - return browser.findElement(by.xpath('//*[@class="modal-body"]/form')).submit(); + return browser.findElement(By.xpath('//*[@class="modal-body"]/form')).submit(); }).then(function () { - return visible(by.xpath('//*[@class="main"]/a[text()="' + bucket + '"]')); + return visible(By.xpath('//*[@class="main"]/a[text()="' + BUCKET + '"]')); }).then(function () { callback(); }); @@ -126,7 +125,7 @@ describe('Application life cycle test', function () { browser.get('https://' + app.fqdn); pageLoaded().then(function () { - return browser.findElement(by.xpath(`//a[contains(text(), ${bucket})]`)); + return browser.findElement(By.xpath(`//a[contains(text(), ${BUCKET})]`)); }).then(function () { callback(); }); @@ -136,35 +135,24 @@ describe('Application life cycle test', function () { browser.get('https://' + app.fqdn); pageLoaded().then(function () { - return visible(by.id('top-right-menu')); + return visible(By.id('top-right-menu')); }).then(function () { - return browser.findElement(by.id('top-right-menu')).click(); + return browser.findElement(By.id('top-right-menu')).click(); }).then(function () { - return visible(by.xpath('//*[contains(text(), "Change Password")]')); + return visible(By.xpath('//*[contains(text(), "Change Password")]')); }).then(function () { - return browser.findElement(by.xpath('//*[contains(text(),"Change Password")]')).click(); + return browser.findElement(By.xpath('//*[contains(text(),"Change Password")]')).click(); }).then(function () { - return browser.wait(until.elementLocated(by.xpath('//*[contains(text(), "Change Password")]')), TEST_TIMEOUT); + return browser.wait(until.elementLocated(By.xpath('//*[contains(text(), "Change Password")]')), TEST_TIMEOUT); }).then(function () { callback(); }); } - xit('build app', function () { - execSync('cloudron build', { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' }); - }); + xit('build app', function () { execSync('cloudron build', EXEC_ARGS); }); + it('install app', function () { execSync('cloudron install --location ' + LOCATION, EXEC_ARGS); }); - it('install app', function () { - execSync('cloudron install --location ' + LOCATION, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' }); - }); - - it('can get app information', function () { - 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 get app information', getAppInfo); it('can login', login.bind(null, 'minioadmin', 'minioadmin')); it('can add bucket', addBucket); @@ -172,29 +160,22 @@ describe('Application life cycle test', function () { it('can logout', logout); it('can change credentials', function () { - execSync('cloudron exec --app ' + app.id + ' -- /app/code/minio-credentials set minioakey minioskey', { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' }); + execSync(`cloudron exec --app ${app.id} -- /app/code/minio-credentials set minioakey minioskey`, EXEC_ARGS); }); - it('can restart app', function (done) { - execSync('cloudron restart'); - done(); - }); + it('can restart app', function () { execSync(`cloudron restart --app ${app.id}`, EXEC_ARGS); }); it('can login', login.bind(null, 'minioakey', 'minioskey')); it('has bucket', checkBucket); it('can logout', logout); - it('backup app', function () { - execSync('cloudron backup create --app ' + app.id, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' }); - }); - + it('backup app', function () { execSync('cloudron backup create --app ' + app.id, EXEC_ARGS); }); it('restore app', function () { - const backups = JSON.parse(execSync('cloudron backup list --raw')); - execSync('cloudron uninstall --app ' + app.id, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' }); - execSync('cloudron install --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]; - execSync(`cloudron restore --backup ${backups[0].id} --app ${app.id}`, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' }); + const backups = JSON.parse(execSync(`cloudron backup list --raw --app ${app.id}`)); + execSync('cloudron uninstall --app ' + app.id, EXEC_ARGS); + execSync('cloudron install --location ' + LOCATION, EXEC_ARGS); + getAppInfo(); + execSync(`cloudron restore --backup ${backups[0].id} --app ${app.id}`, EXEC_ARGS); }); it('can login', login.bind(null, 'minioakey', 'minioskey')); @@ -204,41 +185,30 @@ describe('Application life cycle test', function () { it('move to different location', function () { browser.manage().deleteAllCookies(); - execSync('cloudron configure --location ' + LOCATION + '2', { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' }); - var inspect = JSON.parse(execSync('cloudron inspect')); - app = inspect.apps.filter(function (a) { return a.location === LOCATION + '2'; })[0]; - expect(app).to.be.an('object'); + execSync('cloudron configure --location ' + LOCATION + '2', EXEC_ARGS); }); + it('can get app information', getAppInfo); it('can login', login.bind(null, 'minioakey', 'minioskey')); it('has bucket', checkBucket); it('can logout', logout); - it('uninstall app', function () { - execSync('cloudron uninstall --app ' + app.id, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' }); - }); + it('uninstall app', function () { execSync('cloudron uninstall --app ' + app.id, EXEC_ARGS); }); // test update - it('can install app', function () { - execSync('cloudron install --appstore-id io.minio.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 install app', function () { execSync('cloudron install --appstore-id io.minio.cloudronapp --location ' + LOCATION, EXEC_ARGS); }); + it('can get app information', getAppInfo); it('can login', login.bind(null, 'minioadmin', 'minioadmin')); it('can add buckets', addBucket); it('can logout', logout); - it('can update', function () { - execSync('cloudron update --app ' + 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]; - }); + it('can update', function () { execSync('cloudron update --app ' + LOCATION, EXEC_ARGS); }); + it('can get app information', getAppInfo); + it('can login', login.bind(null, 'minioadmin', 'minioadmin')); it('has bucket', checkBucket); it('can logout', logout); - it('uninstall app', function () { - execSync('cloudron uninstall --app ' + app.id, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' }); - }); + + it('uninstall app', function () { execSync('cloudron uninstall --app ' + app.id, EXEC_ARGS); }); });