You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Are there any working examples of integrating Google Authentication into Cypress?
I've tried using OAuth tokens, closely following the Google example in the docs.
I've tried authenticateWithRedirect().
I'm just struggling to get a working example where I'm authenticated. My Middleware keeps kicking in and requesting me to sign in with Google.
I'll attach a snippet here:
Cypress.Commands.add(`signInTwo`, () => {
cy.log(`Signing in.`);
cy.visit(`https://dissertation-2024.vercel.app/`, {failOnStatusCode: false});
cy.window()
.should((window) => {
expect(window).to.not.have.property(`Clerk`, undefined);
expect(window.Clerk.isReady()).to.eq(true);
})
.then(async (window) => {
await cy.clearCookies({ domain: window.location.domain });
// This just leads to "not permitted to view":
// await window.Clerk.client.signIn.authenticateWithRedirect({
// strategy: "oauth_google",
// });
//
//This route is protected in my Middleware file. Ideally I want the user to be logged in so that they can access the dashboard.
cy.visit(`https://dissertation-2024.vercel.app/dashboard`, {
failOnStatusCode: false,
});
//Local storage probably needs populating (this is also stored as a cookie).
// localStorage.setItem("clerk-db-jwt", "TOKEN");
cy.log(`Finished Signing in.`);
});
});
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Are there any working examples of integrating Google Authentication into Cypress?
I've tried using OAuth tokens, closely following the Google example in the docs.
I've tried
authenticateWithRedirect()
.I'm just struggling to get a working example where I'm authenticated. My Middleware keeps kicking in and requesting me to sign in with Google.
I'll attach a snippet here:
Any ideas are massively appreciated!!
Beta Was this translation helpful? Give feedback.
All reactions