- Clone the repository.
git clone https://github.com/cs4218/cs4218-2420-ecom-project-team06.git
- In the backend directory, install the backend dependencies.
npm install
- Navigate to the frontend directory and install the frontend dependencies.
cd client
npm install
- Create a .env file in the root directory.
PORT = 6060
DEV_MODE = development
MONGO_URL = <Insert your MongoDB database URL>
JWT_SECRET = <Insert your JWT secret key>
BRAINTREE_MERCHANT_ID = <Insert your BrainTree merchant ID>
BRAINTREE_PUBLIC_KEY = <Insert your BrainTree public key>
BRAINTREE_PRIVATE_KEY = <Insert your Braintree private key>
- To start the webapp, run the command
npm run dev
To run an unit test file, run the following command in the root directory.
npm test -- <Path to Test File>
#e.g. npm test -- Register.test.js
To run all frontend unit tests, run this command in the root directory.
npm run test:frontend
To run all backend unit tests, run this command in the root directory.
npm run test:backend
To run all tests, run this command in the root directory.
npm test
Note
Some integration tests will spin up a server, please ensure you do not have another server instance running on your device.
- Update the
.envfile with theMONGO_URLof your test database. - Run
npm run devto start the local server.
To run an unit test file, run these command in the root directory.
# For playwright test results in HTML format
npx playwright test <Path to Test File>
# For playwright test results in UI mode
npx playwright test <Path to Test File> -- ui
To run all UI tests in the tests folder, run this command in the root directory.
# Runs all UI tests and presents playwright test results in UI mode
npm run test:e2e
We have configured Github Actions to run Jest on Github
Run link: https://github.com/cs4218/cs4218-2420-ecom-project-team06/actions/runs/13751806285/job/38453685571