NodeJS, Protractor and Chrome DevTools Error - node.js

I am trying to get Protractor E2E testing to run on my local Windows workstation at work but I keep getting this error.
webpack: Compiled successfully. [07:50:41] I/file_manager - creating
folder
c:\repos\polo-buyer-ui\node_modules\protractor\node_modules\webdriver-manager\selenium
[07:50:42] I/update - chromedriver: unzipping chromedriver_2.32.zip
[07:50:44] I/launcher - Running 1 instances of WebDriver [07:50:44]
I/direct - Using ChromeDriver directly...
[0925/075047.256:ERROR:devtools_http_handler.cc(786)] DevTools
listening on 127.0.0.1:12985
I am able to get it to work with no issues on a linux workstation and my personal (non-work) PC runnning Windows 10. I find very little information on this error message
[0925/075047.256:ERROR:devtools_http_handler.cc(786)] DevTools
But I get this no matter what I do and I can't figure out why?

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.

could you please check whether your laptop has any encryption in the system. Few of these encryptions corrupt the node modules , which results in the failure of the test cases.
This is the only reason I could guess since you ran all your test cases earlier
To verify this you could uninstall all the npm files and re-install them again and then re-run your test cases without re-starting your PC
PS : I faced the same issue and we asked IT team to remove encryption for just one folder which will contain all the automation code

Related

ChromeNotInstalledError while using chrome-launcher npm package

I am using chrome-launcher for running lighthouse programmatically. It works fine locally but when I run it on azure I am getting an error.
On this statement const chrome = await chromeLauncher.launch({chromeFlags: ['--headless']}); I am getting the following error:
ChromeNotInstalledErrorat new LauncherError (C:\home\site\wwwroot\node_modules\chrome-launcher\dist\utils.js:37:22)at new ChromeNotInstalledError (C:\home\site\wwwroot\node_modules\chrome-launcher\dist\utils.js:68:9){message: 'No Chrome installations found.',code: 'ERR_LAUNCHER_NOT_INSTALLED'}
How can I solve this?
You need to install Chrome on the Azure Function app somehow.
One way to do this is by using an npm dependency that installs Chrome as part of its install process. Examples of this are puppeteer and playwright. Although then you end up with some unnecessary dependencies.
You could also have a startup script or something that installs Chrome before running chrome-launcher/lighthouse. You'll need to tell crome-launcher where Chrome is installed if it's not a standard place using chromePath options or CHROME_PATH environment variable link.
You also have to ensure you do a Remote Build for the Function app.
You will also run into this error, which has a possible workaround: https://github.com/GoogleChrome/chrome-launcher/issues/188
Overall it's not easy. I actually ended up moving my workflow to GitHub Actions instead as Chrome is already installed on their runner images.
See:
https://anthonychu.ca/post/azure-functions-headless-chromium-puppeteer-playwright/

Cypress verification timed out after 30000 milliseconds

I am using cypress 5.0 in JS project. When I try to run npx cypress open keep getting error verification timed out after 30000 milliseconds.
Node version: v12.18.2
OS: Windows 7
Cypress : 5.0.0
I have downgraded to Cypress 4.0.0 and downgraded my node too. But keep getting the error. Please find the screenshot below. 2
I had a similar issue and I used the npx cypress verify to carry out the verification.
This happens because there's a verification that's meant to happen for first-time users but for some reason, the verification process times out.so one way to make the verification work is by using the npx cypress verify package.
This issue is not related to Cypress version. To resolve it, you need to increase the default timeout.
Open node_modules\cypress\lib\tasks\verify.js, search for VERIFY_TEST_RUNNER_TIMEOUT_MS and change it from 30000 (default) to 100000.
Save the file, then try to open the runner.
Retrying launching Cypress one more time worked out with the error being gone, hmm...
From Cypress version 9.2.0, you no longer have to change the timeout value in node_modules\cypress\lib\tasks\verify.js file manually.
Instead, you can utilize an environment variable called CYPRESS_VERIFY_TIMEOUT "to override the timeout duration of the verify command". Here is the link to the documentation about cypress verify command that mentions it.
Even better, starting from version 9.3.0, we can set the environment variable in a project's package.json or .npmrc (or .yarnrc) file.
Using this environment variable to increase the timeout (3 minutes for us) was necessary for us to ensure stability in our CI testing pipeline.
It's all due the Cache. Clear the cache it will automatically set.
I got the solution from this article. Follow the last step:
npm cache clean --force
https://softans.com/clear-cache-file-in-cypress/
Rerun it. It will work.
Rerunning it verified the cypress.
I had the same problem, running Cypress in WSL 2 would throw the same error even after trying all the solutions here.
I realised my Xserver was not running, started it up and everything worked again.
Please try this
go to path: node_modules\cypress\lib\tasks\verify.js, and you need to increase the default timeout.
Open verify.js, search for the variable VERIFY_TEST_RUNNER_TIMEOUT_MS. By default it should be 30000. Change it to 100000.
Save and try to open the runner. I hope now you will able to run the tests.
To resolve this issue, you need to increase default timeout. For this, go to below path: node_modules\cypress\lib\tasks\verify.js & Open verify.js, search variable VERIFY_TEST_RUNNER_TIMEOUT_MS. By default it should be 30000. Change it to 100000.
I also got this error , so I relaunch the cypress again(Which works for me) and also to be on safe side i have change the default duration with 100000s for future.
I just had the same problem, I solved it just by disabling the antivirus [Windows 10].
1st time using this tool today on my CentOS system.
Got the same error when trying to run cypress open and cypress verify.
Tried clearing the cache, reinstalling and all that fun stuff.
Nothing fixed it.
Note: I had VSCode running on my system and I had recently started the Angular ng test to test other tests.
Apparently something with ng test interferes with Cypress. Once I turned off ng test and tried to open and verify Cypress it worked.
Cypress 9.1.1
Problem with Windows was restarting the terminal, probably the PATH was not correctly updated.

