Example of tests setup for general CMS with react-admin, jest, enzyme and testcafe.
npm install
In the project directory, you can run following commands.
npm start
Runs the app in the development mode.
Open http://localhost:3000 to view it in the browser.
The page will reload if you make edits.
You will also see any lint errors in the console.
npm run fake:rest
Run json-server on localhost:4444 and using ./data/db.json as data source.
npm test
Launches the test runner in the interactive watch mode.
npm run e2e
Executes e2e tests with testcafe.
Be sure to start dev server with start command or use build -- --test and serve commands for production code testing.
You can pass any option supported by testcafe command.
To learn more about tests and how to write them check ./TESTING.md file.
npm build
Builds the app for production to the build folder.
It correctly bundles React in production mode and optimizes the build for the best performance.
Options:
--test - Include test attributes (used for e2e testing selectors)
The build is minified and the filenames include the hashes.
npm serve
Serve created build from ./build folder.
Open http://localhost:3000 to view it in the browser.
This command also starts json server like fake:rest command.
Options:
--no-json-server - Do not start json server
--no-public - Do not server ./build folder