spectron icon indicating copy to clipboard operation
spectron copied to clipboard

app.stop() not work, electron process stay in the background after the mocha test program exits

Open tanshuai opened this issue 2 years ago • 2 comments

Clone https://github.com/electron/electron-quick-start, then install the spectron and add test code by follow instructions from https://github.com/electron-userland/spectron#usage .

The test code runs successfully, but the electron process stay in the background after the mocha test program exits.

After running the test multiple times, too many processes are staying in the background.

Repo of the code to reproduce this issue: https://github.com/tanshuai/spectron-quick-start

Screenshot of this issue: image

Node.js 14.16.0, Chromium 91.0.4472.164, and Electron 13.5.2, Spectron 15.0.0, macOS 11.6

tanshuai avatar Oct 20 '21 09:10 tanshuai

Hi, Facing the same issue the electron window does not closes after the mocha test program exits with app.stop() and process stays in background.

"dependencies": { "appium": "1.21.0", "appium-adb": "8.12.3", "appium-windows-driver": "1.19.0", "archiver": "3.1.1", "assert": "2.0.0", "axios": "0.19.2", "chromedriver": "^92.0.2", "clipboardy": "2.3.0", "copy-paste": "1.3.0", "createerror": "1.3.0", "decompress": "4.2.1", "dev-null": "0.1.1", "electron": "13.1.7", "expect": "24.9.0", "fs-extra": "9.0.1", "http-status-codes": "1.3.2", "ini": "2.0.0", "kill-port": "1.6.1", "list": "2.0.19", "looks-same": "7.2.1", "mongodb": "3.6.6", "ngrok": "3.3.0", "parse-gitignore": "1.0.1", "puppeteer": "9.1.1", "robotjs": "0.6.0", "shelljs": "0.8.3", "spectron": "15.0.0", "webdriverio": "6.9.1", "yargs": "16.2.0" }, "devDependencies": { "@babel/cli": "7.5.5", "@babel/core": "7.5.5", "@babel/preset-env": "7.5.5", "@babel/register": "7.5.5", "@babel/traverse": "7.5.5", "@babel/types": "7.5.5", "@wdio/appium-service": "6.8.0", "@wdio/cli": "6.9.1", "@wdio/jasmine-framework": "6.8.0", "@wdio/local-runner": "6.9.1", "@wdio/sauce-service": "6.8.0", "@wdio/spec-reporter": "6.3.6", "babel-eslint": "10.0.2", "chai": "4.2.0", "chai-as-promised": "7.1.1", "cross-env": "7.0.3", "electron-chromedriver": "13.0.0", "eslint": "7.14.0", "eslint-config-standard": "12.0.0", "eslint-plugin-import": "2.18.2", "eslint-plugin-node": "7.0.1", "eslint-plugin-promise": "4.2.1", "eslint-plugin-standard": "4.0.1", "eslint-plugin-wdio": "5.12.1", "internal-ip": "5.0.0", "jsdoc": "3.6.3", "mocha": "9.0.2", "mocha-jenkins-reporter": "0.4.5", "ncp": "2.0.0", "node-fetch": "2.3.0", "prettier": "2.2.0", "spectron-fake-dialog": "0.0.1", "xvfb-maybe": "0.2.1" },

RizwanMR avatar Jan 19 '22 12:01 RizwanMR

Hi, Facing the same issue the electron window does not closes after the mocha test program exits with app.stop() and process stays in background.

"dependencies": { "appium": "1.21.0", "appium-adb": "8.12.3", "appium-windows-driver": "1.19.0", "archiver": "3.1.1", "assert": "2.0.0", "axios": "0.19.2", "chromedriver": "^92.0.2", "clipboardy": "2.3.0", "copy-paste": "1.3.0", "createerror": "1.3.0", "decompress": "4.2.1", "dev-null": "0.1.1", "electron": "13.1.7", "expect": "24.9.0", "fs-extra": "9.0.1", "http-status-codes": "1.3.2", "ini": "2.0.0", "kill-port": "1.6.1", "list": "2.0.19", "looks-same": "7.2.1", "mongodb": "3.6.6", "ngrok": "3.3.0", "parse-gitignore": "1.0.1", "puppeteer": "9.1.1", "robotjs": "0.6.0", "shelljs": "0.8.3", "spectron": "15.0.0", "webdriverio": "6.9.1", "yargs": "16.2.0" }, "devDependencies": { "@babel/cli": "7.5.5", "@babel/core": "7.5.5", "@babel/preset-env": "7.5.5", "@babel/register": "7.5.5", "@babel/traverse": "7.5.5", "@babel/types": "7.5.5", "@wdio/appium-service": "6.8.0", "@wdio/cli": "6.9.1", "@wdio/jasmine-framework": "6.8.0", "@wdio/local-runner": "6.9.1", "@wdio/sauce-service": "6.8.0", "@wdio/spec-reporter": "6.3.6", "babel-eslint": "10.0.2", "chai": "4.2.0", "chai-as-promised": "7.1.1", "cross-env": "7.0.3", "electron-chromedriver": "13.0.0", "eslint": "7.14.0", "eslint-config-standard": "12.0.0", "eslint-plugin-import": "2.18.2", "eslint-plugin-node": "7.0.1", "eslint-plugin-promise": "4.2.1", "eslint-plugin-standard": "4.0.1", "eslint-plugin-wdio": "5.12.1", "internal-ip": "5.0.0", "jsdoc": "3.6.3", "mocha": "9.0.2", "mocha-jenkins-reporter": "0.4.5", "ncp": "2.0.0", "node-fetch": "2.3.0", "prettier": "2.2.0", "spectron-fake-dialog": "0.0.1", "xvfb-maybe": "0.2.1" },

@RizwanMR

Spectron will be officially deprecated, I switched to Playwright. Please find my sample code https://github.com/tanshuai/electron-playwright-e2e-test-quick-start

🚨 On February 1, 2022, Spectron will be officially deprecated by the Electron team. Please read about more about our planned deprecation here.

tanshuai avatar Jan 22 '22 09:01 tanshuai