Few test fail in protractor with 199 error - node.js

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

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__/"

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

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

babel.config.js: Error while loading config - Cannot find module 'fibers'

This is driving me nuts.
IDE: Visual Studion 2019
Project: Created a new "Basic Vue.js project" - I chose the *.ts flavour
I validate the new site runs. It does.
Following the quick start on Vuetify : https://vuetifyjs.com/en/getting-started/quick-start/#bootstrapping-the-vuetify-object
After each step I validate the site will still compile and run.
I reach the section where we add new modules to our project. I run this line:
npm install sass sass-loader fibers deepmerge -D
And now the site will not run. When I debug I get this output:
------ Build started: Project: MCCC.Web, Configuration: Debug Any CPU ------
> mccc.web#0.1.0 build C:\Labs\MCCC\Web\MCCC-Web\MCCC.Web
> vue-cli-service build
- Building for production...
Starting type checking service...
Using 1 worker with 2048MB memory limit
ERROR Failed to compile with 1 errors5:04:50 PM
error in ./src/main.ts
Module build failed (from ./node_modules/thread-loader/dist/cjs.js):
Thread Loader (Worker 0)
C:\Labs\MCCC\Web\MCCC-Web\MCCC.Web\babel.config.js: Error while loading config - Cannot find module 'fibers'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Module.require (internal/modules/cjs/loader.js:690:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.<anonymous> (C:\Labs\MCCC\Web\MCCC-Web\MCCC.Web\babel.config.js:17:32)
at Module._compile (internal/modules/cjs/loader.js:776:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
# multi ./src/main.ts
ERROR Build failed with errors.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! mccc.web#0.1.0 build: `vue-cli-service build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the mccc.web#0.1.0 build 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\Dwainwright.BC\AppData\Roaming\npm-cache\_logs\2020-04-26T21_04_50_521Z-debug.log
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Microsoft\VisualStudio\v16.0\Node.js Tools\Microsoft.NodejsToolsV2.targets(60,5): error MSB3073: The command "npm run build" exited with code 1.
Done building project "MCCC.Web.njsproj" -- FAILED.
Build FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
The line that sticks out the most to me is:
C:\Labs\MCCC\Web\MCCC-Web\MCCC.Web\babel.config.js: Error while loading config - Cannot find module 'fibers'
fibres is references in the babel.config.json where I added the rules laid out in quick start:
module.exports = {
presets: [
'#vue/app',
'#babel/preset-env'
],
rules: [
{
test: /\.s(c|a)ss$/,
use: [
'vue-style-loader',
'css-loader',
{
loader: 'sass-loader',
// Requires sass-loader#^7.0.0
options: {
implementation: require('sass'),
fiber: require('fibers'),
indentedSyntax: true // optional
},
// Requires sass-loader#^8.0.0
options: {
implementation: require('sass'),
sassOptions: {
fiber: require('fibers'),
indentedSyntax: true // optional
},
},
},
],
},
]
};
Does anybody know how i can resolve this? Happy to share further info; not sure what else you may need.
Are you using the latest version of the docs? I followed the link you provided and the anchor #bootstrapping-the-vuetify-object doesn't appear to exist anymore. I was able to get a basic project up and running successfully following these steps:
vue create myapp: Selected "custom" and ticked all the boxes, for TypeScript, chose the default "class-style components"
verified that npm run serve worked
vue add vuetify: Selected "Configure", and these options:
Y (default)
y
y
Material Design Icons (default)
N (default)
Y (default)
English (default)
npm run serve would run, but I got warnings about type declaration for vuetify/lib. This answer led me to this FAQ item which made the warnings go away. (You have to add "vuetify" to the compilerOptions.types array in the root tsconfig.json for the project.)
FWIW, fibers does not appear to be included in the project at all anymore (searched for "fibers" in package-lock.json). My babel.config.js file looks like:
module.exports = {
presets: [
'#vue/cli-plugin-babel/preset'
]
}
And vue.config.js looks like:
module.exports = {
transpileDependencies: [
'vuetify'
]
}
Hope this helps!

Jestjs tests fail in Gitlab CI

I'm trying to run Jest tests in Gitlab CI.
The tests succeed locally but when I run them on Gitlab CI I get the following error:
Test suite failed to run
ProcessTerminatedError: cancel after 2 retries!
at Farm.<anonymous> (node_modules/worker-farm/lib/farm.js:81:25)
at Array.forEach (native)
at Farm.<anonymous> (node_modules/worker-farm/lib/farm.js:75:36)
at ontimeout (timers.js:386:14)
at tryOnTimeout (timers.js:250:5)
at Timer.listOnTimeout (timers.js:214:5)
A worker process has quit unexpectedly! Most likely this is an
initialization error.
error Command failed with exit code 1.
I tried to add the --runInBand option but this results in a segmentation fault. And I also tried the --maxWorkers option but this results in the same error. Any ideas how to resolve this issue?
I resolved this issue. The problem in my case was not Jest itself but with canvas-prebuilt I'm still not sure what the problem was but I replaced canvas-prebuilt with the canvas npm package and installed the required packages. Now everything works fine.

Resources