Install JavaScript dependencies:
pnpm installInstall Playwright dependencies:
pnpm playwright install --with-deps --no-shellTo run with the backend API server, first start the API server and use:
pnpm devThis runs the client with a (client-side) mock API:
pnpm dev:mswpnpm lintUnit tests
pnpm testBrowser tests using Playwright:
# tests for frontend with backend and database
# tests use database at backend/target/debug/playwright.sqlite
# build frontend, build backend, setup fresh seeded database:
pnpm test:e2e
# run tests, expect builds and database to be available:
pnpm test:e2e-dev
# view reports and traces, e.g. the ones saved by our pipeline:
pnpm playwright show-report <path-to-unzipped-report-folder>When manually debugging Playwright tests in developer mode, it is important to have Abacus in the correct state:
- Run the Abacus backend with a clean database (in the
../backendfolder):cargo run --features memory-serve -- --reset-database
- Run the Abacus frontend in developer mode (here in
../frontend):pnpm dev
- Start Playwright in debug mode (also here in
../frontend):npm run test:e2e-debug - Alternatively, if you're using the Playwright VS Code extension, set
DEBUG_DEVELOPMENT=trueinsettings.json:Also note that the VS Code extension only works properly if you open the"playwright.env": { "DEBUG_DEVELOPMENT": true },
../frontendfolder as project root in VS Code (otherwise the relative paths used within the tests are incorrect). - Run the "create test user accounts" test with the
initialisation-testandsetup-test-usersprojects enabled. The "create test user accounts" test depends on the initialisation tests, so those will also run automatically. These initialisation tests can only be run once on a clean database, if you try to run them again they will fail. - Now the test user has been initialized, disable the
initialisation-testandsetup-test-usersprojects, and enable one or more of the browser projects (chrome,firefox,safari). Now you can run any of the other browser tests!
# Start Storybook development server
pnpm storybook
# Run Storybook tests
pnpm test --project storybookStorybook runs on http://localhost:6006 and provides an interactive component library for developing and testing UI components in isolation.
Prerequisites:
Install npm dependencies, skipping development dependencies:
pnpm install --prodBuild the frontend:
pnpm buildThe built frontend is located in the dist directory.
The application uses the following dependencies:
react: creating efficient, declarative, and component-based web applications.react-dom: DOM implementation for rendering UIreact-router: Handling browser routing for React applicationsvite: frontend build toollightningcss: CSS post processor
typescript: Strongly typed layer on top of JavaScriptmsw: Mock Service Worker for mocking the server, client sidelefthook: git hook automationcross-env: for building on Windows
vitest: Jest compatible unit test frameworkjsdom: a pure-JavaScript implementation of many web standards for use with Node.jstesting-library: (React) component and dom test utilitiesplaywright: e2e testing frameworkbiome: formatter and lintereslint: Linter
Generate Typescript types from /backend/openapi.json:
pnpm gen:openapiThis results in /frontend/src/types/generated/openapi.ts.
Generate React components from icons located in /frontend/src/assets/icons:
pnpm gen:iconsThis results in /frontend/src/components/generated/icons.tsx.
Use this script to create .po files (one for every defined locale) that can de used in translation software.
This script generates .po translation files from the current json translations in /frontend/src/i18n/locales/<locale>/*.json:
pnpm gen:poThis results in /frontend/translations/<locale>.po. These can be imported into translation software.
Use this script to convert modified .po files back to our application json translation files.
This script generates json translation files from .po translation files in /frontend/translations/<locale>.po:
pnpm gen:translation-jsonThis results in /frontend/src/i18n/locales/<locale>/*.json. These contain the texts used by the application.