From 21ed70687c55462df3777f97d1db7fc2d93515b2 Mon Sep 17 00:00:00 2001 From: Winston Liu <50Wliu@users.noreply.github.com> Date: Thu, 23 May 2019 18:36:12 -0400 Subject: [PATCH 01/29] WIP: Upgrade webdriverio --- script/package-lock.json | 670 ++++++--------------- script/package.json | 2 +- spec/integration/helpers/start-atom.coffee | 165 ----- spec/integration/helpers/start-atom.js | 155 +++++ spec/integration/smoke-spec.coffee | 42 -- spec/integration/smoke-spec.js | 55 ++ 6 files changed, 396 insertions(+), 693 deletions(-) delete mode 100644 spec/integration/helpers/start-atom.coffee create mode 100644 spec/integration/helpers/start-atom.js delete mode 100644 spec/integration/smoke-spec.coffee create mode 100644 spec/integration/smoke-spec.js diff --git a/script/package-lock.json b/script/package-lock.json index 4c8ad5fe2..041660fa2 100644 --- a/script/package-lock.json +++ b/script/package-lock.json @@ -211,6 +211,104 @@ "resolved": "https://registry.npmjs.org/@types/node/-/node-11.9.4.tgz", "integrity": "sha512-Zl8dGvAcEmadgs1tmSPcvwzO1YRsz38bVJQvH1RvRqSR9/5n61Q1ktcDL0ht3FXWR+ZpVmXVwN1LuH4Ax23NsA==" }, + "@wdio/config": { + "version": "5.9.1", + "resolved": "https://registry.npmjs.org/@wdio/config/-/config-5.9.1.tgz", + "integrity": "sha512-u5dqcTpUk4eXILEy5ytKX+0s7vXVHAwU/GghhbWrbL3mDTvZ65Wn6IyDGtBLckY6lfa2KF5Tswk0cg9mCw0mnA==", + "requires": { + "@wdio/logger": "^5.9.0", + "deepmerge": "^2.0.1", + "glob": "^7.1.2" + }, + "dependencies": { + "glob": { + "version": "7.1.4", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz", + "integrity": "sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==", + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "requires": { + "brace-expansion": "^1.1.7" + } + } + } + }, + "@wdio/logger": { + "version": "5.9.0", + "resolved": "https://registry.npmjs.org/@wdio/logger/-/logger-5.9.0.tgz", + "integrity": "sha512-L08MyO844LoTOnOZFxbupbTeqMAH7ZmrrNtN5AXpk3hJP7t4i5A+7eCiNWMpUpmOGHzM+04W27mYdaSei7imKg==", + "requires": { + "chalk": "^2.3.0", + "loglevel": "^1.6.0", + "loglevel-plugin-prefix": "^0.5.3", + "strip-ansi": "^4.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=" + }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "requires": { + "color-convert": "^1.9.0" + } + }, + "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" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=" + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "requires": { + "ansi-regex": "^3.0.0" + } + }, + "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" + } + } + } + }, + "@wdio/repl": { + "version": "5.9.1", + "resolved": "https://registry.npmjs.org/@wdio/repl/-/repl-5.9.1.tgz", + "integrity": "sha512-GUZ35ZLfNAIwKH/3TNrrusisMVX5Ukm9aLjbCRRKUCqGudD9yMFnkw1iJgfWFk38OnEcGS7plgdAJJooQx5Kqw==", + "requires": { + "@wdio/config": "^5.9.1" + } + }, "abbrev": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", @@ -295,41 +393,6 @@ "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==" }, - "archiver": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/archiver/-/archiver-0.6.1.tgz", - "integrity": "sha1-1AKZJXH9F5rtZy2Xl/iI5Wjh3Vw=", - "requires": { - "file-utils": "~0.1.5", - "lazystream": "~0.1.0", - "lodash": "~2.4.1", - "readable-stream": "~1.0.24", - "zip-stream": "~0.2.0" - }, - "dependencies": { - "isarray": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=" - }, - "lodash": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-2.4.2.tgz", - "integrity": "sha1-+t2DS5aDBz2hebPq5tnA0VBT9z4=" - }, - "readable-stream": { - "version": "1.0.34", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", - "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.1", - "isarray": "0.0.1", - "string_decoder": "~0.10.x" - } - } - } - }, "are-we-there-yet": { "version": "1.1.5", "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz", @@ -897,15 +960,6 @@ "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", "integrity": "sha1-aN/1++YMUes3cl6p4+0xDcwed24=" }, - "boom": { - "version": "0.4.2", - "resolved": "https://registry.npmjs.org/boom/-/boom-0.4.2.tgz", - "integrity": "sha1-emNune1O/O+xnO9JR6PGffrukRs=", - "optional": true, - "requires": { - "hoek": "0.9.x" - } - }, "brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -1061,14 +1115,6 @@ "lazy-cache": "^1.0.3" } }, - "chainit": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/chainit/-/chainit-2.1.1.tgz", - "integrity": "sha1-5TRdnAcdRz5zJ0yIrqZskVE2KME=", - "requires": { - "queue": "~1.0.2" - } - }, "chainsaw": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/chainsaw/-/chainsaw-0.1.0.tgz", @@ -1471,15 +1517,6 @@ "which": "^1.2.8" } }, - "cryptiles": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-0.2.2.tgz", - "integrity": "sha1-7ZH/HxetE9N0gohZT4pIoNJvMlw=", - "optional": true, - "requires": { - "boom": "0.4.x" - } - }, "cson-parser": { "version": "1.0.9", "resolved": "https://registry.npmjs.org/cson-parser/-/cson-parser-1.0.9.tgz", @@ -1495,11 +1532,6 @@ } } }, - "css-parse": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/css-parse/-/css-parse-1.7.0.tgz", - "integrity": "sha1-Mh9s9zeCpv91ERE5D8BeLGV9jJs=" - }, "css-select": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/css-select/-/css-select-1.2.0.tgz", @@ -1532,12 +1564,6 @@ "resolved": "https://registry.npmjs.org/css-what/-/css-what-2.1.3.tgz", "integrity": "sha512-a+EPoD+uZiNfh+5fxw2nO9QwFa6nJe2Or35fGY6Ipw1R3R4AGz1d1TEZrCegvw2YTmZ0jXirGYlzxxpYSHwpEg==" }, - "ctype": { - "version": "0.5.3", - "resolved": "https://registry.npmjs.org/ctype/-/ctype-0.5.3.tgz", - "integrity": "sha1-gsGMJGH3QRTvFsE1IkrQuRRMoS8=", - "optional": true - }, "cuint": { "version": "0.2.2", "resolved": "https://registry.npmjs.org/cuint/-/cuint-0.2.2.tgz", @@ -1624,9 +1650,9 @@ "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=" }, "deepmerge": { - "version": "0.2.10", - "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-0.2.10.tgz", - "integrity": "sha1-iQa/nlJaT78bIDsq/LRkAkmCEhk=" + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-2.2.1.tgz", + "integrity": "sha512-R9hc1Xa/NOBi9WRVUWg19rl1UB7Tt4kuPd+thNJgFZoxXsTz7ncaPaeIm+40oSGuP33DfMb4sZt1QIGiJzC4EA==" }, "deferred-leveldown": { "version": "4.0.2", @@ -3322,71 +3348,6 @@ "object-assign": "^4.0.1" } }, - "file-utils": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/file-utils/-/file-utils-0.1.5.tgz", - "integrity": "sha1-3IFTyFU4fLTaywoXJVMfpESmtIw=", - "requires": { - "findup-sync": "~0.1.2", - "glob": "~3.2.6", - "iconv-lite": "~0.2.11", - "isbinaryfile": "~0.1.9", - "lodash": "~2.1.0", - "minimatch": "~0.2.12", - "rimraf": "~2.2.2" - }, - "dependencies": { - "glob": { - "version": "3.2.11", - "resolved": "https://registry.npmjs.org/glob/-/glob-3.2.11.tgz", - "integrity": "sha1-Spc/Y1uRkPcV0QmH1cAP0oFevj0=", - "requires": { - "inherits": "2", - "minimatch": "0.3" - }, - "dependencies": { - "minimatch": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-0.3.0.tgz", - "integrity": "sha1-J12O2qxPG7MyZHIInnlJyDlGmd0=", - "requires": { - "lru-cache": "2", - "sigmund": "~1.0.0" - } - } - } - }, - "iconv-lite": { - "version": "0.2.11", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.2.11.tgz", - "integrity": "sha1-HOYKOleGSiktEyH/RgnKS7llrcg=" - }, - "lodash": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-2.1.0.tgz", - "integrity": "sha1-Bjfqqjaooc/IZcOt+5Qhib+wmY0=" - }, - "lru-cache": { - "version": "2.7.3", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-2.7.3.tgz", - "integrity": "sha1-bUUk6LlV+V1PW1iFHOId1y+06VI=" - }, - "minimatch": { - "version": "0.2.14", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-0.2.14.tgz", - "integrity": "sha1-x054BXT2PG+aCQ6Q775u9TpqdWo=", - "requires": { - "lru-cache": "2", - "sigmund": "~1.0.0" - } - }, - "rimraf": { - "version": "2.2.8", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.2.8.tgz", - "integrity": "sha1-5Dm+Kq7jJzIZUnMPmaiSnk/FBYI=" - } - } - }, "filename-regex": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/filename-regex/-/filename-regex-2.0.1.tgz", @@ -3423,45 +3384,6 @@ } } }, - "findup-sync": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-0.1.3.tgz", - "integrity": "sha1-fz56l7gjksZTvwZYm9hRkOk8NoM=", - "requires": { - "glob": "~3.2.9", - "lodash": "~2.4.1" - }, - "dependencies": { - "glob": { - "version": "3.2.11", - "resolved": "https://registry.npmjs.org/glob/-/glob-3.2.11.tgz", - "integrity": "sha1-Spc/Y1uRkPcV0QmH1cAP0oFevj0=", - "requires": { - "inherits": "2", - "minimatch": "0.3" - } - }, - "lodash": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-2.4.2.tgz", - "integrity": "sha1-+t2DS5aDBz2hebPq5tnA0VBT9z4=" - }, - "lru-cache": { - "version": "2.7.3", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-2.7.3.tgz", - "integrity": "sha1-bUUk6LlV+V1PW1iFHOId1y+06VI=" - }, - "minimatch": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-0.3.0.tgz", - "integrity": "sha1-J12O2qxPG7MyZHIInnlJyDlGmd0=", - "requires": { - "lru-cache": "2", - "sigmund": "~1.0.0" - } - } - } - }, "flat-cache": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-1.3.0.tgz", @@ -3867,6 +3789,11 @@ "resolved": "https://registry.npmjs.org/graceful-readlink/-/graceful-readlink-1.0.1.tgz", "integrity": "sha1-TK+tdrxi8C+gObL5Tpo906ORpyU=" }, + "grapheme-splitter": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz", + "integrity": "sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==" + }, "growl": { "version": "1.9.2", "resolved": "https://registry.npmjs.org/growl/-/growl-1.9.2.tgz", @@ -3971,29 +3898,11 @@ } } }, - "hawk": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/hawk/-/hawk-1.0.0.tgz", - "integrity": "sha1-uQuxaYByhUEdp//LjdJZhQLTtS0=", - "optional": true, - "requires": { - "boom": "0.4.x", - "cryptiles": "0.2.x", - "hoek": "0.9.x", - "sntp": "0.2.x" - } - }, "he": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", "integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0=" }, - "hoek": { - "version": "0.9.1", - "resolved": "https://registry.npmjs.org/hoek/-/hoek-0.9.1.tgz", - "integrity": "sha1-PTIkYrrfB3Fup+uFuviAec3c5QU=", - "optional": true - }, "home-or-tmp": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/home-or-tmp/-/home-or-tmp-1.0.0.tgz", @@ -4543,11 +4452,6 @@ "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" }, - "isbinaryfile": { - "version": "0.1.9", - "resolved": "https://registry.npmjs.org/isbinaryfile/-/isbinaryfile-0.1.9.tgz", - "integrity": "sha1-Fe7ONcSrcI2JJNqZ+4dPK1zAtsQ=" - }, "isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", @@ -4722,32 +4626,6 @@ "resolved": "https://registry.npmjs.org/lazy-cache/-/lazy-cache-1.0.4.tgz", "integrity": "sha1-odePw6UEdMuAhF07O24dpJpEbo4=" }, - "lazystream": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/lazystream/-/lazystream-0.1.0.tgz", - "integrity": "sha1-GyXWPHcqTCDwpe0KnXf0hLbhaSA=", - "requires": { - "readable-stream": "~1.0.2" - }, - "dependencies": { - "isarray": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=" - }, - "readable-stream": { - "version": "1.0.34", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", - "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.1", - "isarray": "0.0.1", - "string_decoder": "~0.10.x" - } - } - } - }, "lcid": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz", @@ -4937,29 +4815,11 @@ "resolved": "https://registry.npmjs.org/lodash._isiterateecall/-/lodash._isiterateecall-3.0.9.tgz", "integrity": "sha1-UgOte6Ql+uhCRg5pbbnPPmqsBXw=" }, - "lodash._isnative": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/lodash._isnative/-/lodash._isnative-2.4.1.tgz", - "integrity": "sha1-PqZAS3hKe+g2x7V1gOHN95sUgyw=" - }, - "lodash._objecttypes": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/lodash._objecttypes/-/lodash._objecttypes-2.4.1.tgz", - "integrity": "sha1-fAt/admKH3ZSn4kLDNsbTf7BHBE=" - }, "lodash._reinterpolate": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz", "integrity": "sha1-DM8tiRZq8Ds2Y8eWU4t1rG4RTZ0=" }, - "lodash._shimkeys": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/lodash._shimkeys/-/lodash._shimkeys-2.4.1.tgz", - "integrity": "sha1-bpzJZm/wgfC1psl4uD4kLmlJ0gM=", - "requires": { - "lodash._objecttypes": "~2.4.1" - } - }, "lodash.assign": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/lodash.assign/-/lodash.assign-4.2.0.tgz", @@ -4975,27 +4835,6 @@ "lodash._isiterateecall": "^3.0.0" } }, - "lodash.defaults": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/lodash.defaults/-/lodash.defaults-2.4.1.tgz", - "integrity": "sha1-p+iIXwXmiFEUS24SqPNngCa8TFQ=", - "requires": { - "lodash._objecttypes": "~2.4.1", - "lodash.keys": "~2.4.1" - }, - "dependencies": { - "lodash.keys": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/lodash.keys/-/lodash.keys-2.4.1.tgz", - "integrity": "sha1-SN6kbfj/djKxDXBrissmWR4rNyc=", - "requires": { - "lodash._isnative": "~2.4.1", - "lodash._shimkeys": "~2.4.1", - "lodash.isobject": "~2.4.1" - } - } - } - }, "lodash.get": { "version": "4.4.2", "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz", @@ -5012,12 +4851,14 @@ "integrity": "sha1-eeTriMNqgSKvhvhEqpvNhRtfu1U=" }, "lodash.isobject": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/lodash.isobject/-/lodash.isobject-2.4.1.tgz", - "integrity": "sha1-Wi5H/mmVPx7mMafrof5k0tBlWPU=", - "requires": { - "lodash._objecttypes": "~2.4.1" - } + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/lodash.isobject/-/lodash.isobject-3.0.2.tgz", + "integrity": "sha1-PI+41bW/S/kK4G4U8qUwpO2TXh0=" + }, + "lodash.isplainobject": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", + "integrity": "sha1-fFJqUtibRcRcxpC4gWO+BJf1UMs=" }, "lodash.keys": { "version": "3.1.2", @@ -5029,6 +4870,11 @@ "lodash.isarray": "^3.0.0" } }, + "lodash.merge": { + "version": "4.6.1", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.1.tgz", + "integrity": "sha512-AOYza4+Hf5z1/0Hztxpm2/xiPZgi/cjMqdnKTUWTBSKchJlxXXuUSxCCl8rJlf4g6yww/j6mA8nC8Hw/EZWxKQ==" + }, "lodash.startcase": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/lodash.startcase/-/lodash.startcase-4.4.0.tgz", @@ -5051,6 +4897,11 @@ "lodash._reinterpolate": "~3.0.0" } }, + "lodash.zip": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/lodash.zip/-/lodash.zip-4.2.0.tgz", + "integrity": "sha1-7GZi5IlkCO1KtsVCo5kLcswIACA=" + }, "log-symbols": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-2.2.0.tgz", @@ -5092,6 +4943,16 @@ } } }, + "loglevel": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/loglevel/-/loglevel-1.6.1.tgz", + "integrity": "sha1-4PyVEztu8nbNyIh82vJKpvFW+Po=" + }, + "loglevel-plugin-prefix": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/loglevel-plugin-prefix/-/loglevel-plugin-prefix-0.5.3.tgz", + "integrity": "sha512-zRAJw3WYCQAJ6xfEIi04/oqlmR6jkwg3hmBcMW82Zic3iPWyju1gwntcgic0m5NgqYNJ62alCmb0g/div26WjQ==" + }, "longest": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/longest/-/longest-1.0.1.tgz", @@ -8951,11 +8812,6 @@ "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-3.3.0.tgz", "integrity": "sha1-h/OPnxj3dKSrTIojL1xc6IcqnRU=" }, - "pragma-singleton": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/pragma-singleton/-/pragma-singleton-1.0.3.tgz", - "integrity": "sha1-aJQxe7jUcVflneKkoAnbfm9j4w4=" - }, "prebuild-install": { "version": "5.2.5", "resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-5.2.5.tgz", @@ -9062,11 +8918,6 @@ "once": "^1.3.1" } }, - "punycode": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz", - "integrity": "sha1-llOgNvt8HuQjQvIyXM7v6jkmxI0=" - }, "q": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/q/-/q-1.5.1.tgz", @@ -9077,16 +8928,6 @@ "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" }, - "querystring": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz", - "integrity": "sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA=" - }, - "queue": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/queue/-/queue-1.0.2.tgz", - "integrity": "sha1-LZr55hyaGuRVem842FtTTq/yBYE=" - }, "quick-lru": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-1.1.0.tgz", @@ -9521,6 +9362,21 @@ "resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz", "integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=" }, + "resq": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/resq/-/resq-1.5.0.tgz", + "integrity": "sha512-6US6oo2fQ/vgs7wBwqq1w9901Z5VEDgxQH0LrNaN8HcHUZInhtrIt1a0Icysu0vuoK26Bt+SR1dIYeR9+ftMxA==", + "requires": { + "fast-deep-equal": "^2.0.1" + }, + "dependencies": { + "fast-deep-equal": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz", + "integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=" + } + } + }, "restore-cursor": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-2.0.0.tgz", @@ -9536,9 +9392,9 @@ "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==" }, "rgb2hex": { - "version": "0.1.8", - "resolved": "https://registry.npmjs.org/rgb2hex/-/rgb2hex-0.1.8.tgz", - "integrity": "sha512-kPH3Zm3UrBIfJv17AtJJGLRxak+Hvvz6SnsTBIajqB2Zbh+A4EEjkMWKkmGhms0cJlzOOjZcu1LX5K3vnON7ug==" + "version": "0.1.9", + "resolved": "https://registry.npmjs.org/rgb2hex/-/rgb2hex-0.1.9.tgz", + "integrity": "sha512-32iuQzhOjyT+cv9aAFRBJ19JgHwzQwbjUhH3Fj2sWW2EEGAW8fpFrDFP5ndoKDxJaLO06x1hE3kyuIFrUQtybQ==" }, "right-align": { "version": "0.1.3", @@ -9646,6 +9502,11 @@ "resolved": "https://registry.npmjs.org/semver/-/semver-5.3.0.tgz", "integrity": "sha1-myzl094C0XxgEq0yaqa00M9U+U8=" }, + "serialize-error": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/serialize-error/-/serialize-error-3.0.0.tgz", + "integrity": "sha512-+y3nkkG/go1Vdw+2f/+XUXM1DXX1XcxTl99FfiD/OEPUNw4uo0i6FKABfTAN5ZcgGtjTRZcEbxcE/jtXbEY19A==" + }, "set-blocking": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", @@ -9685,11 +9546,6 @@ "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=" }, - "sigmund": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/sigmund/-/sigmund-1.0.1.tgz", - "integrity": "sha1-P/IfGYytIXX587eBhT/ZTQ0ZtZA=" - }, "signal-exit": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", @@ -9860,15 +9716,6 @@ "kind-of": "^3.2.0" } }, - "sntp": { - "version": "0.2.4", - "resolved": "https://registry.npmjs.org/sntp/-/sntp-0.2.4.tgz", - "integrity": "sha1-+4hfGLDzqtGJ+CSGJTa87ux1CQA=", - "optional": true, - "requires": { - "hoek": "0.9.x" - } - }, "source-map": { "version": "0.5.7", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", @@ -11076,15 +10923,6 @@ "resolved": "https://registry.npmjs.org/urix/-/urix-0.1.0.tgz", "integrity": "sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI=" }, - "url": { - "version": "0.10.3", - "resolved": "https://registry.npmjs.org/url/-/url-0.10.3.tgz", - "integrity": "sha1-Ah5NnHcF8hu/N9A861h2dAJ3TGQ=", - "requires": { - "punycode": "1.3.2", - "querystring": "0.2.0" - } - }, "use": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/use/-/use-3.1.1.tgz", @@ -11163,142 +11001,37 @@ "resolved": "https://registry.npmjs.org/walkdir/-/walkdir-0.0.12.tgz", "integrity": "sha512-HFhaD4mMWPzFSqhpyDG48KDdrjfn409YQuVW7ckZYhW4sE87mYtWifdB/+73RA7+p4s4K18n5Jfx1kHthE1gBw==" }, - "webdriverio": { - "version": "2.4.5", - "resolved": "https://registry.npmjs.org/webdriverio/-/webdriverio-2.4.5.tgz", - "integrity": "sha1-wD7ajhp+tCMDhYjm5z8nCyx03gs=", + "webdriver": { + "version": "5.9.1", + "resolved": "https://registry.npmjs.org/webdriver/-/webdriver-5.9.1.tgz", + "integrity": "sha512-emUetEEJKN6ZsyZzj28D4HKC5p7Qo3ZSuuRlH9TpWyCp8ahxu3UicgL19ES//Sy1xPomWOi2Xk54/FLv/BIxgQ==", "requires": { - "archiver": "~0.6.1", - "async": "^0.9.0", - "chainit": "^2.1.1", - "css-parse": "^1.7.0", - "css-value": "0.0.1", - "deepmerge": "~0.2.7", - "pragma-singleton": "~1.0.3", - "q": "^1.1.2", - "request": "~2.34.0", - "rgb2hex": "^0.1.0", - "url": "^0.10.1", - "wgxpath": "^0.23.0" - }, - "dependencies": { - "asn1": { - "version": "0.1.11", - "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.1.11.tgz", - "integrity": "sha1-VZvhg3bQik7E2+gId9J4GGObLfc=", - "optional": true - }, - "assert-plus": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-0.1.5.tgz", - "integrity": "sha1-7nQAlBMALYTOxyGcasgRgS5yMWA=", - "optional": true - }, - "async": { - "version": "0.9.2", - "resolved": "https://registry.npmjs.org/async/-/async-0.9.2.tgz", - "integrity": "sha1-rqdNXmHB+JlhO/ZL2mbUx48v0X0=" - }, - "aws-sign2": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.5.0.tgz", - "integrity": "sha1-xXED96F/wDfwLXwuZLYC6iI/fWM=", - "optional": true - }, - "combined-stream": { - "version": "0.0.7", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-0.0.7.tgz", - "integrity": "sha1-ATfmV7qlp1QcV6w3rF/AfXO03B8=", - "optional": true, - "requires": { - "delayed-stream": "0.0.5" - } - }, - "delayed-stream": { - "version": "0.0.5", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-0.0.5.tgz", - "integrity": "sha1-1LH0OpPoKW3+AmlPRoC8N6MTxz8=", - "optional": true - }, - "forever-agent": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.5.2.tgz", - "integrity": "sha1-bQ4JxJIflKJ/Y9O0nF/v8epMUTA=" - }, - "form-data": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-0.1.4.tgz", - "integrity": "sha1-kavXiKupcCsaq/qLwBAxoqyeOxI=", - "optional": true, - "requires": { - "async": "~0.9.0", - "combined-stream": "~0.0.4", - "mime": "~1.2.11" - } - }, - "http-signature": { - "version": "0.10.1", - "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-0.10.1.tgz", - "integrity": "sha1-T72sEyVZqoMjEh5UB3nAoBKyfmY=", - "optional": true, - "requires": { - "asn1": "0.1.11", - "assert-plus": "^0.1.5", - "ctype": "0.5.3" - } - }, - "mime": { - "version": "1.2.11", - "resolved": "https://registry.npmjs.org/mime/-/mime-1.2.11.tgz", - "integrity": "sha1-WCA+7Ybjpe8XrtK32evUfwpg3RA=" - }, - "node-uuid": { - "version": "1.4.8", - "resolved": "https://registry.npmjs.org/node-uuid/-/node-uuid-1.4.8.tgz", - "integrity": "sha1-sEDrCSOWivq/jTL7HxfxFn/auQc=" - }, - "oauth-sign": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.3.0.tgz", - "integrity": "sha1-y1QPk7srIqfVlBaRoojWDo6pOG4=", - "optional": true - }, - "qs": { - "version": "0.6.6", - "resolved": "https://registry.npmjs.org/qs/-/qs-0.6.6.tgz", - "integrity": "sha1-bgFQmP9RlouKPIGQAdXyyJvEsQc=" - }, - "request": { - "version": "2.34.0", - "resolved": "https://registry.npmjs.org/request/-/request-2.34.0.tgz", - "integrity": "sha1-tdi5UmrdSi1GKfTUFxJFc5lkRa4=", - "requires": { - "aws-sign2": "~0.5.0", - "forever-agent": "~0.5.0", - "form-data": "~0.1.0", - "hawk": "~1.0.0", - "http-signature": "~0.10.0", - "json-stringify-safe": "~5.0.0", - "mime": "~1.2.9", - "node-uuid": "~1.4.0", - "oauth-sign": "~0.3.0", - "qs": "~0.6.0", - "tough-cookie": ">=0.12.0", - "tunnel-agent": "~0.3.0" - } - }, - "tunnel-agent": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.3.0.tgz", - "integrity": "sha1-rWgbaPUyGtKCfEz7G31d8s/pQu4=", - "optional": true - } + "@wdio/config": "^5.9.1", + "@wdio/logger": "^5.9.0", + "deepmerge": "^2.0.1", + "lodash.merge": "^4.6.1", + "request": "^2.83.0" } }, - "wgxpath": { - "version": "0.23.0", - "resolved": "https://registry.npmjs.org/wgxpath/-/wgxpath-0.23.0.tgz", - "integrity": "sha1-2z/IOJ2BhOluunA3SJc1wTYiep8=" + "webdriverio": { + "version": "5.9.1", + "resolved": "https://registry.npmjs.org/webdriverio/-/webdriverio-5.9.1.tgz", + "integrity": "sha512-QYlIIrfqr7I0OSkg9HsZyOGpo7d8MlrH7ueo5MHsgNR2QgZG1OxHk/1edV3Te9Q2AUcpCmIKO1IOAJDxlYA+Rw==", + "requires": { + "@wdio/config": "^5.9.1", + "@wdio/logger": "^5.9.0", + "@wdio/repl": "^5.9.1", + "css-value": "^0.0.1", + "grapheme-splitter": "^1.0.2", + "lodash.isobject": "^3.0.2", + "lodash.isplainobject": "^4.0.6", + "lodash.merge": "^4.6.1", + "lodash.zip": "^4.2.0", + "resq": "^1.5.0", + "rgb2hex": "^0.1.0", + "serialize-error": "^3.0.0", + "webdriver": "^5.9.1" + } }, "which": { "version": "1.3.1", @@ -11465,39 +11198,6 @@ "requires": { "fd-slicer": "~1.0.1" } - }, - "zip-stream": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/zip-stream/-/zip-stream-0.2.3.tgz", - "integrity": "sha1-rvCVN2z+E4lZqBNBmB0mM4tG2NM=", - "requires": { - "debug": "~0.7.4", - "lodash.defaults": "~2.4.1", - "readable-stream": "~1.0.24" - }, - "dependencies": { - "debug": { - "version": "0.7.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-0.7.4.tgz", - "integrity": "sha1-BuHqgILCyxTjmAbiLi9vdX+Srzk=" - }, - "isarray": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=" - }, - "readable-stream": { - "version": "1.0.34", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", - "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.1", - "isarray": "0.0.1", - "string_decoder": "~0.10.x" - } - } - } } } } diff --git a/script/package.json b/script/package.json index 1076c63a9..d72c8d5a5 100644 --- a/script/package.json +++ b/script/package.json @@ -46,7 +46,7 @@ "sync-request": "3.0.1", "tello": "1.0.7", "terser": "^3.8.1", - "webdriverio": "2.4.5", + "webdriverio": "^5.9.1", "yargs": "4.8.1" } } diff --git a/spec/integration/helpers/start-atom.coffee b/spec/integration/helpers/start-atom.coffee deleted file mode 100644 index 4820a7120..000000000 --- a/spec/integration/helpers/start-atom.coffee +++ /dev/null @@ -1,165 +0,0 @@ -path = require 'path' -http = require 'http' -temp = require('temp').track() -os = require('os') -remote = require 'remote' -async = require 'async' -{map, extend, once, difference} = require 'underscore-plus' -{spawn, spawnSync} = require 'child_process' -webdriverio = require '../../../script/node_modules/webdriverio' - -AtomPath = remote.process.argv[0] -AtomLauncherPath = path.join(__dirname, "..", "helpers", "atom-launcher.sh") -ChromedriverPath = path.resolve(__dirname, '..', '..', '..', 'script', 'node_modules', 'electron-chromedriver', 'bin', 'chromedriver') -ChromedriverPort = 9515 -ChromedriverURLBase = "/wd/hub" -ChromedriverStatusURL = "http://localhost:#{ChromedriverPort}#{ChromedriverURLBase}/status" - -userDataDir = null - -chromeDriverUp = (done) -> - checkStatus = -> - http - .get ChromedriverStatusURL, (response) -> - if response.statusCode is 200 - done() - else - chromeDriverUp(done) - .on("error", -> chromeDriverUp(done)) - setTimeout(checkStatus, 100) - -chromeDriverDown = (done) -> - checkStatus = -> - http - .get ChromedriverStatusURL, (response) -> - chromeDriverDown(done) - .on("error", done) - setTimeout(checkStatus, 100) - -buildAtomClient = (args, env) -> - userDataDir = temp.mkdirSync('atom-user-data-dir') - client = webdriverio.remote( - host: 'localhost' - port: ChromedriverPort - desiredCapabilities: - browserName: "atom" - chromeOptions: - binary: AtomLauncherPath - args: [ - "atom-path=#{AtomPath}" - "atom-args=#{args.join(" ")}" - "atom-env=#{map(env, (value, key) -> "#{key}=#{value}").join(" ")}" - "dev" - "safe" - "user-data-dir=#{userDataDir}" - ]) - - isRunning = false - client.on "init", -> isRunning = true - client.on "end", -> isRunning = false - - client - .addCommand "waitUntil", (conditionFn, timeout, cb) -> - timedOut = succeeded = false - pollingInterval = Math.min(timeout, 100) - setTimeout((-> timedOut = true), timeout) - async.until( - (-> succeeded or timedOut), - ((next) => - setTimeout(=> - conditionFn.call(this).then( - ((result) -> - succeeded = result - next()), - ((err) -> next(err)) - ) - , pollingInterval)), - ((err) -> cb(err, succeeded))) - - .addCommand "waitForWindowCount", (count, timeout, cb) -> - @waitUntil(-> - @windowHandles().then ({value}) -> value.length is count - , timeout) - .then (result) -> expect(result).toBe(true) - .windowHandles(cb) - - .addCommand "waitForPaneItemCount", (count, timeout, cb) -> - @waitUntil(-> - @execute(-> atom.workspace?.getActivePane()?.getItems().length) - .then(({value}) -> value is count) - , timeout) - .then (result) -> - expect(result).toBe(true) - cb(null) - - .addCommand "treeViewRootDirectories", (cb) -> - @waitForExist('.tree-view', 10000) - .execute(-> - for element in document.querySelectorAll(".tree-view .project-root > .header .name") - element.dataset.path - , cb) - - .addCommand "waitForNewWindow", (fn, timeout, done) -> - @windowHandles (err, {value: oldWindowHandles}) -> - return done() unless isRunning - @call(fn) - .waitForWindowCount(oldWindowHandles.length + 1, 5000) - .then ({value: newWindowHandles}) -> - [newWindowHandle] = difference(newWindowHandles, oldWindowHandles) - return done() unless newWindowHandle - @window(newWindowHandle) - .waitForExist('atom-workspace', 10000, done) - - .addCommand "dispatchCommand", (command, done) -> - @execute "atom.commands.dispatch(document.activeElement, '#{command}')" - .call(done) - -module.exports = (args, env, fn) -> - [chromedriver, chromedriverLogs, chromedriverExit] = [] - - runs -> - chromedriver = spawn(ChromedriverPath, [ - "--verbose", - "--port=#{ChromedriverPort}", - "--url-base=#{ChromedriverURLBase}" - ]) - - chromedriverLogs = [] - chromedriverExit = new Promise (resolve) -> - errorCode = null - chromedriver.on "exit", (code, signal) -> - errorCode = code unless signal? - chromedriver.stderr.on "data", (log) -> - chromedriverLogs.push(log.toString()) - chromedriver.stderr.on "close", -> - resolve(errorCode) - - waitsFor("webdriver to start", chromeDriverUp, 15000) - - waitsFor("tests to run", (done) -> - finish = once -> - client.end() - .then(-> chromedriver.kill()) - .then(chromedriverExit.then( - (errorCode) -> - if errorCode? - jasmine.getEnv().currentSpec.fail """ - Chromedriver exited with code #{errorCode}. - Logs:\n#{chromedriverLogs.join("\n")} - """ - done())) - - client = buildAtomClient(args, env) - - client.on "error", (err) -> - jasmine.getEnv().currentSpec.fail(new Error(err.response?.body?.value?.message)) - finish() - - fn( - client.init() - .waitUntil((-> @windowHandles().then ({value}) -> value.length > 0), 10000) - .waitForExist("atom-workspace", 10000) - ).then(finish) - , 30000) - - waitsFor("webdriver to stop", chromeDriverDown, 15000) diff --git a/spec/integration/helpers/start-atom.js b/spec/integration/helpers/start-atom.js new file mode 100644 index 000000000..a8967ed25 --- /dev/null +++ b/spec/integration/helpers/start-atom.js @@ -0,0 +1,155 @@ +const path = require('path') +const http = require('http') +const temp = require('temp').track() +const os = require('os') +const remote = require('remote') +const async = require('async') +const {map, extend, once, difference} = require('underscore-plus') +const {spawn, spawnSync} = require('child_process') +const webdriverio = require('../../../script/node_modules/webdriverio') + +const AtomPath = remote.process.argv[0] +const AtomLauncherPath = path.join(__dirname, '..', 'helpers', 'atom-launcher.cmd') +const ChromedriverPath = path.resolve(__dirname, '..', '..', '..', 'script', 'node_modules', 'electron-chromedriver', 'bin', 'chromedriver') +const ChromedriverPort = 9515 +const ChromedriverURLBase = '/wd/hub' +const ChromedriverStatusURL = `http://localhost:${ChromedriverPort}${ChromedriverURLBase}/status` + +let userDataDir = null + +const chromeDriverUp = done => { + const checkStatus = () => + http.get(ChromedriverStatusURL, function(response) { + if (response.statusCode === 200) { + done() + } else { + chromeDriverUp(done) + } + }).on('error', () => chromeDriverUp(done)) + + setTimeout(checkStatus, 100) +} + +const chromeDriverDown = done => { + const checkStatus = () => + http.get(ChromedriverStatusURL, response => chromeDriverDown(done)).on('error', done) + + setTimeout(checkStatus, 100) +} + +const buildAtomClient = async (args, env) => { + userDataDir = temp.mkdirSync('atom-user-data-dir') + console.log('awaiting webdriverio') + let client + try { + client = await webdriverio.remote({ + host: 'localhost', + port: ChromedriverPort, + capabilities: { + browserName: 'atom', + chromeOptions: { + binary: AtomLauncherPath, + args: [ + `atom-path=${AtomPath}`, + `atom-args=${args.join(' ')}`, + `atom-env=${map(env, (value, key) => `${key}=${value}`).join(' ')}`, + 'dev', + 'safe', + `user-data-dir=${userDataDir}` + ] + } + } + }) + } catch (error) { + console.log(error) + } + + console.log('about to build client') + + return client.addCommand('waitForWindowCount', async function (count, timeout) { + await this.waitUntil(() => this.getWindowHandles().length === count, timeout) + return this.getWindowHandles() + }).addCommand('waitForPaneItemCount', async function (count, timeout) { + await this.waitUntil(() => this.execute(() => { + if (atom.workspace) { + return atom.workspace.getActivePane().getItems().length + } + return 0 + }), timeout) + }).addCommand('treeViewRootDirectories', async function () { + await $('.tree-view').waitForExist(10000) + return this.execute(() => + Array.from(document.querySelectorAll('.tree-view .project-root > .header .name')) + .map(element => element.dataset.path) + ) + }).addCommand('dispatchCommand', async function (command) { + return this.execute(async () => atom.commands.dispatch(document.activeElement, command)) + }) +} + +module.exports = function(args, env, fn) { + let [chromedriver, chromedriverLogs, chromedriverExit] = [] + + // runs(() => { + // chromedriver = spawn(ChromedriverPath, [ + // '--verbose', + // `--port=${ChromedriverPort}`, + // `--url-base=${ChromedriverURLBase}` + // ]) + // + // chromedriverLogs = [] + // chromedriverExit = new Promise(resolve => { + // let errorCode = null + // chromedriver.on('exit', (code, signal) => { + // if (signal == null) { + // errorCode = code + // } + // }) + // chromedriver.stdout.on('data', log => console.log(log.toString())) + // chromedriver.stderr.on('data', log => console.log(log.toString())) + // // chromedriver.stderr.on('data', log => chromedriverLogs.push(log.toString())) + // chromedriver.stderr.on('close', () => resolve(errorCode)) + // }) + // }) + // + // waitsFor('webdriver to start', chromeDriverUp, 15000) + + waitsFor('tests to run', async done => { + const client = await buildAtomClient(args, env) + + console.log('finished waiting for client') + + const finish = once(async () => { + chromedriver.kill() + const errorCode = await chromedriverExit + if (errorCode != null) { + jasmine.getEnv().currentSpec.fail(`\ +Chromedriver exited with code ${errorCode}. +Logs:\n${chromedriverLogs.join('\n')}\ +` + ) + } + done() + }) + + // client.on('error', err => { + // jasmine.getEnv().currentSpec.fail(new Error(__guard__(__guard__(err.response != null ? err.response.body : undefined, x1 => x1.value), x => x.message))) + // finish() + // }) + + await client.waitUntil(() => this.getWindowHandles().length > 0, 10000) + await $('atom-workspace').waitForExist(10000) + + console.log('about to wait on fn') + + await fn(client) + finish() + } + , 30000) + + waitsFor('webdriver to stop', chromeDriverDown, 15000) +} + +function __guard__(value, transform) { + return (typeof value !== 'undefined' && value !== null) ? transform(value) : undefined +} diff --git a/spec/integration/smoke-spec.coffee b/spec/integration/smoke-spec.coffee deleted file mode 100644 index dd6c9776f..000000000 --- a/spec/integration/smoke-spec.coffee +++ /dev/null @@ -1,42 +0,0 @@ -fs = require 'fs-plus' -path = require 'path' -season = require 'season' -temp = require('temp').track() -runAtom = require './helpers/start-atom' - -describe "Smoke Test", -> - return unless process.platform is 'darwin' # Fails on win32 - - atomHome = temp.mkdirSync('atom-home') - - beforeEach -> - jasmine.useRealClock() - season.writeFileSync(path.join(atomHome, 'config.cson'), { - '*': { - welcome: {showOnStartup: false}, - core: { - telemetryConsent: 'no', - disabledPackages: ['github'] - } - } - }) - - it "can open a file in Atom and perform basic operations on it", -> - tempDirPath = temp.mkdirSync("empty-dir") - filePath = path.join(tempDirPath, "new-file") - - fs.writeFileSync filePath, "", {encoding: "utf8"} - - runAtom [filePath], {ATOM_HOME: atomHome}, (client) -> - client - .treeViewRootDirectories() - .then ({value}) -> expect(value).toEqual([]) - .waitForExist("atom-text-editor", 5000) - .then (exists) -> expect(exists).toBe true - .waitForPaneItemCount(1, 1000) - .click("atom-text-editor") - .waitUntil((-> @execute(-> document.activeElement.closest('atom-text-editor'))), 5000) - .keys("Hello!") - .execute -> atom.workspace.getActiveTextEditor().getText() - .then ({value}) -> expect(value).toBe "Hello!" - .dispatchCommand("editor:delete-line") diff --git a/spec/integration/smoke-spec.js b/spec/integration/smoke-spec.js new file mode 100644 index 000000000..0b8526499 --- /dev/null +++ b/spec/integration/smoke-spec.js @@ -0,0 +1,55 @@ +const fs = require('fs-plus') +const path = require('path') +const season = require('season') +const temp = require('temp').track() +const runAtom = require('./helpers/start-atom') + +describe('Smoke Test', () => { + // Fails on win32 + if (process.platform !== 'darwin') { + return + } + + const atomHome = temp.mkdirSync('atom-home') + + beforeEach(() => { + jasmine.useRealClock() + season.writeFileSync(path.join(atomHome, 'config.cson'), { + '*': { + welcome: {showOnStartup: false}, + core: { + telemetryConsent: 'no', + disabledPackages: ['github'] + } + } + }) + }) + + it('can open a file in Atom and perform basic operations on it', async () => { + const tempDirPath = temp.mkdirSync('empty-dir') + const filePath = path.join(tempDirPath, 'new-file') + + fs.writeFileSync(filePath, '', {encoding: 'utf8'}) + + runAtom([filePath], {ATOM_HOME: atomHome}, async client => { + console.log('here!') + const roots = await client.treeViewRootDirectories() + expect(roots).toEqual([]) + + await $('atom-text-editor').waitForExist(5000) + + await client.waitForPaneItemCount(1, 1000) + + $('atom-text-editor').click() + + await client.waitUntil(function () { + return this.execute(() => document.activeElement.closest('atom-text-editor')) + }, 5000) + + const text = client.keys('Hello!').execute(() => atom.workspace.getActiveTextEditor().getText()) + expect(text).toBe('Hello!') + + await client.dispatchCommand('editor:delete-line') + }) + }) +}) From bc0e0a0ffe208aeef89be70b13747286abf39ae3 Mon Sep 17 00:00:00 2001 From: Winston Liu <50Wliu@users.noreply.github.com> Date: Thu, 23 May 2019 23:15:42 -0400 Subject: [PATCH 02/29] Lint --- spec/integration/helpers/start-atom.js | 68 ++++++++++++-------------- spec/integration/smoke-spec.js | 5 +- 2 files changed, 32 insertions(+), 41 deletions(-) diff --git a/spec/integration/helpers/start-atom.js b/spec/integration/helpers/start-atom.js index a8967ed25..d14d96026 100644 --- a/spec/integration/helpers/start-atom.js +++ b/spec/integration/helpers/start-atom.js @@ -1,11 +1,11 @@ const path = require('path') const http = require('http') const temp = require('temp').track() -const os = require('os') +// const os = require('os') const remote = require('remote') -const async = require('async') -const {map, extend, once, difference} = require('underscore-plus') -const {spawn, spawnSync} = require('child_process') +// const async = require('async') +const {map, once} = require('underscore-plus') +const {spawn} = require('child_process') const webdriverio = require('../../../script/node_modules/webdriverio') const AtomPath = remote.process.argv[0] @@ -64,8 +64,6 @@ const buildAtomClient = async (args, env) => { console.log(error) } - console.log('about to build client') - return client.addCommand('waitForWindowCount', async function (count, timeout) { await this.waitUntil(() => this.getWindowHandles().length === count, timeout) return this.getWindowHandles() @@ -77,7 +75,7 @@ const buildAtomClient = async (args, env) => { return 0 }), timeout) }).addCommand('treeViewRootDirectories', async function () { - await $('.tree-view').waitForExist(10000) + await this.$('.tree-view').waitForExist(10000) return this.execute(() => Array.from(document.querySelectorAll('.tree-view .project-root > .header .name')) .map(element => element.dataset.path) @@ -90,35 +88,31 @@ const buildAtomClient = async (args, env) => { module.exports = function(args, env, fn) { let [chromedriver, chromedriverLogs, chromedriverExit] = [] - // runs(() => { - // chromedriver = spawn(ChromedriverPath, [ - // '--verbose', - // `--port=${ChromedriverPort}`, - // `--url-base=${ChromedriverURLBase}` - // ]) - // - // chromedriverLogs = [] - // chromedriverExit = new Promise(resolve => { - // let errorCode = null - // chromedriver.on('exit', (code, signal) => { - // if (signal == null) { - // errorCode = code - // } - // }) - // chromedriver.stdout.on('data', log => console.log(log.toString())) - // chromedriver.stderr.on('data', log => console.log(log.toString())) - // // chromedriver.stderr.on('data', log => chromedriverLogs.push(log.toString())) - // chromedriver.stderr.on('close', () => resolve(errorCode)) - // }) - // }) - // - // waitsFor('webdriver to start', chromeDriverUp, 15000) + runs(() => { + chromedriver = spawn(ChromedriverPath, [ + '--verbose', + `--port=${ChromedriverPort}`, + `--url-base=${ChromedriverURLBase}` + ]) + + chromedriverLogs = [] + chromedriverExit = new Promise(resolve => { + let errorCode = null + chromedriver.on('exit', (code, signal) => { + if (signal == null) { + errorCode = code + } + }) + chromedriver.stderr.on('data', log => chromedriverLogs.push(log.toString())) + chromedriver.stderr.on('close', () => resolve(errorCode)) + }) + }) + + waitsFor('webdriver to start', chromeDriverUp, 15000) waitsFor('tests to run', async done => { const client = await buildAtomClient(args, env) - console.log('finished waiting for client') - const finish = once(async () => { chromedriver.kill() const errorCode = await chromedriverExit @@ -138,9 +132,7 @@ Logs:\n${chromedriverLogs.join('\n')}\ // }) await client.waitUntil(() => this.getWindowHandles().length > 0, 10000) - await $('atom-workspace').waitForExist(10000) - - console.log('about to wait on fn') + await client.$('atom-workspace').waitForExist(10000) await fn(client) finish() @@ -150,6 +142,6 @@ Logs:\n${chromedriverLogs.join('\n')}\ waitsFor('webdriver to stop', chromeDriverDown, 15000) } -function __guard__(value, transform) { - return (typeof value !== 'undefined' && value !== null) ? transform(value) : undefined -} +// function __guard__(value, transform) { +// return (typeof value !== 'undefined' && value !== null) ? transform(value) : undefined +// } diff --git a/spec/integration/smoke-spec.js b/spec/integration/smoke-spec.js index 0b8526499..63a8528a0 100644 --- a/spec/integration/smoke-spec.js +++ b/spec/integration/smoke-spec.js @@ -32,15 +32,14 @@ describe('Smoke Test', () => { fs.writeFileSync(filePath, '', {encoding: 'utf8'}) runAtom([filePath], {ATOM_HOME: atomHome}, async client => { - console.log('here!') const roots = await client.treeViewRootDirectories() expect(roots).toEqual([]) - await $('atom-text-editor').waitForExist(5000) + await client.$('atom-text-editor').waitForExist(5000) await client.waitForPaneItemCount(1, 1000) - $('atom-text-editor').click() + client.$('atom-text-editor').click() await client.waitUntil(function () { return this.execute(() => document.activeElement.closest('atom-text-editor')) From 76e122274d3101657b99f01d38f330ddeedb1d07 Mon Sep 17 00:00:00 2001 From: Winston Liu <50Wliu@users.noreply.github.com> Date: Fri, 24 May 2019 09:50:53 -0400 Subject: [PATCH 03/29] =?UTF-8?q?=F0=9F=99=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- spec/integration/helpers/start-atom.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/integration/helpers/start-atom.js b/spec/integration/helpers/start-atom.js index d14d96026..b94fcc05b 100644 --- a/spec/integration/helpers/start-atom.js +++ b/spec/integration/helpers/start-atom.js @@ -9,7 +9,7 @@ const {spawn} = require('child_process') const webdriverio = require('../../../script/node_modules/webdriverio') const AtomPath = remote.process.argv[0] -const AtomLauncherPath = path.join(__dirname, '..', 'helpers', 'atom-launcher.cmd') +const AtomLauncherPath = path.join(__dirname, '..', 'helpers', 'atom-launcher.sh') const ChromedriverPath = path.resolve(__dirname, '..', '..', '..', 'script', 'node_modules', 'electron-chromedriver', 'bin', 'chromedriver') const ChromedriverPort = 9515 const ChromedriverURLBase = '/wd/hub' From 2d4eb542e93a4b5f8a61a4ed8af7c302f820602e Mon Sep 17 00:00:00 2001 From: Winston Liu <50Wliu@users.noreply.github.com> Date: Fri, 24 May 2019 09:51:25 -0400 Subject: [PATCH 04/29] Focus it --- spec/integration/smoke-spec.js | 2 +- spec/jasmine-test-runner.coffee | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/integration/smoke-spec.js b/spec/integration/smoke-spec.js index 63a8528a0..4b24dbe2b 100644 --- a/spec/integration/smoke-spec.js +++ b/spec/integration/smoke-spec.js @@ -4,7 +4,7 @@ const season = require('season') const temp = require('temp').track() const runAtom = require('./helpers/start-atom') -describe('Smoke Test', () => { +fdescribe('Smoke Test', () => { // Fails on win32 if (process.platform !== 'darwin') { return diff --git a/spec/jasmine-test-runner.coffee b/spec/jasmine-test-runner.coffee index 5b8662c14..1cb21763f 100644 --- a/spec/jasmine-test-runner.coffee +++ b/spec/jasmine-test-runner.coffee @@ -51,7 +51,7 @@ module.exports = ({logFile, headless, testPaths, buildAtomEnvironment}) -> }) require './spec-helper' - disableFocusMethods() if process.env.JANKY_SHA1 or process.env.CI + # disableFocusMethods() if process.env.JANKY_SHA1 or process.env.CI requireSpecs(testPath) for testPath in testPaths setSpecType('user') From 027b433953a6e5234b7236758a3bc75575dc8092 Mon Sep 17 00:00:00 2001 From: Winston Liu <50Wliu@users.noreply.github.com> Date: Fri, 24 May 2019 10:16:01 -0400 Subject: [PATCH 05/29] Log it all --- spec/integration/helpers/start-atom.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spec/integration/helpers/start-atom.js b/spec/integration/helpers/start-atom.js index b94fcc05b..d9c3d72ae 100644 --- a/spec/integration/helpers/start-atom.js +++ b/spec/integration/helpers/start-atom.js @@ -103,7 +103,9 @@ module.exports = function(args, env, fn) { errorCode = code } }) - chromedriver.stderr.on('data', log => chromedriverLogs.push(log.toString())) + chromedriver.stdout.on('data', log => console.log(log.toString())) + chromedriver.stderr.on('data', log => console.log(log.toString())) + // chromedriver.stderr.on('data', log => chromedriverLogs.push(log.toString())) chromedriver.stderr.on('close', () => resolve(errorCode)) }) }) From 05233b98578908ae776e31563f37f3ecefd33784 Mon Sep 17 00:00:00 2001 From: Winston Liu <50Wliu@users.noreply.github.com> Date: Fri, 24 May 2019 11:37:45 -0400 Subject: [PATCH 06/29] Whole lot of debug code --- spec/integration/helpers/start-atom.js | 6 ++++++ spec/integration/smoke-spec.js | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/spec/integration/helpers/start-atom.js b/spec/integration/helpers/start-atom.js index d9c3d72ae..55d519345 100644 --- a/spec/integration/helpers/start-atom.js +++ b/spec/integration/helpers/start-atom.js @@ -117,6 +117,8 @@ module.exports = function(args, env, fn) { const finish = once(async () => { chromedriver.kill() + + console.log('>>> Waiting for exit code') const errorCode = await chromedriverExit if (errorCode != null) { jasmine.getEnv().currentSpec.fail(`\ @@ -133,9 +135,13 @@ Logs:\n${chromedriverLogs.join('\n')}\ // finish() // }) + console.log('>>> Waiting for window to exist') await client.waitUntil(() => this.getWindowHandles().length > 0, 10000) + + console.log('>>> Waiting for workspace to exist') await client.$('atom-workspace').waitForExist(10000) + console.log('>>> Waiting for test to run') await fn(client) finish() } diff --git a/spec/integration/smoke-spec.js b/spec/integration/smoke-spec.js index 4b24dbe2b..430896451 100644 --- a/spec/integration/smoke-spec.js +++ b/spec/integration/smoke-spec.js @@ -32,15 +32,19 @@ fdescribe('Smoke Test', () => { fs.writeFileSync(filePath, '', {encoding: 'utf8'}) runAtom([filePath], {ATOM_HOME: atomHome}, async client => { + console.log('>>> Waiting for root directories') const roots = await client.treeViewRootDirectories() expect(roots).toEqual([]) + console.log('>>> Waiting for editor to exist') await client.$('atom-text-editor').waitForExist(5000) + console.log('>>> Waiting for there to be one pane item') await client.waitForPaneItemCount(1, 1000) client.$('atom-text-editor').click() + console.log('Waiting for active element to be atom-text-editor') await client.waitUntil(function () { return this.execute(() => document.activeElement.closest('atom-text-editor')) }, 5000) @@ -48,7 +52,10 @@ fdescribe('Smoke Test', () => { const text = client.keys('Hello!').execute(() => atom.workspace.getActiveTextEditor().getText()) expect(text).toBe('Hello!') + console.log('Waiting to delete line') await client.dispatchCommand('editor:delete-line') + + console.log('Done!') }) }) }) From cdfd37d4c50c11736739ec4bdd4ea526c36be2e3 Mon Sep 17 00:00:00 2001 From: Winston Liu <50Wliu@users.noreply.github.com> Date: Fri, 24 May 2019 13:45:17 -0400 Subject: [PATCH 07/29] ??? --- spec/integration/helpers/start-atom.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/spec/integration/helpers/start-atom.js b/spec/integration/helpers/start-atom.js index 55d519345..e9f04bb81 100644 --- a/spec/integration/helpers/start-atom.js +++ b/spec/integration/helpers/start-atom.js @@ -39,7 +39,7 @@ const chromeDriverDown = done => { const buildAtomClient = async (args, env) => { userDataDir = temp.mkdirSync('atom-user-data-dir') - console.log('awaiting webdriverio') + console.log('>>> Waiting for webdriverio') let client try { client = await webdriverio.remote({ @@ -64,6 +64,8 @@ const buildAtomClient = async (args, env) => { console.log(error) } + console.log('>>> Building client') + return client.addCommand('waitForWindowCount', async function (count, timeout) { await this.waitUntil(() => this.getWindowHandles().length === count, timeout) return this.getWindowHandles() @@ -113,6 +115,7 @@ module.exports = function(args, env, fn) { waitsFor('webdriver to start', chromeDriverUp, 15000) waitsFor('tests to run', async done => { + console.log('>>> Waiting for Atom client') const client = await buildAtomClient(args, env) const finish = once(async () => { From 1db4324d66cb724ade1e3e9552b3417a1150a474 Mon Sep 17 00:00:00 2001 From: Winston Liu <50Wliu@users.noreply.github.com> Date: Fri, 24 May 2019 15:02:54 -0400 Subject: [PATCH 08/29] Not sure if addCommand returns anything... --- spec/integration/helpers/start-atom.js | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/spec/integration/helpers/start-atom.js b/spec/integration/helpers/start-atom.js index e9f04bb81..8c3baf063 100644 --- a/spec/integration/helpers/start-atom.js +++ b/spec/integration/helpers/start-atom.js @@ -64,27 +64,40 @@ const buildAtomClient = async (args, env) => { console.log(error) } - console.log('>>> Building client') + console.log('>>> Adding waitForWindowCount') - return client.addCommand('waitForWindowCount', async function (count, timeout) { + client.addCommand('waitForWindowCount', async function (count, timeout) { await this.waitUntil(() => this.getWindowHandles().length === count, timeout) return this.getWindowHandles() - }).addCommand('waitForPaneItemCount', async function (count, timeout) { + }) + console.log('>>> Adding waitForPaneItemCount') + client.addCommand('waitForPaneItemCount', async function (count, timeout) { await this.waitUntil(() => this.execute(() => { if (atom.workspace) { return atom.workspace.getActivePane().getItems().length } return 0 }), timeout) - }).addCommand('treeViewRootDirectories', async function () { + }) + console.log('>>> Adding treeViewRootDirectories') + client.addCommand('treeViewRootDirectories', async function () { await this.$('.tree-view').waitForExist(10000) return this.execute(() => Array.from(document.querySelectorAll('.tree-view .project-root > .header .name')) .map(element => element.dataset.path) ) - }).addCommand('dispatchCommand', async function (command) { + }) + console.log('>>> Adding dispatchCommand') + const test = client.addCommand('dispatchCommand', async function (command) { return this.execute(async () => atom.commands.dispatch(document.activeElement, command)) }) + + console.log('>>> addCommand returns: ') + console.log(test) + + console.log('>>> Returning client') + + return client } module.exports = function(args, env, fn) { From b9817ace02d894dcd30198a12948d6224c02206a Mon Sep 17 00:00:00 2001 From: Winston Liu <50Wliu@users.noreply.github.com> Date: Fri, 24 May 2019 16:42:21 -0400 Subject: [PATCH 09/29] Progress! --- spec/integration/helpers/start-atom.js | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/spec/integration/helpers/start-atom.js b/spec/integration/helpers/start-atom.js index 8c3baf063..10554979f 100644 --- a/spec/integration/helpers/start-atom.js +++ b/spec/integration/helpers/start-atom.js @@ -39,7 +39,6 @@ const chromeDriverDown = done => { const buildAtomClient = async (args, env) => { userDataDir = temp.mkdirSync('atom-user-data-dir') - console.log('>>> Waiting for webdriverio') let client try { client = await webdriverio.remote({ @@ -64,13 +63,10 @@ const buildAtomClient = async (args, env) => { console.log(error) } - console.log('>>> Adding waitForWindowCount') - client.addCommand('waitForWindowCount', async function (count, timeout) { await this.waitUntil(() => this.getWindowHandles().length === count, timeout) return this.getWindowHandles() }) - console.log('>>> Adding waitForPaneItemCount') client.addCommand('waitForPaneItemCount', async function (count, timeout) { await this.waitUntil(() => this.execute(() => { if (atom.workspace) { @@ -79,7 +75,6 @@ const buildAtomClient = async (args, env) => { return 0 }), timeout) }) - console.log('>>> Adding treeViewRootDirectories') client.addCommand('treeViewRootDirectories', async function () { await this.$('.tree-view').waitForExist(10000) return this.execute(() => @@ -87,16 +82,10 @@ const buildAtomClient = async (args, env) => { .map(element => element.dataset.path) ) }) - console.log('>>> Adding dispatchCommand') const test = client.addCommand('dispatchCommand', async function (command) { return this.execute(async () => atom.commands.dispatch(document.activeElement, command)) }) - console.log('>>> addCommand returns: ') - console.log(test) - - console.log('>>> Returning client') - return client } @@ -128,7 +117,6 @@ module.exports = function(args, env, fn) { waitsFor('webdriver to start', chromeDriverUp, 15000) waitsFor('tests to run', async done => { - console.log('>>> Waiting for Atom client') const client = await buildAtomClient(args, env) const finish = once(async () => { @@ -152,7 +140,11 @@ Logs:\n${chromedriverLogs.join('\n')}\ // }) console.log('>>> Waiting for window to exist') - await client.waitUntil(() => this.getWindowHandles().length > 0, 10000) + try { + await client.waitUntil(() => this.getWindowHandles().length > 0, 10000) + } catch (error) { + console.log(error) + } console.log('>>> Waiting for workspace to exist') await client.$('atom-workspace').waitForExist(10000) From a2af8ec9ca63d452bdeead4d04d9c8da083d61b5 Mon Sep 17 00:00:00 2001 From: Winston Liu <50Wliu@users.noreply.github.com> Date: Fri, 24 May 2019 17:00:37 -0400 Subject: [PATCH 10/29] Lint --- spec/integration/helpers/start-atom.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/integration/helpers/start-atom.js b/spec/integration/helpers/start-atom.js index 10554979f..f4f669af3 100644 --- a/spec/integration/helpers/start-atom.js +++ b/spec/integration/helpers/start-atom.js @@ -82,7 +82,7 @@ const buildAtomClient = async (args, env) => { .map(element => element.dataset.path) ) }) - const test = client.addCommand('dispatchCommand', async function (command) { + client.addCommand('dispatchCommand', async function (command) { return this.execute(async () => atom.commands.dispatch(document.activeElement, command)) }) From bb74186003418898eff46e52358f39d1d6f6dc99 Mon Sep 17 00:00:00 2001 From: Winston Liu <50Wliu@users.noreply.github.com> Date: Fri, 24 May 2019 18:08:48 -0400 Subject: [PATCH 11/29] Scoping --- spec/integration/helpers/start-atom.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/spec/integration/helpers/start-atom.js b/spec/integration/helpers/start-atom.js index f4f669af3..9f9003101 100644 --- a/spec/integration/helpers/start-atom.js +++ b/spec/integration/helpers/start-atom.js @@ -141,13 +141,20 @@ Logs:\n${chromedriverLogs.join('\n')}\ console.log('>>> Waiting for window to exist') try { - await client.waitUntil(() => this.getWindowHandles().length > 0, 10000) + await client.waitUntil(function () { + return this.getWindowHandles().length > 0 + }, 10000) } catch (error) { console.log(error) } console.log('>>> Waiting for workspace to exist') - await client.$('atom-workspace').waitForExist(10000) + try { + await client.$('atom-workspace').waitForExist(10000) + } catch (error) { + console.log(error) + jasmine.getEnv().currentSpec.fail(':(') + } console.log('>>> Waiting for test to run') await fn(client) From 8870380a2949b1ec4819fa4290218989bc445256 Mon Sep 17 00:00:00 2001 From: Winston Liu <50Wliu@users.noreply.github.com> Date: Fri, 24 May 2019 20:26:33 -0400 Subject: [PATCH 12/29] Looks like there are windows being returned... --- spec/integration/helpers/start-atom.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/spec/integration/helpers/start-atom.js b/spec/integration/helpers/start-atom.js index 9f9003101..18eed9dc4 100644 --- a/spec/integration/helpers/start-atom.js +++ b/spec/integration/helpers/start-atom.js @@ -142,6 +142,7 @@ Logs:\n${chromedriverLogs.join('\n')}\ console.log('>>> Waiting for window to exist') try { await client.waitUntil(function () { + console.log('>>> Window handles: ' + this.getWindowHandles().length) return this.getWindowHandles().length > 0 }, 10000) } catch (error) { @@ -150,6 +151,8 @@ Logs:\n${chromedriverLogs.join('\n')}\ console.log('>>> Waiting for workspace to exist') try { + console.log('>>> Return value of selector:') + console.log(await client.$('atom-workspace')) await client.$('atom-workspace').waitForExist(10000) } catch (error) { console.log(error) From b58243c93b0eff169609dffc5e455de2b505c660 Mon Sep 17 00:00:00 2001 From: Winston Liu <50Wliu@users.noreply.github.com> Date: Fri, 24 May 2019 20:26:38 -0400 Subject: [PATCH 13/29] Speed up CI --- script/test | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/script/test b/script/test index adb8a5123..5b38c4b3a 100755 --- a/script/test +++ b/script/test @@ -201,7 +201,8 @@ function testSuitesForPlatform (platform) { let suites = [] switch (platform) { case 'darwin': - suites = [runCoreMainProcessTests, runCoreRenderProcessTests, runBenchmarkTests].concat(packageTestSuites) + // suites = [runCoreMainProcessTests, runCoreRenderProcessTests, runBenchmarkTests].concat(packageTestSuites) + suites = [runCoreRenderProcessTests] break case 'win32': suites = (process.arch === 'x64') ? [runCoreMainProcessTests, runCoreRenderProcessTests] : [runCoreMainProcessTests] From 8728e9f1e1e10f8cb27f8a1f68316c1c9631fd43 Mon Sep 17 00:00:00 2001 From: Winston Liu <50Wliu@users.noreply.github.com> Date: Fri, 24 May 2019 21:00:55 -0400 Subject: [PATCH 14/29] Thanks documentation for not giving any hint whatsoever that it's async --- spec/integration/helpers/start-atom.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/spec/integration/helpers/start-atom.js b/spec/integration/helpers/start-atom.js index 18eed9dc4..00a525f2f 100644 --- a/spec/integration/helpers/start-atom.js +++ b/spec/integration/helpers/start-atom.js @@ -63,10 +63,6 @@ const buildAtomClient = async (args, env) => { console.log(error) } - client.addCommand('waitForWindowCount', async function (count, timeout) { - await this.waitUntil(() => this.getWindowHandles().length === count, timeout) - return this.getWindowHandles() - }) client.addCommand('waitForPaneItemCount', async function (count, timeout) { await this.waitUntil(() => this.execute(() => { if (atom.workspace) { @@ -141,9 +137,9 @@ Logs:\n${chromedriverLogs.join('\n')}\ console.log('>>> Waiting for window to exist') try { - await client.waitUntil(function () { - console.log('>>> Window handles: ' + this.getWindowHandles().length) - return this.getWindowHandles().length > 0 + await client.waitUntil(async function () { + const handles = await this.getWindowHandles() + return handles.length > 0 }, 10000) } catch (error) { console.log(error) From 4961b31cf7ce96aebc0c1da67a536c717c74140e Mon Sep 17 00:00:00 2001 From: Winston Liu <50Wliu@users.noreply.github.com> Date: Sat, 25 May 2019 00:17:40 -0400 Subject: [PATCH 15/29] Perhaps it's something with await? --- spec/integration/helpers/start-atom.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/spec/integration/helpers/start-atom.js b/spec/integration/helpers/start-atom.js index 00a525f2f..0caf7f55a 100644 --- a/spec/integration/helpers/start-atom.js +++ b/spec/integration/helpers/start-atom.js @@ -147,8 +147,13 @@ Logs:\n${chromedriverLogs.join('\n')}\ console.log('>>> Waiting for workspace to exist') try { - console.log('>>> Return value of selector:') - console.log(await client.$('atom-workspace')) + console.log('>>> Return value of selector without await:') + console.log(client.$('atom-workspace')) + console.log(client.$('atom-workspace').waitForExist) + const test = await client.$('atom-workspace') + console.log('>>> Return value of selector with await:') + console.log(test) + console.log(test.waitForExist) await client.$('atom-workspace').waitForExist(10000) } catch (error) { console.log(error) From 81fe767077724f24ed1d17b0443cb0c6ee71d8bf Mon Sep 17 00:00:00 2001 From: Winston Liu <50Wliu@users.noreply.github.com> Date: Sat, 25 May 2019 12:49:36 -0400 Subject: [PATCH 16/29] Everything's a Promise, apparently --- spec/integration/helpers/start-atom.js | 14 ++++---------- spec/integration/smoke-spec.js | 5 +++-- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/spec/integration/helpers/start-atom.js b/spec/integration/helpers/start-atom.js index 0caf7f55a..2700fd4ef 100644 --- a/spec/integration/helpers/start-atom.js +++ b/spec/integration/helpers/start-atom.js @@ -72,7 +72,8 @@ const buildAtomClient = async (args, env) => { }), timeout) }) client.addCommand('treeViewRootDirectories', async function () { - await this.$('.tree-view').waitForExist(10000) + const treeViewElement = await this.$('.tree-view') + await treeViewElement.waitForExist(10000) return this.execute(() => Array.from(document.querySelectorAll('.tree-view .project-root > .header .name')) .map(element => element.dataset.path) @@ -147,17 +148,10 @@ Logs:\n${chromedriverLogs.join('\n')}\ console.log('>>> Waiting for workspace to exist') try { - console.log('>>> Return value of selector without await:') - console.log(client.$('atom-workspace')) - console.log(client.$('atom-workspace').waitForExist) - const test = await client.$('atom-workspace') - console.log('>>> Return value of selector with await:') - console.log(test) - console.log(test.waitForExist) - await client.$('atom-workspace').waitForExist(10000) + const workspaceElement = await client.$('atom-workspace') + await workspaceElement.waitForExist(10000) } catch (error) { console.log(error) - jasmine.getEnv().currentSpec.fail(':(') } console.log('>>> Waiting for test to run') diff --git a/spec/integration/smoke-spec.js b/spec/integration/smoke-spec.js index 430896451..67ef7faf5 100644 --- a/spec/integration/smoke-spec.js +++ b/spec/integration/smoke-spec.js @@ -37,12 +37,13 @@ fdescribe('Smoke Test', () => { expect(roots).toEqual([]) console.log('>>> Waiting for editor to exist') - await client.$('atom-text-editor').waitForExist(5000) + const textEditorElement = await client.$('atom-text-editor') + await textEditorElement.waitForExist(5000) console.log('>>> Waiting for there to be one pane item') await client.waitForPaneItemCount(1, 1000) - client.$('atom-text-editor').click() + textEditorElement.click() console.log('Waiting for active element to be atom-text-editor') await client.waitUntil(function () { From e47253febf06b83f9b797264032d45c6ce7b31f8 Mon Sep 17 00:00:00 2001 From: Winston Liu <50Wliu@users.noreply.github.com> Date: Sat, 25 May 2019 13:31:11 -0400 Subject: [PATCH 17/29] I think we need to pass in a folder --- spec/integration/smoke-spec.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/spec/integration/smoke-spec.js b/spec/integration/smoke-spec.js index 67ef7faf5..38515b811 100644 --- a/spec/integration/smoke-spec.js +++ b/spec/integration/smoke-spec.js @@ -31,10 +31,13 @@ fdescribe('Smoke Test', () => { fs.writeFileSync(filePath, '', {encoding: 'utf8'}) - runAtom([filePath], {ATOM_HOME: atomHome}, async client => { + runAtom([tempDirPath], {ATOM_HOME: atomHome}, async client => { console.log('>>> Waiting for root directories') const roots = await client.treeViewRootDirectories() - expect(roots).toEqual([]) + expect(roots).toEqual([tempDirPath]) + + console.log('>>> Waiting for editor to open') + await client.execute(async () => await atom.workspace.open(filePath)) console.log('>>> Waiting for editor to exist') const textEditorElement = await client.$('atom-text-editor') From 397c8d74e8d29eda802f45939e06f4739e73708e Mon Sep 17 00:00:00 2001 From: Winston Liu <50Wliu@users.noreply.github.com> Date: Sat, 25 May 2019 14:24:10 -0400 Subject: [PATCH 18/29] Pass in filePath as an argument --- spec/integration/smoke-spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/integration/smoke-spec.js b/spec/integration/smoke-spec.js index 38515b811..3b5f6f886 100644 --- a/spec/integration/smoke-spec.js +++ b/spec/integration/smoke-spec.js @@ -37,7 +37,7 @@ fdescribe('Smoke Test', () => { expect(roots).toEqual([tempDirPath]) console.log('>>> Waiting for editor to open') - await client.execute(async () => await atom.workspace.open(filePath)) + await client.execute(async filePath => await atom.workspace.open(filePath), filePath) console.log('>>> Waiting for editor to exist') const textEditorElement = await client.$('atom-text-editor') From 8fcd97ae152f27ee20d1206f0d2b0feb8fda45e7 Mon Sep 17 00:00:00 2001 From: Winston Liu <50Wliu@users.noreply.github.com> Date: Sat, 25 May 2019 15:30:36 -0400 Subject: [PATCH 19/29] ...as I was saying, async. --- spec/integration/helpers/start-atom.js | 2 +- spec/integration/smoke-spec.js | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/spec/integration/helpers/start-atom.js b/spec/integration/helpers/start-atom.js index 2700fd4ef..2fecc6c63 100644 --- a/spec/integration/helpers/start-atom.js +++ b/spec/integration/helpers/start-atom.js @@ -80,7 +80,7 @@ const buildAtomClient = async (args, env) => { ) }) client.addCommand('dispatchCommand', async function (command) { - return this.execute(async () => atom.commands.dispatch(document.activeElement, command)) + return this.execute(async () => await atom.commands.dispatch(document.activeElement, command)) }) return client diff --git a/spec/integration/smoke-spec.js b/spec/integration/smoke-spec.js index 3b5f6f886..aa6cc79c1 100644 --- a/spec/integration/smoke-spec.js +++ b/spec/integration/smoke-spec.js @@ -48,18 +48,22 @@ fdescribe('Smoke Test', () => { textEditorElement.click() - console.log('Waiting for active element to be atom-text-editor') + console.log('>>> Waiting for active element to be atom-text-editor') await client.waitUntil(function () { return this.execute(() => document.activeElement.closest('atom-text-editor')) }, 5000) - const text = client.keys('Hello!').execute(() => atom.workspace.getActiveTextEditor().getText()) + console.log('>>> Waiting for text to be inserted') + await client.keys('Hello!') + + console.log('>>> Waiting for text') + const text = await client.execute(() => atom.workspace.getActiveTextEditor().getText()) expect(text).toBe('Hello!') - console.log('Waiting to delete line') + console.log('>>> Waiting to delete line') await client.dispatchCommand('editor:delete-line') - console.log('Done!') + console.log('>>> Done!') }) }) }) From 7e2a23b7973ed0a6f6973ef0c7fa7727f473ca09 Mon Sep 17 00:00:00 2001 From: Winston Liu <50Wliu@users.noreply.github.com> Date: Sat, 25 May 2019 15:42:27 -0400 Subject: [PATCH 20/29] Ah heck, more async --- spec/integration/helpers/start-atom.js | 7 ++++++- spec/integration/smoke-spec.js | 10 +++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/spec/integration/helpers/start-atom.js b/spec/integration/helpers/start-atom.js index 2fecc6c63..2478d1913 100644 --- a/spec/integration/helpers/start-atom.js +++ b/spec/integration/helpers/start-atom.js @@ -155,7 +155,12 @@ Logs:\n${chromedriverLogs.join('\n')}\ } console.log('>>> Waiting for test to run') - await fn(client) + try { + await fn(client) + } catch (error) { + console.log('!!!!!!!!!') + console.log(error) + } finish() } , 30000) diff --git a/spec/integration/smoke-spec.js b/spec/integration/smoke-spec.js index aa6cc79c1..5af7b9cd1 100644 --- a/spec/integration/smoke-spec.js +++ b/spec/integration/smoke-spec.js @@ -46,12 +46,12 @@ fdescribe('Smoke Test', () => { console.log('>>> Waiting for there to be one pane item') await client.waitForPaneItemCount(1, 1000) - textEditorElement.click() + console.log('>>> Waiting to click text editor') + await textEditorElement.click() - console.log('>>> Waiting for active element to be atom-text-editor') - await client.waitUntil(function () { - return this.execute(() => document.activeElement.closest('atom-text-editor')) - }, 5000) + console.log('>>> Waiting for closest element') + const closestElement = await client.execute(() => document.activeElement.closest('atom-text-editor')) + expect(closestElement).not.toBeNull() console.log('>>> Waiting for text to be inserted') await client.keys('Hello!') From 7bbbca95bc3dce7bda2cab2e59a65be322e4576a Mon Sep 17 00:00:00 2001 From: Winston Liu <50Wliu@users.noreply.github.com> Date: Sat, 25 May 2019 15:44:49 -0400 Subject: [PATCH 21/29] atom.workspace should always exist --- spec/integration/helpers/start-atom.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/spec/integration/helpers/start-atom.js b/spec/integration/helpers/start-atom.js index 2478d1913..b0fbd842a 100644 --- a/spec/integration/helpers/start-atom.js +++ b/spec/integration/helpers/start-atom.js @@ -64,12 +64,7 @@ const buildAtomClient = async (args, env) => { } client.addCommand('waitForPaneItemCount', async function (count, timeout) { - await this.waitUntil(() => this.execute(() => { - if (atom.workspace) { - return atom.workspace.getActivePane().getItems().length - } - return 0 - }), timeout) + await this.waitUntil(() => this.execute(() => atom.workspace.getActivePane().getItems().length), timeout) }) client.addCommand('treeViewRootDirectories', async function () { const treeViewElement = await this.$('.tree-view') From 45b772b1114d388e6a00a60214b755e80d4c14d9 Mon Sep 17 00:00:00 2001 From: Winston Liu <50Wliu@users.noreply.github.com> Date: Sat, 25 May 2019 16:50:37 -0400 Subject: [PATCH 22/29] Whoopsies --- spec/integration/helpers/start-atom.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/integration/helpers/start-atom.js b/spec/integration/helpers/start-atom.js index b0fbd842a..18f825067 100644 --- a/spec/integration/helpers/start-atom.js +++ b/spec/integration/helpers/start-atom.js @@ -75,7 +75,7 @@ const buildAtomClient = async (args, env) => { ) }) client.addCommand('dispatchCommand', async function (command) { - return this.execute(async () => await atom.commands.dispatch(document.activeElement, command)) + return this.execute(async (command) => await atom.commands.dispatch(document.activeElement, command), command) }) return client From 50e8c97db4407bcd506cde77bec93bea9c3fa24f Mon Sep 17 00:00:00 2001 From: Winston Liu <50Wliu@users.noreply.github.com> Date: Sat, 25 May 2019 16:50:45 -0400 Subject: [PATCH 23/29] Delete the session when we're done, just to be safe --- spec/integration/helpers/start-atom.js | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/integration/helpers/start-atom.js b/spec/integration/helpers/start-atom.js index 18f825067..3fdf7d5dd 100644 --- a/spec/integration/helpers/start-atom.js +++ b/spec/integration/helpers/start-atom.js @@ -112,6 +112,7 @@ module.exports = function(args, env, fn) { const client = await buildAtomClient(args, env) const finish = once(async () => { + await client.deleteSession() chromedriver.kill() console.log('>>> Waiting for exit code') From e9ba8fdc0520ddee39a287d548342d6f54c22292 Mon Sep 17 00:00:00 2001 From: Winston Liu <50Wliu@users.noreply.github.com> Date: Sat, 25 May 2019 20:50:27 -0400 Subject: [PATCH 24/29] Yay, it's green! Clean things up a bit. --- spec/integration/helpers/start-atom.js | 100 +++++++++++-------------- spec/integration/smoke-spec.js | 11 --- 2 files changed, 42 insertions(+), 69 deletions(-) diff --git a/spec/integration/helpers/start-atom.js b/spec/integration/helpers/start-atom.js index 3fdf7d5dd..6fa6204ce 100644 --- a/spec/integration/helpers/start-atom.js +++ b/spec/integration/helpers/start-atom.js @@ -1,10 +1,8 @@ const path = require('path') const http = require('http') const temp = require('temp').track() -// const os = require('os') const remote = require('remote') -// const async = require('async') -const {map, once} = require('underscore-plus') +const {once} = require('underscore-plus') const {spawn} = require('child_process') const webdriverio = require('../../../script/node_modules/webdriverio') @@ -15,11 +13,9 @@ const ChromedriverPort = 9515 const ChromedriverURLBase = '/wd/hub' const ChromedriverStatusURL = `http://localhost:${ChromedriverPort}${ChromedriverURLBase}/status` -let userDataDir = null - const chromeDriverUp = done => { const checkStatus = () => - http.get(ChromedriverStatusURL, function(response) { + http.get(ChromedriverStatusURL, response => { if (response.statusCode === 200) { done() } else { @@ -38,30 +34,25 @@ const chromeDriverDown = done => { } const buildAtomClient = async (args, env) => { - userDataDir = temp.mkdirSync('atom-user-data-dir') - let client - try { - client = await webdriverio.remote({ - host: 'localhost', - port: ChromedriverPort, - capabilities: { - browserName: 'atom', - chromeOptions: { - binary: AtomLauncherPath, - args: [ - `atom-path=${AtomPath}`, - `atom-args=${args.join(' ')}`, - `atom-env=${map(env, (value, key) => `${key}=${value}`).join(' ')}`, - 'dev', - 'safe', - `user-data-dir=${userDataDir}` - ] - } + const userDataDir = temp.mkdirSync('atom-user-data-dir') + const client = await webdriverio.remote({ + host: 'localhost', + port: ChromedriverPort, + capabilities: { + browserName: 'atom', + chromeOptions: { + binary: AtomLauncherPath, + args: [ + `atom-path=${AtomPath}`, + `atom-args=${args.join(' ')}`, + `atom-env=${Object.entries(env).map(([key, value]) => `${key}=${value}`).join(' ')}`, + 'dev', + 'safe', + `user-data-dir=${userDataDir}` + ] } - }) - } catch (error) { - console.log(error) - } + } + }) client.addCommand('waitForPaneItemCount', async function (count, timeout) { await this.waitUntil(() => this.execute(() => atom.workspace.getActivePane().getItems().length), timeout) @@ -82,7 +73,7 @@ const buildAtomClient = async (args, env) => { } module.exports = function(args, env, fn) { - let [chromedriver, chromedriverLogs, chromedriverExit] = [] + let chromedriver, chromedriverLogs, chromedriverExit runs(() => { chromedriver = spawn(ChromedriverPath, [ @@ -99,9 +90,7 @@ module.exports = function(args, env, fn) { errorCode = code } }) - chromedriver.stdout.on('data', log => console.log(log.toString())) - chromedriver.stderr.on('data', log => console.log(log.toString())) - // chromedriver.stderr.on('data', log => chromedriverLogs.push(log.toString())) + chromedriver.stderr.on('data', log => chromedriverLogs.push(log.toString())) chromedriver.stderr.on('close', () => resolve(errorCode)) }) }) @@ -109,61 +98,56 @@ module.exports = function(args, env, fn) { waitsFor('webdriver to start', chromeDriverUp, 15000) waitsFor('tests to run', async done => { - const client = await buildAtomClient(args, env) + let client + try { + await buildAtomClient(args, env) + } catch (error) { + jasmine.getEnv().currentSpec.fail(`Unable to build Atom client.\n${error}`) + finish() + return + } const finish = once(async () => { await client.deleteSession() chromedriver.kill() - console.log('>>> Waiting for exit code') const errorCode = await chromedriverExit if (errorCode != null) { - jasmine.getEnv().currentSpec.fail(`\ -Chromedriver exited with code ${errorCode}. -Logs:\n${chromedriverLogs.join('\n')}\ -` - ) + jasmine.getEnv().currentSpec.fail(`Chromedriver exited with code ${errorCode}. +Logs:\n${chromedriverLogs.join('\n')}`) } done() }) - // client.on('error', err => { - // jasmine.getEnv().currentSpec.fail(new Error(__guard__(__guard__(err.response != null ? err.response.body : undefined, x1 => x1.value), x => x.message))) - // finish() - // }) - - console.log('>>> Waiting for window to exist') try { await client.waitUntil(async function () { const handles = await this.getWindowHandles() return handles.length > 0 }, 10000) } catch (error) { - console.log(error) + jasmine.getEnv().currentSpec.fail(`Unable to locate windows.\n\n${error}`) + finish() + return } - console.log('>>> Waiting for workspace to exist') try { const workspaceElement = await client.$('atom-workspace') await workspaceElement.waitForExist(10000) } catch (error) { - console.log(error) + jasmine.getEnv().currentSpec.fail(`Unable to find workspace element.\n\n${error}`) + finish() + return } - console.log('>>> Waiting for test to run') try { await fn(client) } catch (error) { - console.log('!!!!!!!!!') - console.log(error) + jasmine.getEnv().currentSpec.fail(error) + finish() + return } finish() - } - , 30000) + }, 30000) waitsFor('webdriver to stop', chromeDriverDown, 15000) } - -// function __guard__(value, transform) { -// return (typeof value !== 'undefined' && value !== null) ? transform(value) : undefined -// } diff --git a/spec/integration/smoke-spec.js b/spec/integration/smoke-spec.js index 5af7b9cd1..673bd0aa0 100644 --- a/spec/integration/smoke-spec.js +++ b/spec/integration/smoke-spec.js @@ -32,38 +32,27 @@ fdescribe('Smoke Test', () => { fs.writeFileSync(filePath, '', {encoding: 'utf8'}) runAtom([tempDirPath], {ATOM_HOME: atomHome}, async client => { - console.log('>>> Waiting for root directories') const roots = await client.treeViewRootDirectories() expect(roots).toEqual([tempDirPath]) - console.log('>>> Waiting for editor to open') await client.execute(async filePath => await atom.workspace.open(filePath), filePath) - console.log('>>> Waiting for editor to exist') const textEditorElement = await client.$('atom-text-editor') await textEditorElement.waitForExist(5000) - console.log('>>> Waiting for there to be one pane item') await client.waitForPaneItemCount(1, 1000) - console.log('>>> Waiting to click text editor') await textEditorElement.click() - console.log('>>> Waiting for closest element') const closestElement = await client.execute(() => document.activeElement.closest('atom-text-editor')) expect(closestElement).not.toBeNull() - console.log('>>> Waiting for text to be inserted') await client.keys('Hello!') - console.log('>>> Waiting for text') const text = await client.execute(() => atom.workspace.getActiveTextEditor().getText()) expect(text).toBe('Hello!') - console.log('>>> Waiting to delete line') await client.dispatchCommand('editor:delete-line') - - console.log('>>> Done!') }) }) }) From 7870675ef4a2b24adf65f4fa6b76ab12eb45ef31 Mon Sep 17 00:00:00 2001 From: Winston Liu <50Wliu@users.noreply.github.com> Date: Sat, 25 May 2019 20:50:53 -0400 Subject: [PATCH 25/29] Re-enable tests --- script/test | 3 +-- spec/integration/smoke-spec.js | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/script/test b/script/test index 5b38c4b3a..adb8a5123 100755 --- a/script/test +++ b/script/test @@ -201,8 +201,7 @@ function testSuitesForPlatform (platform) { let suites = [] switch (platform) { case 'darwin': - // suites = [runCoreMainProcessTests, runCoreRenderProcessTests, runBenchmarkTests].concat(packageTestSuites) - suites = [runCoreRenderProcessTests] + suites = [runCoreMainProcessTests, runCoreRenderProcessTests, runBenchmarkTests].concat(packageTestSuites) break case 'win32': suites = (process.arch === 'x64') ? [runCoreMainProcessTests, runCoreRenderProcessTests] : [runCoreMainProcessTests] diff --git a/spec/integration/smoke-spec.js b/spec/integration/smoke-spec.js index 673bd0aa0..819bc4724 100644 --- a/spec/integration/smoke-spec.js +++ b/spec/integration/smoke-spec.js @@ -4,7 +4,7 @@ const season = require('season') const temp = require('temp').track() const runAtom = require('./helpers/start-atom') -fdescribe('Smoke Test', () => { +describe('Smoke Test', () => { // Fails on win32 if (process.platform !== 'darwin') { return From fe5082df51e75fff12d87fd0934942e4bf3013f9 Mon Sep 17 00:00:00 2001 From: Winston Liu <50Wliu@users.noreply.github.com> Date: Sat, 25 May 2019 20:53:47 -0400 Subject: [PATCH 26/29] Check for focus methods again --- spec/jasmine-test-runner.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/jasmine-test-runner.coffee b/spec/jasmine-test-runner.coffee index 1cb21763f..5b8662c14 100644 --- a/spec/jasmine-test-runner.coffee +++ b/spec/jasmine-test-runner.coffee @@ -51,7 +51,7 @@ module.exports = ({logFile, headless, testPaths, buildAtomEnvironment}) -> }) require './spec-helper' - # disableFocusMethods() if process.env.JANKY_SHA1 or process.env.CI + disableFocusMethods() if process.env.JANKY_SHA1 or process.env.CI requireSpecs(testPath) for testPath in testPaths setSpecType('user') From 791d6b4896ac8c6ff675b9a51d680224e057670b Mon Sep 17 00:00:00 2001 From: Winston Liu <50Wliu@users.noreply.github.com> Date: Sat, 25 May 2019 21:42:32 -0400 Subject: [PATCH 27/29] :arrow_up: webdriverio@5.9.2 --- script/package-lock.json | 6 +++--- script/package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/script/package-lock.json b/script/package-lock.json index 041660fa2..2d4dabd12 100644 --- a/script/package-lock.json +++ b/script/package-lock.json @@ -11014,9 +11014,9 @@ } }, "webdriverio": { - "version": "5.9.1", - "resolved": "https://registry.npmjs.org/webdriverio/-/webdriverio-5.9.1.tgz", - "integrity": "sha512-QYlIIrfqr7I0OSkg9HsZyOGpo7d8MlrH7ueo5MHsgNR2QgZG1OxHk/1edV3Te9Q2AUcpCmIKO1IOAJDxlYA+Rw==", + "version": "5.9.2", + "resolved": "https://registry.npmjs.org/webdriverio/-/webdriverio-5.9.2.tgz", + "integrity": "sha512-ub87P5+h4935jEXXxJ5b22sq5sx25LJC0W5oXmNQfHyYWvca+oS75iJS80jGQ6haDUfyvek1PBMBh7M2+ikeIw==", "requires": { "@wdio/config": "^5.9.1", "@wdio/logger": "^5.9.0", diff --git a/script/package.json b/script/package.json index d72c8d5a5..b6afb73bc 100644 --- a/script/package.json +++ b/script/package.json @@ -46,7 +46,7 @@ "sync-request": "3.0.1", "tello": "1.0.7", "terser": "^3.8.1", - "webdriverio": "^5.9.1", + "webdriverio": "^5.9.2", "yargs": "4.8.1" } } From 5265528675ffb09b1a874b99ee30ba5c28c7b5c2 Mon Sep 17 00:00:00 2001 From: Winston Liu <50Wliu@users.noreply.github.com> Date: Sat, 25 May 2019 21:55:15 -0400 Subject: [PATCH 28/29] =?UTF-8?q?=F0=9F=A4=A6=E2=80=8D=E2=99=80=EF=B8=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- spec/integration/helpers/start-atom.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/integration/helpers/start-atom.js b/spec/integration/helpers/start-atom.js index 6fa6204ce..5877fa96c 100644 --- a/spec/integration/helpers/start-atom.js +++ b/spec/integration/helpers/start-atom.js @@ -100,7 +100,7 @@ module.exports = function(args, env, fn) { waitsFor('tests to run', async done => { let client try { - await buildAtomClient(args, env) + client = await buildAtomClient(args, env) } catch (error) { jasmine.getEnv().currentSpec.fail(`Unable to build Atom client.\n${error}`) finish() From 6263d852501d67ee8a5785b21448e89ff5e08fbd Mon Sep 17 00:00:00 2001 From: Rafael Oleza Date: Fri, 31 May 2019 18:55:45 +0200 Subject: [PATCH 29/29] Re-apply prettier JS formatter --- spec/integration/helpers/start-atom.js | 244 +++++++++++++++---------- spec/integration/smoke-spec.js | 66 +++---- 2 files changed, 178 insertions(+), 132 deletions(-) diff --git a/spec/integration/helpers/start-atom.js b/spec/integration/helpers/start-atom.js index 5877fa96c..09dce64b2 100644 --- a/spec/integration/helpers/start-atom.js +++ b/spec/integration/helpers/start-atom.js @@ -1,40 +1,59 @@ -const path = require('path') -const http = require('http') -const temp = require('temp').track() -const remote = require('remote') -const {once} = require('underscore-plus') -const {spawn} = require('child_process') -const webdriverio = require('../../../script/node_modules/webdriverio') +const path = require('path'); +const http = require('http'); +const temp = require('temp').track(); +const remote = require('remote'); +const { once } = require('underscore-plus'); +const { spawn } = require('child_process'); +const webdriverio = require('../../../script/node_modules/webdriverio'); -const AtomPath = remote.process.argv[0] -const AtomLauncherPath = path.join(__dirname, '..', 'helpers', 'atom-launcher.sh') -const ChromedriverPath = path.resolve(__dirname, '..', '..', '..', 'script', 'node_modules', 'electron-chromedriver', 'bin', 'chromedriver') -const ChromedriverPort = 9515 -const ChromedriverURLBase = '/wd/hub' -const ChromedriverStatusURL = `http://localhost:${ChromedriverPort}${ChromedriverURLBase}/status` +const AtomPath = remote.process.argv[0]; +const AtomLauncherPath = path.join( + __dirname, + '..', + 'helpers', + 'atom-launcher.sh' +); +const ChromedriverPath = path.resolve( + __dirname, + '..', + '..', + '..', + 'script', + 'node_modules', + 'electron-chromedriver', + 'bin', + 'chromedriver' +); +const ChromedriverPort = 9515; +const ChromedriverURLBase = '/wd/hub'; +const ChromedriverStatusURL = `http://localhost:${ChromedriverPort}${ChromedriverURLBase}/status`; const chromeDriverUp = done => { const checkStatus = () => - http.get(ChromedriverStatusURL, response => { - if (response.statusCode === 200) { - done() - } else { - chromeDriverUp(done) - } - }).on('error', () => chromeDriverUp(done)) + http + .get(ChromedriverStatusURL, response => { + if (response.statusCode === 200) { + done(); + } else { + chromeDriverUp(done); + } + }) + .on('error', () => chromeDriverUp(done)); - setTimeout(checkStatus, 100) -} + setTimeout(checkStatus, 100); +}; const chromeDriverDown = done => { const checkStatus = () => - http.get(ChromedriverStatusURL, response => chromeDriverDown(done)).on('error', done) + http + .get(ChromedriverStatusURL, response => chromeDriverDown(done)) + .on('error', done); - setTimeout(checkStatus, 100) -} + setTimeout(checkStatus, 100); +}; const buildAtomClient = async (args, env) => { - const userDataDir = temp.mkdirSync('atom-user-data-dir') + const userDataDir = temp.mkdirSync('atom-user-data-dir'); const client = await webdriverio.remote({ host: 'localhost', port: ChromedriverPort, @@ -45,109 +64,132 @@ const buildAtomClient = async (args, env) => { args: [ `atom-path=${AtomPath}`, `atom-args=${args.join(' ')}`, - `atom-env=${Object.entries(env).map(([key, value]) => `${key}=${value}`).join(' ')}`, + `atom-env=${Object.entries(env) + .map(([key, value]) => `${key}=${value}`) + .join(' ')}`, 'dev', 'safe', `user-data-dir=${userDataDir}` ] } } - }) + }); - client.addCommand('waitForPaneItemCount', async function (count, timeout) { - await this.waitUntil(() => this.execute(() => atom.workspace.getActivePane().getItems().length), timeout) - }) - client.addCommand('treeViewRootDirectories', async function () { - const treeViewElement = await this.$('.tree-view') - await treeViewElement.waitForExist(10000) + client.addCommand('waitForPaneItemCount', async function(count, timeout) { + await this.waitUntil( + () => + this.execute(() => atom.workspace.getActivePane().getItems().length), + timeout + ); + }); + client.addCommand('treeViewRootDirectories', async function() { + const treeViewElement = await this.$('.tree-view'); + await treeViewElement.waitForExist(10000); return this.execute(() => - Array.from(document.querySelectorAll('.tree-view .project-root > .header .name')) - .map(element => element.dataset.path) - ) - }) - client.addCommand('dispatchCommand', async function (command) { - return this.execute(async (command) => await atom.commands.dispatch(document.activeElement, command), command) - }) + Array.from( + document.querySelectorAll('.tree-view .project-root > .header .name') + ).map(element => element.dataset.path) + ); + }); + client.addCommand('dispatchCommand', async function(command) { + return this.execute( + command => atom.commands.dispatch(document.activeElement, command), + command + ); + }); - return client -} + return client; +}; module.exports = function(args, env, fn) { - let chromedriver, chromedriverLogs, chromedriverExit + let chromedriver, chromedriverLogs, chromedriverExit; runs(() => { chromedriver = spawn(ChromedriverPath, [ '--verbose', `--port=${ChromedriverPort}`, `--url-base=${ChromedriverURLBase}` - ]) + ]); - chromedriverLogs = [] + chromedriverLogs = []; chromedriverExit = new Promise(resolve => { - let errorCode = null + let errorCode = null; chromedriver.on('exit', (code, signal) => { if (signal == null) { - errorCode = code + errorCode = code; } - }) - chromedriver.stderr.on('data', log => chromedriverLogs.push(log.toString())) - chromedriver.stderr.on('close', () => resolve(errorCode)) - }) - }) + }); + chromedriver.stderr.on('data', log => + chromedriverLogs.push(log.toString()) + ); + chromedriver.stderr.on('close', () => resolve(errorCode)); + }); + }); - waitsFor('webdriver to start', chromeDriverUp, 15000) + waitsFor('webdriver to start', chromeDriverUp, 15000); - waitsFor('tests to run', async done => { - let client - try { - client = await buildAtomClient(args, env) - } catch (error) { - jasmine.getEnv().currentSpec.fail(`Unable to build Atom client.\n${error}`) - finish() - return - } + waitsFor( + 'tests to run', + async done => { + const finish = once(async () => { + await client.deleteSession(); + chromedriver.kill(); - const finish = once(async () => { - await client.deleteSession() - chromedriver.kill() + const errorCode = await chromedriverExit; + if (errorCode != null) { + jasmine.getEnv().currentSpec + .fail(`Chromedriver exited with code ${errorCode}. +Logs:\n${chromedriverLogs.join('\n')}`); + } + done(); + }); - const errorCode = await chromedriverExit - if (errorCode != null) { - jasmine.getEnv().currentSpec.fail(`Chromedriver exited with code ${errorCode}. -Logs:\n${chromedriverLogs.join('\n')}`) + let client; + try { + client = await buildAtomClient(args, env); + } catch (error) { + jasmine + .getEnv() + .currentSpec.fail(`Unable to build Atom client.\n${error}`); + finish(); + return; } - done() - }) - try { - await client.waitUntil(async function () { - const handles = await this.getWindowHandles() - return handles.length > 0 - }, 10000) - } catch (error) { - jasmine.getEnv().currentSpec.fail(`Unable to locate windows.\n\n${error}`) - finish() - return - } + try { + await client.waitUntil(async function() { + const handles = await this.getWindowHandles(); + return handles.length > 0; + }, 10000); + } catch (error) { + jasmine + .getEnv() + .currentSpec.fail(`Unable to locate windows.\n\n${error}`); + finish(); + return; + } - try { - const workspaceElement = await client.$('atom-workspace') - await workspaceElement.waitForExist(10000) - } catch (error) { - jasmine.getEnv().currentSpec.fail(`Unable to find workspace element.\n\n${error}`) - finish() - return - } + try { + const workspaceElement = await client.$('atom-workspace'); + await workspaceElement.waitForExist(10000); + } catch (error) { + jasmine + .getEnv() + .currentSpec.fail(`Unable to find workspace element.\n\n${error}`); + finish(); + return; + } - try { - await fn(client) - } catch (error) { - jasmine.getEnv().currentSpec.fail(error) - finish() - return - } - finish() - }, 30000) + try { + await fn(client); + } catch (error) { + jasmine.getEnv().currentSpec.fail(error); + finish(); + return; + } + finish(); + }, + 30000 + ); - waitsFor('webdriver to stop', chromeDriverDown, 15000) -} + waitsFor('webdriver to stop', chromeDriverDown, 15000); +}; diff --git a/spec/integration/smoke-spec.js b/spec/integration/smoke-spec.js index 819bc4724..6e2de3edb 100644 --- a/spec/integration/smoke-spec.js +++ b/spec/integration/smoke-spec.js @@ -1,58 +1,62 @@ -const fs = require('fs-plus') -const path = require('path') -const season = require('season') -const temp = require('temp').track() -const runAtom = require('./helpers/start-atom') +const fs = require('fs-plus'); +const path = require('path'); +const season = require('season'); +const temp = require('temp').track(); +const runAtom = require('./helpers/start-atom'); describe('Smoke Test', () => { // Fails on win32 if (process.platform !== 'darwin') { - return + return; } - const atomHome = temp.mkdirSync('atom-home') + const atomHome = temp.mkdirSync('atom-home'); beforeEach(() => { - jasmine.useRealClock() + jasmine.useRealClock(); season.writeFileSync(path.join(atomHome, 'config.cson'), { '*': { - welcome: {showOnStartup: false}, + welcome: { showOnStartup: false }, core: { telemetryConsent: 'no', disabledPackages: ['github'] } } - }) - }) + }); + }); it('can open a file in Atom and perform basic operations on it', async () => { - const tempDirPath = temp.mkdirSync('empty-dir') - const filePath = path.join(tempDirPath, 'new-file') + const tempDirPath = temp.mkdirSync('empty-dir'); + const filePath = path.join(tempDirPath, 'new-file'); - fs.writeFileSync(filePath, '', {encoding: 'utf8'}) + fs.writeFileSync(filePath, '', { encoding: 'utf8' }); - runAtom([tempDirPath], {ATOM_HOME: atomHome}, async client => { - const roots = await client.treeViewRootDirectories() - expect(roots).toEqual([tempDirPath]) + runAtom([tempDirPath], { ATOM_HOME: atomHome }, async client => { + const roots = await client.treeViewRootDirectories(); + expect(roots).toEqual([tempDirPath]); - await client.execute(async filePath => await atom.workspace.open(filePath), filePath) + await client.execute(filePath => atom.workspace.open(filePath), filePath); - const textEditorElement = await client.$('atom-text-editor') - await textEditorElement.waitForExist(5000) + const textEditorElement = await client.$('atom-text-editor'); + await textEditorElement.waitForExist(5000); - await client.waitForPaneItemCount(1, 1000) + await client.waitForPaneItemCount(1, 1000); - await textEditorElement.click() + await textEditorElement.click(); - const closestElement = await client.execute(() => document.activeElement.closest('atom-text-editor')) - expect(closestElement).not.toBeNull() + const closestElement = await client.execute(() => + document.activeElement.closest('atom-text-editor') + ); + expect(closestElement).not.toBeNull(); - await client.keys('Hello!') + await client.keys('Hello!'); - const text = await client.execute(() => atom.workspace.getActiveTextEditor().getText()) - expect(text).toBe('Hello!') + const text = await client.execute(() => + atom.workspace.getActiveTextEditor().getText() + ); + expect(text).toBe('Hello!'); - await client.dispatchCommand('editor:delete-line') - }) - }) -}) + await client.dispatchCommand('editor:delete-line'); + }); + }); +});