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

Override clientCertificates configuration #27302

Open
lukaslebo opened this issue Jul 14, 2023 · 4 comments · May be fixed by #30203
Open

Override clientCertificates configuration #27302

lukaslebo opened this issue Jul 14, 2023 · 4 comments · May be fixed by #30203
Labels
E2E Issue related to end-to-end testing type: feature New feature that does not currently exist

Comments

@lukaslebo
Copy link

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.

@nagash77 nagash77 added type: feature New feature that does not currently exist E2E Issue related to end-to-end testing labels Jul 14, 2023
@mnormak
Copy link

mnormak commented Nov 24, 2023

Will this be done at some point? If yes, when? @nagash77

@lukaslebo
Copy link
Author

lukaslebo commented Dec 12, 2023

@nagash77 do you have any updates for this issue?

@jgreer9514
Copy link

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.

@manimovassagh
Copy link

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

@alienkarma alienkarma linked a pull request Sep 8, 2024 that will close this issue
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E2E Issue related to end-to-end testing type: feature New feature that does not currently exist
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants