From 9f085467b1d52faa833d196aeb8b9c11e38ddbc8 Mon Sep 17 00:00:00 2001 From: TerryChenRDFZ Date: Fri, 22 Nov 2024 15:35:49 -0600 Subject: [PATCH] updates to package for cypress setup --- cypress.config.js | 9 ++++++ cypress/fixtures/example.json | 5 ++++ cypress/support/commands.js | 25 ++++++++++++++++ cypress/support/e2e.js | 20 +++++++++++++ package-lock 2.json | 6 ++++ package.json | 54 +++++++++++++++++------------------ 6 files changed, 92 insertions(+), 27 deletions(-) create mode 100644 cypress.config.js create mode 100644 cypress/fixtures/example.json create mode 100644 cypress/support/commands.js create mode 100644 cypress/support/e2e.js create mode 100644 package-lock 2.json diff --git a/cypress.config.js b/cypress.config.js new file mode 100644 index 00000000..17161e32 --- /dev/null +++ b/cypress.config.js @@ -0,0 +1,9 @@ +import { defineConfig } from "cypress"; + +export default defineConfig({ + e2e: { + setupNodeEvents(on, config) { + // implement node event listeners here + }, + }, +}); diff --git a/cypress/fixtures/example.json b/cypress/fixtures/example.json new file mode 100644 index 00000000..02e42543 --- /dev/null +++ b/cypress/fixtures/example.json @@ -0,0 +1,5 @@ +{ + "name": "Using fixtures to represent data", + "email": "hello@cypress.io", + "body": "Fixtures are a great way to mock data for responses to routes" +} diff --git a/cypress/support/commands.js b/cypress/support/commands.js new file mode 100644 index 00000000..66ea16ef --- /dev/null +++ b/cypress/support/commands.js @@ -0,0 +1,25 @@ +// *********************************************** +// This example commands.js 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) => { ... }) \ No newline at end of file diff --git a/cypress/support/e2e.js b/cypress/support/e2e.js new file mode 100644 index 00000000..0e7290a1 --- /dev/null +++ b/cypress/support/e2e.js @@ -0,0 +1,20 @@ +// *********************************************************** +// This example support/e2e.js is processed and +// loaded automatically before your test files. +// +// This is a great place to put global configuration and +// behavior that modifies Cypress. +// +// You can change the location of this file or turn off +// automatically serving support files with the +// 'supportFile' configuration option. +// +// You can read more here: +// https://on.cypress.io/configuration +// *********************************************************** + +// Import commands.js using ES2015 syntax: +import './commands' + +// Alternatively you can use CommonJS syntax: +// require('./commands') \ No newline at end of file diff --git a/package-lock 2.json b/package-lock 2.json new file mode 100644 index 00000000..d436d209 --- /dev/null +++ b/package-lock 2.json @@ -0,0 +1,6 @@ +{ + "name": "OHours", + "lockfileVersion": 3, + "requires": true, + "packages": {} +} diff --git a/package.json b/package.json index 4f3e905b..102fc799 100644 --- a/package.json +++ b/package.json @@ -10,37 +10,37 @@ "preview": "vite preview", "start": "vite", "test": "vitest", - "coverage": "vitest run --coverage" + "coverage": "vitest run --coverage", + "cy:open": "cypress open" }, "dependencies": { - "@radix-ui/react-alert-dialog": "^1.1.2", + "@radix-ui/react-alert-dialog": "^1.0.5", "@shadcn/ui": "^0.0.4", - "axios": "^1.7.7", - "firebase": "^10.14.0", - "lucide-react": "^0.447.0", - "react": "^18.3.1", - "react-dom": "^18.3.1", - "react-router-dom": "^6.26.2" + "axios": "^1.6.7", + "firebase": "^10.8.0", + "lucide-react": "^0.330.0", + "react": "^18.2.0", + "react-dom": "^18.2.0", + "react-router-dom": "^6.22.0" }, "devDependencies": { - "@eslint/js": "^9.9.0", - "@testing-library/jest-dom": "^6.6.3", - "@testing-library/react": "^16.0.1", + "@testing-library/jest-dom": "^6.4.2", + "@testing-library/react": "^14.2.1", "@testing-library/user-event": "^14.5.2", - "@types/react": "^18.3.3", - "@types/react-dom": "^18.3.0", - "@vitejs/plugin-react": "^4.3.1", - "@vitest/coverage-v8": "^2.1.5", - "autoprefixer": "^10.4.20", - "eslint": "^9.9.0", - "eslint-plugin-react": "^7.35.0", - "eslint-plugin-react-hooks": "^5.1.0-rc.0", - "eslint-plugin-react-refresh": "^0.4.9", - "globals": "^15.9.0", - "jsdom": "^25.0.1", - "postcss": "^8.4.47", - "tailwindcss": "^3.4.13", - "vite": "^5.4.1", - "vitest": "^2.1.5" + "@types/react": "^18.2.55", + "@types/react-dom": "^18.2.19", + "@vitejs/plugin-react": "^4.2.1", + "@vitest/coverage-v8": "^1.2.2", + "autoprefixer": "^10.4.17", + "cypress": "^13.6.4", + "eslint": "^8.56.0", + "eslint-plugin-react": "^7.33.2", + "eslint-plugin-react-hooks": "^4.6.0", + "eslint-plugin-react-refresh": "^0.4.5", + "jsdom": "^24.0.0", + "postcss": "^8.4.35", + "tailwindcss": "^3.4.1", + "vite": "^5.1.0", + "vitest": "^1.2.2" } -} +} \ No newline at end of file