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

Cypress version 11+ integration #234

Open
MarkAPhillips opened this issue Nov 25, 2022 · 11 comments
Open

Cypress version 11+ integration #234

MarkAPhillips opened this issue Nov 25, 2022 · 11 comments

Comments

@MarkAPhillips
Copy link

In relation to https://github.com/thefrontside/simulacrum/tree/v0/integrations/cypress

Would it possible to upgrade the documentation and code to align with the latest version of cypress 11.2?

I am currently reviewing your package and am looking at integrating it with cypress to simulate Auth0.

As I progress am happy to post my findings here if that if of help as assume this is possibly already on your roadmap.

@MarkAPhillips
Copy link
Author

FYI I have managed to get this working now with the latest version of Cypress (browser) and will post some updates here later - key aspect was to create a cypress.config.ts (if using typescript)

import { defineConfig } from 'cypress';
import { encrypt } from '@simulacrum/auth0-cypress/encrypt';

export default defineConfig({
  e2e: {
    baseUrl: 'http://localhost:3000',
    setupNodeEvents(on, config) {
      // implement node event listeners here
      on('task', { encrypt });
    },
    env: {
      audience: 'xxxx',
      domain: 'localhost:4400',
      clientID: 'xxxx',
      connection: 'Username-Password-Authentication',
      scope: 'openid profile email',
    },
  },
});

@dagda1
Copy link
Contributor

dagda1 commented Nov 28, 2022

@MarkAPhillips thank you for raising this. Do you feel comfortable raising a PR to increase the cypress version?

@MarkAPhillips
Copy link
Author

Yes sure @dagda1 - but let me do some further investigations

@dagda1
Copy link
Contributor

dagda1 commented Nov 28, 2022

@MarkAPhillips awesome! You have all the time you need

@MarkAPhillips
Copy link
Author

Please note Cypress has now be updated to version 12 so will look into this now

@dagda1
Copy link
Contributor

dagda1 commented Dec 15, 2022

@MarkAPhillips great stuff, let me know if there is anything I can do.

@MarkAPhillips
Copy link
Author

A few things I have noticed when upgrading to version 12 is that I received this error:
Cypress.Cookies.defaults() has been deprecated and is no longer supported - I am not sure where this is being used unless it relates to the cy.clearCookies command in the logout

Another point of note was that we are using Apollo client which was running a different version of graphql to that used by the auth0 simulator - so initially received an error as you cannot run two versions - so had to override this in the package.json

"overrides": { "@simulacrum/auth0-simulator": { "graphql": "16.6.0" } },

@dagda1
Copy link
Contributor

dagda1 commented Dec 17, 2022

@MarkAPhillips upgrading the dependencies is the right thing to do.

@MarkAPhillips
Copy link
Author

MarkAPhillips commented Aug 9, 2023

@dagda1 reviewing this again now - it seems the issue is that in this file https://github.com/thefrontside/simulacrum/blob/302ff9540612fb58730c1ed4c412d2ff09394134/integrations/cypress/cypress/support/utils/whitelist-cookies.ts - Cypress now recommend using cy.session for these scenarios

Do you have a preferred approach as the version of Cypress you are using is very much out of date - I have cloned this repository and will start to review upgrading Cypress to the latest - Cypress also recommend this approach - https://docs.cypress.io/guides/end-to-end-testing/auth0-authentication - for Cypress 12 - so might review this in line with changes in Cypress 12

What you'll learn

@dagda1
Copy link
Contributor

dagda1 commented Aug 9, 2023

Do you have a preferred approach as the version of Cypress you are using is very much out of date - I have cloned this

@MarkAPhillips I have no preferred approach and I very much look forward to see how you approach this

@JasonLandbridge
Copy link

Please see my PR I just created which solves all of the above 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants