From 86bffe8a99c640e6fd2da733d92df8c7f21287a8 Mon Sep 17 00:00:00 2001 From: VerteDinde Date: Wed, 3 Mar 2021 13:14:08 -0800 Subject: [PATCH 1/4] chore: upgrade to Electron 12, import @electron/remote --- package-lock.json | 226 ++++++++++++++++++++++++++++++++++++---------- package.json | 7 +- 2 files changed, 184 insertions(+), 49 deletions(-) diff --git a/package-lock.json b/package-lock.json index b974d1f05..259027773 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "spectron", - "version": "12.0.0", + "version": "14.0.0", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -89,9 +89,10 @@ } }, "@electron/get": { - "version": "1.12.2", - "resolved": "https://registry.npmjs.org/@electron/get/-/get-1.12.2.tgz", - "integrity": "sha512-vAuHUbfvBQpYTJ5wB7uVIDq5c/Ry0fiTBMs7lnEYAo/qXXppIVcWdfBr57u6eRnKdVso7KSiH6p/LbQAG6Izrg==", + "version": "1.12.4", + "resolved": "https://registry.npmjs.org/@electron/get/-/get-1.12.4.tgz", + "integrity": "sha512-6nr9DbJPUR9Xujw6zD3y+rS95TyItEVM0NVjt1EehY2vUWfIgPiIPVHxCvaTS0xr2B+DRxovYVKbuOWqC35kjg==", + "dev": true, "requires": { "debug": "^4.1.1", "env-paths": "^2.2.0", @@ -100,19 +101,21 @@ "global-tunnel-ng": "^2.7.1", "got": "^9.6.0", "progress": "^2.0.3", - "sanitize-filename": "^1.6.2", + "semver": "^6.2.0", "sumchecker": "^3.0.1" }, "dependencies": { "@sindresorhus/is": { "version": "0.14.0", "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.14.0.tgz", - "integrity": "sha512-9NET910DNaIPngYnLLPeg+Ogzqsi9uM4mSboU5y6p8S5DzMTVEsJZrawi+BoDNUVBa2DhJqQYUFvMDfgU062LQ==" + "integrity": "sha512-9NET910DNaIPngYnLLPeg+Ogzqsi9uM4mSboU5y6p8S5DzMTVEsJZrawi+BoDNUVBa2DhJqQYUFvMDfgU062LQ==", + "dev": true }, "@szmarczak/http-timer": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-1.1.2.tgz", "integrity": "sha512-XIB2XbzHTN6ieIjfIMV9hlVcfPU26s2vafYWQcZHWXHOxiaRZYEDKEwdl129Zyg50+foYV2jCgtrqSA6qNuNSA==", + "dev": true, "requires": { "defer-to-connect": "^1.0.1" } @@ -121,6 +124,7 @@ "version": "6.1.0", "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-6.1.0.tgz", "integrity": "sha512-Oj3cAGPCqOZX7Rz64Uny2GYAZNliQSqfbePrgAQ1wKAihYmCUnraBtJtKcGR4xz7wF+LoJC+ssFZvv5BgF9Igg==", + "dev": true, "requires": { "clone-response": "^1.0.2", "get-stream": "^5.1.0", @@ -135,6 +139,7 @@ "version": "5.2.0", "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", + "dev": true, "requires": { "pump": "^3.0.0" } @@ -142,7 +147,8 @@ "lowercase-keys": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz", - "integrity": "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==" + "integrity": "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==", + "dev": true } } }, @@ -150,6 +156,7 @@ "version": "3.3.0", "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", "integrity": "sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=", + "dev": true, "requires": { "mimic-response": "^1.0.0" } @@ -157,12 +164,14 @@ "defer-to-connect": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-1.1.3.tgz", - "integrity": "sha512-0ISdNousHvZT2EiFlZeZAHBUvSxmKswVCEf8hW7KWgG4a8MVEu/3Vb6uWYozkjylyCxe0JBIiRB1jV45S70WVQ==" + "integrity": "sha512-0ISdNousHvZT2EiFlZeZAHBUvSxmKswVCEf8hW7KWgG4a8MVEu/3Vb6uWYozkjylyCxe0JBIiRB1jV45S70WVQ==", + "dev": true }, "get-stream": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", + "dev": true, "requires": { "pump": "^3.0.0" } @@ -171,6 +180,7 @@ "version": "9.6.0", "resolved": "https://registry.npmjs.org/got/-/got-9.6.0.tgz", "integrity": "sha512-R7eWptXuGYxwijs0eV+v3o6+XH1IqVK8dJOEecQfTmkncw9AV4dcw/Dhxi8MdlqPthxxpZyizMzyg8RTmEsG+Q==", + "dev": true, "requires": { "@sindresorhus/is": "^0.14.0", "@szmarczak/http-timer": "^1.1.2", @@ -188,12 +198,14 @@ "json-buffer": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.0.tgz", - "integrity": "sha1-Wx85evx11ne96Lz8Dkfh+aPZqJg=" + "integrity": "sha1-Wx85evx11ne96Lz8Dkfh+aPZqJg=", + "dev": true }, "keyv": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/keyv/-/keyv-3.1.0.tgz", "integrity": "sha512-9ykJ/46SN/9KPM/sichzQ7OvXyGDYKGTaDlKMGCAlg2UK8KRy4jb0d8sFc+0Tt0YYnThq8X2RZgCg74RPxgcVA==", + "dev": true, "requires": { "json-buffer": "3.0.0" } @@ -201,23 +213,37 @@ "lowercase-keys": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz", - "integrity": "sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA==" + "integrity": "sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA==", + "dev": true }, "p-cancelable": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-1.1.0.tgz", - "integrity": "sha512-s73XxOZ4zpt1edZYZzvhqFa6uvQc1vwUa0K0BdtIZgQMAJj9IbebH+JkgKZc9h+B05PKHLOTl4ajG1BmNrVZlw==" + "integrity": "sha512-s73XxOZ4zpt1edZYZzvhqFa6uvQc1vwUa0K0BdtIZgQMAJj9IbebH+JkgKZc9h+B05PKHLOTl4ajG1BmNrVZlw==", + "dev": true }, "responselike": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/responselike/-/responselike-1.0.2.tgz", "integrity": "sha1-kYcg7ztjHFZCvgaPFa3lpG9Loec=", + "dev": true, "requires": { "lowercase-keys": "^1.0.0" } + }, + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true } } }, + "@electron/remote": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@electron/remote/-/remote-1.0.4.tgz", + "integrity": "sha512-kguDJRhL3ZynHrkbX8Tr7xoAzGsNgh4eqXkycXb6cgXbOgehGqkBVe+MnjSVMXz3QJykerGKPy28gqcM7AFGYw==" + }, "@eslint/eslintrc": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.2.1.tgz", @@ -1384,22 +1410,16 @@ "integrity": "sha512-ZpIN1Vm5hlo9dkkST/1s8QqPNne2uwk3Plf6HcVUhnpfal0WnDRLdNj/wdQo3xRc+wnN3C25wPpPlV2E6aOunQ==" }, "electron": { - "version": "11.0.3", - "resolved": "https://registry.npmjs.org/electron/-/electron-11.0.3.tgz", - "integrity": "sha512-nNfbLi7Q1xfJXOEO2adck5TS6asY4Jxc332E4Te8XfQ9hcaC3GiCdeEqk9FndNCwxhJA5Lr9jfSGRTwWebFa/w==", + "version": "12.0.0", + "resolved": "https://registry.npmjs.org/electron/-/electron-12.0.0.tgz", + "integrity": "sha512-p6oxZ4LG82hopPGAsIMOjyoL49fr6cexyFNH0kADA9Yf+mJ72DN7bjvBG+6V7r6QKhwYgsSsW8RpxBeVOUbxVQ==", "dev": true, "requires": { "@electron/get": "^1.0.1", - "@types/node": "^12.0.12", + "@types/node": "^14.6.2", "extract-zip": "^1.0.3" }, "dependencies": { - "@types/node": { - "version": "12.19.6", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.19.6.tgz", - "integrity": "sha512-U2VopDdmBoYBmtm8Rz340mvvSz34VgX/K9+XCuckvcLGMkt3rbMX8soqFOikIPlPBc5lmw8By9NUK7bEFSBFlQ==", - "dev": true - }, "debug": { "version": "2.6.9", "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", @@ -1430,12 +1450,147 @@ } }, "electron-chromedriver": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/electron-chromedriver/-/electron-chromedriver-11.0.0.tgz", - "integrity": "sha512-ayMJPBbB4puU0SqYbcD9XvF3/7GWIhqKE1n5lG2/GQPRnrZkNoPIilsrS0rQcD50Xhl69KowatDqLhUznZWtbA==", + "version": "12.0.0", + "resolved": "https://registry.npmjs.org/electron-chromedriver/-/electron-chromedriver-12.0.0.tgz", + "integrity": "sha512-zOs98o9+20Er8Q44z06h90VldwrJaoRCieW3Q8WkdDjA3cMRU5mlmm1kGDhPLMeYNuhq6e39aGMVH/IBFD97HQ==", "requires": { - "@electron/get": "^1.12.2", + "@electron/get": "^1.12.4", "extract-zip": "^2.0.0" + }, + "dependencies": { + "@electron/get": { + "version": "1.12.4", + "resolved": "https://registry.npmjs.org/@electron/get/-/get-1.12.4.tgz", + "integrity": "sha512-6nr9DbJPUR9Xujw6zD3y+rS95TyItEVM0NVjt1EehY2vUWfIgPiIPVHxCvaTS0xr2B+DRxovYVKbuOWqC35kjg==", + "requires": { + "debug": "^4.1.1", + "env-paths": "^2.2.0", + "fs-extra": "^8.1.0", + "global-agent": "^2.0.2", + "global-tunnel-ng": "^2.7.1", + "got": "^9.6.0", + "progress": "^2.0.3", + "semver": "^6.2.0", + "sumchecker": "^3.0.1" + } + }, + "@sindresorhus/is": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.14.0.tgz", + "integrity": "sha512-9NET910DNaIPngYnLLPeg+Ogzqsi9uM4mSboU5y6p8S5DzMTVEsJZrawi+BoDNUVBa2DhJqQYUFvMDfgU062LQ==" + }, + "@szmarczak/http-timer": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-1.1.2.tgz", + "integrity": "sha512-XIB2XbzHTN6ieIjfIMV9hlVcfPU26s2vafYWQcZHWXHOxiaRZYEDKEwdl129Zyg50+foYV2jCgtrqSA6qNuNSA==", + "requires": { + "defer-to-connect": "^1.0.1" + } + }, + "cacheable-request": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-6.1.0.tgz", + "integrity": "sha512-Oj3cAGPCqOZX7Rz64Uny2GYAZNliQSqfbePrgAQ1wKAihYmCUnraBtJtKcGR4xz7wF+LoJC+ssFZvv5BgF9Igg==", + "requires": { + "clone-response": "^1.0.2", + "get-stream": "^5.1.0", + "http-cache-semantics": "^4.0.0", + "keyv": "^3.0.0", + "lowercase-keys": "^2.0.0", + "normalize-url": "^4.1.0", + "responselike": "^1.0.2" + }, + "dependencies": { + "get-stream": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", + "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", + "requires": { + "pump": "^3.0.0" + } + }, + "lowercase-keys": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz", + "integrity": "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==" + } + } + }, + "decompress-response": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", + "integrity": "sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=", + "requires": { + "mimic-response": "^1.0.0" + } + }, + "defer-to-connect": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-1.1.3.tgz", + "integrity": "sha512-0ISdNousHvZT2EiFlZeZAHBUvSxmKswVCEf8hW7KWgG4a8MVEu/3Vb6uWYozkjylyCxe0JBIiRB1jV45S70WVQ==" + }, + "get-stream": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", + "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", + "requires": { + "pump": "^3.0.0" + } + }, + "got": { + "version": "9.6.0", + "resolved": "https://registry.npmjs.org/got/-/got-9.6.0.tgz", + "integrity": "sha512-R7eWptXuGYxwijs0eV+v3o6+XH1IqVK8dJOEecQfTmkncw9AV4dcw/Dhxi8MdlqPthxxpZyizMzyg8RTmEsG+Q==", + "requires": { + "@sindresorhus/is": "^0.14.0", + "@szmarczak/http-timer": "^1.1.2", + "cacheable-request": "^6.0.0", + "decompress-response": "^3.3.0", + "duplexer3": "^0.1.4", + "get-stream": "^4.1.0", + "lowercase-keys": "^1.0.1", + "mimic-response": "^1.0.1", + "p-cancelable": "^1.0.0", + "to-readable-stream": "^1.0.0", + "url-parse-lax": "^3.0.0" + } + }, + "json-buffer": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.0.tgz", + "integrity": "sha1-Wx85evx11ne96Lz8Dkfh+aPZqJg=" + }, + "keyv": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-3.1.0.tgz", + "integrity": "sha512-9ykJ/46SN/9KPM/sichzQ7OvXyGDYKGTaDlKMGCAlg2UK8KRy4jb0d8sFc+0Tt0YYnThq8X2RZgCg74RPxgcVA==", + "requires": { + "json-buffer": "3.0.0" + } + }, + "lowercase-keys": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz", + "integrity": "sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA==" + }, + "p-cancelable": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-1.1.0.tgz", + "integrity": "sha512-s73XxOZ4zpt1edZYZzvhqFa6uvQc1vwUa0K0BdtIZgQMAJj9IbebH+JkgKZc9h+B05PKHLOTl4ajG1BmNrVZlw==" + }, + "responselike": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/responselike/-/responselike-1.0.2.tgz", + "integrity": "sha1-kYcg7ztjHFZCvgaPFa3lpG9Loec=", + "requires": { + "lowercase-keys": "^1.0.0" + } + }, + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==" + } } }, "emoji-regex": { @@ -3654,14 +3809,6 @@ "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", "dev": true }, - "sanitize-filename": { - "version": "1.6.3", - "resolved": "https://registry.npmjs.org/sanitize-filename/-/sanitize-filename-1.6.3.tgz", - "integrity": "sha512-y/52Mcy7aw3gRm7IrcGDFx/bCk4AhRh2eI9luHOQM86nZsqwiRkkq2GekHXBBD+SmPidc8i2PqtYZl+pWJ8Oeg==", - "requires": { - "truncate-utf8-bytes": "^1.0.0" - } - }, "semver": { "version": "7.3.2", "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz", @@ -4135,14 +4282,6 @@ "is-number": "^7.0.0" } }, - "truncate-utf8-bytes": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/truncate-utf8-bytes/-/truncate-utf8-bytes-1.0.2.tgz", - "integrity": "sha1-QFkjkJWS1W94pYGENLC3hInKXys=", - "requires": { - "utf8-byte-length": "^1.0.1" - } - }, "tsconfig-paths": { "version": "3.9.0", "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.9.0.tgz", @@ -4244,11 +4383,6 @@ "prepend-http": "^2.0.0" } }, - "utf8-byte-length": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/utf8-byte-length/-/utf8-byte-length-1.0.4.tgz", - "integrity": "sha1-9F8VDExm7uloGGUFq5P8u4rWv2E=" - }, "util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", diff --git a/package.json b/package.json index 5b4dfc218..e5c1046f3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "spectron", - "version": "13.0.0", + "version": "14.0.0", "description": "Easily test your Electron apps using ChromeDriver and WebdriverIO.", "main": "index.js", "types": "./lib/spectron.d.ts", @@ -26,8 +26,9 @@ "author": "Kevin Sawicki", "license": "MIT", "dependencies": { + "@electron/remote": "^1.0.4", "dev-null": "^0.1.1", - "electron-chromedriver": "^11.0.0", + "electron-chromedriver": "^12.0.0", "got": "^11.8.0", "split": "^1.0.1", "webdriverio": "^6.9.1" @@ -39,7 +40,7 @@ "chai-as-promised": "^7.1.1", "chai-roughly": "^1.0.0", "check-for-leaks": "^1.2.1", - "electron": "^11.0.3", + "electron": "^12.0.0", "eslint": "^7.14.0", "eslint-config-standard": "^16.0.2", "eslint-plugin-import": "^2.22.1", From f60fdbc87cd457662ecc960c7d41b5451df73d4d Mon Sep 17 00:00:00 2001 From: VerteDinde Date: Wed, 3 Mar 2021 13:14:28 -0800 Subject: [PATCH 2/4] chore: set fixtures to contentIsolation: false, update deprecation log number --- test/application-test.js | 2 +- test/fixtures/accessible/main.js | 4 +++- test/fixtures/app/main.js | 4 +++- test/fixtures/example/main.js | 4 +++- test/fixtures/multi-window/main.js | 7 +++++-- test/fixtures/no-node-integration/main.js | 4 +++- test/fixtures/not-accessible/main.js | 6 ++++-- test/fixtures/require-name/main.js | 4 +++- test/fixtures/slow/main.js | 4 +++- test/fixtures/web-view/main.js | 4 +++- 10 files changed, 31 insertions(+), 12 deletions(-) diff --git a/test/application-test.js b/test/application-test.js index 9dd51c605..d7f00880e 100644 --- a/test/application-test.js +++ b/test/application-test.js @@ -149,7 +149,7 @@ describe('application loading', function () { it('gets the render process console logs and clears them', async function () { await app.client.waitUntilWindowLoaded(); let logs = await app.client.getRenderProcessLogs(); - expect(logs.length).to.equal(2); + expect(logs.length).to.equal(3); expect(logs[0].message).to.contain('7:14 "render warn"'); expect(logs[0].source).to.equal('console-api'); expect(logs[0].level).to.equal('WARNING'); diff --git a/test/fixtures/accessible/main.js b/test/fixtures/accessible/main.js index 7e2369847..602fa98ff 100644 --- a/test/fixtures/accessible/main.js +++ b/test/fixtures/accessible/main.js @@ -1,4 +1,5 @@ const { app, BrowserWindow } = require('electron'); +require('@electron/remote/main').initialize(); let mainWindow = null; @@ -9,7 +10,8 @@ app.on('ready', function () { height: 600, webPreferences: { nodeIntegration: true, - enableRemoteModule: true + enableRemoteModule: true, + contextIsolation: false } }); mainWindow.loadFile('index.html'); diff --git a/test/fixtures/app/main.js b/test/fixtures/app/main.js index 21e487528..75e3553b0 100644 --- a/test/fixtures/app/main.js +++ b/test/fixtures/app/main.js @@ -1,4 +1,5 @@ const { app, BrowserWindow, ipcMain } = require('electron'); +require('@electron/remote/main').initialize(); const fs = require('fs'); const path = require('path'); @@ -20,7 +21,8 @@ app.on('ready', function () { height: 100, webPreferences: { enableRemoteModule: true, - nodeIntegration: true + nodeIntegration: true, + contextIsolation: false, } }); mainWindow.loadFile('index.html'); diff --git a/test/fixtures/example/main.js b/test/fixtures/example/main.js index d2116975a..068c226e2 100644 --- a/test/fixtures/example/main.js +++ b/test/fixtures/example/main.js @@ -1,4 +1,5 @@ const { app, BrowserWindow } = require('electron'); +require('@electron/remote/main').initialize(); let mainWindow = null; @@ -11,7 +12,8 @@ app.on('ready', function () { minWidth: 100, webPreferences: { nodeIntegration: true, - enableRemoteModule: true + enableRemoteModule: true, + contextIsolation: false, } }); mainWindow.loadFile('index.html'); diff --git a/test/fixtures/multi-window/main.js b/test/fixtures/multi-window/main.js index 4bfc1caf5..bad9fb115 100644 --- a/test/fixtures/multi-window/main.js +++ b/test/fixtures/multi-window/main.js @@ -1,4 +1,5 @@ const { app, BrowserWindow } = require('electron'); +require('@electron/remote/main').initialize(); let topWindow = null; let bottomWindow = null; @@ -11,7 +12,8 @@ app.on('ready', function () { height: 100, webPreferences: { nodeIntegration: true, - enableRemoteModule: true + enableRemoteModule: true, + contextIsolation: false } }); topWindow.loadFile('index-top.html'); @@ -26,7 +28,8 @@ app.on('ready', function () { height: 50, webPreferences: { nodeIntegration: true, - enableRemoteModule: true + enableRemoteModule: true, + contextIsolation: false } }); bottomWindow.loadFile('index-bottom.html'); diff --git a/test/fixtures/no-node-integration/main.js b/test/fixtures/no-node-integration/main.js index 9d5167803..6970a7006 100644 --- a/test/fixtures/no-node-integration/main.js +++ b/test/fixtures/no-node-integration/main.js @@ -1,4 +1,5 @@ const { app, BrowserWindow } = require('electron'); +require('@electron/remote/main').initialize(); let mainWindow = null; @@ -10,7 +11,8 @@ app.on('ready', function () { height: 100, webPreferences: { nodeIntegration: false, - enableRemoteModule: true + enableRemoteModule: true, + contextIsolation: false } }); mainWindow.loadFile('index.html'); diff --git a/test/fixtures/not-accessible/main.js b/test/fixtures/not-accessible/main.js index adffb02da..28a40ebc9 100644 --- a/test/fixtures/not-accessible/main.js +++ b/test/fixtures/not-accessible/main.js @@ -1,4 +1,5 @@ const { app, BrowserWindow } = require('electron'); +require('@electron/remote/main').initialize(); let mainWindow = null; @@ -9,8 +10,9 @@ app.on('ready', function () { height: 600, webPreferences: { nodeIntegration: true, - webviewTag: true, - enableRemoteModule: true + contextIsolation: false, + enableRemoteModule: true, + webviewTag: true } }); mainWindow.loadFile('index.html'); diff --git a/test/fixtures/require-name/main.js b/test/fixtures/require-name/main.js index abe06c484..5e84b08eb 100644 --- a/test/fixtures/require-name/main.js +++ b/test/fixtures/require-name/main.js @@ -1,4 +1,5 @@ const { app, BrowserWindow } = require('electron'); +require('@electron/remote/main').initialize(); const path = require('path'); let mainWindow = null; @@ -12,7 +13,8 @@ app.on('ready', function () { webPreferences: { nodeIntegration: false, preload: path.join(__dirname, 'preload.js'), - enableRemoteModule: true + enableRemoteModule: true, + contextIsolation: false } }); mainWindow.loadFile('index.html'); diff --git a/test/fixtures/slow/main.js b/test/fixtures/slow/main.js index c7ae1de63..9fcbfca92 100644 --- a/test/fixtures/slow/main.js +++ b/test/fixtures/slow/main.js @@ -1,4 +1,5 @@ const { app, BrowserWindow } = require('electron'); +require('@electron/remote/main').initialize(); let mainWindow = null; @@ -10,7 +11,8 @@ app.on('ready', function () { height: 100, webPreferences: { nodeIntegration: true, - enableRemoteModule: true + enableRemoteModule: true, + contextIsolation: false } }); mainWindow.loadFile('index.html'); diff --git a/test/fixtures/web-view/main.js b/test/fixtures/web-view/main.js index 184d167fe..12088c3f1 100644 --- a/test/fixtures/web-view/main.js +++ b/test/fixtures/web-view/main.js @@ -1,4 +1,5 @@ const { app, BrowserWindow } = require('electron'); +require('@electron/remote/main').initialize(); let mainWindow = null; @@ -11,8 +12,9 @@ app.on('ready', function () { minWidth: 100, webPreferences: { nodeIntegration: true, + enableRemoteModule: true, + contextIsolation: false, webviewTag: true, - enableRemoteModule: true } }); mainWindow.loadFile('index.html'); From 04f97b5e96d88f9e3b33be5e16d967cbbdbcfbe0 Mon Sep 17 00:00:00 2001 From: VerteDinde Date: Wed, 3 Mar 2021 13:15:36 -0800 Subject: [PATCH 3/4] chore: disable windowByIndex commands --- test/accessibility-test.js | 19 ++++++++++--------- test/fixtures/app/main.js | 2 +- test/fixtures/example/main.js | 2 +- test/fixtures/web-view/main.js | 2 +- test/web-view-test.js | 11 ++++++----- 5 files changed, 19 insertions(+), 17 deletions(-) diff --git a/test/accessibility-test.js b/test/accessibility-test.js index d46d76982..a188d2f2c 100644 --- a/test/accessibility-test.js +++ b/test/accessibility-test.js @@ -51,7 +51,7 @@ describe('app.client.auditAccessibility()', function () { it('resolves to an audit object with the results', async function () { await app.client.waitUntilWindowLoaded(); await app.client.windowByIndex(0); - let audit = await app.client.auditAccessibility(); + const audit = await app.client.auditAccessibility(); assert.strictEqual(audit.failed, true); expect(audit.results).to.have.length(3); @@ -66,14 +66,15 @@ describe('app.client.auditAccessibility()', function () { expect(audit.results[2].code).to.equal('AX_COLOR_01'); expect(audit.results[2].elements).to.deep.equal(['DIV']); expect(audit.results[2].severity).to.equal('Warning'); - await app.client.windowByIndex(1); - audit = await app.client.auditAccessibility(); - assert.strictEqual(audit.failed, true); - expect(audit.results).to.have.length(1); - - expect(audit.results[0].code).to.equal('AX_ARIA_01'); - expect(audit.results[0].elements).to.deep.equal(['DIV']); - expect(audit.results[0].severity).to.equal('Severe'); + // TODO: windowByIndex on webviews is failing in Electron 12 + // await app.client.windowByIndex(1); + // audit = await app.client.auditAccessibility(); + // assert.strictEqual(audit.failed, true); + // expect(audit.results).to.have.length(1); + + // expect(audit.results[0].code).to.equal('AX_ARIA_01'); + // expect(audit.results[0].elements).to.deep.equal(['DIV']); + // expect(audit.results[0].severity).to.equal('Severe'); }); it('ignores warnings when ignoreWarnings is specified', async function () { diff --git a/test/fixtures/app/main.js b/test/fixtures/app/main.js index 75e3553b0..e17bd10e6 100644 --- a/test/fixtures/app/main.js +++ b/test/fixtures/app/main.js @@ -22,7 +22,7 @@ app.on('ready', function () { webPreferences: { enableRemoteModule: true, nodeIntegration: true, - contextIsolation: false, + contextIsolation: false } }); mainWindow.loadFile('index.html'); diff --git a/test/fixtures/example/main.js b/test/fixtures/example/main.js index 068c226e2..26d29600f 100644 --- a/test/fixtures/example/main.js +++ b/test/fixtures/example/main.js @@ -13,7 +13,7 @@ app.on('ready', function () { webPreferences: { nodeIntegration: true, enableRemoteModule: true, - contextIsolation: false, + contextIsolation: false } }); mainWindow.loadFile('index.html'); diff --git a/test/fixtures/web-view/main.js b/test/fixtures/web-view/main.js index 12088c3f1..16d640f8c 100644 --- a/test/fixtures/web-view/main.js +++ b/test/fixtures/web-view/main.js @@ -14,7 +14,7 @@ app.on('ready', function () { nodeIntegration: true, enableRemoteModule: true, contextIsolation: false, - webviewTag: true, + webviewTag: true } }); mainWindow.loadFile('index.html'); diff --git a/test/web-view-test.js b/test/web-view-test.js index 66b6cd9c2..7c5686678 100644 --- a/test/web-view-test.js +++ b/test/web-view-test.js @@ -33,10 +33,11 @@ describe(' tags', function () { await app.client.waitUntilWindowLoaded(); const count = await app.client.getWindowCount(); expect(count).to.equal(2); - await app.client.windowByIndex(1); - const elem = await app.client.$('body'); - const text = await elem.getText(); - expect(text).to.equal('web view'); - await app.webContents.getTitle().should.eventually.equal('Web View'); + // TODO: windowByIndex on webviews is failing in Electron 12 + // await app.client.windowByIndex(1); + // const elem = await app.client.$('body'); + // const text = await elem.getText(); + // expect(text).to.equal('web view'); + // await app.webContents.getTitle().should.eventually.equal('Web View'); }); }); From d2ecadcb9b4171d8dd4a776d62a3b4e2a8aef425 Mon Sep 17 00:00:00 2001 From: VerteDinde Date: Wed, 3 Mar 2021 22:02:11 -0800 Subject: [PATCH 4/4] fix: disable contextIsolation on webframes --- test/accessibility-test.js | 19 +++++++++---------- test/fixtures/not-accessible/index.html | 8 +++++++- test/fixtures/web-view/index.html | 11 ++++++++++- test/web-view-test.js | 11 +++++------ 4 files changed, 31 insertions(+), 18 deletions(-) diff --git a/test/accessibility-test.js b/test/accessibility-test.js index a188d2f2c..d46d76982 100644 --- a/test/accessibility-test.js +++ b/test/accessibility-test.js @@ -51,7 +51,7 @@ describe('app.client.auditAccessibility()', function () { it('resolves to an audit object with the results', async function () { await app.client.waitUntilWindowLoaded(); await app.client.windowByIndex(0); - const audit = await app.client.auditAccessibility(); + let audit = await app.client.auditAccessibility(); assert.strictEqual(audit.failed, true); expect(audit.results).to.have.length(3); @@ -66,15 +66,14 @@ describe('app.client.auditAccessibility()', function () { expect(audit.results[2].code).to.equal('AX_COLOR_01'); expect(audit.results[2].elements).to.deep.equal(['DIV']); expect(audit.results[2].severity).to.equal('Warning'); - // TODO: windowByIndex on webviews is failing in Electron 12 - // await app.client.windowByIndex(1); - // audit = await app.client.auditAccessibility(); - // assert.strictEqual(audit.failed, true); - // expect(audit.results).to.have.length(1); - - // expect(audit.results[0].code).to.equal('AX_ARIA_01'); - // expect(audit.results[0].elements).to.deep.equal(['DIV']); - // expect(audit.results[0].severity).to.equal('Severe'); + await app.client.windowByIndex(1); + audit = await app.client.auditAccessibility(); + assert.strictEqual(audit.failed, true); + expect(audit.results).to.have.length(1); + + expect(audit.results[0].code).to.equal('AX_ARIA_01'); + expect(audit.results[0].elements).to.deep.equal(['DIV']); + expect(audit.results[0].severity).to.equal('Severe'); }); it('ignores warnings when ignoreWarnings is specified', async function () { diff --git a/test/fixtures/not-accessible/index.html b/test/fixtures/not-accessible/index.html index c945aa298..d416b3a9d 100644 --- a/test/fixtures/not-accessible/index.html +++ b/test/fixtures/not-accessible/index.html @@ -13,6 +13,12 @@
unreadable
- + + diff --git a/test/fixtures/web-view/index.html b/test/fixtures/web-view/index.html index 74ef8f99b..51c588272 100644 --- a/test/fixtures/web-view/index.html +++ b/test/fixtures/web-view/index.html @@ -6,6 +6,15 @@ - + + diff --git a/test/web-view-test.js b/test/web-view-test.js index 7c5686678..66b6cd9c2 100644 --- a/test/web-view-test.js +++ b/test/web-view-test.js @@ -33,11 +33,10 @@ describe(' tags', function () { await app.client.waitUntilWindowLoaded(); const count = await app.client.getWindowCount(); expect(count).to.equal(2); - // TODO: windowByIndex on webviews is failing in Electron 12 - // await app.client.windowByIndex(1); - // const elem = await app.client.$('body'); - // const text = await elem.getText(); - // expect(text).to.equal('web view'); - // await app.webContents.getTitle().should.eventually.equal('Web View'); + await app.client.windowByIndex(1); + const elem = await app.client.$('body'); + const text = await elem.getText(); + expect(text).to.equal('web view'); + await app.webContents.getTitle().should.eventually.equal('Web View'); }); });