Open PaulREnglish opened 2 years ago
I think I have this working based on your steps, I have to tell the Cypress browser to trust the cert before I was able to run any tests without interruption. Of course this is not idea for automated situations but gets us one step further.
One query and possible suggestion I do have is around defining the cert/key in the config. As cypress has support for defining these items in
cypress.json
/cypress.config.json
using theclientCertificates
property, would it not make more sense to leverage what is set there rather than have an additional config for WP-Cypress certificates? This would allow us to stay as consistent as possible with Cypress and end users who will be configuring their own setups.Curious to hear your thoughts on that.
Thanks. Using the default clientCertificates
would probably make more sense since then end users wouldn't have to define two different properties that do the same thing. I'll look into how to get this working.
@ampersarnie I've been thinking. If I use clientCertificates, won't that cause backwards incompatibility issues due to the port number being different in the URL? I could create a separate property in wpContent just for enabling/disabling SSL but I'm not sure if that's a good solution. Thoughts?
Adds the option to use SSL certificates when using WP-Cypress
Description
Partially fixes https://github.com/bigbite/wp-cypress/issues/88 - allows the user to add their own SSL certificates using the
sslCertificate
property incypress.json
. If the user does provide a certificate, WP-Cypress will use the port number provided by thesslPort
property instead of theport
property incypress.json
. If ansslPort
is not provided, the port number will default to 4433 as explained in https://github.com/bigbite/wp-cypress/issues/88.Change Log
sslCertificate
andsslPort
properties incypress.json
sslCertificate
is provided, WP-Cypress will use thesslPort
port number defaulting to 4433.Types of changes (if applicable):
Checklist (if applicable):
Stuff to add to the wiki
Configuration Schema
null
4433
sslCertificate
sslCertificate
object
cert
string
path/to/ssl-certificate
key
string
path/to/ssl-key
sslPort
number
3773
Guide
Here are the steps to get https working with WP-Cypress:
mkcert localhost
in the directory you want your certificate and key to be located (you must call the certificate localhost since it needs to be valid for that domain name)cypress.json
file:Note that the Cypress browser itself will not trust SSL certificates due to the proxy it uses. If you want to test that it works, copy the URL and use a different browser. The new browser should show that the connection is secure.