Open MarkAPhillips opened 1 year ago
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',
},
},
});
@MarkAPhillips thank you for raising this. Do you feel comfortable raising a PR to increase the cypress version?
Yes sure @dagda1 - but let me do some further investigations
@MarkAPhillips awesome! You have all the time you need
Please note Cypress has now be updated to version 12 so will look into this now
@MarkAPhillips great stuff, let me know if there is anything I can do.
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" } },
@MarkAPhillips upgrading the dependencies is the right thing to do.
@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
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
Please see my PR I just created which solves all of the above :+1:
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.