Skip to content

Commit

Permalink
set up cypress
Browse files Browse the repository at this point in the history
  • Loading branch information
jannalee0819 committed Nov 22, 2024
1 parent 655791a commit 16524e8
Show file tree
Hide file tree
Showing 8 changed files with 94 additions and 1 deletion.
10 changes: 10 additions & 0 deletions cypress.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { defineConfig } from "cypress";

export default defineConfig({
e2e: {
setupNodeEvents(on, config) {
// implement node event listeners here
},
baseUrl: 'http://localhost:5173',
},
});
9 changes: 9 additions & 0 deletions cypress/e2e/App.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/* globals cy */

describe ('Test App', () => {

it ('launches', () => {
cy.visit ('/');
});

});
5 changes: 5 additions & 0 deletions cypress/fixtures/example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "Using fixtures to represent data",
"email": "[email protected]",
"body": "Fixtures are a great way to mock data for responses to routes"
}
25 changes: 25 additions & 0 deletions cypress/support/commands.js
Original file line number Diff line number Diff line change
@@ -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) => { ... })
20 changes: 20 additions & 0 deletions cypress/support/e2e.js
Original file line number Diff line number Diff line change
@@ -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')
12 changes: 12 additions & 0 deletions firebase.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,17 @@
},
"database": {
"rules": "database.rules.json"
},
"emulators": {
"database": {
"port": 9000
},
"hosting": {
"port": 5174
},
"ui": {
"enabled": true
},
"singleProjectMode": true
}
}
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@
"preview": "vite preview",
"start": "vite",
"test": "vitest",
"coverage": "vitest run --coverage"
"coverage": "vitest run --coverage",
"em:start": "firebase emulators:start --import=./saved-data --export-on-exit",
"em:exec": "firebase emulators:exec --import=./saved-data 'npm start'",
"em:execui": "firebase emulators:exec --ui --import=./saved-data 'npm start'",
"cy:open": "cypress open"
},
"dependencies": {
"@radix-ui/react-alert-dialog": "^1.1.2",
Expand All @@ -32,6 +36,7 @@
"@vitejs/plugin-react": "^4.3.1",
"@vitest/coverage-v8": "^2.1.3",
"autoprefixer": "^10.4.20",
"cypress": "^13.16.0",
"eslint": "^9.9.0",
"eslint-plugin-react": "^7.35.0",
"eslint-plugin-react-hooks": "^5.1.0-rc.0",
Expand Down
7 changes: 7 additions & 0 deletions saved-data/firebase-export-metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"version": "13.20.2",
"database": {
"version": "4.11.2",
"path": "database_export"
}
}

0 comments on commit 16524e8

Please sign in to comment.