Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cypress failed to verify that your server(http://localhost: 8080) is running error for Cypress Component testing in Jenkins CI pipeline (Uses Linux) #27967

Closed
mdlkumaran opened this issue Oct 4, 2023 · 7 comments
Labels
type: duplicate This issue or pull request already exists

Comments

@mdlkumaran
Copy link

mdlkumaran commented Oct 4, 2023

Current behavior

Hi Cypress team and good day!

I am new to Cypress component testing and was able to follow the official steps and able to successfully run the component tests locally using React and webpack.

component fail-3

component fail 4

component fail 2

However, running the same code in the Jenkins CI pipeline, I am facing this error as below:

18:19:52 DevTools listening on ws://127.0.0.1:39521/devtools/browser/eaff2479-7355-421-ae4f -71b25c94c30b
18:19:53 Missing baser in compilerOptions. tsconfig-paths will be skipped
18:19:56 [webpack-dev-server] Project is running at:
18:19:56 [webpack-dev-server] Loopback: http://127.0.0.1:8080/
18:19:56 [webpack-dev-server] Content not from webpack is served from " /home/jenkins/agent/workspace/DOM-Github_feature_ECSCAEA-1652/public' directory
18:19:57 Cypress could not verify that this server is running:
18:19:57
18:19:57
> http://localhost: 8080
18:19:57
18:19:57 We are verifying this server because it has been configured as your baseUrl.
18:19:57
18:19:57 Cypress automatically waits until your server is accessible before running tests
18:19:57
18:19:57 We will try connecting to it 3 more times.
18:20:00 We will try connecting to it 2 more times
18:20:03 We will try connecting to it 1 more time...

18:20:03
18:20:07 Cypress failed to verify that your server is running.
18:20:07
18:20:07 Please start this server and then run Cypress again.

component test fail

I searched all through the internet and did not find anything that helps me specifically for component testing and all the solutions are around e2e testing like using wait-on or start-server-and-test and I don't think it is applicable to the cypress component testing as I do not see we have control on making the dev server wait in the cypress.config.js.

I also found this link similar to the error message and also a fix for it but for e2e and fixed 2 years back

#8870 - Issue
PostHog/posthog#14539 - Fix

Could someone let me know if there is already a fix/steps to handle this in the pipeline or a bug that needs to be addressed?

It would be great if I could get some help if anyone else faced this issue and found a workaround for this in the pipeline for Cypress component testing. Knowing the awesomeness of Cypress e2e testing for our project, we started this effort to migrate from React testing library unit tests to Cypress component testing. We are stuck here at this point and do not want to stick with the React testing library unit tests again. Thanks for your help in advance.

Desired behavior

Cypress should wait/have config to increase the timeout for the wepack-dev-server (Local server in pipeline) to launch the localhost successfully and then try to run the cypress component testing.

Test code to reproduce

I have posted the necessary screenshots for reproducing this issue.

Cypress Version

13.3.0

Node version

v18.17.0

Operating System

Ubuntu20

Debug Logs

NA

Other

NA

@BuschMartin
Copy link

Any update to this? We are facing exact problem when we try to run the component tests on our Jenkins CI

@jimmux
Copy link

jimmux commented Nov 24, 2023

This looks like the same issue as #28338

The workaround documented there worked in my case.

@jennifer-shehane
Copy link
Member

Duplicate of #28338

@jennifer-shehane jennifer-shehane marked this as a duplicate of #28338 Nov 27, 2023
@jennifer-shehane jennifer-shehane added the type: duplicate This issue or pull request already exists label Nov 27, 2023
@mdlkumaran
Copy link
Author

mdlkumaran commented Jan 25, 2024

I tried to downgrade cypress dependency to 13.1.0 and the issue still exists and hasn't resolved yet based on @jimmux suggestion based on 28338. This issue doesn't look like the exact same issue as referenced above. Can you please reopen this ticket again please @jennifer-shehane? Thanks

@jennifer-shehane
Copy link
Member

@mdlkumaran There hasn't been independent verification that that is the version this issue was introduced in, but the majority of people say it's resolved in v12 latest version.

@mdlkumaran
Copy link
Author

@jennifer-shehane : I did try downgrading to v12.7 for cypress and I see this is resolved as you mentioned. But looks like v12.7 has 2 critical vulnerability reported which makes me not to use that version in our current organization. Could you help with any other suggestions? Thanks

@mdlkumaran
Copy link
Author

@jennifer-shehane : This is possibly related to #27990

@mdlkumaran mdlkumaran changed the title Cypress failed to verify that your server(http://localhost: 8080) is running error for Cypress Component testing in Jenkins CI pipeline Cypress failed to verify that your server(http://localhost: 8080) is running error for Cypress Component testing in Jenkins CI pipeline (Uses Linux) Feb 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

4 participants