diff --git a/cypress/e2e/testing-tokens.cy.ts b/cypress/e2e/testing-tokens.cy.ts
index 2e74358..7a710b5 100644
--- a/cypress/e2e/testing-tokens.cy.ts
+++ b/cypress/e2e/testing-tokens.cy.ts
@@ -34,7 +34,7 @@ describe("Testing Tokens", () => {
// it("sign in with Account Portal redirects", () => {
// setupClerkTestingToken();
- // cy.origin('https://relieved-chamois-53.accounts.dev', () => {
+ // cy.origin('', () => {
// cy.visit('http://localhost:3000/protected');
// cy.contains('h1', 'Sign in');
@@ -53,12 +53,21 @@ describe("Testing Tokens", () => {
// });
- it("sign in with command", () => {
- setupClerkTestingToken();
+ it("sign in and sign out with custom command", () => {
cy.visit(`/`);
- cy.signIn();
+ cy.clerkSignIn({
+ strategy: 'password',
+ identifier: Cypress.env('test_user'),
+ password: Cypress.env('test_password')
+ });
cy.visit('/protected');
cy.contains('h1', 'This is a PROTECTED page');
+ cy.visit('/');
+ cy.clerkSignOut();
+ cy.visit('/protected');
+ cy.get('.cl-signIn-root').should('exist');
+ cy.visit('/');
+ cy.contains('p', 'signed-out');
});
it("sign up", () => {
diff --git a/cypress/support/commands.ts b/cypress/support/commands.ts
index 7997332..956543d 100644
--- a/cypress/support/commands.ts
+++ b/cypress/support/commands.ts
@@ -1,69 +1,5 @@
///
-import type { Clerk } from '@clerk/types';
-// ***********************************************
-// This example commands.ts shows you how to
-// create various custom commands and overwrite
-// existing commands.
-//
-// For more comprehensive examples of custom
-// commands please read more here:
-// https://on.cypress.io/custom-commands
-// ***********************************************
-//
-//
-// -- This is a parent command --
-// Cypress.Commands.add('login', (email, password) => { ... })
-//
-//
-// -- This is a child command --
-// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... })
-//
-//
-// -- This is a dual command --
-// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... })
-//
-//
-// -- This will overwrite an existing command --
-// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
-//
-declare global {
- namespace Cypress {
- interface Chainable {
- signOut(): Chainable
- signIn(): Chainable
- }
- }
- interface Window {
- Clerk: Clerk;
- }
-}
+import { addClerkCommands } from '@clerk/testing/cypress';
+addClerkCommands({ Cypress, cy });
-Cypress.Commands.add(`signOut`, () => {
- cy.log(`Sign out by clearing all cookies.`);
- cy.clearCookies({ domain: null, });
- });
-
-Cypress.Commands.add(`signIn`, () => {
- cy.log(`Signing in.`);
-
- cy.window()
- .should((window) => {
- expect(window).to.not.have.property(`Clerk`, undefined);
- expect(window.Clerk.loaded).to.eq(true);
- })
- .then(async (window) => {
- const res = await window.Clerk.client.signIn.create({
- identifier: Cypress.env(`test_user`),
- password: Cypress.env(`test_password`),
- });
-
- await window.Clerk.setActive({
- session: res.createdSessionId,
- });
-
- cy.log(`Finished Signing in.`);
- });
-});
-
-// Prevent TypeScript from reading file as legacy script
export {};
diff --git a/package-lock.json b/package-lock.json
index b50f980..d30db57 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -8,29 +8,29 @@
"name": "clerk-cypress-example",
"version": "0.3.0",
"dependencies": {
- "@clerk/nextjs": "5.2.3",
+ "@clerk/nextjs": "5.2.6",
"next": "14.2.5",
"react": "18.3.1",
"react-dom": "18.3.1"
},
"devDependencies": {
- "@clerk/testing": "^1.1.10",
+ "@clerk/testing": "1.2.1",
"@types/node": "20.12.12",
- "@types/react": "18.3.2",
+ "@types/react": "18.3.3",
"@types/react-dom": "18.3.0",
- "cypress": "13.13.0",
+ "cypress": "13.13.1",
"eslint": "^8.6.0",
- "eslint-config-next": "14.2.3",
- "typescript": "5.5.3"
+ "eslint-config-next": "14.2.5",
+ "typescript": "5.5.4"
}
},
"node_modules/@clerk/backend": {
- "version": "1.3.1",
- "resolved": "https://registry.npmjs.org/@clerk/backend/-/backend-1.3.1.tgz",
- "integrity": "sha512-6/gaj9lDovtBpj+abK4XCNsoLvRmf2IcOAf+tcEGt9ngx5YeUavWoHTWL0jX4wsxXUzUW7GqKAswJJxIlvP1PA==",
+ "version": "1.4.1",
+ "resolved": "https://registry.npmjs.org/@clerk/backend/-/backend-1.4.1.tgz",
+ "integrity": "sha512-cERP/71pIGZvA7WtJaMCrTf33pu4H6NI89LJXXBcUnMTj8YJy7XAGURKi8jzFTUAeMiQXjV7NESzkEzRWtgCGw==",
"dependencies": {
- "@clerk/shared": "2.3.2",
- "@clerk/types": "4.7.0",
+ "@clerk/shared": "2.4.0",
+ "@clerk/types": "4.9.0",
"cookie": "0.5.0",
"snakecase-keys": "5.4.4",
"tslib": "2.4.1"
@@ -40,12 +40,12 @@
}
},
"node_modules/@clerk/clerk-react": {
- "version": "5.2.7",
- "resolved": "https://registry.npmjs.org/@clerk/clerk-react/-/clerk-react-5.2.7.tgz",
- "integrity": "sha512-8gPS/N0D1ooGg92lrSsAN9nKZEVE1b/nfZGtgEZX9epQ47nD+geThAC1G+mc3hABNkIODvIyecKTLbsk0K+LfA==",
+ "version": "5.2.9",
+ "resolved": "https://registry.npmjs.org/@clerk/clerk-react/-/clerk-react-5.2.9.tgz",
+ "integrity": "sha512-OL2MYVH4SX718gFTUukpy/0jHQUSqAaAxO3sp61WcUrt5T/Djczg4tfTCWoW688kWmqVsinU9+PxlOKNLKrUhA==",
"dependencies": {
- "@clerk/shared": "2.3.2",
- "@clerk/types": "4.7.0",
+ "@clerk/shared": "2.4.0",
+ "@clerk/types": "4.9.0",
"tslib": "2.4.1"
},
"engines": {
@@ -57,16 +57,17 @@
}
},
"node_modules/@clerk/nextjs": {
- "version": "5.2.3",
- "resolved": "https://registry.npmjs.org/@clerk/nextjs/-/nextjs-5.2.3.tgz",
- "integrity": "sha512-BRZ50sS3SWWUu8RqAdEaWD6Ib6EIpJ91BZuvGyn/dkXLU096W3hhwQInAe6CA3GrvxKIwLqUMgO7Ahof4OR/xA==",
- "dependencies": {
- "@clerk/backend": "1.3.1",
- "@clerk/clerk-react": "5.2.7",
- "@clerk/shared": "2.3.2",
- "@clerk/types": "4.7.0",
+ "version": "5.2.6",
+ "resolved": "https://registry.npmjs.org/@clerk/nextjs/-/nextjs-5.2.6.tgz",
+ "integrity": "sha512-xfNkAG4nyJc2I0dfTYe7ofbeA/m6dAlElb8awO6oYqVqxvUnXwkXqoJdKQHAjCTfsMJZEaeNWQi3/OPfEqUghQ==",
+ "dependencies": {
+ "@clerk/backend": "1.4.1",
+ "@clerk/clerk-react": "5.2.9",
+ "@clerk/shared": "2.4.0",
+ "@clerk/types": "4.9.0",
"crypto-js": "4.2.0",
"path-to-regexp": "6.2.2",
+ "server-only": "0.0.1",
"tslib": "2.4.1"
},
"engines": {
@@ -79,12 +80,12 @@
}
},
"node_modules/@clerk/shared": {
- "version": "2.3.2",
- "resolved": "https://registry.npmjs.org/@clerk/shared/-/shared-2.3.2.tgz",
- "integrity": "sha512-uOTYqSmxe41Ye8TnyPtthwLp5rrYK5Ze04bvl1SQzlIibr4qeLU2DXZOYibMnSWvIMwr45pXUHsJh8NfKKIZ2w==",
+ "version": "2.4.0",
+ "resolved": "https://registry.npmjs.org/@clerk/shared/-/shared-2.4.0.tgz",
+ "integrity": "sha512-2UI0OeRB8IIliiALydLTQjYYj3qhPNb/LU9/3tfBbz/PNbCEZkd18AuYKB9N3zIm2MIHbOSMLt7SoZJKsRB8+A==",
"hasInstallScript": true,
"dependencies": {
- "@clerk/types": "4.7.0",
+ "@clerk/types": "4.9.0",
"glob-to-regexp": "0.4.1",
"js-cookie": "3.0.5",
"std-env": "^3.7.0",
@@ -107,14 +108,14 @@
}
},
"node_modules/@clerk/testing": {
- "version": "1.1.10",
- "resolved": "https://registry.npmjs.org/@clerk/testing/-/testing-1.1.10.tgz",
- "integrity": "sha512-XIYraihN4wxhOL691XckdWOQsoJ5is45rSCNdDLzXVpx7Ko+7Ub6P7REK4o76vAEzJiGFxAlftze1nUiXvs3NQ==",
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/@clerk/testing/-/testing-1.2.1.tgz",
+ "integrity": "sha512-W/4T3OAvK64pW+Viy1JYAnuN6OGE4hM4ES0trOAil1WYNffgYUMRILGtREkfEGAsT8aH7kKUx6GdJAzs/eivGA==",
"dev": true,
"dependencies": {
- "@clerk/backend": "1.3.1",
- "@clerk/shared": "2.3.2",
- "@clerk/types": "4.7.0",
+ "@clerk/backend": "1.4.1",
+ "@clerk/shared": "2.4.0",
+ "@clerk/types": "4.9.0",
"dotenv": "16.4.5"
},
"engines": {
@@ -134,9 +135,9 @@
}
},
"node_modules/@clerk/types": {
- "version": "4.7.0",
- "resolved": "https://registry.npmjs.org/@clerk/types/-/types-4.7.0.tgz",
- "integrity": "sha512-Gg4zEZLE7wgByMhgHMU69tkIEwfiFKNSbtRwdtAwrW+Pg0blpVpw7XuN0wHNAYFM2COrrKEUaGt8KWZmmdTFbg==",
+ "version": "4.9.0",
+ "resolved": "https://registry.npmjs.org/@clerk/types/-/types-4.9.0.tgz",
+ "integrity": "sha512-t+PDtVItnwit8u+YefMBVfJVdENdRAndMiIwGGJgnZ7+DyPjOwqomVy3VmcyycUdkdHcnx16UKm3a0rh2JQG/w==",
"dependencies": {
"csstype": "3.1.1"
},
@@ -360,9 +361,9 @@
"integrity": "sha512-/zZGkrTOsraVfYjGP8uM0p6r0BDT6xWpkjdVbcz66PJVSpwXX3yNiRycxAuDfBKGWBrZBXRuK/YVlkNgxHGwmA=="
},
"node_modules/@next/eslint-plugin-next": {
- "version": "14.2.3",
- "resolved": "https://registry.npmjs.org/@next/eslint-plugin-next/-/eslint-plugin-next-14.2.3.tgz",
- "integrity": "sha512-L3oDricIIjgj1AVnRdRor21gI7mShlSwU/1ZGHmqM3LzHhXXhdkrfeNY5zif25Bi5Dd7fiJHsbhoZCHfXYvlAw==",
+ "version": "14.2.5",
+ "resolved": "https://registry.npmjs.org/@next/eslint-plugin-next/-/eslint-plugin-next-14.2.5.tgz",
+ "integrity": "sha512-LY3btOpPh+OTIpviNojDpUdIbHW9j0JBYBjsIp8IxtDFfYFyORvw3yNq6N231FVqQA7n7lwaf7xHbVJlA1ED7g==",
"dev": true,
"dependencies": {
"glob": "10.3.10"
@@ -590,9 +591,9 @@
"dev": true
},
"node_modules/@types/react": {
- "version": "18.3.2",
- "resolved": "https://registry.npmjs.org/@types/react/-/react-18.3.2.tgz",
- "integrity": "sha512-Btgg89dAnqD4vV7R3hlwOxgqobUQKgx3MmrQRi0yYbs/P0ym8XozIAlkqVilPqHQwXs4e9Tf63rrCgl58BcO4w==",
+ "version": "18.3.3",
+ "resolved": "https://registry.npmjs.org/@types/react/-/react-18.3.3.tgz",
+ "integrity": "sha512-hti/R0pS0q1/xx+TsI73XIqk26eBsISZ2R0wUijXIngRK9R/e7Xw/cXVxQK7R5JjW+SV4zGcn5hXjudkN/pLIw==",
"dev": true,
"dependencies": {
"@types/prop-types": "*",
@@ -1564,9 +1565,9 @@
"integrity": "sha512-DJR/VvkAvSZW9bTouZue2sSxDwdTN92uHjqeKVm+0dAqdfNykRzQ95tay8aXMBAAPpUiq4Qcug2L7neoRh2Egw=="
},
"node_modules/cypress": {
- "version": "13.13.0",
- "resolved": "https://registry.npmjs.org/cypress/-/cypress-13.13.0.tgz",
- "integrity": "sha512-ou/MQUDq4tcDJI2FsPaod2FZpex4kpIK43JJlcBgWrX8WX7R/05ZxGTuxedOuZBfxjZxja+fbijZGyxiLP6CFA==",
+ "version": "13.13.1",
+ "resolved": "https://registry.npmjs.org/cypress/-/cypress-13.13.1.tgz",
+ "integrity": "sha512-8F9UjL5MDUdgC/S5hr8CGLHbS5gGht5UOV184qc2pFny43fnkoaKxlzH/U6//zmGu/xRTaKimNfjknLT8+UDFg==",
"dev": true,
"hasInstallScript": true,
"dependencies": {
@@ -2141,12 +2142,12 @@
}
},
"node_modules/eslint-config-next": {
- "version": "14.2.3",
- "resolved": "https://registry.npmjs.org/eslint-config-next/-/eslint-config-next-14.2.3.tgz",
- "integrity": "sha512-ZkNztm3Q7hjqvB1rRlOX8P9E/cXRL9ajRcs8jufEtwMfTVYRqnmtnaSu57QqHyBlovMuiB8LEzfLBkh5RYV6Fg==",
+ "version": "14.2.5",
+ "resolved": "https://registry.npmjs.org/eslint-config-next/-/eslint-config-next-14.2.5.tgz",
+ "integrity": "sha512-zogs9zlOiZ7ka+wgUnmcM0KBEDjo4Jis7kxN1jvC0N4wynQ2MIx/KBkg4mVF63J5EK4W0QMCn7xO3vNisjaAoA==",
"dev": true,
"dependencies": {
- "@next/eslint-plugin-next": "14.2.3",
+ "@next/eslint-plugin-next": "14.2.5",
"@rushstack/eslint-patch": "^1.3.3",
"@typescript-eslint/parser": "^5.4.2 || ^6.0.0 || 7.0.0 - 7.2.0",
"eslint-import-resolver-node": "^0.3.6",
@@ -5083,6 +5084,11 @@
"node": ">=10"
}
},
+ "node_modules/server-only": {
+ "version": "0.0.1",
+ "resolved": "https://registry.npmjs.org/server-only/-/server-only-0.0.1.tgz",
+ "integrity": "sha512-qepMx2JxAa5jjfzxG79yPPq+8BuFToHd1hm7kI+Z4zAq1ftQiP7HcxMhDDItrbtwVeLg/cY2JnKnrcFkmiswNA=="
+ },
"node_modules/set-function-length": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz",
@@ -5736,9 +5742,9 @@
}
},
"node_modules/typescript": {
- "version": "5.5.3",
- "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.3.tgz",
- "integrity": "sha512-/hreyEujaB0w76zKo6717l3L0o/qEUtRgdvUBvlkhoWeOVMjMuHNHk0BRBzikzuGDqNmPQbg5ifMEqsHLiIUcQ==",
+ "version": "5.5.4",
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.4.tgz",
+ "integrity": "sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q==",
"dev": true,
"bin": {
"tsc": "bin/tsc",
diff --git a/package.json b/package.json
index 95eb338..d2e3e83 100644
--- a/package.json
+++ b/package.json
@@ -11,19 +11,19 @@
"cypress:run": "cypress run --e2e"
},
"dependencies": {
- "@clerk/nextjs": "5.2.3",
+ "@clerk/nextjs": "5.2.6",
"next": "14.2.5",
"react": "18.3.1",
"react-dom": "18.3.1"
},
"devDependencies": {
- "@clerk/testing": "^1.1.10",
+ "@clerk/testing": "1.2.1",
"@types/node": "20.12.12",
- "@types/react": "18.3.2",
+ "@types/react": "18.3.3",
"@types/react-dom": "18.3.0",
- "cypress": "13.13.0",
+ "cypress": "13.13.1",
"eslint": "^8.6.0",
- "eslint-config-next": "14.2.3",
- "typescript": "5.5.3"
+ "eslint-config-next": "14.2.5",
+ "typescript": "5.5.4"
}
}