Make sure you have installed the following:
- a package manager (e.g., homebrew for macOS, apt for Ubuntu, etc.)
- git
- nvm (Node Version Manager)
- direnv (auto-loads environment variables)
- Beginner Hints: before
direnvworks you need to hook it into your shell: depending on which shell you're using (find out withecho $SHELL) - add
eval "$(direnv hook bash)"to your~/.bashrcOReval "$(direnv hook zsh)"to your~/.zshrc(create those files if they don't exist yet). - After that, restart the terminal or run
source ~/.bashrcORsource ~/.zshrc.
- Beginner Hints: before
When cloning the repo, you should pass --recurse-submodules to the git clone invocation to ensure you also
get the kausal_common submodule checked out.
git clone --recurse-submodulesIf you already have a pre-existing clone, you can update the submodule with:
git submodule update --initNavigate to the paths-ui folder. Allow loading environment variables:
direnv allowActivate the right node version (you can do all steps from 2 to 5 to make sure that the update does not fail). The right node version should show with the command
cat .nvmrcInstall the number the .nvmrc file says and activate it
nvm install [insert node number]
nvm use [insert node number]Make sure the pnpm version is controlled with corepack:
corepack enable npmIf you need access to the Kausal private themes:
npx verdaccio-openid@latest --registry https://npm.kausal.tech
pnpm config set @kausal-private:registry https://npm.kausal.tech
Install dependencies:
pnpm iMake sure that your installation does not give errors about missing files. If it does, there is probably something wrong in step 4.
To run local development against a Kausal Paths backend, create an .env file with the following env variable set to the staging GraphQL API URL. Ask a teammate for this value.
PATHS_BACKEND_URL=
Start the development server with:
pnpm run devOpen http://localhost:3000 with your browser to see the result. Note: The address mentioned may differ depending on the instance you are using. For example, it could be something like http://sunnydale.localhost:3000.
# Start development server
pnpm run dev
# Build for production
pnpm run build
# Update dependencies
pnpm update
# Switch to project's Node version
nvm use [other node number]If you want to run the UI against your own backend, configure it in .env:
PATHS_BACKEND_URL=http://localhost:8000
The tests live under the e2e-tests/ directory. It has its own package.json,
so the first thing to do is to install the dependencies:
cd e2e-tests
pnpm installBefore the first test run, ensure the browsers Playwright needs are installed:
node_modules/.bin/playwright install
Then add the plan identifiers you want to test to your .env file:
TEST_INSTANCE_IDENTIFIERS=abcd, efgh, ijlk
To point tests to the specific environment use the following environment variable in .env file:
TEST_PAGE_BASE_URL=http://{planId}.localhost:3000
or
TEST_PAGE_BASE_URL=http://{planId}.paths.staging.kausal.dev
Now you should be able to run the test suite. You might want to start
either the development or the production server first. If you don't, the
test suite will start one for you (the dev server will be started if the
TEST_DEVSERVER env variable is set). You should be able to run the test
suite like this:
node_modules/.bin/playwright test -j 1 --project chromium
Use --update snapshots flag when running the test locally for the first time to set the screenshots baseline. Using multiple workers with --workers flag speeds up the test run.
node_modules/.bin/playwright test -j 1 --project chromium --update-snapshots --workers 2
GitHub actions are configured to handle continuous deployment when deployment/* branches are updated.
To avoid merge conflicts and ensure deployment branches stay up to date with main, you can push main directly to the deployment branch via:
git push origin main:deployment/testingSwap deployment/testing out for any of the following depending on the environment you want to update:
deployment/production: The production environment used by customers and end usersdeployment/testing: The test environment used by customers and end usersdeployment/staging: The staging environment primarily used by Kausal, this can be used as a playground and doesn't need to be stable.
When you call sentry-cli (which probably happens automatically when you deploy this project), you need to set an auth token. You can supply this in the environment variable SENTRY_AUTH_TOKEN or in a file called .sentryclirc, for example like this:
[auth]
token=your-auth-token