YCC Frontend Application. Skeleton based on hello-react/03-react-keycloak.
- Start
ycc-local-db(fromycc-infra) - Start
ycc-keycloak-local(fromycc-infra) & configure it (see below) - Start
ycc-hull - Populate test data if this is your first time
pnpm installpnpm start
Needs a CERN account.
- In
config.tschooseDEV_WITH_LOCAL_HULL_CONFIG - Configure
ycc-hullto use the DEVELOPMENT DB. - Start
ycc-hull pnpm installpnpm start
- Create a realm
YCC-LOCALand select it - Add YCC user federation
ycc-db-local - Create a client scope
ycc-client-groups-and-roleswhich will allow clients to access Keycloak groups and roles for the user - Add mappers to the client scope:
Mappers -> Add mapper -> By configuration -> Group Membership, token claim name:groupsMappers -> Add mapper -> By configuration -> User realm role, token claim name:roles, multivalued, type:String- On all mappers enable
Add to user info
- Create a client
ycc-app-local:- For URLs use
http://localhost:3000 - You need to enable
Standard flowin capability config - Add the
ycc-client-groups-and-rolesclient scope
- For URLs use
pnpm lint
pnpm fixYou can run the end-to-end tests using Playwright:
pnpm exec playwright test --uiThis needs the full stack running with test data. There are several ways doing so:
- Run the tests on the DEV instance
- Run YCC App locally, connect it to the DEV environment
- Run YCC App and YCC Hull locally, connect both to the DEV environment
- Run all components locally (YCC App, YCC Hull, Keycloak server and the DB)
When writing end-to-end tests fewer longer ones are preferred over many short ones. This is because the first load of the page is slow. Also note that the tests share the same database and backend.
Note that you can run the app locally in different ways:
- Development mode (
pnpm start) - Preview mode (
pnpm build && pnpm preview) - Docker container (see below)
Deployed on CERN OKD, built SPA served by serve.
You can test the build locally. If you do not want to run the instance, but only inspect the contents, you can set the entry point in your local copy to /bin/bash for simplicity.
You can test the build with this command:
docker build . -t ycc-app-local-test --build-arg VITE_APP_ENVIRONMENT=DEVELOPMENT
Then start a new container from the image:
docker run -p 3000:8080 -it ycc-app-local-test