The Inventory Management System is a ReactJs-based web application. It is a micro-frontend that can be integrated with the parent web application SciGateway.
The Inventory Management System uses Yarn workspaces to manage it's monorepo structure, so please use Yarn instead of npm for package management.
The SciGateway application offers features such as authentication and authorisation functionality, notifications, cookies management.
For more details about the project's architecture, development guidelines and installation procedures, visit the SciGateway documentation.
This project uses Vite.
In the project directory, you can run:
This will install all the project dependencies. Running yarn install
at the top
level initialises all the packages, and you will be ready to start development in any of them!
Runs the dev
script, which runs the app in development mode.
Open http://localhost:3000 to view it in the browser.
Runs unit tests for all packages
Runs e2e tests for all packages
Lints all packages
Builds the app for production to the dist
folder.\
The build is minified and the filenames include the hashes. Your app is ready to be deployed!
See the section about building for production for more information.
Deploys a static version of the build from the dist
directory to port 5001. Use yarn preview:build
to build and preview it in SciGateway.
For development purposes, use yarn preview:build:dev
to build in watch mode so that changes are built automatically.
- Docker installed (if you want to run the microservice inside Docker)
- Ensure that Docker is installed and running on your machine.
- Clone the repository and navigate to the project directory:
git clone [email protected]:ral-facilities/inventory-management-system.git cd inventory-management-system
- Create a inventory-management-system-settings.json file
cp public/inventory-management-system-settings.example.json public/inventory-management-system-settings.json
- Build and start the Docker containers:
The website should now be running inside Docker at http://localhost:3000.
docker-compose up
- Node.js (https://nodejs.org/en/) - (LTS version at the time of writing is 16.17.0)
- NPM (comes with the node.js installation)
- An IDE for developing with JavaScript (VS Code is a good cross-platform suggestion)
- Yarn 3.5.0
- Clone the repository and navigate to the project directory:
git clone [email protected]:ral-facilities/inventory-management-system.git cd inventory-management-system
- Run install all the dependancies
yarn install
- Create a inventory-management-system-settings.json file
cp public/inventory-management-system-settings.example.json public/inventory-management-system-settings.json
- Start the website
yarn inventory-management-system
This guide outlines the steps to perform end-to-end testing for the Inventory Management System (IMS) locally. You have two options: testing with the actual API and testing with mocked data.
-
Set up IMS-API with an Empty Database: Begin by setting up the IMS-API using the instructions provided in the IMS-API repository. Ensure that the database is empty to maintain test consistency.
-
Configure IMS-API URL: Add the IMS-API URL to the
inventory-management-system-settings.json
file. This file likely contains various settings for your IMS application. -
Host IMS-API and IMS-Frontend Together: To prevent CORS errors during testing, ensure both IMS-API and IMS-Frontend (production build) are hosted on the same machine.
-
Run Testing Scripts:
- Execute
yarn e2e:api
oryarn e2e:interactive:api
depending on your preferred testing mode. These scripts are configured to perform end-to-end testing with the API.
- Execute
- Run Testing Scripts:
- Execute
yarn e2e
oryarn e2e:interactive
to perform end-to-end testing without relying on the actual API. This setup utilizes MSW (Mock Service Worker) to simulate API responses.
- Execute
By following these instructions, you can effectively conduct end-to-end testing for the Inventory Management System. Choose the method that best suits your testing requirements and development environment.
Note: On the CI environment, the IMS-API is accessed via 127.0.0.1
due to issues with localhost
.