cypress-io / cypress

Fast, easy and reliable testing for anything that runs in a browser.
https://cypress.io
MIT License
47.02k stars 3.18k forks source link

Add --auto-import-ca Option to speed up tests in Chrome #26744

Open amenk opened 1 year ago

amenk commented 1 year ago

What would you like?

As described in #7307, Google Chrome has severe performance issues for untrusted websites.

Why is this needed?

Cypress uses a own CA to issue certificates, so Cypress tests run slow, because now Chrome does not cache anything anymore.

Other

The certificate can be imported like this as a workaround:

Prequirements (example for Debian Linux based systems):

apt update
apt install -y libnss3-tools

Installing the CA:

yarn cypress install
touch cypress/e2e/empty.cy.js
yarn cypress run --browser chrome --spec cypress/e2e/empty.cy.js || true
certutil -A -n Cypress -t 'TCu,Cu,Tu' -i /root/.config/Cypress/cy/production/proxy/certs/ca.pem -d sql:/root/.pki/nssdb 

It has to be checked if certutil needs to be present if we put this in cypress or if there is a node dependency which can do the same.

Cypress needs to run once to generate the ca.pem, that why we currently create an empty testsuite in the workaround. If cypress installs the CA itself, of course this can be done in a cleaner way.

If certutil is required, --auto-import-ca could just print an error, that certutil needs to be installed first.

nagash77 commented 1 year ago

@amenk , Thank you for submitting your feature request. Cypress Product Managers will review this request and consider it for future implementation. Please remember we cannot guarantee this will be implemented in a specific timeframe or at all. Please see the Cypress App Product Roadmap for what we currently have in the works.

ChaseBig commented 11 months ago

This issue is causing my lighthouse performance audit tests to fail and I cannot seem to figure out how to get the workaround to work on the latest Cypress version (v13.6.0). I use the cypress-audit plugin and this opens up a new tab in the cypress runner browser to execute the performance audit -- the issue is that it loads on http which doesn't allow my app to access a certain header required to load my app correctly.

Is there any update on this?

valter11111 commented 7 months ago

I reported this issue in 2021, it was merged with this ticket and the cache issue was reported even earlier (in 2019 - I found it from those forums)... It was closed due to "Lack of activity"...

Wouldn't it be a time to tell us the approximate time? Another 2 years or we wait till this ticket is also "lack of activity" and then merge with someone else who "recently" reported it and make it seem like its "just new"?