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

performance issue: cypress@7 next.js headless #15827

Closed
frattaro opened this issue Apr 6, 2021 · 7 comments
Closed

performance issue: cypress@7 next.js headless #15827

frattaro opened this issue Apr 6, 2021 · 7 comments

Comments

@frattaro
Copy link

frattaro commented Apr 6, 2021

Current behavior

Running start-server-and-test ... cypress:open runs all my tests in a little less than 28 seconds. Running start-server-and-test ... cypress:run results in every test timing out. Happens locally (windows) as well as on travis (linux). This is new with cypress@7, did not happen on 6.8

The setup is pretty similar to a gatsby app I have (same cypress plugins, including code-coverage) that does not have failing tests, except this one is a next@latest app. Processor usage for cypress run is much higher than for cypress open (which is different in 7 vs 6.8), and I assume next can't get enough processor power to compile the pages on first load.

Running node 14 locally and in travis.

@lmiller1990
Copy link
Contributor

Thanks for the report, will look into this one for you. Just to check, as of Cypress 7.0, we have at component testing specific runner. Did you migrate to the latest following this guide? Then you would do either open-ct and run-ct for the component testing runner + new dev-server architecture.

Aside from that, anything specific I should do or just use a standard next.js app like this one?

Also what version of next.js are you on?

@frattaro
Copy link
Author

frattaro commented Apr 7, 2021

next@10.1.3. Not very different from the example next app but the getServerSideProps function in mine is a bit more heavyweight, making a few parallel async api calls (contentful) and doing some object transformations afterwards.

I hadn't been using the component testing, but when I went to set it up I couldn't get it to find any spec files. open-ct had a blank left menu, and run-ct --spec cypress/component-testing/home.spec.js gave:

Can't run because no spec files were found.

We searched for any files matching this glob pattern:

cypress\component-testing\home.spec.js

Relative to the project root folder:

C:\[my_app_dir]

@lmiller1990
Copy link
Contributor

The missing spec list is windows specific, we have an issue and this will be fixed asap: #15842

As for your run mode problem, I will look into this. Once these problems are solved, things should be a lot faster. I'll keep you updated.

Thanks for the patience and quick responses!

@pjg
Copy link

pjg commented Apr 9, 2021

For us Cypress v7.0.0 is roughly 2-2.5x slower. I also notice that when I use cy.intercept() with a fixture, for some reason a real network request is still sent to the running API server in the background (which is #15841). The stubbed response is still being used, but it might be that the request waits till it's "finished".

@lmiller1990
Copy link
Contributor

Hi! The cy.intercept issue is been looked into as a priority see here for some more info, as is performance.

I will keep you updated!

@frattaro
Copy link
Author

With 7.2.0, performance is good enough I merged in the dependabot PR. Difference is less than a minute to the slower side.

@lmiller1990
Copy link
Contributor

lmiller1990 commented Apr 30, 2021

Good to hear. We will continue to work on improving perf... for now, it seems this issue is mostly solved, so I will close this. This doesn't mean we won't keep working on perf - we are actively working on improving the dev server architecture.

If anyone else is still seeing major perf issues after 7.2, please comment and I can re-open and investigate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants