Failure during cypress open after cypress v8.4.0 upgrade - automation

I'm trying to use cypress 8.4.0. Used 'npm install cypress --save-dev' to install it. However, after installation, running any command
npx cypress open/ run end up with error.
It looks like this is your first time using Cypress: 8.4.0
Cypress failed to start.
This may be due to a missing library or dependency. https://on.cypress.io/required-dependencies
Please refer to the error below for more details.
----------
Command failed with exit code 2147483651: C:\Users\NEX20UR\AppData\Local\Cypress\Cache\8.4.0\Cypress\Cypress.exe --smoke-test --ping=672
----------
When I run 'npx cypress verify', I got below error:
Cypress verification timed out.
This command failed with the following output:
C:\Users\NEX20UR\AppData\Local\Cypress\Cache\8.4.0\Cypress\Cypress.exe --smoke-test --ping=466
----------
Command timed out after 30000 milliseconds: C:\Users\NEX20UR\AppData\Local\Cypress\Cache\8.4.0\Cypress\Cypress.exe --smoke-test --ping=466
Timed out
more details:
Cypress package version: 8.4.0
Cypress binary version: 8.4.0
Electron version: 13.2.0
Bundled Node version:
14.16.0
PS: I uninstalled and installed many times.

Remove cache from location mentioned below:
C:\Users\username\AppData\Local\Cypress
then reinstall cypress
npm install --save-dev cypress#8.4.0 -force,

Related

Webdriver IO face with spec node found error above Node.js version 14

