Azure Pipeline E2E Testing: unknown error: Chrome failed to start: exited abnormally - node.js

I about to run my protractor test in azure pipeline.
Following steps are success,
npm install
webdriver update
when running "npm run e2e" got below error (highlighted with space),
2020-12-28T11:24:00.1123719Z Date: 2020-12-28T11:24:00.108Z - Hash: 3bfb7dbf8249d8ecd0a9 - Time: 44081ms
2020-12-28T11:24:00.1205386Z ** Angular Live Development Server is listening on localhost:4203, open your browser on http://localhost:4203/ **
2020-12-28T11:24:00.1739298Z [34mℹ[39m [90m「wdm」[39m: Compiled successfully.
2020-12-28T11:24:01.9754480Z [11:24:01] I/launcher - Running 1 instances of WebDriver
2020-12-28T11:24:01.9755656Z [11:24:01] I/direct - Using ChromeDriver directly...
2020-12-28T11:24:06.7970214Z [11:24:06] E/launcher - unknown error: Chrome failed to start: exited abnormally.
2020-12-28T11:24:06.7972134Z (unknown error: DevToolsActivePort file doesn't exist)
2020-12-28T11:24:06.7980054Z (The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
2020-12-28T11:24:06.7981720Z (Driver info: chromedriver=87.0.4280.88 (89e2380a3e36c3464b5dd1302349b1382549290d-refs/branch-heads/4280#{#1761}),platform=Linux 4.15.0-1100-azure x86_64)
2020-12-28T11:24:06.7982724Z [11:24:06] E/launcher - WebDriverError: unknown error: Chrome failed to start: exited abnormally.
2020-12-28T11:24:06.7983474Z (unknown error: DevToolsActivePort file doesn't exist)
2020-12-28T11:24:06.7984515Z (The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
2020-12-28T11:24:06.7985577Z (Driver info: chromedriver=87.0.4280.88 (89e2380a3e36c3464b5dd1302349b1382549290d-refs/branch-heads/4280#{#1761}),platform=Linux 4.15.0-1100-azure x86_64)
2020-12-28T11:24:06.7986586Z at Object.checkLegacyResponse (/home/vsts/work/1/s/amaze-commerce/node_modules/selenium-webdriver/lib/error.js:546:15)
2020-12-28T11:24:06.7987489Z at parseHttpResponse (/home/vsts/work/1/s/amaze-commerce/node_modules/selenium-webdriver/lib/http.js:509:13)
2020-12-28T11:24:06.7988405Z at doSend.then.response (/home/vsts/work/1/s/amaze-commerce/node_modules/selenium-webdriver/lib/http.js:441:30)
2020-12-28T11:24:06.7988962Z at process._tickCallback (internal/process/next_tick.js:68:7)
2020-12-28T11:24:06.7989391Z From: Task: WebDriver.createSession()
2020-12-28T11:24:06.7990163Z at Function.createSession (/home/vsts/work/1/s/amaze-commerce/node_modules/selenium-webdriver/lib/webdriver.js:769:24)
2020-12-28T11:24:06.7991076Z at Function.createSession (/home/vsts/work/1/s/amaze-commerce/node_modules/selenium-webdriver/chrome.js:761:15)
2020-12-28T11:24:06.7992017Z at Direct.getNewDriver (/home/vsts/work/1/s/amaze-commerce/node_modules/protractor/built/driverProviders/direct.js:77:33)
2020-12-28T11:24:06.7992916Z at Runner.createBrowser (/home/vsts/work/1/s/amaze-commerce/node_modules/protractor/built/runner.js:195:43)
2020-12-28T11:24:06.7993802Z at q.then.then (/home/vsts/work/1/s/amaze-commerce/node_modules/protractor/built/runner.js:339:29)
2020-12-28T11:24:06.8001078Z at _fulfilled (/home/vsts/work/1/s/amaze-commerce/node_modules/q/q.js:834:54)
2020-12-28T11:24:06.8001877Z at /home/vsts/work/1/s/amaze-commerce/node_modules/q/q.js:863:30
2020-12-28T11:24:06.8002782Z at Promise.promise.promiseDispatch (/home/vsts/work/1/s/amaze-commerce/node_modules/q/q.js:796:13)
2020-12-28T11:24:06.8003556Z at /home/vsts/work/1/s/amaze-commerce/node_modules/q/q.js:556:49
2020-12-28T11:24:06.8004307Z at runSingle (/home/vsts/work/1/s/amaze-commerce/node_modules/q/q.js:137:13)
2020-12-28T11:24:06.8005078Z [11:24:06] E/launcher - Process exited with error code 199
2020-12-28T11:24:07.4394944Z npm ERR! code ELIFECYCLE
2020-12-28T11:24:07.4395828Z npm ERR! errno 1
2020-12-28T11:24:07.4462731Z npm ERR! amaze-commerce#1.0.0 e2etest: `node --max_old_space_size=35000 ./node_modules/#angular/cli/bin/ng e2e`
2020-12-28T11:24:07.4465097Z npm ERR! Exit status 1
2020-12-28T11:24:07.4468705Z npm ERR!
2020-12-28T11:24:07.4472803Z npm ERR! Failed at the amaze-commerce#1.0.0 e2etest script.
2020-12-28T11:24:07.4475619Z npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2020-12-28T11:24:07.4546066Z
2020-12-28T11:24:07.4546683Z npm ERR! A complete log of this run can be found in:
2020-12-28T11:24:07.4547625Z npm ERR! /home/vsts/.npm/_logs/2020-12-28T11_24_07_448Z-debug.log
2020-12-28T11:24:07.4656714Z ##[error]Bash exited with code '1'.
2020-12-28T11:24:07.4737893Z ##[section]Finishing: run e2e test
Please help me on this issue.
Thanks in Advance.

Add below chromeOptions in protractor.conf file
capabilities: {
browserName: 'chrome',
chromeOptions: {
args: ['--disable-gpu', '--no-sandbox','--headless', '--disable-extensions', '--disable-dev-shm-usage']
}
--disable-dev-shm-usage : overcome limited resource problems
// The /dev/shm partition is too small in certain VM environments, causing
// Chrome to fail or crash (see http://crbug.com/715363). Use disable-dev-shm-usage flag to
// work-around this issue (a temporary directory will always be used to create
// anonymous shared memory files).

Related

Few test fail in protractor with 199 error

I am very new to protractor, I am fixing non-reg written by x-team members, the issue Im facing is all the test scripts work perfectly, except 3 of them, I am unable to find out how to start investigating the issue or what the issue could be.
the 199 error I have seen here is mostly associated with browser/ chrome driver issues, but hundreds of the other tests in the same folder work absolutely fine and these scripts get skip execution, hence they show result as fail.
I tried checking if there could be any issue in the script, but the script appears fine.
here is the error I get, when this particular script is run:
> mui-qa#1.0.0 prepro-run C:\mui_2jan
> node node_modules/typescript/bin/tsc || echo done
> mui-qa#1.0.0 pro-run C:\mui_2jan
> node node_modules/protractor/bin/protractor jsTranspiledFiles/config.js
spcefile: { browserName: 'chrome',
chromeOptions:
{ args:
[ '--start-maximized',
'--disable-web-security',
'--allow-file-access',
'--allow-insecure-localhost',
'--allow-running-insecure-content',
'--enable-automation' ] },
specs: [] }
[23:57:32] W/launcher - You have specified both capabilities and multiCapabilities. This will result in capabilities being ignored
[23:57:32] E/launcher - Spec patterns did not match any files.
[23:57:32] E/launcher - Error: Spec patterns did not match any files.
at Runner.run (C:\mui_2jan\node_modules\protractor\built\runner.js:322:19)
at TaskRunner.run (C:\mui_2jan\node_modules\protractor\built\taskRunner.js:110:27)
at createNextTaskRunner (C:\mui_2jan\node_modules\protractor\built\launcher.js:235:28)
at helper.runFilenameOrFn_.then.then.then (C:\mui_2jan\node_modules\protractor\built\launcher.js:260:13)
at _fulfilled (C:\mui_2jan\node_modules\q\q.js:834:54)
at self.promiseDispatch.done (C:\mui_2jan\node_modules\q\q.js:863:30)
at Promise.promise.promiseDispatch (C:\mui_2jan\node_modules\q\q.js:796:13)
at C:\mui_2jan\node_modules\q\q.js:604:44
at runSingle (C:\mui_2jan\node_modules\q\q.js:137:13)
at flush (C:\mui_2jan\node_modules\q\q.js:125:13)
[23:57:32] E/launcher - Process exited with error code 199
npm ERR! code ELIFECYCLE
npm ERR! errno 199
npm ERR! mui-qa#1.0.0 pro-run: `node node_modules/protractor/bin/protractor jsTranspiledFiles/config.js`
npm ERR! Exit status 199
npm ERR!
npm ERR! Failed at the mui-qa#1.0.0 pro-run script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\rbegum\AppData\Roaming\npm-cache\_logs\2021-02-05T18_27_32_296Z-debug.log
Any Idea?
Without seeing your config file, I see multiple problems:
specs: [] && Error: Spec patterns did not match any files. no specs specified. Maybe because it's specified in a wrong place
what is spcefile?
You have specified both capabilities and multiCapabilities. This will result in capabilities being ignored error. I would not recommend using multiCapabilities until you become comfortable with protractor
it seems that your specs list specs: [] is empty. you must provide the specs files which you want to execute in your script. the protractor.conf files do not know which file to execute.
Basically, in layman's terms, the flow is you write your specs file let's say spec1.ts, spec2.ts, and so on.
Then you need to mention those files in your protractor.conf files.
Details can be found https://www.protractortest.org/#/api-overview

Protractor : MicrosoftEdge Driver : Error: Error: Server terminated early with status 1

I have followed the below but still not able to run Microsoft edge
In windows to download the MicrosoftEdge Webdriver for the HTML version >= 18 then follow the below steps
Open Command Prompt, issue the following command and wait until operation gets completed
DISM.exe /Online /Add-Capability /CapabilityName:Microsoft.WebDriver~~~~0.0.1.0
Open the File Explorer and navigate to C:\Windows\WinSxS and search for MicrosoftWebDriver and it will display two results, copy the webdriver from the amd64_microsoft-webdriver-server-components10.0.18362.1_none and paste it in
/c/Users/Administrator/AppData/Roaming/npm/node_modules/protractor/node_modules/webdriver-`manager/selenium
(Note: Using git bash, it's easy to copy the Webdriver)
In the config file of Edge browser, make the following changes
seleniumArgs:['-Dwebdriver.edge.driver=C:\\Users\\Administrator\\AppData\\Roaming\\npm\\node_modules\\protractor\\node_modules\\webdriver-manager\\selenium\\MicrosoftWebDriver.exe'],
capabilities: {
'browserName': 'MicrosoftEdge',
'maxInstances': 1,
'platformName': 'windows',
'nativeEvents': false,
shardTestFiles: true,
},
Open the command prompt, and navigate to project repo and issue the following command to start the edge session
webdriver-manager start --edge "C:\Users\Administrator\AppData\Roaming\npm\node_modules\protractor\node_modules\webdriver-manager\selenium\MicrosoftWebDriver.exe"`
Getting an error as :
[23:38:22] I/launcher - Running 1 instances of WebDriver
[23:38:22] I/local - Starting selenium standalone server...
[23:38:22] E/launcher - Error: Error: Server terminated early with status 1
at C:\Collabera\Web Automation\Spades3\node_modules\protractor\node_modules\selenium-webdriver\remote\index.js:252:52
at processTicksAndRejections (internal/process/task_queues.js:93:5)
[23:38:22] E/launcher - Process exited with error code 100
npm ERR! code ELIFECYCLE
npm ERR! errno 100
npm ERR! spades3#1.0.0 test: `protractor JSFiles/configuration.js`
npm ERR! Exit status 100
npm ERR!
npm ERR! Failed at the spades3#1.0.0 test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Thanks
Aakash Paliwal

jhipster error in windows

I was able to run the steps in the this link in Mac
When I tried the same example in Windows , I get the below error on npm start.
[at-loader] Ok, 0.216 sec.
Error: spawn UNKNOWN
at _errnoException (util.js:999:13)
at ChildProcess.spawn (internal/child_process.js:340:11)
at exports.spawn (child_process.js:499:9)
at Object.exports.execFile (child_process.js:209:15)
at Object.module.exports.fileCommand (D:\Users\myusername\Projects\apps\testjhispter\node_modules\node-notifier\lib\utils.js:53:13)
at WindowsToaster.notify (D:\Users\myusername\Projects\apps\testjhispter\node_modules\node-notifier\notifiers\toaster.js:65:9)
at module.exports.WebpackNotifierPlugin.compilationDone (D:\Users\myusername\Projects\apps\testjhispter\node_modules\webpack-notifier\index.js:62:18)
at Compiler.applyPlugins (D:\Users\myusername\Projects\apps\testjhispter\node_modules\tapable\lib\Tapable.js:61:14)
at Watching._done (D:\Users\myusername\Projects\apps\testjhispter\node_modules\webpack\lib\Compiler.js:105:17)
at onCompiled (D:\Users\myusername\Projects\apps\testjhispter\node_modules\webpack\lib\Compiler.js:55:18)
at applyPluginsAsync.err (D:\Users\myusername\Projects\apps\testjhispter\node_modules\webpack\lib\Compiler.js:510:14)
at next (D:\Users\myusername\Projects\apps\testjhispter\node_modules\tapable\lib\Tapable.js:202:11)
at D:\Users\myusername\Projects\apps\testjhispter\node_modules\awesome-typescript-loader\src\instance.ts:488:25
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:160:7)
[Browsersync] Proxying: http://localhost:9060
[Browsersync] Access URLs:
-------------------------------------
Local: http://localhost:9000
External: http://10.23.150.12:9000
-------------------------------------
UI: http://localhost:3001
UI External: http://10.23.150.12:3001
-------------------------------------
webpack: wait until bundle finished: /
webpack: wait until bundle finished: /
webpack: wait until bundle finished: /
webpack: wait until bundle finished: /
webpack: wait until bundle finished: /
Windows 10 Enterprise
Node version 9.3.0
NPM version 5.6.0
JHipster version 4.13.0
Installed node LTS version and got the same error again
Error: spawn UNKNOWN
at _errnoException (util.js:1024:11)
at ChildProcess.spawn (internal/child_process.js:323:11)
at exports.spawn (child_process.js:502:9)
at Object.exports.execFile (child_process.js:212:15)
at Object.module.exports.fileCommand (D:\Users\myusername\Projects\apps\testjhipsterlts\node_modules\node-notifier\lib\utils.js:53:13)
at WindowsToaster.notify (D:\Users\myusername\Projects\apps\testjhipsterlts\node_modules\node-notifier\notifiers\toaster.js:65:9)
at module.exports.WebpackNotifierPlugin.compilationDone (D:\Users\myusername\Projects\apps\testjhipsterlts\node_modules\webpack-notifier\index.js:62:18)
at Compiler.applyPlugins (D:\Users\myusername\Projects\apps\testjhipsterlts\node_modules\tapable\lib\Tapable.js:61:14)
at Watching._done (D:\Users\myusername\Projects\apps\testjhipsterlts\node_modules\webpack\lib\Compiler.js:105:17)
at compiler.emitRecords.err (D:\Users\myusername\Projects\apps\testjhipsterlts\node_modules\webpack\lib\Compiler.js:79:19)
at Compiler.emitRecords (D:\Users\myusername\Projects\apps\testjhipsterlts\node_modules\webpack\lib\Compiler.js:371:38)
at compiler.emitAssets.err (D:\Users\myusername\Projects\apps\testjhipsterlts\node_modules\webpack\lib\Compiler.js:62:20)
at applyPluginsAsyncSeries1.err (D:\Users\myusername\Projects\apps\testjhipsterlts\node_modules\webpack\lib\Compiler.js:364:12)
at next (D:\Users\myusername\Projects\apps\testjhipsterlts\node_modules\tapable\lib\Tapable.js:218:11)
at Compiler.compiler.plugin (D:\Users\myusername\Projects\apps\testjhipsterlts\node_modules\webpack\lib\performance\SizeLimitsPlugin.js:99:4)
at next (D:\Users\myusername\Projects\apps\testjhipsterlts\node_modules\tapable\lib\Tapable.js:220:14)
Windows 10 Enterprise Edition
Node 8.9.3
npm 5.6.0
JHipster 4.13.0
Tried installing yarn and using it instead of npm - no luck. I still get the same error

Server terminated early with status 2 error while running e2e tests on windows

I'm working on an angular 2 app and for that I've configured protractor for end-2-end testing. but when I try to run the test cases, I get the following error
[11:53:45] I/local - Starting selenium standalone server...
[11:53:45] I/launcher - Running 1 instances of WebDriver
[11:53:45] E/launcher - Server terminated early with status 2
[11:53:45] E/launcher - Error: Server terminated early with status 2
at Error (native)
at C:\Users\Dell\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\remote\index.js:242:20
at ManagedPromise.invokeCallback_ (C:\Users\Dell\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:1379:14)
at TaskQueue.execute_ (C:\Users\Dell\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:2913:14)
at TaskQueue.executeNext_ (C:\Users\Dell\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:2896:21)
at asyncRun (C:\Users\Dell\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:2775:27)
at C:\Users\Dell\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:639:7
at process._tickCallback (internal/process/next_tick.js:109:7)
[11:53:45] E/launcher - Process exited with error code 199
webdriver-manager version: 10.3.0
node version: 6.11.0
npm version: 3.8.6
protractor version: 4.0.9
Environment: Windows
I've searched the web but unable to find solution for the issue. Any help would be appreciated. Thanks

E/launcher - Process exited with error code 135

I am trying to run the protractor test from my windows machine.
Configuration Used:
OS : Windows 7
Node : 6.11.3
Protractor : 5.1.2
NPM : 3.10.10
I am unable to run the Protractor test because of the below error.
C:\Users\Admin>protractor conf.js [14:45:16] I/launcher - Running 1 instances of WebDriver [14:45:16] I/hosted - Using the selenium server at http://localhost:4444/wd/hub [14:45:18] E/launcher - Error code: 135 [14:45:18] E/launcher - Error message: ECONNREFUSED connect ECONNREFUSED 127.0.0 .1:4444 [14:45:18] E/launcher - Error: ECONNREFUSED connect ECONNREFUSED 127.0.0.1:4444
at ClientRequest.<anonymous> (C:\Users\Admin\AppData\Roaming\npm\node_module s\protractor\node_modules\selenium-webdriver\http\index.js:238:15)
at emitOne (events.js:96:13)
at ClientRequest.emit (events.js:188:7)
at Socket.socketErrorListener (_http_client.js:310:9)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at emitErrorNT (net.js:1277:8)
at _combinedTickCallback (internal/process/next_tick.js:80:11)
at process._tickCallback (internal/process/next_tick.js:104:9) From: Task: WebDriver.createSession()
at Function.createSession (C:\Users\Admin\AppData\Roaming\npm\node_modules\p rotractor\node_modules\selenium-webdriver\lib\webdriver.js:777:24)
at Function.createSession (C:\Users\Admin\AppData\Roaming\npm\node_modules\p rotractor\node_modules\selenium-webdriver\chrome.js:709:29)
at createDriver (C:\Users\Admin\AppData\Roaming\npm\node_modules\protractor\ node_modules\selenium-webdriver\index.js:167:33)
at Builder.build (C:\Users\Admin\AppData\Roaming\npm\node_modules\protractor \node_modules\selenium-webdriver\index.js:623:16)
at Hosted.getNewDriver (C:\Users\Admin\AppData\Roaming\npm\node_modules\prot ractor\lib\driverProviders\driverProvider.ts:60:29)
at Runner.createBrowser (C:\Users\Admin\AppData\Roaming\npm\node_modules\pro tractor\lib\runner.ts:225:39)
at q.then.then (C:\Users\Admin\AppData\Roaming\npm\node_modules\protractor\l ib\runner.ts:391:27)
at _fulfilled (C:\Users\Admin\AppData\Roaming\npm\node_modules\protractor\no de_modules\q\q.js:834:54)
at self.promiseDispatch.done (C:\Users\Admin\AppData\Roaming\npm\node_module s\protractor\node_modules\q\q.js:863:30)
at Promise.promise.promiseDispatch (C:\Users\Admin\AppData\Roaming\npm\node_ modules\protractor\node_modules\q\q.js:796:13) [14:45:18]
***E/launcher - Process exited with error code 135***
I keep receiving the error "E/launcher - Process exited with error code 135" noted in the stack-trace above. How can I get the protractor test to complete successfully?
Try doing below steps:-
Open cmd and in the home path use below commands.
webdriver-manager clean
webdriver-manager status
webdriver-manager update
webdriver-manager start.
It looks like You can't connect to the selenium server. Comment this :
seleniumAddress: 'http://localhost:4444/wd/hub'
and replace it with:
directConnect: true,
just to check if is working directly.
Also You can navigate directly to http://localhost:4444/wd/hub to see If you can access there. If not it might be some firewall or something similar.
First, open a command prompt and then
run the following command:
webdriver-manager start
Open a second command prompt then enter your command. Mine is protractor conf.js
Probably a bit late but I get this error when I fail to start server for web-driver using:
webdriver-manager start
Update the chrome driver using the command =>
webdriver-manager update --versions.chrome <73.0.3683.68>
after upgrading just install node modules once again using cmd => npm install

Resources