Protractor : MicrosoftEdge Driver : Error: Error: Server terminated early with status 1 - node.js

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

Related

"vitest --ui" causing "Error: spawn xdg-open ENOENT"

I'm trying to check out Vitest's fancy UI server in my node docker container. But can't get it up and running. When running the npm script vitest --ui I get a node error spawn xdg-open ENOENT.
Here the full error message:
$ npm run test-ui
> wpvite#0.0.0 test-ui
> vitest --ui
DEV v0.23.4 /home/node/apps/main/frontend
UI started at http://localhost:51204/__vitest__/
node:events:491
throw er; // Unhandled 'error' event
^
Error: spawn xdg-open ENOENT
at ChildProcess._handle.onexit (node:internal/child_process:283:19)
at onErrorNT (node:internal/child_process:476:16)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
Emitted 'error' event on ChildProcess instance at:
at ChildProcess._handle.onexit (node:internal/child_process:289:12)
at onErrorNT (node:internal/child_process:476:16)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
errno: -2,
code: 'ENOENT',
syscall: 'spawn xdg-open',
path: 'xdg-open',
spawnargs: [ 'https://localhost:51204/__vitest__/' ]
}
Node.js v18.10.0
Google is no help at all - nothing related to Vitest even close. Also I'm obviously not a Node.js expert.
Even though the Node.js error message appears pretty cryptic to me, I still was lucky to use Ubuntu as my primary OS (beside macOS) which made me draw my attention to xdg-open in the error message - I occasionally use the command to open all kind of programs/apps on Ubuntu. Don't know why, but you need to have xdg-open installed on your system, to be able to run vitest --ui, even though it's neither mentioned in Vitest nor in Vite Github repos with a single word. Anyway for debian based containers it's:
apt install xdg-utils --fix-missing
Allthough this made the ENOENT error go away and the UI server starts up without errors, I still don't get to see the UI app due to some runtime-dom errors... I give it up. But maybe someone else finds the xdg-open info helpful.
UPDATE: It's working!
I just had to append /__vitest__/ to my proxied local url as clearly described in the docs:
"Then you can visit the Vitest UI at http://localhost:51204/__vitest__/"

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

Azure Pipeline E2E Testing: unknown error: Chrome failed to start: exited abnormally

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).

Error while executing an automated script from azure pipeline

We have a script which was written in Protractor using node.js and grunt.
We have built an azure pipeline to execute that automated script by fetching it from github. Please see the commands we have written in yml file.
pool:
vmImage: 'vs2017-win2016'
steps:
- task: NodeTool#0
inputs:
versionSpec: '8.x'
displayName: 'Install Node.js'
- script: |
node --version
npm install
npm install -g grunt-cli
npm install grunt-cli
npm install grunt --save-dev
displayName: 'npm install and run grunt'
- script: |
npm install webdriver-manager -g
npm install protractor -g
webdriver-manager update
webdriver-manager start
displayName: 'Webdriver install'
- task: CmdLine#2
inputs:
script: |
cd resources
grunt
Question1: The script executes in 5 mins whereas with azure pipeline it takes 15 to 20 mins to run. Is it really worth to install all packages everytime and execute script through azure.
Question2: the command webdriver-manager start is a mandatory step for execution of the script(This is to make the selenium hub up and running), but while running the yml file, this particular step is throwing error and gets skipped.
Please see the error below.
[12:36:53] I/launcher - Running 1 instances of WebDriver
2018-12-18T12:36:53.4831548Z [12:36:53] I/hosted - Using the selenium server at http://localhost:4444/wd/hub
2018-12-18T12:36:54.2436510Z [12:36:54] E/launcher - Error code: 135
2018-12-18T12:36:54.2436720Z [12:36:54] E/launcher - Error message: ECONNREFUSED connect ECONNREFUSED 127.0.0.1:4444
2018-12-18T12:36:54.2436826Z [12:36:54] E/launcher - Error: ECONNREFUSED connect ECONNREFUSED 127.0.0.1:4444
2018-12-18T12:36:54.2441705Z [12:36:54] E/launcher - Process exited with error code 135
2018-12-18T12:36:54.2532843Z ‌>> ‌
2018-12-18T12:36:54.2537675Z ‌Warning: Tests failed, protractor exited with code: 135 Use --force to continue.‌
2018-12-18T12:36:54.2608988Z
2018-12-18T12:36:54.2609215Z ‌Aborted due to warnings.‌
2018-12-18T12:36:54.3660216Z ##[error]Cmd.exe exited with code '135'.
We have tried another way to execute the script, by hardcoding the selenium hub address in config.js (instead of localhost, ip address is provided) like this
seleniumAddress: 'http://<ipaddress>:4444/wd/hub',
but we see a different error as shown below.
2018-12-18T12:23:06.4867590Z ‌Running "protractor:e2e_tests" (protractor) task‌
2018-12-18T12:23:07.0061140Z I/launcher - Running 1 instances of WebDriver
2018-12-18T12:23:07.0061367Z I/hosted - Using the selenium server at http://:4444/wd/hub
2018-12-18T12:23:28.0555423Z E/launcher - ETIMEDOUT connect ETIMEDOUT :4444
2018-12-18T12:23:28.0556179Z E/launcher - Error: ETIMEDOUT connect ETIMEDOUT :4444
2018-12-18T12:23:28.0571368Z E/launcher - Process exited with error code 199
2018-12-18T12:23:28.0635055Z ‌>> ‌
2018-12-18T12:23:28.0635654Z ‌Warning: Tests failed, protractor exited with code: 199 Use --force to continue.‌
2018-12-18T12:23:28.0668847Z
2018-12-18T12:23:28.0688725Z ‌Aborted due to warnings.‌
2018-12-18T12:23:28.1695155Z ##[error]Cmd.exe exited with code '199'.
Any help will be highly appreciated. Thanks in advance!!

How can I use saucelabs connect with circle-ci 2.0?

In circle-ci 1.0 the config file seemed to specify dependencies. I noticed that in circle-ci 2.0 that this concept is gone to some degree.
Sooo I tried the following:
steps:
- checkout
- run:
name: Install Sauce Connect
command: |
wget https://saucelabs.com/downloads/sc-latest-linux.tar.gz
tar -xzf sc-latest-linux.tar.gz
...
- run: yarn integration
Seems like this didn't quite pan out. I get the following result in circle-ci's console:
#!/bin/bash -eo pipefail
yarn run integration
yarn run v0.24.6
$ node_modules/.bin/wdio test/wdio.conf.js
A service failed in the 'onPrepare' hook
Error: Could not start Sauce Connect. Exit code 1 signal: null
at ChildProcess.<anonymous> (/home/circleci/repo/node_modules/sauce-connect-launcher/lib/sauce-connect-launcher.js:559:12)
at emitTwo (events.js:125:13)
at ChildProcess.emit (events.js:213:7)
at Process.ChildProcess._handle.onexit (internal/child_process.js:197:12)
Continue...
ERROR: connect ECONNREFUSED 127.0.0.1:4445
chrome
Error
ERROR: connect ECONNREFUSED 127.0.0.1:4445
chrome
Error
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Exited with code 1
I'm using wdio, with the sauce and mocha plugins. It works locally. Ideas? Any guides that exist anywhere for this? Google didn't produce any answers for circle-ci 2.0 and saucelabs integrations.

Resources