#2694 - Visiting PKI protected domains with cy.visit() - Exploratory PR #2740
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue
Hello! We are really enjoying using Cypress at the BBC, but some of our domains under test are protected with PKI, and we receive SSL errors when accessing them with
cy.visit()
because we can't pass our certificates through.When researching this we noticed an issue had been raised a few days ago (not by us) - #2694 so we thought we'd try and have a go at adding support for certificate protected domains.
This PR resolves the issue for us, but we haven't contributed to Cypress before so this is a very naive implementation (which is why I haven't named the branch after the issue or proposed any documentation changes). I'm sure there's some context or complexities we're missing and would welcome your thoughts :)
Proposal
We felt that it may be useful to allow users to pass in
key
andcert
options tocy.visit()
which would contain their PKI credentials. These options can then be passed alongside existing ones so that, if a cert/key has been provided, they are included in the options provided torequest
as per their docs.Usage
This PR would allow users to do something along the lines of:
This approach seemed like the simplest way to get this working (and it worked for us) but I'm sure there's other options (e.g. plugins that use
fs
to read certs from the filesystem) that might be more suitable.I hope this is useful and that we can look at ways of implementing this so that we can use Cypress more widely.