cypress
cypress copied to clipboard
Override clientCertificates configuration
What would you like?
The Cypress configuration for clientCertificates allows to configure one certificate per URL. This configuration is currently readonly and cannot be overridden in the tests. I would like to override the clientCertificates for some tests.
it('test as admin', () => {
Cypress.config({
clientCertificates: [
{
url: 'https://localhost:8443',
certs: [
{
cert: './cypress/cert/admin.crt',
key: './cypress/cert/admin.key',
},
],
}
]
});
cy.visit('/');
})
it('test as user', () => {
Cypress.config({
clientCertificates: [
{
url: 'https://localhost:8443',
certs: [
{
cert: './cypress/cert/user.crt',
key: './cypress/cert/user.key',
},
],
}
]
});
cy.visit('/');
})
currently results in
CypressError: Cypress.config() can never override clientCertificates because it is a read-only configuration option.
Why is this needed?
Users authenticate with their client certificates and we need to test the behaviour for users with different roles.
Other
An Alternative could be to allow the configuration of multiple clientCertificates for the same URL and then allow to select one when visiting a site.
Will this be done at some point? If yes, when? @nagash77
@nagash77 do you have any updates for this issue?
Is there a solution that allows loading a different cert within a test? Just trying to figure out if there is a better way than having different configuration files with different certs and have different directories of tests. I basically want to submit a record, change a cert and then approve it with another cert all within the same test.
I have also the same issue . I need to be able to toggle between client certificates but the config object is read only and it is not possible