Files
zitadel/tests/functional-ui/project.json
T
RamonandGitHub 7b6395c348 fix: improve NX caching (#11434)
# Which Problems Are Solved
This PR improves our NX caching, especially for the console and api.
It makes sure that if the console is changed the api is also rebuilt and
if the api is changed the functional-ui tests are rerun. It is important
to note this only fixes a subset of our problems.

# How the Problems Are Solved
NX ignores .gitignored files even if they are explicitly added to the
inputs of an NX target. To counteract this one can add these files to a
.nxignore file with a negated pattern.
https://nx.dev/docs/reference/inputs#token-behavior-with-nested-projects
. This solution is not documented per se but can be find in this Github
issue: https://github.com/nrwl/nx/issues/6821 . Further more nx
calculates the hashes of inputs at the start and does not recalculate
them even if a dependency of a target changes. To solve this problem one
needs to use
https://nx.dev/docs/reference/inputs#outputs-of-dependent-tasks . This
comment of an NX developer helped me further to understand the actual
behaviour of NX:
https://github.com/nrwl/nx/issues/33379#issuecomment-3657929455 .

# Additional Changes
Because the functional-ui tests now correctly run again they had to be
fixed. This pr unifies the field names in the user create v1 and v2 ui.

# Additional Context
To document this somewhere, this proposed fix does not work:
https://github.com/nrwl/nx/issues/6821#issuecomment-1309475504 . In my
local testing NX runtime inputs also get executed at the beginning of
the NX loop and ignore subsequent changes by targets. While testing this
fix and browsing through NX code I found this, which could be helpful in
the future and isn't documented: https://github.com/nrwl/nx/pull/31428
2026-01-29 14:42:52 +01:00

47 lines
2.0 KiB
JSON

{
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"implicitDependencies": ["@zitadel/api"],
"targets": {
"run-db": {
"continuous": true,
"description": "Runs a local ephemeral Postgres database for functional UI (Console) tests.",
"command": "nx run @zitadel/devcontainer:compose up --force-recreate --renew-anon-volumes db-functional-ui"
},
"run-api": {
"description": "Sets up and runs the Zitadel API with the embedded Management Console against which the functional UI tests are run.",
"continuous": true,
"dependsOn": ["@zitadel/api:build"],
"executor": "nx:run-commands",
"options": {
"command": "nx run @zitadel/api:prod:test-functional-ui --excludeTaskDependencies"
}
},
"open": {
"description": "Opens the Cypress Test Runner for interactive testing.",
"continuous": true,
"dependsOn": ["@zitadel/console:dev", "run-db", "run-api"]
},
"test": {
"description": "Runs the functional UI (Console) tests against a Zitadel API and a specified browser. Pass an installed browser as an argument, like --browser electron. The 'electron' browser should always be available.",
"dependsOn": ["run-db", "run-api", "@zitadel/api:build"],
"executor": "nx:run-commands",
"options": {
"parallel": false,
"cwd": "{projectRoot}",
"commands": [
"cypress install",
"wait-on --verbose --interval 2000 --simultaneous 1 --timeout 30m \"${CYPRESS_BACKEND_URL}/debug/ready\"",
"DISPLAY='' cypress run",
"nx run @zitadel/functional-ui:stop"
]
},
"cache": true,
"inputs": ["default", { "dependentTasksOutputFiles": ".artifacts/bin/*/*/zitadel.local" }]
},
"stop": {
"description": "Stops the local Postgres database used for functional UI (Console) tests.",
"command": "nx run @zitadel/devcontainer:compose down --volumes db-functional-ui"
}
}
}