Description:
I can't trigger webdriver io test feature under node.js 16.
I have tried 14.20.0 worked for me, but face with element locating issue.
With node version below, all same issue happened:
v16.16.0
v18.12.1
v18.13.0
v19.4.0
And most unbelievable is that, same code code with same node and npm version on windows machine, all works good and pass.
I'm very confused about if the webdriver io is not supported on Mac or not.
Env:
1.Mac OS 12.6.2 (21G320)
2.Node version v16.16.0
3.Npm version 9.4.0
Error Log:
automationtests#1.0.0 Test
npx wdio run wdio.conf.ts
Execution of 0 workers started at 2023-02-07T05:43:36.724Z
Starting Cucumber Test
2023-02-07T05:43:38.278Z ERROR #wdio/cli:launcher: No specs found to run, exiting with failure
2023-02-07T05:43:38.332Z ERROR #wdio/cli:utils: Error in onCompleteHook: Error: There were issues reading JSON-files from '.tmp/json'.
at collectJSONS (/Users/jjiang310/IdeaProjects/fc-ui-test-automation/node_modules/multiple-cucumber-html-reporter/lib/collect-jsons.js:27:15)
at Object.generateReport [as generate] (/Users/jjiang310/IdeaProjects/fc-ui-test-automation/node_modules/multiple-cucumber-html-reporter/lib/generate-report.js:79:23)
at Object.onComplete (/Users/jjiang310/IdeaProjects/fc-ui-test-automation/wdio.conf.ts:407:38)
at /Users/jjiang310/IdeaProjects/fc-ui-test-automation/node_modules/#wdio/cli/build/utils.js:99:19
at Array.map ()
at runOnCompleteHook (/Users/jjiang310/IdeaProjects/fc-ui-test-automation/node_modules/#wdio/cli/build/utils.js:97:39)
at Launcher.run (/Users/jjiang310/IdeaProjects/fc-ui-test-automation/node_modules/#wdio/cli/build/launcher.js:96:75)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
Spec Files: 0 passed, 0 total (0% completed) in 00:00:01
I have tried different node version, and test the same code with same node and npm version run on Windows machine can all pass which can make sure there is no code level problem to make the test case failed.
I expected the code can run and pass on Mac machine same as the windows.

Cypress cannot run because this binary file does not have executable permissions

I was trying to create a new project in cypress and I got the following strange error message.
Steps:
npm init -y
npm install cypress --save-dev
I then did npx open cypress and I got the following message from my console
How do I fix this?
Cypress cannot run because this binary file does not have executable permissions here:
/Users/myName/Library/Caches/Cypress/7.5.0/Cypress.app/Contents/MacOS/Cypress
Reasons this may happen:
- node was installed as 'root' or with 'sudo'
- the cypress npm package as 'root' or with 'sudo'
Please check that you have the appropriate user permissions.
You can also try clearing the cache with 'cypress cache clear' and reinstalling.
----------
Platform: darwin (20.5.0)
Cypress Version: 7.5.0
You can do two things:
Run the command npm cypress cache clear and then again install cypress npm install cypress --save-dev and check.
Or, install npm globally without sudo using the command npm install -g. Then create a new folder and then run npm init, npm install cypress --save-dev and npx cypress open.
Do navigate to the cache directory by doing
cd /Users/myName/Library/Caches/
Here you have to delete Cypress directory completely by running the command
rm -rf Cypress
Now head over to your project directory and run the command
npx install cypress
Cypress will be installed in your system again. Next time you won't get any errors.
So, I had a chat with the dev team at Cypress and got the following answer. After reading the logs I had a feeling this might be the root cause. So please check you have the most up to date version of Node.js

Error: "detox-cli" package is not meant to be installed locally, exiting

I am trying to follow this link to use detox for e2e testing for my react native app. I did it successfully once, but I removed e2e folder, was conducting some experiments, now I am not able to run detox init -r jest
every time I run this line it gives me this error:
Error: "detox-cli" package is not meant to be installed locally, exiting...
HINT: Remove the local installation and reinstall it globally:
npm uninstall detox-cli
npm install -g detox-cli
I have tried the solution in the hint, but it didn't resolve the issue, any suggestions?
If I uninstall and run the command, same error shows up.
when I install it, this is what I see (node version and detox-cli version)
/Users/.../.nvm/versions/node/v14.17.0/bin/detox -> /Users/.../.nvm/versions/node/v14.17.0/lib/node_modules/detox-cli/cli.js
+ detox-cli#18.13.0
updated 1 package in 1.358s
-----Update:
I just tried this and worked:
/Users/.../.nvm/versions/node/v14.17.0/bin/detox init -r jest

Bitbucket pipeline Your system is missing the dependency: Xvfb

I'm trying to add cypress to the bitbucket pipeline but it tells me that I need to install Xvfb and I don't know how to keep going. This is my bitbucket.pipelines.yml
# Template NodeJS build
# This template allows you to validate your NodeJS code.
# The workflow allows running tests and code linting on the default branch.
image: node:14.15.4
pipelines:
default:
- step:
name: Build
script:
- npm install
- npm run lint
- npm run cypress:run
This is my package.json scripts
"scripts": {
"cypress:open": "cypress open",
"cypress:run": "npx cypress run --record --key xxxxxxxxxxxx"
}
and the test are running fine locally
But in the pipeline I'm getting this error:
+ npm run cypress:run
> wallet-frontend#0.1.0 cypress:run /opt/atlassian/pipelines/agent/build
> npx cypress run --record --key 70004462-62d4-42ce-b359-5bff73d8b001
It looks like this is your first time using Cypress: 6.5.0
[16:30:09] Verifying Cypress can run /root/.cache/Cypress/6.5.0/Cypress [started]
[16:30:09] Verifying Cypress can run /root/.cache/Cypress/6.5.0/Cypress [failed]
Your system is missing the dependency: Xvfb
Install Xvfb and run Cypress again.
Read our documentation on dependencies for more information:
https://on.cypress.io/required-dependencies
If you are using Docker, we provide containers with all required dependencies installed.
----------
Error: spawn Xvfb ENOENT
----------
Platform: linux (Debian - 9.13)
Cypress Version: 6.5.0
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! wallet-frontend#0.1.0 cypress:run: `npx cypress run --record --key xxxxxxxxx`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the wallet-frontend#0.1.0 cypress:run script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Xvfb is an in-memory display server for a UNIX-like operating system, in your case Linux (Debian - 9.13). This is a system-level dependency that cypress assumes is installed beforehand. In the case of bitbucket env, this is not installed and hence this error. This is primarily used for Display (UI) in case of headed browsers while running cypress.
There are few easy workarounds here:
Installing the dependency manually: I won't suggest this as you might miss out few more dependencies unless you thoroughly look into all the dependencies.
Run headless browsers:: Headless browsers don't use Xvfb, so won't be facing this exact error but as I said in point 1, there can be other issues. Command will become cypress run --headless
Use Cypress provided Docker images (Suggested): I can see that you are using the node:14.15.4 image for this build. Instead of that, use a cypress provided official base images for whatever node version you want to run (Look for different node version in tags). If you look into the Dockerfile, you will see that they have taken an effort to install the dependencies needed to run Cypress inside the docker (You can see Xvfb there).
Also, look for already open issues when you get stuck in cypress-related issues, they have a very active and helpful issues section. I found this same issue in there: https://github.com/cypress-io/cypress/issues/14457
Cypress provides the dependencies for CI.
Linux
Ubuntu/Debian
apt-get install libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 libxtst6 xauth xvfb
CentOS
yum install -y xorg-x11-server-Xvfb gtk2-devel gtk3-devel libnotify-devel GConf2 nss libXScrnSaver alsa-lib
reference: https://docs.cypress.io/guides/continuous-integration/introduction#Dependencies

Failed to start the app. Run CLI with --verbose flag for more details

Error: Command failed: adb shell am start -n com.getgroceryapp/com.getgroceryapp.MainActivity
at makeError (F:\desuvit\projects\workingbranch\MobileApp\node_modules\execa\index.js:174:9)
node version: 12.4.0
npm version: 6.14.7
Using these command for running the app: 1)react-native run-android or npx react-native run-android
also same error
after i upgraded to v12.18.3(node version) also same error.
but i'm trying to run the project getting above error
please help me
advance thanks....
Open Android Studio File -> Project Structure -> Gradle Settings -> Gradle JDK
and set up as
Embedded JDK
This worked for me after trying so many other options.
If you previously installed a global react-native-cli package, please remove it as it may cause unexpected issues:
npm uninstall -g react-native-cli #react-native-community/cli