Skip to content

Commit

Permalink
chore: Update dependencies to latest versions
Browse files Browse the repository at this point in the history
  • Loading branch information
anagstef committed Jul 24, 2024
1 parent 8e5e811 commit af4bf28
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 129 deletions.
17 changes: 13 additions & 4 deletions cypress/e2e/testing-tokens.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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", () => {
Expand Down
68 changes: 2 additions & 66 deletions cypress/support/commands.ts
Original file line number Diff line number Diff line change
@@ -1,69 +1,5 @@
/// <reference types="cypress" />
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<void>
signIn(): Chainable<void>
}
}
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 {};
112 changes: 59 additions & 53 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}

0 comments on commit af4bf28

Please sign in to comment.