A simple full stack todo web app with testing using Typescript. This is used to demonstrate the Cypress end-to-end testing framework.
- A React project initialized using
create-react-app
or other setups. - Node.js and npm/yarn installed on your system.
- Redirect to the working directory.
- Run the following command to add Cypress
npm install cypress --save-dev
After installation, open Cypress for the first time to initialize its configuration
npx cypress open
This command creates a cypress folder in your project and adds a default cypress.config.ts
file.
Edit cypress.config.ts to customize the base URL for the React app:
import { defineConfig } from "cypress";
export default defineConfig({
e2e: {
baseUrl: "http://localhost:5173", // Enter base URL here
},
});
Update the package.json
file with the following script.
"scripts": {
"cy:open": "cypress open"
},
Make sure to remove the following part from the package.json
file.
{
"type": "module"
}
We can use the following CLI to start the frontend server
npm start
We can use the following CLI to start the backend server
npm start
We can use the following CLI to start the Cypress
npm run cy:open