Issues running React app on Windows environement

I have a working react app that I had hosted on a linux environment, but the client has switched their hosting provider and now I have to run the app on a Windows environment. I personally am unfamiliar with Windows and having some serious issues getting my app to work now.
After loads of debugging and testing I now can get my app to run, but when I start it, it will throw some errors which will results in a broken app in the browser.
So when I run npm start it will start up the app and spit out this error:
Screenshot of the terminal error 1/2
Screenshot of the terminal error 2/2
It seems to spit out some complaints when using npm run watchJS which runs this command babel src --watch --out-dir lib.
I am completely lost at this point and have no idea where to go from here.
I can provide as much detail as anyone needs after looking at the question, I just don't know what else to add to this issue and don't want to fill up this question with irrelevant info.
Thanks in advance for any help
It is likely a bug with the version of npm you are using.
See this thread:
https://github.com/npm/npm/issues/18380
Try rolling back your version of npm to 5.3
The issue appears to be exclusive to windows with babel packages.

Protactor error, Unexpected token )

I was about start learning protractor and following the simple tutorial in there http://www.protractortest.org/#/tutorial
but unfortunately getting weird error after run this command protractor conf.js
[launcher] Process exited with error code 1
/usr/local/lib/node_modules/protractor/node_modules/q/q.js:126
throw e;
SyntaxError: Unexpected token )
at goog.loadModuleFromSource_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/base.js:1123:19)
at Object.goog.loadModule (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/base.js:1085:46)
at /usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1:6
at Object.Context.closure.goog.retrieveAndExecModule_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/_base.js:135:8)
at <anonymous>:1:6
at Context.closure.closure.vm.createContext.CLOSURE_IMPORT_SCRIPT (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/_base.js:104:12)
at Object.goog.importScript_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/base.js:879:9)
at Object.goog.importModule_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/base.js:900:14)
at Object.goog.writeScripts_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/base.js:1323:16)
at Object.goog.require (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/base.js:663:14)
node version : v0.10.37
java version : 1.8.0_66
protractor : Version 3.0.0
jadmine : jasmine v2.3.2 jasmine-core v2.3.4
UPDATE
already clone the repository https://github.com/angular/protractor
run following command
./bin/webdriver-manager update --standalone
./bin/webdriver-manager start
open new terminal tab
change to website direcotry
run the website folder using npm start and the website already running on port 8080
open new terminal tab, still under website folder
run test command npm test then chrome browser open up in a few second
and show same error above
Protractor upgraded to WebDriver 2.48.2 with their release of version 3.0.0. This version of WebDriver is not compatible with Node.js versions < 4.
From CHANGELOG.md in the Protractor project:
(18e1f71) chore(webdriver): upgrade Protractor to webdriver 2.48.2
BREAKING CHANGE:
1) Users will no longer be able to use node versions < 4.
2) There are significant changes to the control flow, and tests may need to be modified to be compliant with the new control flow. See Changes
Downgrading Protractor to 2.5.1 or upgrading Node.js to >= v4.0.0 should solve your problem. See here for more info on breaking changes in Protractor v3.0.0.

Downloading source files cache modernizr.load.1.5.4.js Grunt Build Stall

I have been using Yeoman to start building with web apps and such for maybe the last month. And I have been running into some issues and have been able to resolve most of them. However, now I am stuck.
I'm running MAC OS 10.6.8
I have reinstalled Yeoman and Node fixed my paths for (what I know) as global.
Running grunt in my app.
Forces me to run as sudo. (I think this is because this OS has password protected permissions for apps and programs to install/modify files.
** If I run grunt -f
Warning: Unable to write "dist/scripts/vendor/modernizr.js" file (Error code: EACCES). This error happens with most of the main tasks in grunt.
Running sudo grunt
grunt runs through the tasks just fine until the real issue I cannot locate an answer.
Running "modernizr" task
Enabled Extras
shiv
load
cssclasses
Looking for Modernizr references
in dist/styles/main.css
svg
input
Downloading source files
cache modernizr.load.1.5.4.js
And grunt will not finish this download of source files. When I ran grunt using force it would complete the download. I am looking for a solution for the 2nd list item. Any assistance would be helpful.
Found out that there some glitch in the npm grunt-modernizr.
I used this code:
npm remove grunt-moderizr && npm install --save-dev grunt-modernizr
found here: https://github.com/Modernizr/grunt-modernizr/issues/48

Resources