galv-team / galv-frontend

React app to provide a user-friendly interface to the Galv REST API
https://galv-team.github.io/galv-frontend/
Other
6 stars 0 forks source link

Galv frontend (React app)

A metadata secretary for battery science

GitHub package.json dynamic

Storybook Chromatic Storybook deployment

Jest CI Build docs

The Galv frontend is a user-friendly web interface for interacting with the Galv REST API.

Galv Project

For more complete documentation, see the Galv Frontend documentation.

Deploying

The frontend is deployed as a Docker container.
The Dockerfile is in the root directory of this repository.

To deploy the frontend, you will need to set the following environment variables in the Docker container:

You can set these variables either by editing the Dockerfile, or by passing them in as arguments to docker run or docker-compose up. If you're using docker-compose, you can set them in the environment section of the frontend service in the docker-compose.yml file.

Development

Development is most easily done by using the provided Dockerfile and docker-compose.yml files. The docker-compose.yml file will start a postgres database and the Django server. The Django server will automatically reload when changes are made to the code. This will create four containers:

The following command will start the server:

docker-compose up frontend

The server will be available at http://localhost:8002. If you need access to the backend, it will be available at http://localhost:8081.

Gotchas

Testing

There are unit tests and Cypress end-to-end tests.
The unit tests are run with Jest and the end-to-end tests are run with Cypress.

Unit tests

Unit tests are kept to a minimum, and used to ensure that novel logic in the components works as expected.

To run the unit tests, run the following command:

docker-compose up frontend_test

Remember to add the --build flag if you have made changes to the frontend code outside the src directory.

End-to-end tests

End-to-end tests are used to ensure that the frontend works as expected from the user's perspective. They are run with Cypress.

To run the end-to-end tests, run the following command:

docker-compose up frontend_test_e2e

Remember to add the --build flag if you have made changes to the frontend code outside the src directory.

To develop end-to-end tests, you can use the Cypress GUI. To do this, run the following command:

pnpm run cypress:open