Compare commits

...
172 Commits
Author SHA1 Message Date
ars9 8b48d4812d Merge pull request 'feat(auth): deliver optional authentication across Liqa' (#24) from agent-codex/liqa:master into master
CI / changes (push) Successful in 31s
CI / server (push) Failing after 1h42m43s
CI / client (push) Successful in 2m55s
CI / image (push) Skipped
Reviewed-on: #24
2026-11-11 19:35:12 +02:00
ars9 ff9a700c86 Merge pull request 'test(auth): cover integrated account journey' (#6) from feat/task-57-auth-integration into master
CI / changes (pull_request) Canceled after 0s
CI / server (pull_request) Canceled after 0s
CI / client (pull_request) Canceled after 0s
CI / image (pull_request) Canceled after 0s
Reviewed-on: agent-codex/liqa#6
2026-11-09 23:25:48 +02:00
ars9 ea4f72c236 Merge pull request 'docs(auth): document optional authentication setup' (#5) from feat/task-56-auth-documentation into master
Reviewed-on: agent-codex/liqa#5
2026-11-09 23:24:38 +02:00
agent 9ff9579a7b test(auth): cover integrated account journey
- Exercise CLI provisioning through browser/API/MCP auth, run events, logout, and deletion.
- Allow integration coverage to reopen the same file-backed test database.
2026-11-09 15:58:49 -05:00
agent 9bdba32a34 docs(auth): document optional authentication setup
- Explain opt-in configuration, protected surfaces, migrations and cookie behavior.
- Document operator CLI, MCP bearer use, cleanup, and supported local origins.
2026-11-09 15:50:12 -05:00
ars9 d4d9bceb98 Merge pull request 'feat(auth): add operator account CLI' (#4) from feat/task-53-operator-cli-refresh into master
Reviewed-on: agent-codex/liqa#4
2026-11-09 22:35:48 +02:00
agent 768a799db0 feat(auth): add operator account CLI
- Add local and container-ready user management and token commands.
- Document setup and verify commands against an isolated database.
2026-11-09 14:31:29 -05:00
ars9 fe19fb9d56 Merge pull request 'feat(client): add cookie-backed browser authentication' (#3) from fix/task-55-authenticated-eventsource-repair-2 into master
Reviewed-on: agent-codex/liqa#3
2026-11-09 21:21:20 +02:00
agent f2bcbe07b6 fix(client): clarify login form styling
- Add spacing for the session-expired notice and distinguish login inputs.
- Assert those surfaces in expired-session light and dark stories.
2026-11-09 14:07:59 -05:00
agent 8676d6281c fix(client): focus password after invalid login
- Defer focus until submission finishes and the password field is cleared.
2026-11-05 04:32:25 -05:00
agent 92141a25fb feat(client): add cookie-backed authentication UI
- Add session-aware login, logout and protected navigation.
- Send cookie credentials for API and run-event requests with localized UI stories.
2026-11-05 04:18:11 -05:00
ars9 9e4b692444 Merge pull request 'feat(auth): clean expired revoked tokens' (#2) from feat/task-54-revocation-cleanup into master
Reviewed-on: agent-codex/liqa#2
2026-11-05 11:12:51 +02:00
agent 2976a08aef feat(auth): clean expired revoked tokens
- Remove expired token revocations at startup and on the configured cron.
- Verify expiry boundaries and disabled-auth behavior.
2026-11-05 02:48:53 -05:00
ars9 c3e8670515 Merge pull request 'feat(auth): add optional authentication' (#1) from feat/task-52-optional-auth-server into master
Reviewed-on: agent-codex/liqa#1
2026-11-05 00:31:56 +02:00
agent 1830feb71b refactor(auth): address server review feedback
- Extract auth DTOs, cookie/JWT helpers and the generic duration parser.
- Configure the session cookie and map domain auth failures to HTTP responses.
- Add typed Swagger responses and focused regression coverage.
2026-11-04 17:15:00 -05:00
agent 72e127888c fix(auth): redact passwords on normalized login paths
CI / changes (pull_request) Canceled after 0s
CI / server (pull_request) Canceled after 0s
CI / client (pull_request) Canceled after 0s
CI / image (pull_request) Canceled after 0s
- Normalize login paths before applying request-body redaction.
- Cover trailing-slash paths and assert the password never reaches logs.
2026-11-04 15:59:49 -05:00
agent de41571b5c feat(auth): add optional authentication boundary
- Add account, JWT session, revocation, cookie and bearer handling.
- Protect server surfaces while preserving public health, manifest and disabled mode.
- Add SQLite migration and focused server regression coverage.
2026-11-04 15:43:33 -05:00
ars9 d4bb274982 chore(release): cut minor release
CI / changes (push) Skipped
CI / server (push) Failing after 34m15s
CI / client (push) Successful in 2m43s
CI / image (push) Skipped
- bump version to 1.26.0
- add versioned e2e test export to the changelog
2026-10-08 18:54:34 +03:00
ars9 969f24ea73 Merge pull request 'feat: export e2e tests for a chosen scenario version' (#21) from feat/e2e-export-version into master
CI / changes (push) Successful in 16s
CI / server (push) Successful in 1m32s
CI / client (push) Successful in 1m32s
CI / image (push) Skipped
Reviewed-on: #21
2026-10-08 18:53:26 +03:00
ars9 81164f8494 feat: export e2e tests for a chosen scenario version
CI / changes (pull_request) Successful in 14s
CI / server (pull_request) Successful in 2m25s
CI / client (pull_request) Successful in 1m35s
CI / image (pull_request) Skipped
- GET /scenarios/:id/export-e2e and the export_e2e_test MCP tool take
  an optional version, defaulting to the latest
- build the test project from that version's steps, name and timeout
- put the version in the zip name (<scenario>-vN-e2e-test.zip), the
  generated package name and the README heading
- the Export e2e test button exports the version being viewed
- document the e2e export in scenario.md and mcp.md
2026-10-08 18:37:33 +03:00
ars9 14763103cf chore(release): cut minor release
CI / server (push) Successful in 1m7s
CI / changes (push) Skipped
CI / client (push) Successful in 1m23s
CI / image (push) Successful in 1m59s
- bump version to 1.25.0
- add browser notifications for scenario runs to the changelog
2026-10-07 19:23:01 +03:00
ars9 78f4c35d56 docs(claude): forbid co-author trailers and issue refs in commits
CI / changes (push) Successful in 6s
CI / server (push) Skipped
CI / client (push) Skipped
CI / image (push) Skipped
- keep issue references like Closes #12 for pull request descriptions
2026-10-07 19:22:02 +03:00
ars9 4b050fbdc4 Merge pull request 'Browser notifications' (#14) from feat/browser-notifications into master
CI / changes (push) Successful in 6s
CI / server (push) Successful in 3m4s
CI / client (push) Successful in 1m33s
CI / image (push) Skipped
Reviewed-on: #14
2026-10-07 19:20:59 +03:00
ars9 a93b3ef835 fix(client): keep run notifications connected in Firefox
CI / changes (pull_request) Successful in 6s
CI / server (pull_request) Successful in 1m16s
CI / client (pull_request) Successful in 1m28s
CI / image (pull_request) Skipped
- reopen the run events stream with backoff when the browser closes it for good (Firefox drops quiet connections after a network change)
- enable notifications when the permission is granted outside the bell, unless turned off explicitly
- follow permission changes made in the browser's site settings
- highlight the bell while notifications are on
2026-10-07 19:04:59 +03:00
ars9 d7eb018245 feat: browser notifications for scenario runs
- add RunEventsService and emit run.started / run.finished from the scheduler
- stream run events over SSE at GET /api/v1/scenarios/runs/events with a heartbeat
- add useRunNotifications hook and NotificationToggle (opt-in bell in the side panel footer)
- refresh runs lists when a run finishes
- document the events stream and notifications

Closes #12
2026-10-07 18:20:30 +03:00
ars9 968a8e470b chore(release): cut patch release
CI / server (push) Successful in 1m14s
CI / changes (push) Skipped
CI / client (push) Successful in 1m23s
CI / image (push) Successful in 1m52s
- bump version to 1.24.4
- add changelog entry for versioned export filenames and the
  install script terminal fix
2026-10-07 17:38:11 +03:00
ars9 3c8def3814 Merge pull request 'feat(client): include version in exported scenario and snippet filenames' (#13) from feat/export-version-filename into master
CI / changes (push) Successful in 6s
CI / server (push) Skipped
CI / client (push) Successful in 1m15s
CI / image (push) Skipped
Reviewed-on: #13
2026-10-07 17:36:55 +03:00
ars9 6e5da08719 feat(client): include version in exported scenario and snippet filenames
CI / changes (pull_request) Successful in 10s
CI / server (pull_request) Skipped
CI / client (pull_request) Successful in 1m21s
CI / image (pull_request) Skipped
- request the exact version being exported via ?version=N so file
  content always matches the filename
- name downloads <scenario>-v<N>.yaml and snippet-<alias>-v<N>.yaml
2026-10-07 17:34:21 +03:00
ars9 1abd95f9e1 Merge pull request 'fix(install): read prompts from the terminal and start liqa' (#11) from fix/install-tty into master
CI / changes (push) Successful in 6s
CI / server (push) Skipped
CI / client (push) Skipped
CI / image (push) Skipped
Reviewed-on: #11
2026-10-02 15:53:43 +03:00
ars9 d7476f0fe8 fix(install): read prompts from the terminal and start liqa
CI / changes (pull_request) Successful in 7s
CI / server (pull_request) Skipped
CI / client (pull_request) Skipped
CI / image (pull_request) Skipped
- read answers from /dev/tty: under `curl ... | bash` stdin is the
  script itself, so `read` consumed the script's own lines; fall back
  to defaults when there is no terminal
- check that docker, the compose plugin and the daemon work and that
  compose accepts the generated compose.yaml
- start liqa with `docker compose up -d` in the install directory,
  printing the manual start command if a check or the start fails
2026-10-02 15:53:16 +03:00
ars9 75bb0af9fd chore: self-test example and tag-only image builds
CI / server (push) Successful in 1m7s
CI / changes (push) Skipped
CI / client (push) Successful in 1m15s
CI / image (push) Successful in 1m58s
- examples/self-test: importable scenario, snippets, credential and
  environment that test the liqa instance they run on
- CI builds the Docker image only for vX.Y.Z release tags
- bump version to 1.24.3
2026-10-02 15:43:31 +03:00
ars9 0c11e11c27 Merge pull request 'feat(examples): add self-test example' (#10) from feat/examples into master
CI / changes (push) Successful in 6s
CI / client (push) Skipped
CI / server (push) Successful in 1m6s
CI / image (push) Skipped
Reviewed-on: #10
2026-10-02 15:42:19 +03:00
ars9 c1924060eb feat(examples): add self-test example
CI / changes (pull_request) Successful in 7s
CI / client (pull_request) Skipped
CI / server (pull_request) Successful in 1m7s
CI / image (pull_request) Skipped
- add examples/ with a ready-to-import self-test: environment, credential,
  snippets and a scenario that creates, runs and checks another scenario
  through the liqa REST API and UI, then cleans up
- add test/examples.spec.ts: imports every example and parses its code
- link the examples from README, docs/scenario.md and CLAUDE.md

Closes #6
2026-10-02 15:39:02 +03:00
ars9 28dfce246a Merge pull request 'ci: build docker images only on release tags' (#9) from chore/release-on-tags into master
CI / changes (push) Successful in 7s
CI / server (push) Successful in 1m12s
CI / client (push) Successful in 1m21s
CI / image (push) Skipped
Reviewed-on: #9
2026-10-02 14:37:34 +03:00
ars9 a0624789ce ci: build docker images only on release tags
CI / changes (pull_request) Successful in 6s
CI / server (pull_request) Successful in 1m19s
CI / client (pull_request) Successful in 1m26s
CI / image (pull_request) Skipped
- trigger the image job on vX.Y.Z tag pushes instead of master pushes
- run server and client checks unconditionally on tags before the build
- fail the build when the tag doesn't match the package.json version
- document the release routine: version bump, changelog and tag are
  done on master after work branches are merged
2026-10-02 14:36:59 +03:00
ars9 a8d00056ff chore: run log data collapsing and client manifest
CI / changes (push) Successful in 6s
CI / version (push) Successful in 7s
CI / server (push) Successful in 1m17s
CI / client (push) Successful in 1m14s
CI / image (push) Successful in 1m58s
- large run log data blocks start collapsed, with per-block and
  expand/collapse-all toggles; limits set by RUN_LOG_DATA_COLLAPSE_BYTES
  and RUN_LOG_DATA_COLLAPSE_LINES
- copy logs button copies the filtered logs as plain text
- GET /manifest.json serves the app version and public client settings,
  cached by the UI in localStorage
- bump version to 1.24.2
2026-10-02 14:16:02 +03:00
ars9 639b80f468 Merge pull request 'feat(logs): collapse large run log data and serve client manifest' (#8) from feat/log-data-collapse into master
CI / changes (push) Successful in 7s
CI / version (push) Successful in 7s
CI / server (push) Successful in 1m13s
CI / client (push) Successful in 1m28s
CI / image (push) Skipped
Reviewed-on: #8
2026-10-02 14:12:54 +03:00
ars9 718a12c2f4 feat(logs): collapse large run log data and serve client manifest
CI / changes (pull_request) Successful in 6s
CI / version (pull_request) Skipped
CI / server (pull_request) Successful in 1m30s
CI / client (pull_request) Successful in 1m31s
CI / image (pull_request) Skipped
- collapse run log data blocks whose pretty-printed JSON exceeds a byte
  or line limit, with a per-block toggle and an expand/collapse-all
  button next to the Logs heading
- align data blocks and toggles with the context/message column
- add a "Copy logs" button that copies the filtered logs as plain text
  with every data block expanded
- add GET /manifest.json with the app name, version and run log data
  limits (RUN_LOG_DATA_COLLAPSE_BYTES / RUN_LOG_DATA_COLLAPSE_LINES)
- load the manifest in the client stale-while-revalidate: localStorage
  copy first, refetched per page load and on tab focus after a while
- show the server version in the sidebar footer, with a reload hint
  when it differs from the client build

Closes #3
2026-10-02 14:05:49 +03:00
ars9 4e55d14599 chore: step output and assertion log data
CI / changes (push) Successful in 14s
CI / version (push) Successful in 12s
CI / server (push) Successful in 1m17s
CI / client (push) Successful in 1m18s
CI / image (push) Successful in 1m49s
- "Step N passed" log entries carry the step's return value as data
- context.assert takes an optional details argument stored as log data
  on failure; step and snippet failure entries name only the assertion
- log output shows elapsed time in whole seconds
- run artifact and scenario file names open the file in a new tab
- bump version to 1.24.1
2026-10-02 11:12:12 +03:00
ars9 0f84db57f1 Merge pull request 'feat(scenario): attach step output and assertion details to run log' (#7) from feat/step-assert-log-data into master
CI / changes (push) Successful in 6s
CI / version (push) Successful in 8s
CI / server (push) Successful in 1m25s
CI / client (push) Successful in 1m16s
CI / image (push) Skipped
Reviewed-on: #7
2026-10-02 11:09:52 +03:00
ars9 959b3b70c9 feat(scenario): attach step output and assertion details to run log
CI / changes (pull_request) Successful in 9s
CI / version (pull_request) Skipped
CI / server (pull_request) Successful in 1m44s
CI / client (pull_request) Successful in 1m36s
CI / image (pull_request) Skipped
- "Step N passed" log entry carries the step's return value as data
- context.assert accepts an optional details argument; on failure the
  assertion:fail entry stores { details, error } as data
- assertion failures throw AssertionFailedError so "Step N failed" and
  "Snippet X failed" entries name only the assertion, without repeating
  the details; the step run description keeps the full message
- exported e2e runtime accepts and prints assert details
- log output shows elapsed time in whole seconds, matching the stored
  timestamp resolution
- run artifact and scenario file names link to the inline file content
  in a new tab
2026-10-02 11:05:29 +03:00
ars9 2281a8729b chore: code reference modal
CI / changes (push) Successful in 6s
CI / version (push) Successful in 6s
CI / server (push) Successful in 1m24s
CI / client (push) Successful in 1m34s
CI / image (push) Successful in 1m57s
- step and snippet editors open a reference of the script runtime and
  its context API from a (?) button next to the Code label
- bump version to 1.24.0
2026-10-01 14:50:23 +03:00
ars9 e3c2c0cebb Merge pull request 'feat(client): add code reference modal to step and snippet editors' (#4) from feat/code-context-help into master
CI / changes (push) Successful in 5s
CI / server (push) Skipped
CI / version (push) Successful in 5s
CI / client (push) Successful in 1m18s
CI / image (push) Skipped
Reviewed-on: #4
2026-10-01 14:48:35 +03:00
ars9 daecf3d539 feat(client): add code reference modal to step and snippet editors
CI / changes (pull_request) Successful in 7s
CI / version (pull_request) Skipped
CI / server (pull_request) Skipped
CI / client (pull_request) Successful in 1m13s
CI / image (pull_request) Skipped
- a (?) button next to the Code label on the step and snippet
  create/edit pages opens a reference of the script runtime: globals,
  every context member with examples, and pitfalls such as awaiting
  getStepOutput and assert
- the reference lives in components/modals/code-help.md and is
  rendered as markdown
- Modal takes size="lg" for document-like content; the dialog is
  capped to the viewport and its body scrolls, focusable when lg so
  the keyboard can scroll it
- docs/scenario.md notes that getStepOutput is async and points to
  the in-app reference to keep in sync
2026-10-01 14:45:03 +03:00
ars9 71259bc11d chore: run log context, data and debug level
CI / changes (push) Successful in 6s
CI / version (push) Successful in 6s
CI / server (push) Successful in 1m9s
CI / client (push) Successful in 1m17s
CI / image (push) Successful in 1m48s
- scenario run log entries carry a context (step/snippet/assertion/run)
  and a data payload split out from the message, plus a new debug level
- run detail page shows the full log list in a terminal-style viewer
  instead of a paginated table
- bump version to 1.23.0
2026-10-01 14:24:01 +03:00
ars9 d085ea3ded Merge pull request 'Add log context and data' (#2) from feat/run-log-context into master
CI / changes (push) Successful in 6s
CI / version (push) Successful in 7s
CI / server (push) Successful in 1m4s
CI / client (push) Successful in 1m22s
CI / image (push) Skipped
Reviewed-on: #2
2026-10-01 14:19:39 +03:00
ars9 1273491eee feat(scenario): split log args into message/data and add debug level
CI / changes (pull_request) Successful in 12s
CI / version (pull_request) Skipped
CI / server (pull_request) Successful in 1m4s
CI / client (pull_request) Successful in 1m33s
CI / image (pull_request) Skipped
- context.log/warn/error and console.* split arguments: strings join
  into message, object/array args are kept out of it and stored as
  the log entry's new data column (JSON), so message stays a stable
  string regardless of an object's shape
- added a debug log level alongside log/warn/error, including
  context.debug() and console.debug() (previously folded into log)
- CSV/Markdown run log export include the data column/block
- LogOutput renders data pretty-printed in a separate block below
  the message, and dims debug entries with a dedicated grey token
  calibrated to the WCAG AA contrast floor
2026-10-01 14:09:45 +03:00
ars9 6cba785e2f feat(scenario): tag run log entries with their context
- scenario_run_logs gains a context column (step:N, snippet:alias,
  assertion:pass/fail, run), tracked through a call stack in
  CodeExecutorService so nested runSnippet calls tag their own and
  inner log lines
- automatic step started/passed/failed entries and the Playwright
  trace upload notice are tagged accordingly
- run log export (CSV/Markdown) and the logs search match context
  as well as message
- add a LogOutput UI component: a terminal-style log viewer with
  level color coding, elapsed-time-since-start timestamps and a
  context tag, replacing the generic Table on the run detail page
- show the full log list instead of paginating it, capped to a
  scrollable block
- fix migrations.spec.ts's revert test, which only undid the last
  migration instead of all of them
2026-10-01 13:26:07 +03:00
ars9 5152fffe82 Merge pull request 'Chore/ci path filters and registry version check' (#1) from chore/ci-path-filters-and-registry-version-check into master
CI / changes (push) Successful in 6s
CI / version (push) Successful in 6s
CI / server (push) Successful in 1m24s
CI / client (push) Successful in 1m15s
CI / image (push) Skipped
Reviewed-on: #1
2026-10-01 12:30:58 +03:00
ars9 9df8a652dc ci: guard image job with an explicit push-event check
CI / changes (pull_request) Successful in 7s
CI / version (pull_request) Skipped
CI / server (pull_request) Successful in 1m6s
CI / client (pull_request) Successful in 1m20s
CI / image (pull_request) Skipped
- defense in depth alongside the version job's existing push-only
  condition, so the image job can't run on pull requests
2026-10-01 12:29:08 +03:00
ars9 e577ee8683 ci: skip unaffected jobs and rebuilt image versions
CI / changes (pull_request) Successful in 11s
CI / version (pull_request) Skipped
CI / server (pull_request) Successful in 1m10s
CI / client (pull_request) Successful in 1m23s
CI / image (pull_request) Skipped
- server and client jobs only run when their directory (or shared
  root files) changed, via a new changes job using dorny/paths-filter
- the version job now checks the registry for an existing image tag
  of the current package.json version instead of diffing against the
  previous commit's package.json, so the image job is skipped once
  that version has already been pushed
- the image job tolerates server/client being skipped rather than
  requiring both to succeed
2026-10-01 12:26:57 +03:00
ars9 0e998333e0 docs(claude): require a branch for features, chores and fixes
- master is reserved for version-bump release commits
2026-10-01 12:23:09 +03:00
ars9 2840df68b2 docs: add quick install script and README section
CI / server (push) Successful in 1m39s
CI / client (push) Successful in 1m23s
CI / version (push) Successful in 7s
CI / image (push) Skipped
- scripts/install.sh prompts for install directory, port and version,
  then writes a compose.yaml using the published registry image and
  creates a data/ directory for the SQLite volume
- README documents a one-line curl | bash install using the script's
  raw URL on the Gitea instance
2026-10-01 12:20:20 +03:00
ars9 0341fc2201 docs(claude): tag version commits with their changelog entry
CI / server (push) Successful in 1m24s
CI / client (push) Successful in 1m43s
CI / version (push) Successful in 6s
CI / image (push) Skipped
- add a step to tag each version-bump commit as v<version>, annotated
  with that version's changelog entry verbatim
- push tags with git push --follow-tags
2026-10-01 12:04:43 +03:00
ars9 bba6eb2f94 chore: license the project under mit
CI / server (push) Successful in 1m9s
CI / client (push) Successful in 1m23s
CI / version (push) Successful in 6s
CI / image (push) Successful in 2m7s
- add the mit LICENSE and set license and author in all package.json
  files, plus a license section in the readme
- generate the license notices of all shipped production dependencies
  and node.js in a dockerfile stage and serve them at /licenses.txt,
  linked from the sidebar footer
- keep license files when slimming node_modules in the image
- add oci labels, with the version passed in by ci
- document licensing in the development docs
- bump version to 1.22.2
2026-10-01 11:44:51 +03:00
ars9 531754c3fa test(server): stop timing-dependent failures on busy ci runners
- raise the jest test timeout to 30s: building the nest app in
  beforeAll can exceed the 5s default when all suites start at once
- accept any run status when reading back a just-created run, since
  the scheduler may already have picked it up
2026-10-01 11:44:51 +03:00
ars9 cafc126d1b ci: set the image registry explicitly
- use REGISTRY (git.hq.ars9.space) for login and image tags instead of
  deriving it from the server url, which is the runner's registration
  address and may be internal-only
- document how jobs reach gitea when the runner uses an internal address
2026-10-01 11:11:39 +03:00
ars9 f24a1b7dd5 ci: add gitea actions for quality checks and versioned images
- run server lint, type-check, tests and build, and client lint, build
  and storybook tests on master and pull requests
- when a push to master changes the package.json version, build the
  docker image and push it to the gitea registry tagged with the
  version and latest
- document the workflow and the REGISTRY_TOKEN secret
2026-10-01 11:07:42 +03:00
ars9 63c2df96f1 build(docker): slim down the runtime image
- install production dependencies and chromium in a separate stage
- drop source maps, typescript sources and declarations, docs,
  typeorm's browser build, better-sqlite3's c sources and ffmpeg
- base the runtime on debian:bookworm-slim with only the node binary
- document the image layout
- bump version to 1.22.1
2026-10-01 10:52:47 +03:00
ars9 23fa302b25 feat(scenarios): export used snippets with a scenario
- list the snippets a scenario uses in the export dialog, checked by
  default, with the versions the scenario uses
- export each selected snippet once per used version (latest and
  pinned) via the new snippetIds query parameter
- resolve used snippets from the exported version's steps
- show the scenario version in the export dialog
- document the export query parameters
- bump version to 1.22.0
2026-10-01 10:45:39 +03:00
ars9 f43d902297 feat(credentials): hide credential data until revealed
- add a RevealableCodeBlock ui component that renders its code only
  after the user clicks Reveal, with a storybook story
- use it for the data section of the credential page
- bump version to 1.21.1
2026-10-01 10:36:37 +03:00
ars9 2129708819 feat(ui): color-code uuid badges and highlight them on hover
- show a circle colored by the first 6 hex digits of the uuid,
  bordered with the badge text color for contrast in both themes
- lighten the uuid badge background on hover
- let Badge accept a className
- add a storybook story with six sample uuids and a randomize button
- bump version to 1.21.0
2026-10-01 10:23:50 +03:00
ars9 6e9b99e415 fix(ui): meet wcag aa text contrast in both themes
- add --color-primary-text for lime used as text or icon color
- stop dimming the idle refresh label with opacity
- darken the light danger button and lighten the dark danger hover
- define syntax highlighting colors per theme as --hl-* tokens
- darken light muted text slightly
- add a storybook contrast page, fail storybook tests on a11y violations
  and show live token values in the colors story
- bump version to 1.20.2
2026-09-30 22:27:06 +03:00
ars9 8aadbd25fb chore(deps): update dependencies and bring storybook up to date
- update client and server dependencies within their ranges, keeping
  all playwright packages aligned at 1.63
- fix code flagged by react-hooks 7.1: refs written during render and
  synchronous setState in effects
- add stories for the ui components that had none, with interaction
  tests, and cover all DescriptionList layouts
- drop the unused mdx stories pattern
- run the storybook tests as part of the pre-commit checks
- bump version to 1.20.1
2026-09-30 22:05:21 +03:00
ars9 9f341719ef feat(database): manage the schema with typeorm migrations
- replace synchronize with migrations, starting with a generated initial
  migration that adopts databases created by synchronize
- apply pending migrations in the docker container before the server,
  and refuse to start the server while migrations are pending
- share one entity list and data source between app, migration runner,
  typeorm cli and tests; tests run the real migrations
- add migration:run, migration:show and migration:generate scripts and
  a test that fails when entities and migrations differ
- exit with code 1 when startup fails
- bump version to 1.20.0
2026-09-30 21:45:42 +03:00
ars9 5de9272281 feat(server): choose cors origins by NODE_ENV and run docker in production
- allow the vite dev server origins in development and the compose port
  origins in production; CORS_ORIGINS overrides both
- set NODE_ENV=production in the runtime docker image
- document both settings in .env.example and the development docs
- bump version to 1.19.3
2026-09-30 21:31:48 +03:00
ars9 a6d468bd2c chore: make .env optional and comment out all example settings
- load .env in compose only when it exists; every setting has a default
- comment out every setting in .env.example, with ## for descriptions
  and # VAR=default for settings to uncomment
- update README, development docs and CLAUDE.md accordingly
2026-09-30 21:23:18 +03:00
ars9 b0f2c72b5f docs: bring docs up to date and drop unused keys setting
- rewrite architecture, development, mcp and scenario docs to match the
  current code: single container, all mcp tools, runs, versioning,
  timeouts, settings, client routing and dev setup
- rewrite README as a general overview without liquio-specific wording
- remove the unused KEYS_DIR setting and ./keys compose mount
- remove the unused result parameter from step code execution
- complete .env.example with the file storage settings and fix the
  DB_PATH default
2026-09-30 21:18:41 +03:00
ars9 e586ab9bd9 fix(scenarios): preselect default environment when opening run modal
- choose the scenario's default environment when the run modal opens on
  the scenario detail page, instead of in a load effect that raced with
  loading the scenario and could fall back to the first environment
- set the run to a final status directly in the status filter test so
  the scheduler can't change it mid-test
- bump version to 1.19.2
2026-09-30 21:07:15 +03:00
ars9 68415f805b chore: upgrade to node 24 and read app version from workspace root
- base the docker image on node:24-slim and require node >=24 via
  engines in the root package.json
- read app name and version from the workspace root package.json for
  config, swagger, startup log and mcp server info; drop the server
  workspace version
- bind test http servers to 127.0.0.1 so tests pass in containers
  without ipv6 loopback
- bump version to 1.19.1
2026-09-30 20:57:33 +03:00
ars9 a4bfa3117f feat(docker): serve the whole app from a single container
- serve the built client from the server via serve-static (CLIENT_DIR),
  falling back to index.html outside /api, /mcp, /docs and /health
- replace server and client Dockerfiles and nginx with one root
  Dockerfile and a single liqa compose service on port 13000
- use Playwright's chromium-headless-shell with only its required libs
  and DejaVu/Liberation fonts instead of Debian chromium and Noto
- clear the npm cache in the runtime image
- bump version to 1.19.0
2026-09-30 20:28:10 +03:00
ars9 8935783371 feat(import): add central yaml import for all exportable kinds
- add POST /import, an import page and the import_yaml mcp tool; items
  are validated up front and imported in dependency order
- switch list page import buttons to the central import
- write scenario exports as separate --- yaml documents per entity
- give each test app its own files dir to avoid cross-suite races
- use node: prefix for node built-in imports
- bump version to 1.18.0
2026-09-30 19:25:03 +03:00
ars9 cf56840df9 refactor: fix lint errors across server and client
- replace any types with explicit types in scenario file listing,
  import/export and mcp upload code
- type test server addresses and list callbacks, drop unused vars
- document why e2e export keeps the archiver import-require form
- remove unused scenario files total state in the client
- require clean lint in both packages in CLAUDE.md
2026-09-30 18:55:17 +03:00
ars9 1c5c906cbb feat(runs): add deleting files from a run
- add DELETE /scenarios/:id/runs/:runId/files/:fileId and the
  delete_run_file MCP tool; the stored file is removed once no scenario
  or run references it
- add a delete button with confirmation to the run detail files table
- bump version to 1.17.0
2026-09-30 18:51:25 +03:00
ars9 ac12301818 docs: add CLAUDE.md and rename compose file to compose.yaml
- add CLAUDE.md with app overview, compose deployment details, doc
  references, code quality checks and the release/commit workflow
- rename docker-compose.yaml to compose.yaml, the preferred compose
  spec file name
2026-09-30 18:45:59 +03:00
ars9 84dba6d670 fix(runs): disable playwright traces by default, bump to 1.16.1
- default PLAYWRIGHT_TRACE_MODE to off since traces often reach ~10 MB
  per run; traces can still be enabled per run or via the setting
2026-09-30 18:35:26 +03:00
ars9 ff83b6c7da feat(versioning): version scenarios and snippets, bump to 1.16.0
- snapshot scenario and snippet content into version tables on every
  content change; live tables keep holding the latest version
- record the scenario version on each run and copy its steps into the
  run steps, so runs execute and show the version they were created with
- keep run step history when a step is deleted (FK set null)
- pin a snippet version with runSnippet('alias@N')
- add version picker to the run modal and version info across the UI
- add version list/get endpoints and MCP tools
- include version in exports and require it on import, restoring the
  exact version by id + version
2026-09-30 15:24:44 +03:00
ars9 a328ef5ea7 feat(runs): record playwright traces with per-run trace mode, bump to 1.15.0
- record a trace for each scenario run and upload it as trace.zip
- add PLAYWRIGHT_TRACE_MODE (on, retain-on-failure, off) as the default
- add a trace mode option to the run modal, stored per run and reused
  by repeat run; expose the default via GET /scenarios/run-defaults
- accept traceMode in POST /scenarios/:id/run and run_scenario MCP tool
- share one run modal component between scenario list and detail pages
- git-ignore server/data
2026-09-30 14:58:07 +03:00
ars9 7d366e6368 feat(runs): add repeat run action to run detail page, bump to 1.14.0
- start a new run with the same environment and saveSession settings
  and navigate to it; disabled when the run's environment was deleted
- remount the run detail page per run id so per-run state resets
- type ScenarioRun.environmentId as nullable to match the backend
2026-09-30 14:35:31 +03:00
ars9 5ea1e38f25 feat(mcp): add credential CRUD tools, bump to 1.13.0
- add list/get/create/update/delete_credential MCP tools so credentials
  can be created and attached to scenarios entirely via MCP
- update_credential only changes the fields passed, keeping data intact
- add changelog entries for 1.13.0 and the missing 1.12.0 release
2026-09-30 14:26:15 +03:00
ars9andClaude Sonnet 5 d99bb75fc2 chore: sync package-lock.json version to 1.12.0
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-16 15:53:21 +03:00
ars9andClaude Sonnet 5 d79415cbb3 feat(scenario): dump page screenshot and HTML to run files on step failure
Captures a full-page screenshot and the current page HTML whenever a
scenario or snippet step fails, and uploads both as run artifacts so
failures can be diagnosed from the run's file list.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-16 15:52:32 +03:00
ars9 1eea4eb8d8 feat(scenario): export scenarios as standalone playwright e2e test projects
- Added E2eExportService to package scenarios as plug-and-play zip archives
  containing package.json, playwright.config.ts, test.spec.ts, .env, credentials.json,
  snippets, and referenced scenario files
- Only bundles credentials, snippets, and files actually referenced (directly or
  transitively) by the scenario's steps, reducing archive size
- Exported test runs entirely offline using a context shim that mirrors liqa's API
  (page, getCredential, runSnippet, getScenarioFiles, downloadFile, assert, etc.)
- Added GET /scenarios/:id/export-e2e HTTP endpoint and export_e2e_test MCP tool
- Added getUsedSnippets() endpoint to list snippets referenced by a scenario
- Added "Used Snippets" section on scenario detail page
- Added archiver@^7.0.1 dependency for zip archive creation
- Bumped version to 1.11.0
2026-09-16 12:33:16 +03:00
ars9 385f51f3ba fix(scenario-logs): fix out-of-order run log persistence
- Add seq column assigned in call order to fix logs racing each other
  as fire-and-forget writes (e.g. a snippet's "started" entry could be
  saved after its "finished" entry)
- Log snippet start/finish/failure via context.runSnippet, matching
  existing step start/pass/fail logging
- Rework Markdown log export to per-entry sections instead of a table
- Version bump: 1.10.0 -> 1.10.1
2026-09-15 13:17:29 +03:00
ars9 540a7ec96b feat(logs): add scenario run logs export
- Backend: logs export endpoint for CSV and Markdown formats
- Frontend: ExportLogsModal with download button on run detail page
- Updated i18n and CHANGELOG
- Version bump: 1.9.1 -> 1.10.0
2026-09-15 13:04:59 +03:00
ars9 4e79d3cd81 feat(scenario): add automatic step boundary logging to run logs
- step start, pass, and fail events logged automatically
- step boundaries visible in run logs without explicit context.log calls
- version bumped from 1.9.0 to 1.9.1
2026-09-15 12:53:33 +03:00
ars9 cbfd4404c1 feat(scenario): add context.assert() API for script assertions
- Add context.assert(fn, description) for function assertions
- Logs outcome on success/failure, throws on assertion failure
- Bump package version from 1.8.0 to 1.9.0
2026-09-15 12:35:17 +03:00
ars9andClaude Sonnet 5 50820b8b40 feat(scenario): let context.downloadFile save data: URLs as run artifacts
Scenario steps can now persist in-script generated content (e.g. an
obtained VC's JWT) as a run file via context.downloadFile('data:...'),
without needing a network fetch. Bumps to 1.8.0.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-15 10:37:22 +03:00
ars9 502a3e4f2c 1.7.1 2026-04-21 18:09:49 +03:00
ars9 b57b55f3e1 feat(mcp): add file tools for scenarios and runs
- expose scenario file upload, listing, and content retrieval over MCP\n- expose run artifact listing and content retrieval with end-to-end coverage
2026-04-21 18:00:41 +03:00
ars9 06c662042b doc(changelog): add changelog 2026-04-21 17:09:05 +03:00
ars9 461669b3fb 1.7.0 2026-04-21 16:49:46 +03:00
ars9 9580a7b2df fix(files): expose expiry and disable expired downloads
- return expiresAt and createdAt for scenario and run file metadata\n- keep download actions visible while preventing expired file access
2026-04-21 16:46:33 +03:00
ars9 86f9ac5603 feat(files): add file management UI for scenarios and runs
- add scenario upload and download UI with typed file API helpers
- show run artifacts on run detail pages after polling completes
- handle multipart uploads and absolute file paths for downloads
2026-04-21 15:58:04 +03:00
ars9 6a91ce30e3 feat(files): add file storage subsystem with scenario and run artifact support
- add FileEntity, ScenarioFileEntity, ScenarioRunFileEntity with UUID-sharded disk tree
- FileStorageService: write/sha256/expiry, paginated listing, dynamic cleanup cron via SchedulerRegistry
- expose getScenarioFiles() and downloadFile() on ScriptContext for use in exec code
- wire scenarioId, runId, fileService into ExecContextBuilder and scenario scheduler
- add file upload and listing endpoints to ScenarioController
- add FILES_DIR, FILE_RUN_EXPIRATION_DAYS, FILE_CLEANUP_CRON to AppConfig
2026-04-21 13:01:09 +03:00
ars9 aa3bae9020 feat(client): set dynamic page title based on content
- add usePageTitle hook that writes '<title> | Liqa' to document.title
- list pages use section name; detail pages use entity name once loaded
- create/edit pages use static action title, edit includes entity name
2026-04-20 16:32:16 +03:00
ars9 ba46789226 feat(mcp): add snippet CRUD tools to MCP server
- register list_snippets, get_snippet, create_snippet, update_snippet, delete_snippet
- inject SnippetService into McpService and import SnippetModule into McpModule
- cover all five tools with integration tests including error cases
2026-04-20 16:21:52 +03:00
ars9 4e494ce4fd feat(scenarios): show last run status and timestamp on scenarios list
- extend findAll to join latest run per scenario via correlated subquery
- return lastRunStatus and lastRunAt fields in GET /scenarios response
- add Last Run column with badge and timestamp to ScenariosPage
- add integration tests for null and populated lastRunStatus
2026-04-17 15:13:28 +03:00
ars9 8c6158e8e3 1.6.1 2026-04-17 14:49:03 +03:00
ars9 b4cfe050fa perf(scenario-scheduler): parallelize run pickup with effect, add cache cleanup
- replace sequential for-loop in pickUpPendingRuns with Effect.forEach concurrency:10
- extract CONCURRENCY_LIMIT constant shared by both startup and pickup paths
- clear all run caches (creds, snippets, env, timeouts, activeRuns) on setup failure
- call failRun on setup error to leave the db run in a consistent failed state
2026-04-17 14:48:55 +03:00
ars9 a199700878 perf(scenario-scheduler): parallelize stale-run cleanup on startup with effect
- use Effect.forEach with concurrency:10 to fail up to 10 runs in parallel
- isolate each failRun with catchAll so one failure doesn't abort the rest
- log unexpected failRun errors per run without halting the batch
2026-04-17 14:32:25 +03:00
ars9 2a46b355db fix(scenario-runner): harden run failure handling across all paths
- add onModuleInit to fail in_progress runs on server restart
  (playwright sessions cannot be recovered after restart)
- extract failRun() shared method used by restart cleanup, timeout,
  and unexpected error paths for consistent step run status updates
- fix catch path to also fail/cancel step runs (previously left orphaned)
- accept plain {name, steps} payload in importScenario alongside
  full export format; throw BadRequestException for invalid input
- include stepRuns relation in findRuns paginated response
- add scenario-scheduler.spec.ts integration tests for onModuleInit
2026-04-17 14:11:43 +03:00
ars9 a50dce2755 feat(scenarios): add timeoutSeconds to scenarios and steps
- add timeoutSeconds field to scenario and step entities
- add timeoutSeconds to create/update DTOs for scenario and step
- enforce timeout via scheduler: abort run if step exceeds limit
- expose timeoutSeconds in MCP create/update scenario and step tools
- add client-side type, API, i18n, and form support for timeoutSeconds
- add integration tests for timeout persistence via REST and MCP
2026-04-17 13:46:30 +03:00
ars9 8dbd319bba fix(scenario-runner): preserve session on failed runs
- failStepRun was calling closeBrowserHandle immediately, removing the
  handle before maybePreserveSession could read it in the finally block
- delegate browser lifecycle to maybePreserveSession for both pass and
  fail paths so saveSession=true is honoured regardless of run outcome
2026-04-15 18:49:31 +03:00
ars9 67e230a647 fix(credential): stamp lastUsedAt via db CURRENT_TIMESTAMP when run consumes credentials 2026-04-15 12:26:09 +03:00
ars9 ad155e269c feat(table,runs,sessions): add server-side sorting and pagination
- add sortable column support to Table with asc/desc/unsorted icons
- active sort icon uses --color-primary; no header background change
- Table supports server-side mode via total/page/onPageChange props
- wire server-side sort+pagination in ScenariosPage, AllRunsPage, RunsPage, SessionsPage
- remove steps count column from run tables
- fix server: RunsQueryDto now extends PaginationQueryDto with orderBy/orderDir
- fix findAllRuns to use QueryBuilder; sort by scenario.name via JOIN
- add per-resource typed query DTOs with @IsIn allowlist on orderBy
- prevents SQL injection and returns 400 for unknown orderBy values
2026-04-15 12:18:47 +03:00
ars9 f268d0e3eb feat(scenarios): overhaul export/import with multi-entity YAML format
- export now accepts includeEnvironment and credentialIds query params
- output is a YAML stream with comment-delimited environment, credential, and scenario sections
- scenario entity includes credentials array with alias mappings
- import accepts both old single-object and new array format, upserts envs/creds before linking
- new ExportScenarioModal with env and per-credential checkboxes replaces direct download
2026-04-15 00:35:14 +03:00
ars9 a779ab4667 feat(scenarios): link scenarios to a default environment
- add optional ManyToOne relation from scenario to environment entity
- expose environmentId in create/update DTOs, service, and MCP tools
- pre-select linked environment in run modals on detail and list pages
- add environment selector to create/edit scenario forms
- show linked environment as a navigable link on scenario detail page
2026-04-15 00:05:55 +03:00
ars9 e6aacc899d feat(scenarios,environments): add markdown description field
- add optional description to scenario and environment entities
- expose description in create/update DTOs, MCP tools, and export DTOs
- render description as markdown on detail pages
- add description editor (CodeEditor) to create/edit forms for both resources
2026-04-14 23:53:45 +03:00
ars9 4dab218b75 1.6.0 2026-04-14 23:16:44 +03:00
ars9 622924ed53 refactor(nav): reorganize sidebar with dynamic sections at top
- move runs and sessions to top of navigation (most dynamic)
- add visual separator between dynamic and configuration sections
- reorder remaining items: scenarios, snippets, credentials, environments
- implement separator component in nav rendering logic
2026-04-14 23:15:49 +03:00
ars9 6c43b53590 fix(scenarios): add error handling for API calls and dev script with local API
- add catch handler to promises for better error visibility
- use null coalescing operators to prevent undefined accessing
- add dev:compose-api npm script pointing to localhost:13000 API
- include toast dependency in useCallback to avoid stale closures
2026-04-14 23:09:38 +03:00
ars9 e66e53c817 chore: apply code formatting and linting
- format long import statements with consistent line wrapping
- apply consistent indentation across client and server modules
- remove generated tsconfig.tsbuildinfo file
2026-04-14 22:54:03 +03:00
ars9 a71be39076 fix: fix links in scenario service 2026-04-14 21:11:35 +03:00
ars9 5ec9fd0bc3 refactor: add session and environment relationships to scenario run
- add sessionId optional column to ScenarioRunEntity
- add ManyToOne relationship to EnvironmentEntity (with eager loading)
- add ManyToOne relationship to SessionEntity (optional)
- update ScenarioRun client types to include session and environment data
- add environment name and session link to RunDetailPage
- update UI to display save session, environment, and session info
2026-04-14 19:29:48 +03:00
ars9 80d9af42b5 fix: add save session checkbox to run modal on scenarios list page
- add saveSessionFlag state to ScenariosPage
- pass saveSessionFlag to scenarios.run() call
- render save session checkbox in run modal when envs are available
- reset saveSessionFlag after scenario run completes
2026-04-14 19:24:13 +03:00
ars9 dcb002304b feat(run-detail): add expandable step output blocks with json pretty-printing
- add collapsible code blocks for step output with JSON syntax highlighting
- display byte count when output exists but no description available
- support both individual row expansion and header-level expand all toggle
- pretty-print JSON output for improved readability
- wrap log messages in code tags for monospace display
- fix step order numbering to start from 1 instead of 2
2026-04-14 19:19:39 +03:00
ars9 196bf4c2e8 feat: add saveSession flag to create scenario runs
- Add optional `saveSession` boolean parameter to CreateScenarioRunDto
- Add `saveSession` column to ScenarioRunEntity
- When saveSession=true and run completes, preserve the browser context as a named explore session instead of closing it
- Session name follows pattern: run-{runId}
- Automatically extracts token and localStorage for session persistence
- Injected SessionService and SessionContextService into ScenarioSchedulerService
- Updated MCP run_scenario tool to accept saveSession parameter
- Updated UI run dialog with checkbox to enable session preservation
- Client API updated to pass saveSession flag
2026-04-14 18:54:45 +03:00
ars9 0e47623a6b feat(browser,mcp): resolve environment and credentials from DB in exec
- POST /exec now accepts environmentId (UUID) and credentials (alias → UUID)
  instead of raw payloads; resolves entities via EnvironmentService and
  CredentialService before passing data to browserService.exec
- exec_code MCP tool updated with same schema: environmentId + credentials map
- CredentialModule imported into BrowserModule and McpModule
- docs(scenario): rewrite script runtime section for single context argument
- docs(mcp): update exec_code description to reflect new parameter shapes
- style: reorder imports across server source (formatter)
2026-04-14 18:09:28 +03:00
ars9 90be5a5490 refactor(code-executor): migrate user scripts to single context argument
- replace (page, context, helpers) signature with async (context) => {}
- add ScriptContext interface exposing page, browser, env, getEnv,
  getCredential, getStepOutput, runSnippet, dumpDom, log/warn/error
- rename getEnvUrl to getEnv throughout service and docs
- fix step ordering: normalizeStepOrder and run step rows are now 1-based
- migrate existing DB rows (scenario_steps, scenario_run_steps) +1
- update all tests and stored snippet/step code in DB to new API
2026-04-14 17:44:59 +03:00
ars9 1a2e786ca8 feat(browser): add environment, credentials, and script logger to POST /exec
- ExecDto gains optional `environment` and `credentials` fields
- BrowserService.exec forwards both to CodeExecutorService.execute so
  helpers.env, helpers.getEnvUrl(), and helpers.getCredential() work
  identically to scenario-scheduler steps
- script console.log/warn/error now routed through TraceLogger with
  session label prefix
- integration tests cover env/creds injection and missing-alias error
2026-04-14 16:57:06 +03:00
ars9 d34ea9e943 fix(browser): inject snippets into exec_code context; fix(ui): step order starts at 1 in run detail
- BrowserService.exec() now builds snippet map via SnippetService and passes
  it to CodeExecutorService.execute() for both named-session and anonymous paths
- SnippetModule added to BrowserModule imports to wire the dependency
- RunDetailPage step order column renders s.order + 1 (was 0-based)
2026-04-14 16:28:31 +03:00
ars9 310997c3ae feat(mcp): add credential and all-runs tools; replace deprecated z.string().uuid()
- add list_scenario_credentials, add_scenario_credential, remove_scenario_credential tools
- add list_all_runs tool (global across all scenarios)
- replace all deprecated z.string().uuid() with z.uuid() throughout mcp.service
2026-04-14 14:45:55 +03:00
ars9 7acd1bc5a1 feat(client): add nginx config for SPA routing and API proxy
- add try_files fallback to serve index.html for all non-asset paths
- proxy /api/ requests to the server container to avoid HTML being
  returned by nginx for API calls when using full route paths
2026-04-14 13:05:55 +03:00
ars9 5ba327b745 1.5.0 2026-04-11 00:53:44 +03:00
ars9 238c52610a refactor(scenario): remove validateCode — assertions live in execCode
- drop validateCode column, DTOs, service mappings, and scheduler branch
- remove parseValidateResult helper and ValidateResult interface
- inject playwright expect into code executor for direct use in execCode
- strip validateCode from MCP tool schemas, client types, and UI forms
2026-04-11 00:52:50 +03:00
ars9 29e91b0078 test(server): align specs with run environment and step schema
- update scenario tests to create runs with required environmentId
- adjust browser controller expectations to session auto-create behavior
- sync playwright/context mocks with current browser service usage
2026-04-11 00:22:58 +03:00
ars9 56d23f913d feat(scenarios): require environment for scenario runs
- require environmentId when creating runs in API and MCP tools

- pass selected environment data into step execution helpers

- prompt for environment selection before running scenarios in UI
2026-04-11 00:12:21 +03:00
ars9 d8ea2d0126 feat(ui): require confirmation before delete actions
- add a reusable modal component and export it from the shared ui barrel

- gate all delete and remove flows behind explicit confirmation dialogs

- use a solid modal surface color token with fallback to avoid transparent body
2026-04-10 23:46:20 +03:00
ars9 7223371fae refactor(snippets): adopt alias/title model and markdown UX
- rename snippet identity from name to alias and add required title fields

- migrate snippet API, forms, cards, and detail views to alias/title semantics

- render markdown descriptions with short card previews and split vendor chunks
2026-04-10 23:26:36 +03:00
ars9 11db983ea6 refactor(api): version routes and externalize client base url
- serve REST endpoints under /api/v1 with root exceptions for health and mcp

- move swagger UI to /docs and allow direct frontend calls via CORS

- remove Vite proxy/hash routing and rely on env-driven VITE_API_URL
2026-04-10 22:53:32 +03:00
ars9 ccce3381c1 refactor(client): centralize error feedback with toast events
- emit API/network failures through a shared toast event bridge

- remove per-page inline error notifications to avoid duplicate error UI

- dedupe repeated toast messages to keep feedback readable
2026-04-10 22:24:30 +03:00
ars9 7444082b65 feat(ui): add toasts for create edit and run flows
- add global ToastProvider and useToast hook mounted at app root

- show success/error toasts for environment, credential, snippet, and scenario create/edit actions

- show run-started/error toasts on scenario run actions with 100ms exit animation
2026-04-10 21:44:04 +03:00
ars9 d511c85891 refactor(client): split feature chunks and polish environment ui
- lazy-load route pages and add entity-based manual chunking in Vite

- prevent environment pages from crashing when legacy records miss data

- fix sidebar toggle chevron direction and make env forms full width
2026-04-10 21:32:07 +03:00
ars9 fd515ee459 refactor(environment): rename urls payload to data
- replace hardcoded URL keys with a generic key-value data map

- align backend DTOs, MCP schemas, and service import/export mapping

- update environment UI forms to edit JSON data instead of fixed fields
2026-04-10 21:22:46 +03:00
ars9 b45f95d8cf refactor(session): auto-create named browser sessions
- create and register named browser sessions on open/exec when missing

- align scenario step DTO/entity/service by removing sessionName usage

- update MCP scenario-step schemas to use optional title fields
2026-04-10 21:06:00 +03:00
ars9 1627733701 docs: refresh architecture and runtime documentation
- align architecture, development, MCP, and scenario docs with current code

- remove obsolete key descriptor document and stale keys/auth references
2026-04-10 20:40:20 +03:00
ars9 0e4a2e1819 feat(app): add environment import/export and sidebar footer info
- add environment import/export API endpoints and client integration

- add environment export actions and toolbar import/export buttons in UI

- move theme switcher to sidebar bottom and show root package version

- switch snippet card menu icon to cog for consistent options affordance
2026-04-10 20:29:40 +03:00
ars9 99da7ac891 feat(ui): add breadcrumb icons, fix alignment, and remove duplicate form headers
- add section icons to all breadcrumbs across every page
- fix breadcrumb nav display:flex so icons align vertically with buttons
- wrap all page breadcrumbs in pageToolbar div for consistent layout
- add Breadcrumbs to AllRunsPage which previously used a plain h1
- fix envCardHeader flex:1 so settings button hugs the right edge
- remove card header from environment create/edit forms (duplicated breadcrumb)
2026-04-10 19:58:33 +03:00
ars9 de0cbeef7c refactor(workspace): restore yaml exports and align docker builds
- return scenario export payloads as yaml to match existing workflows

- harden step reordering flow for drag-and-drop and one-based ui labels

- switch server container to workspace-lockfile installs and root ignore rules
2026-04-10 18:19:38 +03:00
ars9 259dac806e refactor(auth): remove keys auth module and align tests
- remove server auth module and client keys page/routes/api to simplify flow

- update mcp and scenario tests to match uuid routes and step schema
2026-04-10 16:42:43 +03:00
ars9 673aa0f458 refactor(scenario): remove step type and simplify scheduler to exec-only
- remove StepType, type column, and type field from step entity and DTOs
- remove executeLoginStep, executeSignStep, executeExecStep from scheduler
- inline exec logic directly in executeStepRun; all steps run execCode
- remove AuthService, EnvironmentService, runEnvironments from scheduler
- remove type selector from CreateStepPage and EditStepPage
- remove type badge column from ScenarioDetailPage
- fix useEffect dependency arrays in RunDetailPage (FINAL, id, runId, polling)
- fix duplicate /snippets proxy key in vite.config.ts
- remove unused escapeHtml export from hljs.ts
2026-04-10 16:14:17 +03:00
ars9 1c13e068ad feat(ui): add CodeBlock and CodeEditor components with Monaco and hljs
- add CodeBlock for read-only syntax-highlighted display (hljs, js/json)
- add CodeEditor wrapping Monaco editor with theme sync, focus state, and error state
- replace code textareas in snippet, credential, and step pages with CodeEditor
- replace code <pre> blocks in snippet and credential detail pages with CodeBlock
- make form cards full-width on pages with code editors
- add resize:vertical support to CodeEditor wrapper with automaticLayout
2026-04-10 15:53:26 +03:00
ars9 2046e64428 feat(runs): add log search with backend LIKE filter and pagination
- add Search pill component with lucide icon and focus highlight
- wire debounced search input to GET /run/:id?q= backend filter
- backend filters run logs with LIKE %q% via TypeORM
- add sectionHeadingRow layout for heading + search alignment
- add i18n keys: runs.step_title, logs_search_placeholder
2026-04-10 15:09:05 +03:00
ars9 fd655c3253 feat(runs): add step title column, step descriptions, and snippet logging 2026-04-10 14:56:15 +03:00
ars9 607abcafc5 fix(scenarios): order runs by createdAt desc, scenarios list by updatedAt desc 2026-04-10 13:57:34 +03:00
ars9 b26eb10b3d 1.4.0 2026-04-10 13:09:25 +03:00
ars9 32be7c0a59 feat(export-import): add yaml export/import with id upsert for credentials, snippets, and scenarios
- all entities export a kind field (credential/snippet/scenario) for safe type checking on import
- import upserts by id: overwrites if id exists, creates with explicit id otherwise
- scenario export now includes id and step ids; import deletes old steps before recreating
- add GET /:id/export and POST /import endpoints to credential and snippet controllers
- add UuidBadge ui component: shortens uuid to first+last 4 hex chars, tooltip, clipboard copy with animated ClipboardCheck icon pop
- apply UuidBadge across all entity id display sites (detail pages, card footers, table columns)
- add export/import buttons to CredentialsPage, SnippetsPage, CredentialDetailPage, SnippetDetailPage
2026-04-10 13:09:09 +03:00
ars9 1164289173 feat(snippets): add snippets entity, crud, and auto-browser-per-run
- add Snippet entity with name, description, code; full CRUD backend
- add snippets pages (list, create, edit, detail) and nav entry
- add runSnippet helper in code-executor using new Function with args array
- add result param to execute() so validateCode can access exec output
- remove sessionName from steps; each run now spawns its own fresh browser
- fix waitForURL race by polling localStorage for token instead
2026-04-10 00:22:51 +03:00
ars9 1efbbb38a3 feat(scenarios): add step title, scenario credentials, and environment context in executor
- add nullable title column to scenario steps; exposed in create/edit forms and step table
- add scenario-credential join (many-to-many with CredentialEntity) with CRUD endpoints
- expose environment URLs in code executor helpers via helpers.env and helpers.getEnvUrl()
- resolve and cache environment per run from the login step's environmentName in scheduler
- add section spacing and step table title column to ScenarioDetailPage
2026-04-09 23:37:21 +03:00
ars9 1f3a604940 feat(runs): add runs pages, polling, autorefresh indicator, and scheduler fix
- add global runs page and per-scenario runs/run-detail pages
- run detail page polls every 1s until pass/fail, cleans up on unmount
- runs list pages poll every 10s with AutoRefreshIndicator (pulse on data load)
- fix scheduler: set run to pass after empty step loop to prevent stuck in_progress
- fix table header colors and link cell color for readability
- fix play button to navigate to the new run after creation
- fix package.json import paths in server for Docker build context
2026-04-09 21:58:27 +03:00
ars9 ebcb8b8ff4 refactor(client): group pages by entity and add scenario/step crud
- move environment, scenario, session pages into entity subdirs
- add CreateScenarioPage and EditScenarioPage
- add CreateStepPage and EditStepPage with order/type/session/code fields
- add per-step edit and delete row actions on ScenarioDetailPage
- add step api methods (get, create, update, remove) to api client
- add sectionToolbar, formField, fieldLabel, textarea css utilities
2026-04-09 20:45:34 +03:00
ars9 6b1307c58a 1.3.0 2026-04-09 20:26:45 +03:00
ars9 a2afe97cd3 chore: rename project to liqa and fix code quality issues
- rename package names from liquio-qa-bot to liqa/liqa-client/liqa-server
- replace QA Bot text with liqa.svg logo image in sidebar header
- add favicon.svg (liqa-mini.svg) and page title update
- fix DescriptionList extractText generic type for TS strict props access
- configure server eslint to allow underscore-prefixed unused vars
- fix session.controller unused destructured vars (_cookies, _localStorage)
- update server package.json version import path after server rename
- fix session DELETE test assertion from 200 to 204
2026-04-09 20:26:31 +03:00
ars9 a5f87b904e feat(scenarios): add detail page, comfortable DescriptionList layout, and environment card refactor
- Add ScenarioDetailPage with DescriptionList, steps table, run/delete actions
- Add /scenarios/:id route
- Add i18n keys for scenario detail fields, steps columns, and 404 error
- Add 'comfortable' and 'inline' layout variants to DescriptionList (with compact as default stacked)
- Apply layout="comfortable" to session, environment, and scenario detail pages
- Apply layout="compact" to EnvironmentsPage card DescriptionList
- Refactor EnvironmentsPage card to use ContextMenu (view/edit/delete) with icons
- Add ScenariosPage clickable rows, Play icon (primary) and Trash2 icon (danger) action buttons
- Add Page.module.css sectionHeading and stepsSection utility classes
- Fix Notification.tsx and Table.tsx formatting (prettier)
2026-04-09 19:16:49 +03:00
ars9 d342637eb6 feat(sessions): add detail page, Notification component, and session API improvements
- add SessionDetailPage with breadcrumbs, DescriptionList, status badge, masked token
- add Notification component (info/success/error/warning/note variants) for contextual messages
- use Notification for 404 errors on session and environment detail pages
- add GET /sessions/:id endpoint; sanitize token (head…tail) and strip cookies/localStorage
- change DELETE /sessions/:id to return 204 No Content so client redirect works correctly
- add onRowClick prop to Table for clickable rows; stop propagation on actions column
- update status badges: open=success (green), closed=error (red) on both list and detail
2026-04-09 19:00:16 +03:00
ars9 097c747993 style(Table): apply Kimberly header and striped row backgrounds 2026-04-09 17:45:33 +03:00
ars9 18177cac52 feat(client): add create/edit environment pages and hoverable cards
- add CreateEnvironmentPage and EditEnvironmentPage with pre-filled form
- add /environments/new and /environments/:id/edit routes
- add Edit option to card context menu and detail page toolbar
- move env id pill to card footer (left), timestamp stays right
- make env cards clickable (navigate to detail); cog stops propagation
- add hoverable Card variant with primary border+shadow on hover
- add link color tokens and global anchor styles for both themes
- fix Timestamp pill visibility in dark mode with border token
- add DescriptionList truncate prop with ellipsis and title tooltip
- stack DescriptionList dd below dt with 8px gap between items
2026-04-09 17:22:01 +03:00
ars9 89016b01d2 feat(client): add Card header/footer, DescriptionList, and portal ContextMenu
- add Card header prop (primary/secondary variants) and footer prop (sticks to bottom)
- add Breadcrumbs to all 5 pages; remove duplicate h1 headings
- add pageToolbar layout for breadcrumbs + danger button aligned right
- add DescriptionList component replacing raw dl/dt/dd markup; supports truncate+tooltip
- rewrite ContextMenu to render dropdown via React portal to avoid clip/overflow issues
- update EnvironmentCard to use Card header (primary), footer (Timestamp), and truncated DescriptionList
- fix cog button contrast, square sizing, and right-edge alignment on colored header
- add border to Timestamp pill for dark-mode visibility
- add id badge pill styling to environment card header
2026-04-09 14:29:16 +03:00
ars9 35997f8bcb feat(client): add ContextMenu component, environment cards, detail page, and breadcrumbs
- add ContextMenu component with click-outside/Escape dismiss, align prop, and danger variant
- replace EnvironmentsPage table with responsive card grid
- add cog button to each card opening a context menu with view and delete actions
- add EnvironmentDetailPage at /environments/:id with meta grid, URLs card, and delete
- add Breadcrumbs to all pages; detail page uses two-item trail with delete button inline
- add Table stories for pagination and Timestamp column
2026-04-09 10:55:45 +03:00
ars9 077cd6ad5f feat(client): add Pagination component and integrate with Table and pages
- add Pagination component with prev/next, ellipsis page range, and optional page-size selector
- add Pagination and Table pagination stories (WithPagination, WithPaginationAndSizeSelector)
- extend Table with optional pageSize and pageSizeOptions props for built-in client-side pagination
- add Timestamp column to Table story fixtures
- enable pagination on all four pages with pageSize=10 and size selector
- add pagination i18n keys to en.json
2026-04-09 10:43:45 +03:00
ars9 b4d576c6e9 chore: centralise version field in root package.json
- remove version from server and client workspace packages
- bump root to 1.2.0 to match previous server version
2026-04-09 10:35:07 +03:00
ars9 f83141b484 docs: update architecture and development docs to cover client workspace
- add client workspace section to architecture diagram and description
- split development.md commands into server and client per-workspace
- document client tech stack, directory layout, routing, and theming
- add Client overview section with Storybook test instructions
2026-04-09 10:32:49 +03:00
ars9 32beec2229 feat(client): add Timestamp component, ESLint 10 + Prettier, and code quality fixes
- add Timestamp component with moment relative time and ISO tooltip
- add Timestamp stories (JustNow, MinutesAgo, HoursAgo, DaysAgo, MonthsAgo)
- add ESLint 10 with typescript-eslint, react-hooks, react-refresh, prettier
- add Prettier config with singleQuote, semi, trailingComma all, printWidth 100
- add lint, lint:fix, format, test:storybook scripts to package.json
- fix react-hooks/set-state-in-effect in all page components
- auto-fix 113 Prettier formatting issues across src and .storybook
2026-04-09 10:25:15 +03:00
ars9 50b942801f feat(client): add routing and sidebar icons
- install react-router-dom and wrap app in HashRouter to avoid dev proxy conflicts
- replace useState-based section switching with NavLink + Routes
- add lucide icons (Globe, KeyRound, Monitor, ClipboardList) to nav items
- icon opacity transitions on hover and active state via CSS
2026-04-09 10:09:19 +03:00
ars9 876b1518da feat(client): add i18n with i18next and react-i18next
- install i18next and react-i18next
- create src/i18n/index.ts bootstrapping i18next with initReactI18next
- add src/i18n/locales/en.json with keys for nav, all pages, and ThemeSwitcher
- replace hardcoded English strings in App, all pages, and ThemeSwitcher with t()
- move static column definitions inside components where useTranslation is available
2026-04-09 10:03:54 +03:00
ars9 aefa1db2bd feat(client): add ThemeSwitcher and relocate stories to .storybook/
- add lucide-react for Sun/Moon icons
- add useTheme hook persisting choice to localStorage with prefers-color-scheme fallback
- add ThemeSwitcher button component wired into SidePanel header
- add blocking inline script to index.html to prevent flash-of-wrong-theme
- move all *.stories.tsx from src/ into .storybook/stories/ and update imports
- update main.ts stories glob to .storybook/stories/**
2026-04-09 09:56:59 +03:00
ars9 9916ef5aaf feat(client): add UI kit, data layer, app shell, and Table component
- design token system (Atlantis, Kimberly, Powder Ash palette)
- Button, Badge, Input, Select, Card, SidePanel, Breadcrumbs components
- generic typed Table<T> component with loading/empty states
- API data layer: typed fetch client for environments, keys, sessions, scenarios
- Vite dev proxy targeting server on port 13000
- App shell with SidePanel nav and four entity pages (Environments, Keys, Sessions, Scenarios)
- Storybook config with dark/light theme toggle and a11y addon
2026-04-09 00:11:55 +03:00
ars9 5cc16725fb chore(repo): restructure as monorepo with server and client workspaces
- move NestJS app into server/ subdirectory
- add client/ React+TypeScript (Vite) app with Hello World
- update docker-compose to build and run both services
- add root package.json declaring npm workspaces
- update .gitignore to cover node_modules and dist at all depths
2026-04-08 21:28:01 +03:00
ars9 afc4627353 fix(auth): skip sign widget open if already visible
- check for file input visibility before clicking the sign button
- prevents double-open when Готово triggers the widget automatically
- remove stale scenario-25-export.json (superseded by notes export)
2026-04-08 21:09:36 +03:00
ars9 73cfe99cb7 1.2.0 2026-04-08 20:14:10 +03:00
ars9 9e79cad237 feat(session): persistent browser context pool with lifecycle management
- SessionContextService: in-memory Map of live Playwright handles, reused
  per sessionName across exec_code/open_url calls; closed on module destroy
- SessionSchedulerService: @Interval closes idle sessions and deletes old
  closed ones using SESSION_IDLE_TIMEOUT_MINUTES / SESSION_DELETE_CLOSED_DAYS
- SessionService: onApplicationBootstrap closes all open sessions on restart;
  upsert marks status=open and sets lastUsedAt; adds markOpen/markClosed/
  touchLastUsed/findExpiredOpen/findOldClosed/findById helpers
- SessionEntity: status (open|closed) and lastUsedAt columns added
- AuthService: keeps browser alive after login, registers context in pool
- BrowserService: named sessions reuse persistent context; anonymous remain ephemeral
- AppConfig: all config fields declared with typed defaults; validate wired
  into ConfigModule so mis-configuration fails fast at startup
- ConfigService<AppConfig, true> used everywhere — no more untyped get() calls
2026-04-08 20:14:05 +03:00
385 changed files with 42463 additions and 6111 deletions

No files matched your search

+7 -4
View File
@@ -1,7 +1,10 @@
.git
.gitignore
node_modules
dist
**/node_modules
**/dist
**/.DS_Store
**/*.log
data
keys
.env
.git
*.log
**/*.tsbuildinfo
+54 -6
View File
@@ -1,8 +1,56 @@
NODE_ENV=development
PORT=3000
## Optional overrides: copy to .env and uncomment the settings you need.
## Every setting has a default (shown below), so liqa runs without a .env file.
##
## Lines starting with "##" are descriptions.
## Lines starting with "# " are settings: remove the "# " to enable one.
# Directory (relative to cwd) containing *.json key descriptors
KEYS_DIR=keys
## production in the Docker image; also selects the default CORS origins
# NODE_ENV=development
# PORT=3000
# SQLite database path
DB_PATH=data/sessions.db
## Optional account authentication (disabled unless explicitly enabled)
# AUTH_ENABLED=true
## Required when AUTH_ENABLED=true. Set a private, high-entropy value outside source control.
# AUTH_JWT_SECRET=replace-with-a-private-random-secret
## Browser cookie name and default JWT lifetime
# AUTH_COOKIE_NAME=liqa_auth
# AUTH_JWT_EXPIRES_IN=24h
## Expired logout revocations are cleaned at startup and on this cron schedule.
# AUTH_REVOKED_TOKEN_CLEANUP_CRON=0 3 * * *
## Origins allowed to call the API cross-origin (comma separated). Default: the
## Vite dev server (http://localhost:5173) in development, the compose port
## (http://localhost:13000) in production
# CORS_ORIGINS=http://localhost:5173,http://127.0.0.1:5173
## SQLite database path
# DB_PATH=data/liqa.db
## Stored scenario files and run artifacts (downloads, failure dumps, traces)
# FILES_DIR=data/files
## Days to keep run artifacts before they are deleted
# FILE_RUN_EXPIRATION_DAYS=7
## When expired files are deleted (cron expression)
# FILE_CLEANUP_CRON=0 3 * * *
## Close open sessions that have been idle for longer than this many minutes
# SESSION_IDLE_TIMEOUT_MINUTES=30
## Delete closed sessions whose updatedAt is older than this many days
# SESSION_DELETE_CLOSED_DAYS=7
## Playwright trace recording for scenario runs: on | retain-on-failure | off
## (traces often reach ~10 MB per run; can be overridden per run in the run modal)
# PLAYWRIGHT_TRACE_MODE=off
## Run log data blocks whose pretty-printed JSON exceeds either limit start
## collapsed in the UI (bytes, lines); served to the client via /manifest.json
# RUN_LOG_DATA_COLLAPSE_BYTES=256
# RUN_LOG_DATA_COLLAPSE_LINES=5
## Chromium binary to use instead of Playwright's own (not needed in Docker,
## which ships Playwright's chromium-headless-shell)
# PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH=/usr/bin/chromium
## Directory with the built client to serve at / (the Docker image sets it to
## "client"; leave unset to not serve the UI, e.g. when using the Vite dev server)
# CLIENT_DIR=client
+120
View File
@@ -0,0 +1,120 @@
# Code quality checks on master and pull requests. The server and client jobs
# only run when their directory (or shared root files) changed. On a release
# tag push (vX.Y.Z), runs both jobs unconditionally and then builds the Docker
# image and pushes it to this Gitea instance's container registry, tagged with
# the version and `latest`. The tag must match the root package.json version.
#
# Needs a repository (or owner) secret REGISTRY_TOKEN: a Gitea access token
# with package write access for the repository owner. The registry host is
# set explicitly below rather than taken from the server URL, which is the
# address the runner was registered with and may be internal-only.
name: CI
on:
push:
branches: [master]
tags: ['v[0-9]+.[0-9]+.[0-9]+']
pull_request:
env:
REGISTRY: git.hq.ars9.space
jobs:
# Not needed on tag pushes: server and client always run there
changes:
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
runs-on: ubuntu-latest
outputs:
server: ${{ steps.filter.outputs.server }}
client: ${{ steps.filter.outputs.client }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
server:
- 'server/**'
- 'package.json'
- 'package-lock.json'
- '.gitea/workflows/ci.yml'
client:
- 'client/**'
- 'package.json'
- 'package-lock.json'
- '.gitea/workflows/ci.yml'
server:
needs: changes
# changes is skipped on tag pushes, hence !cancelled()
if: |
!cancelled() &&
(startsWith(github.ref, 'refs/tags/') || needs.changes.outputs.server == 'true')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 24
cache: npm
- run: npm ci -w server
- name: Lint
run: npm run -w server lint -- --max-warnings=0
- name: Type-check
run: npx tsc --noEmit -p server/tsconfig.json
- name: Test
run: npm test -w server
- name: Build
run: npm run -w server build
client:
needs: changes
# changes is skipped on tag pushes, hence !cancelled()
if: |
!cancelled() &&
(startsWith(github.ref, 'refs/tags/') || needs.changes.outputs.client == 'true')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 24
cache: npm
- run: npm ci -w client
- name: Lint
run: npm run -w client lint -- --max-warnings=0
- name: Build
run: npm run -w client build
- name: Install headless Chromium for Storybook tests
run: npx playwright install --with-deps --only-shell chromium
- name: Storybook tests
run: npm run -w client test:storybook
image:
needs: [server, client]
if: ${{ !failure() && !cancelled() && startsWith(github.ref, 'refs/tags/') }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check the tag matches package.json
run: |
version=$(node -p "require('./package.json').version")
if [ "${GITHUB_REF_NAME}" != "v${version}" ]; then
echo "tag ${GITHUB_REF_NAME} does not match package.json version ${version}"
exit 1
fi
echo "VERSION=${version}" >> "$GITHUB_ENV"
- name: Log in to the registry
env:
REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
OWNER: ${{ github.repository_owner }}
run: |
echo "IMAGE=${REGISTRY}/$(echo "${GITHUB_REPOSITORY}" | tr '[:upper:]' '[:lower:]')" >> "$GITHUB_ENV"
echo "$REGISTRY_TOKEN" | docker login "$REGISTRY" -u "$OWNER" --password-stdin
- name: Build
run: docker build --build-arg VERSION="${VERSION}" -t "${IMAGE}:${VERSION}" -t "${IMAGE}:latest" .
- name: Push
run: |
docker push "${IMAGE}:${VERSION}"
docker push "${IMAGE}:latest"
+22 -4
View File
@@ -1,6 +1,24 @@
/keys
/node_modules
/dist
# runtime
/data
server/data/
.env
/*.log
*.log
# dependencies
node_modules/
# build outputs
/dist
server/dist
client/dist
*storybook.log
storybook-static
tsconfig.tsbuildinfo
# organization
TODO.md
# IDE/editor
.vscode/
.idea/
.github/
+449
View File
@@ -0,0 +1,449 @@
# Changelog
All notable changes to this project will be documented in this file.
## 1.26.0 - 2026-10-08
Changes since 1.25.0:
### Added
- e2e test export for a chosen scenario version: `GET /api/v1/scenarios/:id/export-e2e` and the `export_e2e_test` MCP tool take an optional `version` (defaults to the latest), and the test project is built from that version's steps, name and timeout. The Export e2e test button in the UI exports the version being viewed.
### Changed
- Exported e2e test archives include the version in their filename (`<scenario name>-v<N>-e2e-test.zip`), and the version also appears in the generated package name and README heading.
## 1.25.0 - 2026-10-07
Changes since 1.24.4:
### Added
- Browser notifications for scenario runs: the UI shows "Run started / passed / failed: <scenario>" notifications for runs started from the UI, the REST API, MCP or the scheduler; clicking one opens the run. Turn them on with the bell button in the side panel footer (granting the permission from the browser's prompt or site settings works too). Notifications need a secure context (HTTPS or `localhost`).
- `GET /api/v1/scenarios/runs/events`: a server-sent events stream of run lifecycle events (`run.started`, `run.finished`) with a periodic `ping` heartbeat.
### Changed
- Runs lists refresh as soon as a run finishes while notifications are on.
## 1.24.4 - 2026-10-07
Changes since 1.24.3:
### Changed
- Exported scenario and snippet files include the exported version in their filename: `<scenario name>-v<N>.yaml` and `snippet-<alias>-v<N>.yaml`.
### Fixed
- `scripts/install.sh` reads prompts from the terminal, so `curl ... | bash` installs no longer consume the script's own lines as answers (it falls back to defaults when there is no terminal). It also checks that Docker, the compose plugin and the daemon work, and starts liqa with `docker compose up -d`, printing the manual start command if a check or the start fails.
## 1.24.3 - 2026-10-02
Changes since 1.24.2:
### Added
- `examples/` directory with ready-to-import example resources. The first one, `examples/self-test`, is a scenario that tests the liqa instance it runs on: it creates a temporary scenario through the REST API, runs it, checks the run and its page in the UI, and cleans up. It uses an environment, a credential, snippets and assertions.
### Changed
- CI builds and pushes the Docker image only when a `vX.Y.Z` release tag is pushed, not on every merge to `master`.
## 1.24.2 - 2026-10-02
Changes since 1.24.1:
### Added
- Large run log data blocks start collapsed behind a "Show data (size, lines)" toggle: data whose pretty-printed JSON is over `RUN_LOG_DATA_COLLAPSE_BYTES` (default 256) bytes or `RUN_LOG_DATA_COLLAPSE_LINES` (default 5) lines. An "Expand data" / "Collapse data" button next to the Logs heading opens or closes all of them.
- "Copy logs" button on the run page: copies the currently filtered logs to the clipboard as plain text, with every data block expanded.
- `GET /manifest.json`: public client configuration served by the server - the app name and version, and the run log data limits. The UI caches it in `localStorage` and revalidates it on page load and when the tab is refocused after a while.
### Changed
- The sidebar footer shows the server's version (from `/manifest.json`); its tooltip suggests reloading the page when it differs from the version the UI was built with.
- Run log data blocks are aligned with the context/message column instead of the level column.
## 1.24.1 - 2026-10-02
Changes since 1.24.0:
### Added
- `context.assert(fn, description, details?)`: optional `details` argument. On failure, the `assertion:fail` log entry stores `{ details, error }` as data (`error` is the exception message when `fn` threw), so large diagnostics such as a response body can stay out of the message. The exported e2e runtime accepts and prints it too.
- The "Step N passed" log entry carries the step's return value as data.
- File names in the run Artifacts and scenario Files tables link to the file content, opening it in a new tab (shown inline when the browser can display it).
### Changed
- For assertion failures, the "Step N failed" and "Snippet X failed" log entries name only the assertion (`Assertion failed: <description>`) instead of repeating the failure details. The step run's description keeps the full message.
- Log output shows elapsed time in whole seconds (`+14s`), matching the stored timestamp resolution.
## 1.24.0 - 2026-10-01
Changes since 1.23.0:
### Added
- Code reference in the UI: a (?) button next to the Code label on the step and snippet create/edit pages opens a modal documenting the script runtime - the globals (`context`, `expect`, `console`, and `args` in snippets) and every `context` member with examples, including pitfalls such as awaiting `getStepOutput()` and `assert()`, and `downloadFile()` not sending the browser's cookies.
### Changed
- `Modal` UI component: new `size="lg"` for long, document-like content. Dialogs are now capped to the viewport height and their body scrolls, instead of overflowing the screen.
## 1.23.0 - 2026-10-01
Changes since 1.22.2:
### Added
- Run log entries now carry a `context` (where the message was generated: `step:<N>`, `snippet:<alias>`, `assertion:pass`/`fail`, or `run`) and a `data` field: `context.log`/`warn`/`error` and `console.*` split their arguments so strings join into `message` while object/array arguments are kept separate as `data` (JSON), instead of being `JSON.stringify`'d into the message text.
- Added a `debug` log level (`context.debug()`, `console.debug()`), alongside `log`/`warn`/`error`.
- New `LogOutput` UI component: a terminal-style log viewer on the run detail page, color-coded by level, with an elapsed-time-since-start column, a context tag, and `data` rendered pretty-printed in a separate block below the message. The full log list is shown (no more pagination), capped to a scrollable block.
- Run log CSV/Markdown export (`GET /scenarios/:id/runs/:runId/export`) include the new `context` and `data` columns/blocks; the logs search (`?q=`) also matches `context`.
## 1.22.2 - 2026-10-01
Changes since 1.22.1:
### Added
- MIT license (`LICENSE`), declared in all `package.json` files and the README.
- The Docker image includes the license notices of everything it ships: `scripts/third-party-licenses.mjs` collects the license of every production dependency of the client and server, the Node.js license is added, and the result is served at `/licenses.txt`, linked as "Licenses" in the sidebar footer.
- OCI image labels for title, version, license and source; CI passes the version as the `VERSION` build arg.
### Fixed
- The Docker image keeps packages' `LICENSE.md`/`NOTICE.md` files, which the 1.22.1 slimming step deleted along with other Markdown files.
## 1.22.1 - 2026-10-01
Changes since 1.22.0:
### Changed
- The Docker image is about 20% smaller (1.09 GB → 876 MB on disk, 251 MB → 220 MB compressed). Production dependencies and Chromium are installed in a separate stage that drops files nothing loads at runtime (source maps, TypeScript sources and declarations, docs, TypeORM's browser build, better-sqlite3's C sources, Playwright's ffmpeg). The runtime image is `debian:bookworm-slim` with only the `node` binary, so it no longer contains `npm`, `npx`, `yarn` or `corepack`.
## 1.22.0 - 2026-10-01
Changes since 1.21.1:
### Added
- The Export Scenario dialog lists the snippets the scenario uses (including ones used only through other snippets), all checked by default. A selected snippet is exported once per version the scenario uses: the latest for `runSnippet("alias")`, plus each version pinned with `alias@N`. `GET /scenarios/:id/export` takes the new `snippetIds` query parameter for this.
- The Export Scenario dialog shows the scenario version next to its name and id.
## 1.21.1 - 2026-10-01
Changes since 1.21.0:
### Changed
- The credential page hides the credential data when it opens; a Reveal button shows it and Hide hides it again. The data is not rendered on the page until revealed.
### Added
- A `RevealableCodeBlock` UI component (a CodeBlock that starts hidden behind a Reveal/Hide button), with a Storybook story.
## 1.21.0 - 2026-10-01
Changes since 1.20.2:
### Added
- UUID badges show a small colored circle in front of the short id. Its color comes from the first 6 hex digits of the UUID, so the same id always gets the same color, and its border uses the badge text color to stay visible in both themes.
- UUID badges get lighter on hover to show they can be clicked.
- `Badge` accepts an optional `className`.
- A Storybook "Colors" story for UuidBadge with six sample ids and a button to randomize them.
## 1.20.2 - 2026-09-30
Changes since 1.20.1:
### Fixed
- Text contrast now meets WCAG AA (4.5:1) in both themes:
- the "Live" refresh label and the table sort icon use a new `--color-primary-text` token (dark lime in the light theme) instead of the light lime brand color;
- the idle refresh label is no longer dimmed with opacity;
- the light theme's danger button is a little darker, and the dark theme's danger hover is lighter so its dark text stays readable;
- syntax highlighting colors are defined per theme (`--hl-*` tokens), darker in the light theme;
- muted text is slightly darker in the light theme.
### Added
- A Storybook "Accessibility / Contrast" page that measures the contrast of the most contrast-prone components in both themes.
- Storybook accessibility checks now fail the tests on violations (`a11y.test: 'error'`). The Colors story shows each token's current value per theme and includes the syntax colors.
## 1.20.1 - 2026-09-30
Changes since 1.20.0:
### Added
- Storybook stories for AutoRefreshIndicator, CodeBlock, CodeEditor, MarkdownContent, Modal, Notification, Search, Textarea, Toast and UuidBadge, with interaction tests where the component has behavior. The DescriptionList story covers all four layouts.
### Changed
- Updated all client and server dependencies to the latest versions within their ranges, including React 19.3, Storybook 10.6, NestJS 11.2, TypeORM 0.3.31 and Playwright 1.63 (the Docker image now ships HeadlessChrome 153).
- The Storybook tests are part of the pre-commit checks.
### Fixed
- Code flagged by the stricter React hooks lint rules: the runs list no longer writes refs during render, and the scenario list, scenario files and sessions list no longer set state synchronously inside effects.
## 1.20.0 - 2026-09-30
Changes since 1.19.3:
### Added
- Database migrations: the SQLite schema is now managed by TypeORM migrations (`server/src/database/migrations/`) instead of `synchronize`. The Docker container applies pending migrations before starting the server, and the server refuses to start while migrations are pending.
- `npm -w server run migration:run`, `migration:show` and `migration:generate` scripts; the workflow for schema changes is described in `docs/development.md`.
- A test that fails when an entity changes without a matching migration.
### Changed
- Databases created before migrations (by `synchronize`) are adopted automatically: the initial migration is recorded as applied without changing them.
- Tests now build their database from the migrations instead of `synchronize`.
### Fixed
- Startup failures were logged but the process exited with code 0; they now exit with code 1.
## 1.19.3 - 2026-09-30
Changes since 1.19.2:
### Changed
- The Docker image runs with `NODE_ENV=production`.
- The origins allowed to call the API cross-origin depend on `NODE_ENV`: the Vite dev server (`http://localhost:5173`, `http://127.0.0.1:5173`) in development, the compose port (`http://localhost:13000`, `http://127.0.0.1:13000`) in production. The new `CORS_ORIGINS` setting (comma separated) overrides both. A `NODE_ENV=development` in `.env` overrides the image's production mode.
- `.env` is optional: compose loads it only when it exists, and every setting in `.env.example` is commented out and shows its default.
### Removed
- The unused `KEYS_DIR` setting and the `./keys` mount in `compose.yaml`.
## 1.19.2 - 2026-09-30
Changes since 1.19.1:
### Fixed
- Running a scenario from its detail page could preselect the first environment in the list instead of the scenario's default environment, depending on whether the environment list or the scenario loaded first. The default environment is now chosen when the run modal opens.
- Made the run status filter test deterministic; it could fail when the scheduler picked up the test's pending run mid-test.
## 1.19.1 - 2026-09-30
Changes since 1.19.0:
### Changed
- Upgraded to Node.js 24: the Docker image is based on `node:24-slim`, and the root `package.json` declares `"engines": { "node": ">=24" }`.
- The server reads the app name and version (startup log, Swagger, MCP server info, `APP_NAME`/`APP_VERSION`) from the workspace root `package.json`. Previously local runs reported the server workspace's own `liqa-server` / `1.0.0`; the server workspace no longer has a version.
### Fixed
- Tests using a local HTTP server bind to `127.0.0.1` instead of `localhost`, which could resolve to an unreachable `::1` inside Docker containers.
## 1.19.0 - 2026-09-30
Changes since 1.18.0:
### Changed
- **Breaking (deployment):** the whole application now runs from a single image and container. The server serves the built client itself (new `CLIENT_DIR` setting, set by the image) next to the API, MCP and Swagger, so the UI moved from http://localhost:13001 to **http://localhost:13000**. The root `Dockerfile` replaces `server/Dockerfile`, `client/Dockerfile` and `client/nginx.conf`, and `compose.yaml` has a single `liqa` service. When upgrading, run `docker compose up -d --build --remove-orphans` to remove the old `server` and `client` containers.
- The image uses Playwright's headless-only Chromium build (`chromium-headless-shell`, always matching the installed Playwright version) with only the libraries it needs, instead of Debian's desktop `chromium` package. Fonts are now DejaVu and Liberation (metric-compatible with Arial/Times) instead of Noto. Together with clearing the npm cache, this shrinks the image from 1.76 GB to 1.07 GB.
## 1.18.0 - 2026-09-30
Changes since 1.17.0:
### Added
- Added a central import: `POST /import`, an Import page in the UI, and the `import_yaml` MCP tool. It takes YAML made of `---`-separated documents, each holding one exported item or a list of items (JSON is accepted too), with any mix of environments, credentials, snippets and scenarios. All items are validated before anything is imported, and they are imported in dependency order (environments, credentials, snippets, scenarios), so a scenario can reference an environment or credential from the same file.
### Changed
- The Import buttons on the scenario, snippet, credential and environment list pages use the central import. When the file holds exactly one item of the page's kind, that item is opened; otherwise the Import page shows everything that was imported.
### Fixed
- Scenario exports that included the environment or credentials were not valid YAML (all entities were written into one document). Each entity is now a separate `---` document.
## 1.17.0 - 2026-09-30
Changes since 1.16.1:
### Added
- Files can be deleted from a run: a delete button (with confirmation) in the Files section of the run detail page, `DELETE /scenarios/:id/runs/:runId/files/:fileId`, and the `delete_run_file` MCP tool. The stored file is removed once no scenario or run references it.
## 1.16.1 - 2026-09-30
Changes since 1.16.0:
### Changed
- Playwright traces are now off by default (`PLAYWRIGHT_TRACE_MODE` defaults to `off`), since a trace often reaches ~10 MB per run. Traces can still be enabled per run in the run modal, via `traceMode` in `POST /scenarios/:id/run`, or for all runs by setting `PLAYWRIGHT_TRACE_MODE`.
## 1.16.0 - 2026-09-30
Changes since 1.15.0:
### Added
- Scenarios and snippets are now versioned, starting at version 1. A scenario's version goes up when its name, description, default environment, timeout or steps change; a snippet's when its alias, title, description or code changes. Saving without changes does not create a new version. Credential assignments and scenario files are not versioned.
- Each run records the scenario version it runs. The run modal has a version picker (latest by default), `POST /scenarios/:id/run` and the `run_scenario` MCP tool accept an optional `version`, and "Repeat run" reuses the run's version.
- `context.runSnippet("alias@N")` pins version N of a snippet; `runSnippet("alias")` keeps using the latest. The scenario page's "Used Snippets" section shows which snippets are pinned.
- Version numbers are shown on the scenario, snippet and run pages and in the scenario and run lists.
- Added `GET /scenarios/:id/versions[/:version]` and `GET /snippets/:id/versions[/:version]`, and the `list_scenario_versions`, `get_scenario_version`, `list_snippet_versions` and `get_snippet_version` MCP tools.
- Scenario and snippet exports accept `?version=N` (the `export_scenario` MCP tool takes `version`).
### Changed
- **Breaking:** scenario and snippet exports now include `version`, and imports require it. An import restores that exact version by id + version: an existing version is left untouched, and a new one is stored under its number and becomes the latest when it is higher than the current latest. Export files from earlier releases need a `version` field added before they can be imported.
- Scenario exports now include scenario and step timeouts.
- Runs keep their own copy of the steps they were created with. Editing or deleting a step no longer changes past runs, and deleting a step no longer deletes its results from past runs. Existing run steps are backfilled from the current steps on startup.
## 1.15.0 - 2026-09-30
Changes since 1.14.0:
### Added
- Scenario runs now record a Playwright trace (screenshots and DOM snapshots) and upload it to the run's files as `trace.zip` when the run finishes. Open it with `npx playwright show-trace trace.zip` or at https://trace.playwright.dev.
- Added the `PLAYWRIGHT_TRACE_MODE` setting (`on` (default), `retain-on-failure`, or `off`) that controls which traces are kept.
- Added a "Playwright trace" option to the run modal to override the trace mode for a single run. It defaults to the server's `PLAYWRIGHT_TRACE_MODE`, served by the new `GET /scenarios/run-defaults` endpoint.
- `POST /scenarios/:id/run` and the `run_scenario` MCP tool accept an optional `traceMode`. The trace mode is stored on the run, shown on the run detail page, and reused by "Repeat run".
### Changed
- The run modals on the scenario list and scenario detail pages now share one component.
- `server/data/` is now git-ignored.
## 1.14.0 - 2026-09-30
Changes since 1.13.0:
### Added
- Added a "Repeat run" button on the scenario run detail page that starts a new run of the same scenario with the same environment and "save session" setting, then navigates to it. The button is disabled when the run's environment has since been deleted.
## 1.13.0 - 2026-09-30
Changes since 1.12.0:
### Added
- Added credential CRUD tools to the MCP server: `list_credentials`, `get_credential`, `create_credential`, `update_credential`, and `delete_credential`. Combined with the existing `add_scenario_credential` tool, credentials can now be created and attached to scenarios entirely via MCP.
## 1.12.0 - 2026-09-16
Changes since 1.11.0:
### Added
- When a scenario or snippet step fails, a full-page screenshot and the current page HTML are captured and uploaded as run artifacts, so failures can be diagnosed from the run's file list.
## 1.11.0 - 2026-09-15
Changes since 1.10.1:
### Added
- Added export of a scenario as a standalone, plug-and-play Playwright e2e test project (zip archive with `package.json`, `playwright.config.ts`, `test.spec.ts`, `README.md`, `.env`, `credentials.json`, `snippets/*.js`, and any attached scenario files) that runs entirely independently of the liqa backend. Available as a "Export e2e test" button on the scenario detail page, `GET /scenarios/:id/export-e2e`, and the `export_e2e_test` MCP tool.
- The exported test only bundles the credentials, snippets, and attached files actually referenced (directly or transitively) by the scenario's steps.
- Added a "Used Snippets" section on the scenario detail page listing the snippets referenced by the scenario's steps, linking to each snippet's detail page. Backed by `GET /scenarios/:id/used-snippets`.
## 1.10.1 - 2026-09-15
Changes since 1.10.0:
### Added
- `context.runSnippet()` now logs "Snippet started"/"finished"/"failed" entries, matching the automatic step start/pass/fail logging.
### Changed
- Reworked the Markdown log export format: each log entry is now its own `## [level] timestamp` section with the message as its body, instead of a single large table.
### Fixed
- Run logs could persist out of call order (e.g. a snippet's "started" log appearing after its "finished" log) because writes were fire-and-forget and raced against each other. Log entries now carry a per-run sequence number assigned in call order, and queries/exports sort by it.
## 1.10.0 - 2026-09-15
Changes since 1.9.1:
### Added
- Added a "Download logs" button on the scenario run detail page: opens a modal to choose Markdown (default) or CSV, then downloads the run's logs in that format.
- Added `GET /scenarios/:id/run/:runId/logs/export?format=csv|md` backend endpoint to export a run's logs.
## 1.9.1 - 2026-09-15
Changes since 1.9.0:
### Added
- Scenario run logs now include an automatic entry when a step starts and when it finishes (pass or fail), so step boundaries are visible in run logs even for steps that don't call `context.log`/`context.assert` themselves.
## 1.9.0 - 2026-09-15
Changes since 1.8.0:
### Added
- Added `context.assert(fn, description)` for scenario/snippet script steps: runs the given function, requires it to return `true`, logs the outcome (`log` on success, `error` on failure or exception), and throws to stop the step on failure.
### Changed
- Documented `context.assert` in `docs/scenario.md`.
## 1.8.0 - 2026-09-15
Changes since 1.7.1:
### Added
- `context.downloadFile()` now accepts `data:` URIs, so scenario steps can save in-script generated content (e.g. a credential JWT) as a run artifact without a network fetch.
### Changed
- Documented the full scenario step `context` file API (`getScenarioFiles`, `downloadFile`) in `docs/scenario.md`.
## 1.7.1 - 2026-04-21
Changes since 1.7.0:
### Added
- Added MCP tools to upload, list, and fetch scenario files using base64 content payloads.
- Added MCP tools to list run artifacts and fetch run artifact content with metadata.
### Changed
- Documented MCP binary content handling for scenario files and run artifacts.
## 1.7.0 - 2026-04-21
Changes since 1.6.1:
### Added
- Added scenario file storage and run artifact support on the backend.
- Added file management UI for scenarios and run details, including artifact lists.
- Added snippet CRUD tools to the MCP server.
### Changed
- Added dynamic page titles based on the active client content.
- Extended the scenarios list to show the latest run status and timestamp.
### Fixed
- Exposed file expiry metadata in scenario and run file responses.
- Disabled expired download actions in the UI while keeping the action visible.
+75
View File
@@ -0,0 +1,75 @@
# liqa
liqa is a browser automation and QA service for web applications. It stores **scenarios** (ordered Playwright steps), **snippets** (reusable code run via `context.runSnippet`), **environments**, **credentials** and **sessions**, and runs scenarios in headless Chromium. Scenarios and snippets are versioned; each run records the scenario version it executed.
It is an npm workspace with two packages:
- `server/` - NestJS API + scheduler + MCP server, SQLite via TypeORM; the schema is managed by migrations in `server/src/database/migrations/` (see "Database migrations" in `docs/development.md`). Any entity change needs a generated migration - `test/migrations.spec.ts` fails otherwise. REST API under `/api/v1`, Swagger UI at `/docs`, MCP at `/mcp`, health at `/health`, public client configuration at `/manifest.json`.
- `client/` - React 19 + Vite SPA (i18n strings in `client/src/i18n/locales/en.json`).
## Docs
- [README.md](README.md) - overview
- [docs/architecture.md](docs/architecture.md) - services and modules
- [docs/development.md](docs/development.md) - local setup, running, testing, Docker
- [docs/scenario.md](docs/scenario.md) - scenario execution, script `context` API, versioning, export/import, Playwright traces
- [docs/mcp.md](docs/mcp.md) - MCP tool reference
- [examples/](examples/README.md) - ready-to-import example resources (YAML); `server/test/examples.spec.ts` imports each file, so keep them in sync with the import format
- [CHANGELOG.md](CHANGELOG.md) - release notes per version
- [Dockerfile](Dockerfile) - single image: builds client and server, runtime serves both
- [.env.example](.env.example) - all configuration variables (validated in `server/src/config/app.config.ts`)
## Default deployment (docker compose)
`compose.yaml` at the repo root runs a single `liqa` container, built from the root `Dockerfile`, at http://localhost:13000. The server serves everything: the UI at `/` (the built client, via `CLIENT_DIR`), the REST API at `/api/v1`, MCP at `/mcp`, Swagger at `/docs`. It reads `.env` if present (optional - every setting has a default) and mounts `./data` (SQLite DB `data/liqa.db` + stored files).
Rebuild and restart: `docker compose up -d --build`. Check with `docker compose ps`, `curl localhost:13000/health` and `docker compose logs liqa`.
The live database is `data/liqa.db`. The container applies pending migrations before starting the server, so back it up before deploying a release with new migrations.
## Branching
Never commit directly to `master` when implementing a feature, chore or bug fix: create a separate branch for the work first, forked from `master`. These commits don't change the version or `CHANGELOG.md`; the branch is merged back to `master` through a pull request. Only release commits (see "Releasing a new version") are made on `master`.
Never add a `Co-Authored-By` trailer to commit messages. Don't put issue references like `Closes #12` in commit messages either; they belong only in the pull request description.
When committing on a work branch, also update the docs affected by the change (`docs/*.md`, `README.md`, `.env.example`, MCP tool descriptions) in the same branch.
## Code quality
Before committing, run and pass all of these (and report the results):
```bash
# server
cd server && npm run lint && npx tsc --noEmit -p tsconfig.json && npm test && npm run build
# client
cd client && npm run lint && npm run build && npm run test:storybook
```
- Lint must stay clean in both packages (no errors, no warnings).
- `test:storybook` runs every story in `client/.storybook/stories/` in headless Chromium (needs `npx playwright install --only-shell chromium` once, and again after Playwright updates). Add or update a story when adding or changing a `client/src/ui/` component.
- Don't run prettier over whole existing files; several aren't prettier-clean and it produces unrelated diffs. Format only new files or the lines you changed.
- Server tests use an in-memory DB, a Playwright mock (`server/test/__mocks__/playwright.ts`), and a temporary files directory per test app (see `server/test/app.harness.ts`).
- Import Node.js built-in modules with the `node:` prefix (`node:fs`, `node:path`, `node:crypto`, ...).
## Releasing a new version
A release is cut on `master` after one or more work branches have been merged (their pull request checks are already green). CI builds and pushes the Docker image only when a `vX.Y.Z` tag is pushed, not on merges.
When asked to release:
1. Make sure you're on an up-to-date, clean `master` (`git switch master && git pull`), and collect the changes since the last release: `git log --oneline "$(git describe --tags --abbrev=0)"..HEAD`.
2. **Ask which version to bump** - major, minor or patch - and propose a sensible default based on those changes: patch for fixes and small behavior/default tweaks, minor for new features, major for breaking changes (e.g. changed API or export/import formats that old clients or files can't use).
3. Bump `version` in the root `package.json` and in both places at the top of `package-lock.json` (the root entry and `packages[""]`). `server/package.json` and `client/package.json` keep their own versions; don't bump them.
4. Add a `## <version> - <YYYY-MM-DD>` entry at the top of `CHANGELOG.md` ("Changes since <previous version>:", then `### Added` / `### Changed` / `### Fixed`). Mark breaking changes with **Breaking:**.
5. Commit only these release changes on `master`. Build the commit message with the `/git-commit` skill if it is available, following its format and rules. Otherwise use a conventional commit message (`type(scope): subject`, then a bullet list body). Either way, put the version bump in the body as a bullet (e.g. `- bump version to <version>`), not in the subject line. This overrides the skill's rule of putting versions in the subject.
6. **Tag the release commit** with an annotated tag `v<version>` whose message is that version's `CHANGELOG.md` entry, verbatim (from its `## <version>` heading up to the next version's heading). `--cleanup=whitespace` is required: the default cleanup strips lines starting with `#`, which would drop the entry's headings:
```bash
v=<version>
awk -v v="$v" 'index($0, "## " v " ") == 1 {p = 1; print; next} p && /^## / {exit} p' CHANGELOG.md \
| git tag -a "v$v" --cleanup=whitespace -F -
```
7. **Ask the user before pushing**, then push the commit and the tag together with `git push --follow-tags` (it also pushes annotated tags). The tag push triggers the image build; it fails if the tag doesn't match the `package.json` version.
8. **Ask the user whether to rebuild and restart the docker compose containers** (`docker compose up -d --build`); don't do it without confirmation.
+137 -19
View File
@@ -1,39 +1,157 @@
# ── Build stage ──────────────────────────────────────────────────────────────
FROM node:22-slim AS builder
# Single image serving the whole application: the NestJS server (API, MCP,
# scheduler) also serves the built client, so one container is enough.
# ── Client build ──────────────────────────────────────────────────────────────
FROM node:24-slim AS client-build
WORKDIR /app
# Root lockfile + workspace manifest so npm ci can resolve the full graph
COPY package*.json ./
COPY client/package.json ./client/
RUN npm ci -w client
COPY client ./client
RUN npm run -w client build
# ── Server build ──────────────────────────────────────────────────────────────
FROM node:24-slim AS server-build
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY server/package.json ./server/
RUN npm ci -w server
COPY nest-cli.json tsconfig*.json ./
COPY src ./src
RUN npm run build
COPY server/nest-cli.json ./server/
COPY server/tsconfig*.json ./server/
COPY server/src ./server/src
RUN npm run -w server build
# ── Runtime stage ─────────────────────────────────────────────────────────────
FROM node:22-slim AS runtime
# ── Runtime dependencies ──────────────────────────────────────────────────────
FROM node:24-slim AS runtime-deps
# Playwright / Chromium system dependencies
WORKDIR /app
COPY package*.json ./
COPY server/package.json ./server/
# Production dependencies and Playwright's headless-only Chromium build,
# matching the installed Playwright version. All browser launches are
# headless, so the full desktop Chromium (GTK, Mesa/LLVM, icon themes) isn't
# needed, and neither is ffmpeg (only used for video recording).
#
# Then drop what nothing loads at runtime: source maps, TypeScript sources and
# declarations, docs (but not license files), TypeORM's browser build and
# better-sqlite3's C sources (the addon is already compiled).
ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright
RUN npm ci --omit=dev -w server \
&& npx playwright install --only-shell chromium \
&& rm -rf /ms-playwright/ffmpeg-* \
&& find node_modules -type f \( \
-name '*.map' -o -name '*.ts' -o -name '*.mts' -o -name '*.cts' \
-o \( \( -iname '*.md' -o -iname '*.markdown' \) \
! -iname 'licen[cs]e*' ! -iname 'notice*' ! -iname 'copying*' \) \
\) -delete \
&& rm -rf node_modules/typeorm/browser \
node_modules/better-sqlite3/deps \
node_modules/better-sqlite3/src
# ── License notices ───────────────────────────────────────────────────────────
# One file with the project's LICENSE and the license of everything the image
# ships: the production dependencies of both workspaces (the client's are
# bundled into its build, so their license files aren't in the image
# otherwise) and the Node.js binary, whose LICENSE the node image doesn't
# include.
FROM node:24-slim AS licenses
WORKDIR /app
COPY package*.json LICENSE ./
COPY client/package.json ./client/
COPY server/package.json ./server/
COPY scripts/third-party-licenses.mjs ./scripts/
RUN npm ci --omit=dev --ignore-scripts \
&& node scripts/third-party-licenses.mjs > licenses.txt \
&& node -e ' \
const url = `https://raw.githubusercontent.com/nodejs/node/v${process.versions.node}/LICENSE`; \
fetch(url).then(async (r) => { \
if (!r.ok) throw new Error(`${url}: ${r.status}`); \
const rule = "-".repeat(79); \
process.stdout.write(`\n${rule}\n\nnode@${process.versions.node}\nLicense: MIT\n\n${(await r.text()).trim()}\n`); \
}).catch((e) => { console.error(e.message); process.exit(1); });' >> licenses.txt
# ── Runtime ───────────────────────────────────────────────────────────────────
# Plain Debian with just the node binary: npm, yarn, corepack and the C
# headers that come with the node image aren't needed to run the app.
FROM debian:bookworm-slim AS runtime
# Set by CI from the root package.json version
ARG VERSION=dev
LABEL org.opencontainers.image.title="liqa" \
org.opencontainers.image.version="${VERSION}" \
org.opencontainers.image.licenses="MIT" \
org.opencontainers.image.source="https://git.hq.ars9.space/ars9/liqa"
# Runtime only: in the build stages it would make npm ci skip devDependencies
ENV NODE_ENV=production
# Shared libraries chrome-headless-shell links against (from `ldd`), plus
# fontconfig and basic fonts for text rendering. Playwright's `--with-deps`
# would also pull in xvfb (with Mesa/LLVM) and extra font packages, which
# headless-only use doesn't need.
RUN apt-get update && apt-get install -y --no-install-recommends \
chromium \
fonts-noto \
ca-certificates \
fontconfig \
fonts-dejavu-core \
fonts-liberation \
libasound2 \
libatk-bridge2.0-0 \
libatk1.0-0 \
libatspi2.0-0 \
libdbus-1-3 \
libexpat1 \
libgbm1 \
libglib2.0-0 \
libnspr4 \
libnss3 \
libx11-6 \
libxcb1 \
libxcomposite1 \
libxdamage1 \
libxext6 \
libxfixes3 \
libxkbcommon0 \
libxrandr2 \
&& rm -rf /var/lib/apt/lists/*
# Tell Playwright to use the system Chromium instead of downloading its own
ENV PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
ENV PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH=/usr/bin/chromium
COPY --from=runtime-deps /usr/local/bin/node /usr/local/bin/node
WORKDIR /app
COPY package*.json ./
RUN npm ci --omit=dev
COPY server/package.json ./server/
COPY --from=builder /app/dist ./dist
ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright
COPY --from=runtime-deps /ms-playwright /ms-playwright
COPY --from=runtime-deps /app/node_modules ./node_modules
# Runtime directories (keys and SQLite DB mounted via volumes)
RUN mkdir -p data keys
COPY --from=server-build /app/server/dist ./dist
COPY --from=client-build /app/client/dist ./client
# The project's license, and every shipped component's license notices (also
# served by the app at /licenses.txt)
COPY LICENSE ./
COPY --from=licenses /app/licenses.txt ./client/licenses.txt
# Serve the built client at / (see server/src/common/client-static.ts)
ENV CLIENT_DIR=client
# Runtime directory (SQLite DB and stored files, mounted as a volume)
RUN mkdir -p data
EXPOSE 3000
CMD ["node", "dist/main"]
# Apply pending database migrations, then start the server (which refuses to
# start while migrations are pending)
CMD ["sh", "-c", "node dist/database/migrate && exec node dist/main"]
+21
View File
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2026 Andrii Arsenin
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+48 -29
View File
@@ -1,46 +1,65 @@
# liquio-qa-bot
# liqa
A headless QA automation service for Liquio environments. Exposes an **MCP (Model Context Protocol)** server that lets AI agents define, run, and monitor multi-step browser test scenarios using [Playwright](https://playwright.dev/).
A browser automation and QA service for web applications. It stores multi-step browser scenarios, runs them with [Playwright](https://playwright.dev/) in headless Chromium, and keeps their results, logs and artifacts. Scenarios are managed from a web UI, a REST API, or an **MCP (Model Context Protocol)** server that lets AI agents define, run and debug them.
---
## Quick start
```bash
docker compose up -d --build
```
No configuration is needed: every setting has a default. To override one, copy `.env.example` to `.env` and uncomment it.
Authentication is **disabled by default**. To enable operator-managed accounts, set `AUTH_ENABLED=true` and provide a private `AUTH_JWT_SECRET`; then rebuild/restart the service and provision an account with the CLI. See [operator authentication](docs/development.md#operator-account-commands) for setup and browser/API usage. Existing deployments remain unauthenticated until explicitly enabled.
Everything is served from one container at **http://localhost:13000**: the UI at `/`, the REST API at `/api/v1`, MCP at `/mcp`, Swagger at `/docs`. Data is kept in `./data/`.
To see it work, import and run the [self-test example](examples/self-test/): a scenario that tests liqa itself using an environment, a credential and snippets.
---
## Installation
To install liqa from the published image, without cloning this repo:
```bash
curl -fsSL https://git.hq.ars9.space/ars9/liqa/raw/branch/master/scripts/install.sh | bash
```
This asks for an install directory, a port and a version (latest by default), then writes a `compose.yaml` and a `data/` directory there. Start it with `docker compose up -d` in that directory.
---
## Overview
The bot manages four core concepts:
| Concept | Description |
|---|---|
| **Environment** | A named set of URLs for a deployment target (e.g. `liquio-diia-stg`) |
| **Key** | A JSON descriptor in `keys/` that points to an EDS key file + password |
| **Session** | Saved browser state (cookies + localStorage) produced by a login |
| **Scenario** | An ordered list of steps that run in sequence against a shared browser instance |
| **Scenario** | An ordered list of steps (async Playwright JS) that run in sequence in one browser. Versioned: every content change creates a new version |
| **Run** | One execution of a scenario version in an environment, with per-step status and output, logs, and run files (downloads, failure screenshots, Playwright traces) |
| **Snippet** | Reusable, versioned code called from steps with `context.runSnippet("alias")` (or `"alias@N"` for a specific version) |
| **Environment** | A named set of key/value settings for a deployment target (URLs etc.), read with `context.getEnv(key)` |
| **Credential** | Secret data (e.g. a key file and password), assigned to scenarios under an alias and read with `context.getCredential(alias)` |
| **Session** | Saved browser state (cookies + localStorage), e.g. kept from a run with "save session" |
Scenarios, snippets, environments and credentials can be exported as YAML and imported back (one file may hold several of them).
---
## Architecture
## Documentation
See [docs/architecture.md](docs/architecture.md).
- [docs/architecture.md](docs/architecture.md) - components, data model, client
- [docs/scenario.md](docs/scenario.md) - runs, the script `context` API, versioning, import/export, Playwright traces
- [docs/mcp.md](docs/mcp.md) - MCP tool reference
- [docs/development.md](docs/development.md) - setup, configuration, running, testing, linting, Docker
- [examples/](examples/) - ready-to-import example scenarios
- [CHANGELOG.md](CHANGELOG.md) - release notes
---
## Key descriptors
## License
See [docs/key-descriptors.md](docs/key-descriptors.md).
[MIT](LICENSE) © 2026 Andrii Arsenin
---
## MCP tools
See [docs/mcp.md](docs/mcp.md).
---
## Scenario execution
See [docs/scenario.md](docs/scenario.md).
---
## Development
See [docs/development.md](docs/development.md) for setup, running, testing, linting, and Docker instructions.
Third-party packages keep their own licenses. The Docker image includes all their notices, and the app serves them at `/licenses.txt` (linked as "Licenses" in the sidebar footer). See [docs/development.md](docs/development.md#licenses).
+8
View File
@@ -0,0 +1,8 @@
node_modules
client/node_modules
client/dist
server
data
keys
.env
*.log
+3
View File
@@ -0,0 +1,3 @@
# Frontend API base URL.
# Example for local Docker server: backend container is exposed on localhost:13000.
VITE_API_URL=http://localhost:13000/api/v1
+5
View File
@@ -0,0 +1,5 @@
dist/
storybook-static/
node_modules/
*.css
*.json
+8
View File
@@ -0,0 +1,8 @@
{
"semi": true,
"singleQuote": true,
"trailingComma": "all",
"printWidth": 100,
"tabWidth": 2,
"arrowParens": "always"
}
+23
View File
@@ -0,0 +1,23 @@
import type { StorybookConfig } from '@storybook/react-vite';
import { dirname } from 'path';
import { fileURLToPath } from 'url';
/**
* This function is used to resolve the absolute path of a package.
* It is needed in projects that use Yarn PnP or are set up within a monorepo.
*/
function getAbsolutePath(value: string) {
return dirname(fileURLToPath(import.meta.resolve(`${value}/package.json`)));
}
const config: StorybookConfig = {
stories: ['./stories/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
addons: [
getAbsolutePath('@storybook/addon-vitest'),
getAbsolutePath('@storybook/addon-a11y'),
getAbsolutePath('@storybook/addon-docs'),
],
framework: getAbsolutePath('@storybook/react-vite'),
};
export default config;
+46
View File
@@ -0,0 +1,46 @@
import React from 'react';
import type { Preview } from '@storybook/react-vite';
import '../src/ui/tokens.css';
const preview: Preview = {
globalTypes: {
theme: {
name: 'Theme',
description: 'Color theme',
defaultValue: 'light',
toolbar: {
icon: 'circlehollow',
items: [
{ value: 'light', icon: 'sun', title: 'Light' },
{ value: 'dark', icon: 'moon', title: 'Dark' },
],
dynamicTitle: true,
},
},
},
decorators: [
(Story, context) => {
const theme = (context.globals['theme'] as string) ?? 'light';
document.documentElement.setAttribute('data-theme', theme);
return (
<div style={{ background: 'var(--color-bg)', minHeight: '100vh', padding: 0 }}>
<Story />
</div>
);
},
],
parameters: {
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/i,
},
},
a11y: {
// Accessibility violations (e.g. color contrast) fail the story's test
test: 'error',
},
},
};
export default preview;
@@ -0,0 +1,28 @@
import '../../src/i18n';
import type { Meta, StoryObj } from '@storybook/react-vite';
import { expect, fn, userEvent, within } from 'storybook/test';
import { AuthStatusPage } from '../../src/pages/auth/AuthStatusPage';
const meta: Meta<typeof AuthStatusPage> = {
title: 'Authentication/Session status',
component: AuthStatusPage,
parameters: { layout: 'fullscreen' },
tags: ['autodocs'],
args: { onRetry: fn() },
};
export default meta;
type Story = StoryObj<typeof AuthStatusPage>;
export const Checking: Story = {};
export const SessionCheckFailure: Story = {
args: { failed: true },
play: async ({ canvasElement, args }) => {
const canvas = within(canvasElement);
await expect(canvas.getByRole('alert')).toHaveTextContent(
"Couldn't check your session. Try again.",
);
await userEvent.click(canvas.getByRole('button', { name: 'Retry' }));
await expect(args.onRetry).toHaveBeenCalledTimes(1);
},
};
@@ -0,0 +1,71 @@
import type { Meta, StoryObj } from '@storybook/react-vite';
import { expect } from 'storybook/test';
import { auth } from '../../src/api/client';
import { createRunEventSource } from '../../src/hooks/useRunNotifications';
function TransportExample() {
return <p>Browser auth uses HttpOnly cookies for API and run-event requests.</p>;
}
const meta: Meta<typeof TransportExample> = {
title: 'Authentication/Cookie transport',
component: TransportExample,
tags: ['autodocs'],
};
export default meta;
type Story = StoryObj<typeof TransportExample>;
export const CookieCredentials: Story = {
play: async () => {
const originalFetch = globalThis.fetch;
const localStorageLength = localStorage.length;
let requestInit: RequestInit | undefined;
globalThis.fetch = async (_input, init) => {
requestInit = init;
return new Response(
JSON.stringify({
user: {
id: 'synthetic-user-id',
username: 'synthetic-operator',
createdAt: '2026-01-01T00:00:00.000Z',
updatedAt: '2026-01-01T00:00:00.000Z',
},
}),
{ status: 200, headers: { 'Content-Type': 'application/json' } },
);
};
try {
const user = await auth.login('synthetic-operator', 'synthetic-password');
await expect(requestInit?.credentials).toBe('include');
await expect(user.username).toBe('synthetic-operator');
await expect(new Headers(requestInit?.headers).has('Authorization')).toBe(false);
await expect(localStorage.length).toBe(localStorageLength);
} finally {
globalThis.fetch = originalFetch;
}
},
};
export const EventStreamIncludesCookieCredentials: Story = {
play: async () => {
const previous = Object.getOwnPropertyDescriptor(globalThis, 'EventSource');
let options: EventSourceInit | undefined;
class StubEventSource {
constructor(_url: string | URL, init?: EventSourceInit) {
options = init;
}
close() {}
}
Object.defineProperty(globalThis, 'EventSource', {
configurable: true,
value: StubEventSource,
});
try {
createRunEventSource().close();
await expect(options?.withCredentials).toBe(true);
} finally {
if (previous) Object.defineProperty(globalThis, 'EventSource', previous);
else Reflect.deleteProperty(globalThis, 'EventSource');
}
},
};
@@ -0,0 +1,25 @@
import type { Meta, StoryObj } from '@storybook/react-vite';
import { expect, fn, userEvent, within } from 'storybook/test';
import { AutoRefreshIndicator } from '../../src/ui/AutoRefreshIndicator/AutoRefreshIndicator';
const meta: Meta<typeof AutoRefreshIndicator> = {
title: 'UI/AutoRefreshIndicator',
component: AutoRefreshIndicator,
parameters: { layout: 'centered' },
tags: ['autodocs'],
args: { onClick: fn() },
};
export default meta;
type Story = StoryObj<typeof AutoRefreshIndicator>;
export const Active: Story = { args: { active: true, pulseKey: 1 } };
export const Idle: Story = { args: { active: false } };
export const Errored: Story = { args: { active: false, error: true } };
export const ClickToRefresh: Story = {
args: { active: false },
play: async ({ args, canvasElement }) => {
await userEvent.click(within(canvasElement).getByRole('button'));
await expect(args.onClick).toHaveBeenCalled();
},
};
@@ -0,0 +1,25 @@
import type { Meta, StoryObj } from '@storybook/react-vite';
import { Badge } from '../../src/ui/Badge/Badge';
const meta: Meta<typeof Badge> = {
title: 'UI/Badge',
component: Badge,
parameters: { layout: 'centered' },
tags: ['autodocs'],
argTypes: {
variant: {
control: 'select',
options: ['success', 'error', 'warning', 'info', 'neutral', 'running'],
},
dot: { control: 'boolean' },
},
};
export default meta;
type Story = StoryObj<typeof Badge>;
export const Success: Story = { args: { children: 'Passed', variant: 'success', dot: true } };
export const Error: Story = { args: { children: 'Failed', variant: 'error', dot: true } };
export const Warning: Story = { args: { children: 'Warning', variant: 'warning' } };
export const Info: Story = { args: { children: 'Info', variant: 'info' } };
export const Neutral: Story = { args: { children: 'Pending', variant: 'neutral' } };
export const Running: Story = { args: { children: 'Running', variant: 'running', dot: true } };
@@ -0,0 +1,45 @@
import type { Meta, StoryObj } from '@storybook/react-vite';
import { Breadcrumbs } from '../../src/ui/Breadcrumbs/Breadcrumbs';
const meta: Meta<typeof Breadcrumbs> = {
title: 'UI/Breadcrumbs',
component: Breadcrumbs,
parameters: { layout: 'centered' },
tags: ['autodocs'],
};
export default meta;
type Story = StoryObj<typeof Breadcrumbs>;
export const Default: Story = {
args: {
items: [{ label: 'Scenarios', href: '#' }, { label: 'Login flow' }],
},
};
export const Deep: Story = {
args: {
items: [
{ label: 'Home', href: '#' },
{ label: 'Scenarios', href: '#' },
{ label: 'Login flow', href: '#' },
{ label: 'Step 3' },
],
},
};
export const SingleItem: Story = {
args: {
items: [{ label: 'Dashboard' }],
},
};
export const CustomSeparator: Story = {
args: {
separator: '/',
items: [
{ label: 'Environments', href: '#' },
{ label: 'Staging', href: '#' },
{ label: 'Config' },
],
},
};
@@ -0,0 +1,26 @@
import type { Meta, StoryObj } from '@storybook/react-vite';
import { Button } from '../../src/ui/Button/Button';
const meta: Meta<typeof Button> = {
title: 'UI/Button',
component: Button,
parameters: { layout: 'centered' },
tags: ['autodocs'],
argTypes: {
variant: { control: 'select', options: ['primary', 'secondary', 'ghost', 'danger'] },
size: { control: 'select', options: ['sm', 'md', 'lg'] },
loading: { control: 'boolean' },
disabled: { control: 'boolean' },
},
};
export default meta;
type Story = StoryObj<typeof Button>;
export const Primary: Story = { args: { children: 'Button', variant: 'primary' } };
export const Secondary: Story = { args: { children: 'Button', variant: 'secondary' } };
export const Ghost: Story = { args: { children: 'Button', variant: 'ghost' } };
export const Danger: Story = { args: { children: 'Delete', variant: 'danger' } };
export const Small: Story = { args: { children: 'Small', size: 'sm' } };
export const Large: Story = { args: { children: 'Large', size: 'lg' } };
export const Loading: Story = { args: { children: 'Saving…', loading: true } };
export const Disabled: Story = { args: { children: 'Button', disabled: true } };
@@ -0,0 +1,85 @@
import React from 'react';
import type { Meta, StoryObj } from '@storybook/react-vite';
import { Card } from '../../src/ui/Card/Card';
import { Badge } from '../../src/ui/Badge/Badge';
import { Button } from '../../src/ui/Button/Button';
const meta: Meta<typeof Card> = {
title: 'UI/Card',
component: Card,
parameters: { layout: 'centered' },
tags: ['autodocs'],
decorators: [
(Story) => (
<div style={{ width: 360 }}>
<Story />
</div>
),
],
argTypes: {
padding: { control: 'select', options: ['sm', 'md', 'lg'] },
headerVariant: { control: 'select', options: ['primary', 'secondary'] },
},
};
export default meta;
type Story = StoryObj<typeof Card>;
export const Default: Story = {
args: { children: 'Card content goes here.', padding: 'md' },
};
export const WithPrimaryHeader: Story = {
args: {
header: 'Section Title',
headerVariant: 'primary',
children: 'Card content with a primary header.',
},
};
export const WithSecondaryHeader: Story = {
args: {
header: 'Section Title',
headerVariant: 'secondary',
children: 'Card content with a secondary header.',
},
};
export const WithFooter: Story = {
args: {
header: 'My Card',
headerVariant: 'primary',
children: 'Card body content.',
footer: 'Last updated 2 minutes ago',
},
};
export const ScenarioCard: Story = {
render: () => (
<Card>
<div
style={{
display: 'flex',
justifyContent: 'space-between',
alignItems: 'flex-start',
marginBottom: 8,
}}
>
<span style={{ fontWeight: 600, fontSize: 14 }}>Login flow</span>
<Badge variant="success" dot>
Passed
</Badge>
</div>
<p style={{ margin: '0 0 16px', fontSize: 13, color: 'var(--color-text-muted)' }}>
Last run 2 minutes ago · 4 steps
</p>
<div style={{ display: 'flex', gap: 8 }}>
<Button size="sm" variant="primary">
Run
</Button>
<Button size="sm" variant="ghost">
Edit
</Button>
</div>
</Card>
),
};
@@ -0,0 +1,33 @@
import type { Meta, StoryObj } from '@storybook/react-vite';
import { expect } from 'storybook/test';
import { CodeBlock } from '../../src/ui/CodeBlock/CodeBlock';
const meta: Meta<typeof CodeBlock> = {
title: 'UI/CodeBlock',
component: CodeBlock,
parameters: { layout: 'padded' },
tags: ['autodocs'],
};
export default meta;
type Story = StoryObj<typeof CodeBlock>;
export const JavaScript: Story = {
args: {
language: 'javascript',
code: "const url = context.getEnv('BASE_URL');\nawait context.page.goto(url);\nreturn await context.page.title();",
},
play: async ({ canvasElement }) => {
// Highlighting splits the code into many spans: check the whole text and
// that highlighting actually happened
const code = canvasElement.querySelector('code');
await expect(code).toHaveTextContent('await context.page.goto(url);');
await expect(code?.querySelector('.hljs-keyword')).not.toBeNull();
},
};
export const Json: Story = {
args: {
language: 'json',
code: JSON.stringify({ status: 'pass', output: { title: 'Dashboard' } }, null, 2),
},
};
@@ -0,0 +1,35 @@
import React, { useState } from 'react';
import type { Meta, StoryObj } from '@storybook/react-vite';
import { CodeEditor, type CodeEditorProps } from '../../src/ui/CodeEditor/CodeEditor';
// Monaco is loaded from a CDN at runtime, so these stories only check that the
// editor mounts; they have no interaction tests.
function ControlledEditor(
props: Omit<CodeEditorProps, 'value' | 'onChange'> & { initial: string },
) {
const { initial, ...rest } = props;
const [value, setValue] = useState(initial);
return <CodeEditor {...rest} value={value} onChange={setValue} />;
}
const meta: Meta<typeof ControlledEditor> = {
title: 'UI/CodeEditor',
component: ControlledEditor,
parameters: { layout: 'padded' },
tags: ['autodocs'],
};
export default meta;
type Story = StoryObj<typeof ControlledEditor>;
export const JavaScript: Story = {
args: {
language: 'javascript',
rows: 8,
initial:
"await context.page.goto(context.getEnv('BASE_URL'));\nreturn await context.page.title();",
},
};
export const WithError: Story = {
args: { language: 'javascript', rows: 4, error: true, initial: 'await context.page.goto(' },
};
@@ -0,0 +1,183 @@
import React, { useLayoutEffect, useRef, useState } from 'react';
import type { Meta, StoryObj } from '@storybook/react-vite';
const palette = [
{ name: 'Atlantis', token: '--color-primary', hex: '#9DD341', role: 'Primary / Action' },
{
name: 'Atlantis text',
token: '--color-primary-text',
hex: '#496904',
role: 'Primary as text / icon',
},
{ name: 'Outer Space', token: '--color-text', hex: '#2D3339', role: 'Text / Surface' },
{ name: 'Kimberly', token: '--color-text-muted', hex: '#634DBD', role: 'Muted text / Info' },
{ name: 'Powder Ash', token: '--color-border', hex: '#AFBFB9', role: 'Border / Neutral' },
];
const semanticColors = [
{ name: 'Success bg', token: '--color-success-bg', hex: '#EEF8D6' },
{ name: 'Success fg', token: '--color-success-fg', hex: '#3E6010' },
{ name: 'Error bg', token: '--color-error-bg', hex: '#FAEAEA' },
{ name: 'Error fg', token: '--color-error-fg', hex: '#8B2020' },
{ name: 'Warning bg', token: '--color-warning-bg', hex: '#FEF5E0' },
{ name: 'Warning fg', token: '--color-warning-fg', hex: '#7A4E00' },
{ name: 'Info bg', token: '--color-info-bg', hex: '#EEEDF6' },
{ name: 'Info fg', token: '--color-info-fg', hex: '#4A4270' },
{ name: 'Neutral bg', token: '--color-neutral-bg', hex: '#EDF1EF' },
{ name: 'Neutral fg', token: '--color-neutral-fg', hex: '#4D6059' },
{ name: 'Running bg', token: '--color-running-bg', hex: '#FEF9C3' },
{ name: 'Running fg', token: '--color-running-fg', hex: '#6B4A00' },
];
const syntaxColors = [
{ name: 'Comment', token: '--hl-comment', hex: '#4F6557' },
{ name: 'Keyword', token: '--hl-keyword', hex: '#764E99' },
{ name: 'String / title', token: '--hl-string', hex: '#4F6821' },
{ name: 'Number', token: '--hl-number', hex: '#895403' },
{ name: 'Function', token: '--hl-function', hex: '#056980' },
{ name: 'Variable / params', token: '--hl-variable', hex: '#815354' },
{ name: 'Property', token: '--hl-property', hex: '#1D6971' },
{ name: 'Meta', token: '--hl-meta', hex: '#615B7E' },
];
const surfaceColors = [
{ name: 'Background', token: '--color-bg', hex: '#E6EDEA' },
{ name: 'Background subtle', token: '--color-bg-subtle', hex: '#D8E2DE' },
{ name: 'Secondary', token: '--color-secondary', hex: '#EDF1EF' },
{ name: 'Secondary hover', token: '--color-secondary-hover', hex: '#DFE6E3' },
{ name: 'Danger', token: '--color-danger', hex: '#CE4546' },
{ name: 'Primary fg', token: '--color-primary-fg', hex: '#2D3339' },
];
function Swatch({
name,
token,
hex,
role,
}: {
name: string;
token: string;
hex: string;
role?: string;
}) {
// Show the token's current value (per theme) rather than a hard-coded copy
const ref = useRef<HTMLDivElement>(null);
const [value, setValue] = useState(hex);
useLayoutEffect(() => {
const read = () => {
if (!ref.current) return;
const resolved = getComputedStyle(ref.current).getPropertyValue(token).trim();
if (resolved) setValue(resolved.toUpperCase());
};
read();
// Re-read when the theme toolbar switches data-theme on <html>
const observer = new MutationObserver(read);
observer.observe(document.documentElement, {
attributes: true,
attributeFilter: ['data-theme'],
});
return () => observer.disconnect();
}, [token]);
return (
<div
ref={ref}
style={{
display: 'flex',
flexDirection: 'column',
overflow: 'hidden',
borderRadius: 8,
border: 'var(--border-width) solid var(--color-border)',
minWidth: 160,
flex: '1 1 160px',
maxWidth: 220,
}}
>
<div
style={{
background: `var(${token}, ${hex})`,
height: 80,
}}
/>
<div style={{ padding: '10px 12px', background: 'var(--color-bg)' }}>
<div style={{ fontWeight: 600, fontSize: 13, color: 'var(--color-text)', marginBottom: 2 }}>
{name}
</div>
{role && (
<div style={{ fontSize: 11, color: 'var(--color-text-muted)', marginBottom: 4 }}>
{role}
</div>
)}
<div style={{ fontSize: 11, fontFamily: 'monospace', color: 'var(--color-text-muted)' }}>
{value}
</div>
<div style={{ fontSize: 11, fontFamily: 'monospace', color: 'var(--color-text-muted)' }}>
{token}
</div>
</div>
</div>
);
}
function Section({ title, children }: { title: string; children: React.ReactNode }) {
return (
<div style={{ marginBottom: 40 }}>
<h2
style={{
fontFamily: 'var(--font-family)',
color: 'var(--color-text)',
fontSize: 14,
fontWeight: 600,
marginBottom: 16,
textTransform: 'uppercase',
letterSpacing: '0.08em',
}}
>
{title}
</h2>
<div style={{ display: 'flex', flexWrap: 'wrap', gap: 12 }}>{children}</div>
</div>
);
}
function ColorPalette() {
return (
<div style={{ padding: 32, fontFamily: 'var(--font-family)' }}>
<h1 style={{ color: 'var(--color-text)', fontSize: 22, fontWeight: 700, marginBottom: 8 }}>
Color Palette
</h1>
<p style={{ color: 'var(--color-text-muted)', fontSize: 14, marginBottom: 40 }}>
All colors are exposed as CSS custom properties on <code>:root</code> via{' '}
<code>tokens.css</code>.
</p>
<Section title="Brand">
{palette.map((c) => (
<Swatch key={c.token} {...c} />
))}
</Section>
<Section title="Semantic">
{semanticColors.map((c) => (
<Swatch key={c.token} {...c} />
))}
</Section>
<Section title="Surface & Action">
{surfaceColors.map((c) => (
<Swatch key={c.token} {...c} />
))}
</Section>
<Section title="Syntax highlighting">
{syntaxColors.map((c) => (
<Swatch key={c.token} {...c} />
))}
</Section>
</div>
);
}
const meta: Meta = {
title: 'Design Tokens/Colors',
parameters: { layout: 'fullscreen' },
};
export default meta;
type Story = StoryObj;
export const All: Story = { render: () => <ColorPalette /> };
@@ -0,0 +1,52 @@
import type { Meta, StoryObj } from '@storybook/react-vite';
import { Settings, Trash2, ExternalLink } from 'lucide-react';
import { Button } from '../../src/ui/Button/Button';
import { ContextMenu } from '../../src/ui/ContextMenu/ContextMenu';
const meta: Meta<typeof ContextMenu> = {
title: 'UI/ContextMenu',
component: ContextMenu,
parameters: { layout: 'centered' },
tags: ['autodocs'],
};
export default meta;
type Story = StoryObj<typeof ContextMenu>;
const trigger = (
<Button variant="ghost" size="sm" aria-label="Actions">
<Settings size={16} />
</Button>
);
export const Default: Story = {
args: {
trigger,
items: [
{ label: 'View details', icon: <ExternalLink size={14} />, onClick: () => {} },
{ label: 'Delete', icon: <Trash2 size={14} />, variant: 'danger', onClick: () => {} },
],
},
};
export const AlignLeft: Story = {
args: {
trigger,
align: 'left',
items: [
{ label: 'View details', icon: <ExternalLink size={14} />, onClick: () => {} },
{ label: 'Delete', icon: <Trash2 size={14} />, variant: 'danger', onClick: () => {} },
],
},
};
export const ManyItems: Story = {
args: {
trigger,
items: [
{ label: 'View details', icon: <ExternalLink size={14} />, onClick: () => {} },
{ label: 'Edit', icon: <Settings size={14} />, onClick: () => {} },
{ label: 'Duplicate', onClick: () => {} },
{ label: 'Delete', icon: <Trash2 size={14} />, variant: 'danger', onClick: () => {} },
],
},
};
@@ -0,0 +1,330 @@
import React, { useLayoutEffect, useRef, useState } from 'react';
import type { Meta, StoryObj } from '@storybook/react-vite';
import { AutoRefreshIndicator } from '../../src/ui/AutoRefreshIndicator/AutoRefreshIndicator';
import { Button } from '../../src/ui/Button/Button';
import { CodeBlock } from '../../src/ui/CodeBlock/CodeBlock';
/*
* Text contrast review page (WCAG AA: 4.5:1 for normal text, 3:1 for large
* text) for the components where contrast is easiest to get wrong: light
* brand colors used as text, dimmed labels, colored buttons and syntax
* highlighting. Every sample is the real component, shown in both themes, and
* the contrast of each piece of text is measured live from the rendered
* colors - so this page stays accurate as the design tokens change.
*/
// ── Contrast measurement ─────────────────────────────────────────────────────
type Rgba = [number, number, number, number];
function parseColor(value: string): Rgba {
const parts = value.match(/[\d.]+/g)?.map(Number) ?? [0, 0, 0];
return [parts[0], parts[1], parts[2], parts[3] ?? 1];
}
function luminance([r, g, b]: Rgba): number {
const channel = (c: number) => {
const s = c / 255;
return s <= 0.03928 ? s / 12.92 : ((s + 0.055) / 1.055) ** 2.4;
};
return 0.2126 * channel(r) + 0.7152 * channel(g) + 0.0722 * channel(b);
}
function contrast(a: Rgba, b: Rgba): number {
const [hi, lo] = [luminance(a), luminance(b)].sort((x, y) => y - x);
return (hi + 0.05) / (lo + 0.05);
}
/** Blends `top` over an opaque `bottom`. */
function blend(top: Rgba, bottom: Rgba): Rgba {
const a = top[3];
return [0, 1, 2].map((i) => top[i] * a + bottom[i] * (1 - a)).concat(1) as Rgba;
}
/** Product of the `opacity` of `el` and its ancestors (e.g. a dimmed idle label). */
function opacityChain(el: Element): number {
let opacity = 1;
for (let node: Element | null = el; node; node = node.parentElement) {
opacity *= parseFloat(getComputedStyle(node).opacity);
}
return opacity;
}
/** The opaque color behind `el`, from its own and its ancestors' backgrounds. */
function effectiveBackground(el: Element): Rgba {
const layers: Rgba[] = [];
for (let node: Element | null = el; node; node = node.parentElement) {
const bg = parseColor(getComputedStyle(node).backgroundColor);
bg[3] *= opacityChain(node);
if (bg[3] > 0) layers.push(bg);
if (bg[3] >= 1) break;
}
return layers.reduceRight<Rgba>((under, layer) => blend(layer, under), [255, 255, 255, 1]);
}
const hex = ([r, g, b]: Rgba) =>
'#' + [r, g, b].map((c) => Math.round(c).toString(16).padStart(2, '0')).join('');
interface Measurement {
text: string;
fg: string;
bg: string;
ratio: number;
required: number;
}
/** Measures every element that directly contains visible text. */
function measure(root: HTMLElement): Measurement[] {
const seen = new Set<string>();
const results: Measurement[] = [];
for (const el of Array.from(root.querySelectorAll<HTMLElement>('*'))) {
const text = Array.from(el.childNodes)
.filter((n) => n.nodeType === Node.TEXT_NODE)
.map((n) => n.textContent ?? '')
.join('')
.trim();
if (!text || el.closest('[aria-hidden="true"]')) continue;
const style = getComputedStyle(el);
const fontSize = parseFloat(style.fontSize);
const bold = Number(style.fontWeight) >= 700;
// WCAG "large text": at least 24px, or 18.66px bold
const required = fontSize >= 24 || (bold && fontSize >= 18.66) ? 3 : 4.5;
const bgColor = effectiveBackground(el);
const fg = parseColor(style.color);
fg[3] *= opacityChain(el);
const fgColor = blend(fg, bgColor);
const key = `${hex(fgColor)}|${hex(bgColor)}|${required}`;
if (seen.has(key)) continue;
seen.add(key);
results.push({
text: text.length > 28 ? `${text.slice(0, 28)}…` : text,
fg: hex(fgColor),
bg: hex(bgColor),
ratio: contrast(fgColor, bgColor),
required,
});
}
return results.sort((a, b) => a.ratio / a.required - b.ratio / b.required);
}
function Readout({ items }: { items: Measurement[] }) {
return (
<table style={{ width: '100%', borderCollapse: 'collapse', fontSize: 12, marginTop: 8 }}>
<tbody>
{items.map((m) => {
const pass = m.ratio >= m.required;
return (
<tr
key={`${m.fg}${m.bg}${m.required}`}
style={{ borderTop: '1px solid var(--color-border)' }}
>
<td style={{ padding: '4px 6px' }}>
<span
style={{
display: 'inline-block',
padding: '1px 6px',
borderRadius: 3,
background: m.bg,
color: m.fg,
fontFamily: 'monospace',
}}
>
{m.text}
</span>
</td>
<td
style={{
padding: '4px 6px',
fontFamily: 'monospace',
color: 'var(--color-text-muted)',
}}
>
{m.fg} on {m.bg}
</td>
<td
style={{
padding: '4px 6px',
textAlign: 'right',
fontWeight: 700,
whiteSpace: 'nowrap',
color: pass ? 'var(--color-text)' : 'var(--color-danger)',
}}
>
{m.ratio.toFixed(2)}:1 {pass ? '✓' : `✗ needs ${m.required}:1`}
</td>
</tr>
);
})}
</tbody>
</table>
);
}
/** Renders a sample and measures its text contrast after layout. */
function Sample({ children }: { children: React.ReactNode }) {
const ref = useRef<HTMLDivElement>(null);
const [items, setItems] = useState<Measurement[]>([]);
useLayoutEffect(() => {
const el = ref.current;
if (!el) return;
// Measure after the theme/styles have applied
const frame = requestAnimationFrame(() => setItems(measure(el)));
return () => cancelAnimationFrame(frame);
}, []);
return (
<div>
<div ref={ref}>{children}</div>
<Readout items={items} />
</div>
);
}
// ── Page ─────────────────────────────────────────────────────────────────────
// Covers every syntax color: comment, keyword, string, number, function
// (title), params, property
const JS_CODE = [
'// Open the app and wait for the dashboard',
'async function openDashboard(context, timeoutMs) {',
" const url = context.getEnv('BASE_URL');",
' await context.page.goto(url, { timeout: timeoutMs ?? 30000 });',
' return context.page.title();',
'}',
].join('\n');
const JSON_CODE = JSON.stringify(
{ status: 'pass', attempts: 2, cached: false, output: { title: 'Dashboard' } },
null,
2,
);
interface Issue {
title: string;
note: string;
render: () => React.ReactNode;
}
const ISSUES: Issue[] = [
{
title: 'AutoRefreshIndicator label',
note: 'Active ("Live", --color-primary-text), idle and error labels (runs pages).',
render: () => (
<div style={{ display: 'flex', gap: 12, flexWrap: 'wrap' }}>
<AutoRefreshIndicator active pulseKey={1} />
<AutoRefreshIndicator active={false} />
<AutoRefreshIndicator active={false} error />
</div>
),
},
{
title: 'Danger button',
note: 'Danger, primary and secondary buttons (text on colored backgrounds).',
render: () => (
<div style={{ display: 'flex', gap: 8, flexWrap: 'wrap' }}>
<Button variant="danger">Delete</Button>
<Button variant="danger" size="sm">
Delete
</Button>
<Button variant="primary">Run</Button>
<Button variant="secondary">Cancel</Button>
</div>
),
},
{
title: 'Code highlighting - JavaScript',
note: 'All --hl-* syntax colors on the page background (step code, snippets).',
render: () => <CodeBlock language="javascript" code={JS_CODE} />,
},
{
title: 'Code highlighting - JSON',
note: 'Keys, strings, numbers and literals in JSON step outputs.',
render: () => <CodeBlock language="json" code={JSON_CODE} />,
},
{
title: 'Muted text',
note: '--color-text-muted on both background shades (hints, table headers, descriptions).',
render: () => (
<div style={{ display: 'flex', gap: 8 }}>
{['var(--color-bg)', 'var(--color-bg-subtle)'].map((bg) => (
<span
key={bg}
style={{
background: bg,
color: 'var(--color-text-muted)',
padding: '4px 8px',
fontSize: 13,
}}
>
Last run 2 minutes ago
</span>
))}
</div>
),
},
];
function Panel({ theme }: { theme: 'light' | 'dark' }) {
return (
<section
// The dark tokens apply under [data-theme="dark"]; light is the page default
data-theme={theme === 'dark' ? 'dark' : undefined}
style={{
flex: '1 1 420px',
minWidth: 0,
padding: 16,
borderRadius: 8,
background: 'var(--color-bg)',
color: 'var(--color-text)',
border: '1px solid var(--color-border)',
}}
>
<h2 style={{ margin: '0 0 12px', fontSize: 16 }}>
{theme === 'dark' ? 'Dark theme' : 'Light theme'}
</h2>
{ISSUES.map((issue) => (
<div key={issue.title} style={{ marginBottom: 24 }}>
<h3 style={{ margin: '0 0 2px', fontSize: 14 }}>{issue.title}</h3>
<p style={{ margin: '0 0 8px', fontSize: 12, color: 'var(--color-text-muted)' }}>
{issue.note}
</p>
<Sample>{issue.render()}</Sample>
</div>
))}
</section>
);
}
function ContrastPage() {
return (
<div style={{ padding: 16 }}>
<p
style={{
margin: '0 0 16px',
fontSize: 13,
color: 'var(--color-text-muted)',
maxWidth: 820,
}}
>
Text contrast of the components where it's easiest to get wrong (WCAG AA: 4.5:1 for normal
text, 3:1 for large text). Each row is a piece of text in the sample, measured from its
rendered colors, worst first.
</p>
<div style={{ display: 'flex', gap: 16, flexWrap: 'wrap', alignItems: 'flex-start' }}>
<Panel theme="light" />
<Panel theme="dark" />
</div>
</div>
);
}
const meta: Meta<typeof ContrastPage> = {
title: 'Accessibility/Contrast',
component: ContrastPage,
// a11y checks use the project default ('error' in preview.tsx)
parameters: { layout: 'fullscreen' },
// The light panel relies on the page default (light) theme
globals: { theme: 'light' },
};
export default meta;
type Story = StoryObj<typeof ContrastPage>;
export const Overview: Story = {};
@@ -0,0 +1,58 @@
import React from 'react';
import type { Meta, StoryObj } from '@storybook/react-vite';
import { DescriptionList } from '../../src/ui/DescriptionList/DescriptionList';
const meta: Meta<typeof DescriptionList> = {
title: 'UI/DescriptionList',
component: DescriptionList,
parameters: { layout: 'centered' },
tags: ['autodocs'],
decorators: [
(Story) => (
<div style={{ width: 360 }}>
<Story />
</div>
),
],
argTypes: {
layout: { control: 'select', options: ['inline', 'compact', 'comfortable', 'grid'] },
},
};
export default meta;
type Story = StoryObj<typeof DescriptionList>;
const urlItems = [
{ term: 'ID_URL', detail: 'https://id.example.com/' },
{ term: 'CABINET_URL', detail: 'https://cabinet.example.com/messages' },
{ term: 'ADMIN_URL', detail: 'https://admin.example.com/' },
];
export const Inline: Story = {
args: { items: urlItems, layout: 'inline' },
};
export const Compact: Story = {
args: { items: urlItems, layout: 'compact' },
};
export const Comfortable: Story = {
args: { items: urlItems, layout: 'comfortable' },
};
export const Grid: Story = {
args: { items: urlItems, layout: 'grid' },
};
export const WithLinks: Story = {
args: {
layout: 'inline',
items: urlItems.map(({ term, detail }) => ({
term,
detail: (
<a href={detail as string} target="_blank" rel="noopener noreferrer">
{detail}
</a>
),
})),
},
};
@@ -0,0 +1,40 @@
import type { Meta, StoryObj } from '@storybook/react-vite';
import { Input } from '../../src/ui/Input/Input';
const meta: Meta<typeof Input> = {
title: 'UI/Input',
component: Input,
parameters: { layout: 'centered' },
tags: ['autodocs'],
decorators: [
(Story) => (
<div style={{ width: 320 }}>
<Story />
</div>
),
],
};
export default meta;
type Story = StoryObj<typeof Input>;
export const Default: Story = {
args: { label: 'Label', placeholder: 'Placeholder' },
};
export const WithHint: Story = {
args: {
label: 'Environment name',
placeholder: 'e.g. staging',
hint: 'Used to identify this environment in scenarios.',
},
};
export const WithError: Story = {
args: {
label: 'URL',
placeholder: 'https://...',
defaultValue: 'not a url',
error: 'Must be a valid URL.',
},
};
export const Disabled: Story = {
args: { label: 'Label', value: 'Some value', disabled: true, readOnly: true },
};
@@ -0,0 +1,197 @@
import { useState } from 'react';
import type { Meta, StoryObj } from '@storybook/react-vite';
import { expect, userEvent, within } from 'storybook/test';
import { LogOutput, type LogOutputEntry } from '../../src/ui/LogOutput/LogOutput';
import { formatLogText } from '../../src/ui/LogOutput/logText';
const meta: Meta<typeof LogOutput> = {
title: 'UI/LogOutput',
component: LogOutput,
tags: ['autodocs'],
parameters: { layout: 'padded' },
};
export default meta;
type Story = StoryObj<typeof LogOutput>;
const secondsAgo = (n: number) => new Date(Date.now() - n * 1000).toISOString();
export const Default: Story = {
args: {
startTime: secondsAgo(60),
entries: [
{
id: 0,
level: 'debug',
context: 'step:1',
message: 'Resolved credential alias "sdJwtKey" to a file credential',
createdAt: secondsAgo(61),
},
{
id: 1,
level: 'log',
context: 'step:1',
message: 'Step 1 started: Login with PKCS',
createdAt: secondsAgo(60),
},
{
id: 2,
level: 'log',
context: 'snippet:loginWithPkcs',
message: 'Snippet "loginWithPkcs" started',
createdAt: secondsAgo(58),
},
{
id: 3,
level: 'log',
context: 'snippet:loginWithPkcs',
message: 'Saved credential as run file:',
data: JSON.stringify({
id: '181d8ae2-4aee-4f33-a657-210efe7fe668',
name: 'credential.sd-jwt',
mimeType: 'application/octet-stream',
size: 1657,
sha256: '9c4226999c700a39bda30279907e4479a5b3920ccde5c75771ea0e264c638c0',
path: 'data/files/18/181d/181d8ae2-4aee-4f33-a657-210efe7fe668',
}),
createdAt: secondsAgo(57),
},
{
id: 4,
level: 'log',
context: 'snippet:loginWithPkcs',
message: 'Navigating to ID login: https://id.example.com',
createdAt: secondsAgo(57),
},
{
id: 5,
level: 'log',
context: 'assertion:pass',
message: 'Assertion passed: page must have redirected to cabinet URL',
createdAt: secondsAgo(40),
},
{
id: 6,
level: 'warn',
context: 'snippet:loginWithPkcs',
message: 'Retrying file upload after a transient error',
createdAt: secondsAgo(39),
},
{
id: 7,
level: 'log',
context: 'step:1',
message: 'Step 1 passed',
createdAt: secondsAgo(30),
},
{
id: 8,
level: 'error',
context: 'assertion:fail',
message: 'Assertion failed: Document validation must pass (got 422)',
createdAt: secondsAgo(10),
},
{
id: 9,
level: 'error',
context: 'step:2',
message: 'Step 2 failed: Document validation must pass (got 422)',
createdAt: secondsAgo(9),
},
],
},
};
export const Scrollable: Story = {
args: {
maxHeight: 160,
startTime: secondsAgo(60),
entries: Array.from({ length: 30 }, (_, i) => ({
id: i,
level: (['log', 'log', 'log', 'warn', 'error'] as const)[i % 5],
context: `step:${Math.floor(i / 6) + 1}`,
message: `Log entry ${i + 1}`,
createdAt: secondsAgo(60 - i * 2),
})),
},
};
const largeDataEntries: LogOutputEntry[] = [
{
id: 0,
level: 'log',
context: 'step:1',
message: 'Small payload:',
data: JSON.stringify({ status: 200 }),
createdAt: secondsAgo(20),
},
{
id: 1,
level: 'log',
context: 'step:1',
message: 'Large payload:',
data: JSON.stringify({
user: { id: 42, name: 'Jane Doe', roles: ['admin', 'qa'] },
token: 'eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiI0MiJ9',
}),
createdAt: secondsAgo(18),
},
{
id: 2,
level: 'warn',
context: 'step:2',
message: 'Another large payload:',
data: JSON.stringify(Array.from({ length: 8 }, (_, i) => ({ row: i }))),
createdAt: secondsAgo(10),
},
];
function LargeDataLog() {
const [expanded, setExpanded] = useState(false);
return (
<div style={{ display: 'flex', flexDirection: 'column', gap: 8, alignItems: 'flex-start' }}>
<button type="button" onClick={() => setExpanded((v) => !v)}>
{expanded ? 'Collapse all' : 'Expand all'}
</button>
<LogOutput startTime={secondsAgo(20)} entries={largeDataEntries} dataExpanded={expanded} />
</div>
);
}
/** Data blocks over the default limits (256 bytes, 5 lines) start collapsed. */
export const LargeData: Story = {
render: () => <LargeDataLog />,
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
// Data blocks are syntax-highlighted into separate tokens, so check the log's text
const log = canvas.getByRole('log');
// Only the small payload is visible initially
await expect(log).toHaveTextContent('"status": 200');
await expect(log).not.toHaveTextContent('Jane Doe');
const toggles = canvas.getAllByRole('button', { name: /^Show data/ });
await expect(toggles).toHaveLength(2);
await userEvent.click(toggles[0]);
await expect(log).toHaveTextContent('Jane Doe');
await userEvent.click(canvas.getByRole('button', { name: 'Hide data' }));
await expect(log).not.toHaveTextContent('Jane Doe');
await userEvent.click(canvas.getByRole('button', { name: 'Expand all' }));
await expect(log).toHaveTextContent('Jane Doe');
await expect(canvas.getAllByRole('button', { name: 'Hide data' })).toHaveLength(2);
await userEvent.click(canvas.getByRole('button', { name: 'Collapse all' }));
await expect(log).not.toHaveTextContent('Jane Doe');
// The plain-text form always includes every data block
const text = formatLogText(largeDataEntries, largeDataEntries[0].createdAt);
await expect(text).toContain('[step:1] Large payload:\n {');
await expect(text).toContain('"name": "Jane Doe"');
},
};
export const Empty: Story = {
args: {
entries: [],
emptyMessage: 'No logs yet.',
},
};
@@ -0,0 +1,132 @@
import '../../src/i18n';
import type { Meta, StoryObj } from '@storybook/react-vite';
import { expect, userEvent, within } from 'storybook/test';
import { ApiError } from '../../src/api/client';
import { LoginForm } from '../../src/pages/auth/LoginForm';
const meta: Meta<typeof LoginForm> = {
title: 'Authentication/Login form',
component: LoginForm,
parameters: { layout: 'centered' },
tags: ['autodocs'],
args: { onSubmit: async () => undefined },
decorators: [
(Story) => (
<div style={{ width: 'min(calc(100vw - 32px), 440px)' }}>
<Story />
</div>
),
],
};
export default meta;
type Story = StoryObj<typeof LoginForm>;
async function expectLoginSurfaces(canvasElement: HTMLElement) {
const canvas = within(canvasElement);
const card = canvasElement.querySelector('section');
const notice = canvas.getByText('Your session has expired. Sign in again to continue.');
const username = canvas.getByRole('textbox', { name: 'Username' });
if (!card) throw new Error('Login card was not rendered.');
await expect(window.getComputedStyle(notice).marginBottom).not.toBe('0px');
await expect(window.getComputedStyle(username).backgroundColor).not.toBe(
window.getComputedStyle(card).backgroundColor,
);
}
export const Initial: Story = {};
export const ExpiredSession: Story = {
args: { expired: true },
play: async ({ canvasElement }) => expectLoginSurfaces(canvasElement),
};
export const SignedOut: Story = { args: { signedOut: true } };
export const DarkTheme: Story = {
args: { expired: true },
decorators: [
(Story) => (
<div data-theme="dark" style={{ width: 440, padding: 24, background: 'var(--color-bg)' }}>
<Story />
</div>
),
],
play: async ({ canvasElement }) => expectLoginSurfaces(canvasElement),
};
export const NarrowViewport: Story = {
decorators: [
(Story) => (
<div style={{ width: 320, padding: 16, background: 'var(--color-bg)' }}>
<Story />
</div>
),
],
};
export const EmptyFieldValidation: Story = {
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
await userEvent.click(canvas.getByRole('button', { name: 'Sign in' }));
await expect(canvas.getByText('Enter your username.')).toBeVisible();
await expect(canvas.getByRole('textbox', { name: 'Username' })).toHaveFocus();
await expect(canvas.getByLabelText('Password')).toHaveAttribute('aria-invalid', 'true');
},
};
export const InvalidCredentials: Story = {
args: {
onSubmit: async () => {
throw new ApiError(401, 'Unauthorized');
},
},
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
await userEvent.type(canvas.getByRole('textbox', { name: 'Username' }), 'operator');
await userEvent.type(canvas.getByLabelText('Password'), 'wrong-password');
await userEvent.click(canvas.getByRole('button', { name: 'Sign in' }));
await expect(await canvas.findByRole('alert')).toHaveTextContent(
'Username or password is incorrect.',
);
await expect(canvas.getByRole('textbox', { name: 'Username' })).toHaveValue('operator');
await expect(canvas.getByLabelText('Password')).toHaveValue('');
await expect(canvas.getByLabelText('Password')).toHaveFocus();
},
};
export const RequestFailureAndRetry: Story = {
args: {
onSubmit: (() => {
let attempts = 0;
return async () => {
attempts += 1;
if (attempts === 1) throw new ApiError(503, 'Unavailable');
};
})(),
},
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
await userEvent.type(canvas.getByRole('textbox', { name: 'Username' }), 'operator');
await userEvent.type(canvas.getByLabelText('Password'), 'temporary');
await userEvent.click(canvas.getByRole('button', { name: 'Sign in' }));
await expect(await canvas.findByRole('alert')).toHaveTextContent(
"Couldn't sign in. Check your connection and try again.",
);
await expect(canvas.getByLabelText('Password')).toHaveValue('temporary');
await userEvent.click(canvas.getByRole('button', { name: 'Sign in' }));
await expect(canvas.queryByRole('alert')).not.toBeInTheDocument();
},
};
export const Submitting: Story = {
args: { onSubmit: () => new Promise(() => undefined) },
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
await userEvent.type(canvas.getByRole('textbox', { name: 'Username' }), 'operator');
await userEvent.type(canvas.getByLabelText('Password'), 'secret');
await userEvent.click(canvas.getByRole('button', { name: 'Sign in' }));
await expect(canvas.getByRole('status')).toHaveTextContent('Signing in…');
await expect(canvas.getByRole('button', { name: 'Signing in…' })).toBeDisabled();
},
};
@@ -0,0 +1,35 @@
import type { Meta, StoryObj } from '@storybook/react-vite';
import { expect, within } from 'storybook/test';
import { MarkdownContent } from '../../src/ui/MarkdownContent/MarkdownContent';
const meta: Meta<typeof MarkdownContent> = {
title: 'UI/MarkdownContent',
component: MarkdownContent,
parameters: { layout: 'padded' },
tags: ['autodocs'],
};
export default meta;
type Story = StoryObj<typeof MarkdownContent>;
export const Description: Story = {
args: {
content: [
'## Login flow',
'',
'Logs in with the **test user** and checks the dashboard.',
'',
'- Uses the `BASE_URL` environment value',
'- Needs the `user` credential alias',
'',
'```js',
"await context.page.goto(context.getEnv('BASE_URL'));",
'```',
].join('\n'),
},
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
await expect(canvas.getByRole('heading', { name: 'Login flow' })).toBeInTheDocument();
await expect(canvas.getByText('test user').tagName).toBe('STRONG');
await expect(canvas.getAllByRole('listitem')).toHaveLength(2);
},
};
@@ -0,0 +1,98 @@
import React, { useState } from 'react';
import type { Meta, StoryObj } from '@storybook/react-vite';
import { expect, userEvent, within } from 'storybook/test';
import { Modal } from '../../src/ui/Modal/Modal';
import { Button } from '../../src/ui/Button/Button';
function ModalDemo({
title,
body,
size,
}: {
title: string;
body: React.ReactNode;
size?: 'md' | 'lg';
}) {
const [open, setOpen] = useState(false);
return (
<>
<Button onClick={() => setOpen(true)}>Open modal</Button>
<Modal
open={open}
size={size}
title={title}
onClose={() => setOpen(false)}
footer={
<>
<Button variant="secondary" onClick={() => setOpen(false)}>
Cancel
</Button>
<Button onClick={() => setOpen(false)}>Confirm</Button>
</>
}
>
{body}
</Modal>
</>
);
}
const meta: Meta<typeof ModalDemo> = {
title: 'UI/Modal',
component: ModalDemo,
parameters: { layout: 'centered' },
tags: ['autodocs'],
args: { title: 'Delete scenario', body: 'This deletes the scenario, its versions and its runs.' },
};
export default meta;
type Story = StoryObj<typeof ModalDemo>;
export const Default: Story = {
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
await userEvent.click(canvas.getByRole('button', { name: 'Open modal' }));
const dialog = canvas.getByRole('dialog', { name: 'Delete scenario' });
await expect(dialog).toHaveTextContent('its versions and its runs');
await userEvent.click(within(dialog).getByRole('button', { name: 'Cancel' }));
await expect(canvas.queryByRole('dialog')).not.toBeInTheDocument();
},
};
export const ClosesOnEscapeAndBackdrop: Story = {
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
await userEvent.click(canvas.getByRole('button', { name: 'Open modal' }));
await userEvent.keyboard('{Escape}');
await expect(canvas.queryByRole('dialog')).not.toBeInTheDocument();
await userEvent.click(canvas.getByRole('button', { name: 'Open modal' }));
await userEvent.click(canvas.getByRole('presentation'));
await expect(canvas.queryByRole('dialog')).not.toBeInTheDocument();
},
};
export const Large: Story = {
args: {
title: 'Code reference',
size: 'lg',
body: (
<>
{Array.from({ length: 60 }, (_, i) => (
<p key={i}>Paragraph {i + 1} of a long, document-like modal body.</p>
))}
</>
),
},
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
await userEvent.click(canvas.getByRole('button', { name: 'Open modal' }));
const dialog = canvas.getByRole('dialog', { name: 'Code reference' });
// The dialog stays within the viewport; its body scrolls instead.
await expect(dialog.getBoundingClientRect().height).toBeLessThanOrEqual(window.innerHeight);
const body = within(dialog).getByText(
'Paragraph 1 of a long, document-like modal body.',
).parentElement!;
await expect(body.scrollHeight).toBeGreaterThan(body.clientHeight);
await expect(within(dialog).getByRole('button', { name: 'Confirm' })).toBeVisible();
},
};
@@ -0,0 +1,30 @@
import type { Meta, StoryObj } from '@storybook/react-vite';
import { Notification } from '../../src/ui/Notification/Notification';
const meta: Meta<typeof Notification> = {
title: 'UI/Notification',
component: Notification,
parameters: { layout: 'padded' },
tags: ['autodocs'],
argTypes: {
variant: { control: 'select', options: ['info', 'success', 'error', 'warning', 'note'] },
},
};
export default meta;
type Story = StoryObj<typeof Notification>;
export const Info: Story = {
args: {
variant: 'info',
title: 'Traces are off',
children: 'Enable them per run in the run modal.',
},
};
export const Success: Story = { args: { variant: 'success', children: 'Scenario imported.' } };
export const Error: Story = {
args: { variant: 'error', title: 'Run failed', children: 'Step 2 timed out after 60s.' },
};
export const Warning: Story = {
args: { variant: 'warning', children: 'The environment of this run no longer exists.' },
};
export const Note: Story = { args: { variant: 'note', children: 'Pinned snippet version: v3.' } };
@@ -0,0 +1,17 @@
import type { Meta, StoryObj } from '@storybook/react-vite';
import { fn } from 'storybook/test';
import { NotificationToggle } from '../../src/ui/NotificationToggle/NotificationToggle';
const meta: Meta<typeof NotificationToggle> = {
title: 'UI/NotificationToggle',
component: NotificationToggle,
parameters: { layout: 'centered' },
tags: ['autodocs'],
args: { onToggle: fn() },
};
export default meta;
type Story = StoryObj<typeof NotificationToggle>;
export const Off: Story = { args: { state: 'off' } };
export const On: Story = { args: { state: 'on' } };
export const Blocked: Story = { args: { state: 'blocked' } };
@@ -0,0 +1,56 @@
import type { Meta, StoryObj } from '@storybook/react-vite';
import { useState } from 'react';
import { Pagination } from '../../src/ui/Pagination/Pagination';
const meta: Meta<typeof Pagination> = {
title: 'UI/Pagination',
component: Pagination,
parameters: { layout: 'padded' },
tags: ['autodocs'],
};
export default meta;
type Story = StoryObj<typeof Pagination>;
function Controlled(args: React.ComponentProps<typeof Pagination>) {
const [page, setPage] = useState(args.page);
const [pageSize, setPageSize] = useState(args.pageSize);
return (
<Pagination
{...args}
page={page}
pageSize={pageSize}
onPageChange={setPage}
onPageSizeChange={args.onPageSizeChange ? setPageSize : undefined}
/>
);
}
export const FewPages: Story = {
render: (args) => <Controlled {...args} />,
args: { page: 1, pageSize: 10, total: 30 },
};
export const ManyPages: Story = {
render: (args) => <Controlled {...args} />,
args: { page: 5, pageSize: 10, total: 200 },
};
export const LastPage: Story = {
render: (args) => <Controlled {...args} />,
args: { page: 20, pageSize: 10, total: 200 },
};
export const SinglePage: Story = {
render: (args) => <Controlled {...args} />,
args: { page: 1, pageSize: 10, total: 7 },
};
export const WithPageSizeSelector: Story = {
render: (args) => <Controlled {...args} />,
args: {
page: 1,
pageSize: 10,
total: 150,
onPageSizeChange: () => {},
},
};
@@ -0,0 +1,31 @@
import type { Meta, StoryObj } from '@storybook/react-vite';
import { expect } from 'storybook/test';
import { safeReturnTo } from '../../src/auth/returnTo';
function ReturnToSafetyExample() {
return <p>Local return destinations are checked before use.</p>;
}
const meta: Meta<typeof ReturnToSafetyExample> = {
title: 'Authentication/Return destination safety',
component: ReturnToSafetyExample,
tags: ['autodocs'],
};
export default meta;
type Story = StoryObj<typeof ReturnToSafetyExample>;
export const Validation: Story = {
play: async () => {
await expect(safeReturnTo('/scenarios/123/runs/456?example=1#details')).toBe(
'/scenarios/123/runs/456?example=1#details',
);
await expect(safeReturnTo('/scenarios')).toBe('/scenarios');
await expect(safeReturnTo('//external.example/path')).toBeNull();
await expect(safeReturnTo('https://external.example/path')).toBeNull();
await expect(safeReturnTo('/%2f%2fexternal.example')).toBeNull();
await expect(safeReturnTo('/%5c%5cexternal.example')).toBeNull();
await expect(safeReturnTo('/login?returnTo=/scenarios')).toBeNull();
await expect(safeReturnTo('/auth/me')).toBeNull();
await expect(safeReturnTo('/%')).toBeNull();
},
};
@@ -0,0 +1,33 @@
import type { Meta, StoryObj } from '@storybook/react-vite';
import { expect, userEvent, within } from 'storybook/test';
import { RevealableCodeBlock } from '../../src/ui/RevealableCodeBlock/RevealableCodeBlock';
const meta: Meta<typeof RevealableCodeBlock> = {
title: 'UI/RevealableCodeBlock',
component: RevealableCodeBlock,
parameters: { layout: 'padded' },
tags: ['autodocs'],
};
export default meta;
type Story = StoryObj<typeof RevealableCodeBlock>;
export const Default: Story = {
args: {
language: 'json',
code: JSON.stringify({ username: 'admin', password: 's3cr3t-p4ss' }, null, 2),
},
play: async ({ canvasElement }) => {
// The code is not rendered until revealed, and hidden again on the second click
const canvas = within(canvasElement);
const toggle = canvas.getByRole('button');
await expect(canvasElement).not.toHaveTextContent('s3cr3t-p4ss');
await expect(toggle).toHaveAttribute('aria-expanded', 'false');
await userEvent.click(toggle);
await expect(canvasElement.querySelector('code')).toHaveTextContent('s3cr3t-p4ss');
await expect(toggle).toHaveAttribute('aria-expanded', 'true');
await userEvent.click(toggle);
await expect(canvasElement).not.toHaveTextContent('s3cr3t-p4ss');
},
};
@@ -0,0 +1,34 @@
import React, { useState } from 'react';
import type { Meta, StoryObj } from '@storybook/react-vite';
import { expect, userEvent, within } from 'storybook/test';
import { Search } from '../../src/ui/Search/Search';
function ControlledSearch({ placeholder }: { placeholder?: string }) {
const [value, setValue] = useState('');
return (
<div>
<Search value={value} onChange={setValue} placeholder={placeholder} />
<p data-testid="query">{value}</p>
</div>
);
}
const meta: Meta<typeof ControlledSearch> = {
title: 'UI/Search',
component: ControlledSearch,
parameters: { layout: 'centered' },
tags: ['autodocs'],
};
export default meta;
type Story = StoryObj<typeof ControlledSearch>;
export const Default: Story = {};
export const Typing: Story = {
args: { placeholder: 'Filter logs…' },
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
await userEvent.type(canvas.getByPlaceholderText('Filter logs…'), 'timeout');
await expect(canvas.getByTestId('query')).toHaveTextContent('timeout');
},
};
@@ -0,0 +1,75 @@
import type { Meta, StoryObj } from '@storybook/react-vite';
import { Select } from '../../src/ui/Select/Select';
const ENVIRONMENTS = [
{ value: 'dev', label: 'Development' },
{ value: 'staging', label: 'Staging' },
{ value: 'prod', label: 'Production' },
];
const SCENARIO_TYPES = [
{ value: 'smoke', label: 'Smoke test' },
{ value: 'regression', label: 'Regression' },
{ value: 'e2e', label: 'End-to-end' },
{ value: 'perf', label: 'Performance', disabled: true },
];
const meta: Meta<typeof Select> = {
title: 'UI/Select',
component: Select,
parameters: { layout: 'centered' },
tags: ['autodocs'],
decorators: [
(Story) => (
<div style={{ width: 320 }}>
<Story />
</div>
),
],
};
export default meta;
type Story = StoryObj<typeof Select>;
export const Default: Story = {
args: {
label: 'Environment',
options: ENVIRONMENTS,
placeholder: 'Select an environment…',
},
};
export const WithValue: Story = {
args: {
label: 'Environment',
options: ENVIRONMENTS,
defaultValue: 'staging',
},
};
export const WithHint: Story = {
args: {
label: 'Test type',
options: SCENARIO_TYPES,
placeholder: 'Choose a type…',
hint: 'Performance tests require a dedicated runner.',
},
};
export const WithError: Story = {
args: {
label: 'Environment',
options: ENVIRONMENTS,
defaultValue: '',
placeholder: 'Select an environment…',
error: 'Please select an environment.',
},
};
export const Disabled: Story = {
args: {
label: 'Environment',
options: ENVIRONMENTS,
defaultValue: 'prod',
disabled: true,
},
};
@@ -0,0 +1,75 @@
import type { Meta, StoryObj } from '@storybook/react-vite';
import { SidePanel } from '../../src/ui/SidePanel/SidePanel';
const NAV_ITEMS = ['Dashboard', 'Scenarios', 'Environments', 'Reports', 'Settings'];
function NavList() {
return (
<ul
style={{
listStyle: 'none',
margin: 0,
padding: 0,
display: 'flex',
flexDirection: 'column',
gap: 2,
}}
>
{NAV_ITEMS.map((item) => (
<li key={item}>
<button
style={{
width: '100%',
textAlign: 'left',
background: 'none',
border: 'none',
borderRadius: 'var(--radius-md)',
padding: 'var(--space-2) var(--space-3)',
fontSize: 'var(--font-size-sm)',
color: 'var(--color-text)',
cursor: 'pointer',
fontFamily: 'var(--font-family)',
}}
onMouseEnter={(e) => (e.currentTarget.style.background = 'var(--color-secondary)')}
onMouseLeave={(e) => (e.currentTarget.style.background = 'none')}
>
{item}
</button>
</li>
))}
</ul>
);
}
const meta: Meta<typeof SidePanel> = {
title: 'UI/SidePanel',
component: SidePanel,
parameters: { layout: 'fullscreen' },
tags: ['autodocs'],
decorators: [
(Story) => (
<div style={{ display: 'flex', height: 420, background: 'var(--color-bg)' }}>
<Story />
<div
style={{
flex: 1,
padding: 'var(--space-6)',
color: 'var(--color-text-muted)',
fontSize: 'var(--font-size-sm)',
}}
>
Main content area
</div>
</div>
),
],
};
export default meta;
type Story = StoryObj<typeof SidePanel>;
export const Default: Story = {
args: {
header: 'Navigation',
children: <NavList />,
},
};
@@ -0,0 +1,34 @@
import '../../src/i18n';
import type { Meta, StoryObj } from '@storybook/react-vite';
import { expect, fn, userEvent, within } from 'storybook/test';
import { SignOutControl } from '../../src/pages/auth/SignOutControl';
const meta: Meta<typeof SignOutControl> = {
title: 'Authentication/Sign out',
component: SignOutControl,
parameters: { layout: 'centered' },
tags: ['autodocs'],
args: { onSignOut: fn() },
};
export default meta;
type Story = StoryObj<typeof SignOutControl>;
export const Ready: Story = {};
export const Pending: Story = {
args: { pending: true },
play: async ({ canvasElement }) => {
const button = within(canvasElement).getByRole('button', { name: 'Signing out…' });
await expect(button).toBeDisabled();
},
};
export const FailureAndRetry: Story = {
args: { failed: true },
play: async ({ canvasElement, args }) => {
const canvas = within(canvasElement);
await expect(canvas.getByRole('alert')).toHaveTextContent("Couldn't sign out. Try again.");
await userEvent.click(canvas.getByRole('button', { name: 'Retry' }));
await expect(args.onSignOut).toHaveBeenCalledTimes(1);
},
};
+107
View File
@@ -0,0 +1,107 @@
import type { Meta, StoryObj } from '@storybook/react-vite';
import { Table } from '../../src/ui/Table/Table';
import { Badge } from '../../src/ui/Badge/Badge';
import { Timestamp } from '../../src/ui/Timestamp/Timestamp';
const meta: Meta<typeof Table> = {
title: 'UI/Table',
component: Table,
tags: ['autodocs'],
parameters: { layout: 'padded' },
};
export default meta;
interface User {
id: number;
name: string;
email: string;
status: 'active' | 'inactive';
updatedAt: string;
}
const daysAgo = (n: number) => new Date(Date.now() - n * 86_400_000).toISOString();
const users: User[] = [
{
id: 1,
name: 'Alice Müller',
email: 'alice@example.com',
status: 'active',
updatedAt: daysAgo(1),
},
{
id: 2,
name: 'Bob Nguyen',
email: 'bob@example.com',
status: 'inactive',
updatedAt: daysAgo(5),
},
{
id: 3,
name: 'Carol Santos',
email: 'carol@example.com',
status: 'active',
updatedAt: daysAgo(30),
},
];
const manyUsers: User[] = Array.from({ length: 47 }, (_, i) => ({
id: i + 1,
name: `User ${i + 1}`,
email: `user${i + 1}@example.com`,
status: i % 3 === 0 ? 'inactive' : 'active',
updatedAt: daysAgo(i),
}));
const columns: StoryObj<typeof Table<User>>['args'] = {
rowKey: (u: User) => u.id,
emptyMessage: 'No users found.',
columns: [
{ key: 'id', header: 'ID', render: (u: User) => u.id, width: 60 },
{ key: 'name', header: 'Name', render: (u: User) => u.name },
{ key: 'email', header: 'Email', render: (u: User) => u.email },
{
key: 'status',
header: 'Status',
width: 110,
render: (u: User) => (
<Badge variant={u.status === 'active' ? 'success' : 'neutral'}>{u.status}</Badge>
),
},
{
key: 'updated',
header: 'Updated',
width: 140,
render: (u: User) => <Timestamp value={u.updatedAt} />,
},
],
};
export const Default: StoryObj<typeof Table<User>> = {
args: { ...columns, data: users },
};
export const Loading: StoryObj<typeof Table<User>> = {
args: { ...columns, data: users, loading: true },
};
export const Empty: StoryObj<typeof Table<User>> = {
args: { ...columns, data: [] },
};
export const SingleRow: StoryObj<typeof Table<User>> = {
args: { ...columns, data: [users[0]] },
};
export const WithPagination: StoryObj<typeof Table<User>> = {
args: { ...columns, data: manyUsers, pageSize: 10 },
};
export const WithPaginationAndSizeSelector: StoryObj<typeof Table<User>> = {
args: {
...columns,
data: manyUsers,
pageSize: 10,
pageSizeOptions: [10, 25, 50],
},
};
@@ -0,0 +1,37 @@
import type { Meta, StoryObj } from '@storybook/react-vite';
import { expect, within } from 'storybook/test';
import { Textarea } from '../../src/ui/Textarea/Textarea';
const meta: Meta<typeof Textarea> = {
title: 'UI/Textarea',
component: Textarea,
parameters: { layout: 'centered' },
tags: ['autodocs'],
decorators: [
(Story) => (
<div style={{ width: 360 }}>
<Story />
</div>
),
],
};
export default meta;
type Story = StoryObj<typeof Textarea>;
export const Default: Story = {
args: { label: 'Description', placeholder: 'Describe this scenario', rows: 4 },
};
export const WithHint: Story = {
args: { label: 'Description', hint: 'Markdown is supported.', rows: 4 },
};
export const WithError: Story = {
args: { label: 'Description', error: 'Description is too long.', rows: 4 },
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
const textarea = canvas.getByLabelText('Description');
await expect(textarea).toHaveAttribute('aria-invalid', 'true');
await expect(canvas.getByRole('alert')).toHaveTextContent('Description is too long.');
},
};
@@ -0,0 +1,13 @@
import type { Meta, StoryObj } from '@storybook/react-vite';
import { ThemeSwitcher } from '../../src/ui/ThemeSwitcher/ThemeSwitcher';
const meta: Meta<typeof ThemeSwitcher> = {
title: 'UI/ThemeSwitcher',
component: ThemeSwitcher,
parameters: { layout: 'centered' },
tags: ['autodocs'],
};
export default meta;
type Story = StoryObj<typeof ThemeSwitcher>;
export const Default: Story = {};
@@ -0,0 +1,21 @@
import type { Meta, StoryObj } from '@storybook/react-vite';
import { Timestamp } from '../../src/ui/Timestamp/Timestamp';
const meta: Meta<typeof Timestamp> = {
title: 'UI/Timestamp',
component: Timestamp,
parameters: { layout: 'centered' },
tags: ['autodocs'],
};
export default meta;
type Story = StoryObj<typeof Timestamp>;
const minutesAgo = (n: number) => new Date(Date.now() - n * 60_000).toISOString();
const hoursAgo = (n: number) => new Date(Date.now() - n * 3_600_000).toISOString();
const daysAgo = (n: number) => new Date(Date.now() - n * 86_400_000).toISOString();
export const JustNow: Story = { args: { value: minutesAgo(1) } };
export const MinutesAgo: Story = { args: { value: minutesAgo(15) } };
export const HoursAgo: Story = { args: { value: hoursAgo(3) } };
export const DaysAgo: Story = { args: { value: daysAgo(5) } };
export const MonthsAgo: Story = { args: { value: daysAgo(90) } };
@@ -0,0 +1,41 @@
import React from 'react';
import type { Meta, StoryObj } from '@storybook/react-vite';
import { expect, userEvent, within } from 'storybook/test';
import { ToastProvider } from '../../src/ui/Toast/ToastProvider';
import { useToast } from '../../src/ui/Toast/useToast';
import { Button } from '../../src/ui/Button/Button';
function ToastButtons() {
const toast = useToast();
return (
<div style={{ display: 'flex', gap: 8 }}>
<Button onClick={() => toast.success('Scenario run started')}>Success</Button>
<Button variant="danger" onClick={() => toast.error('Environment not found')}>
Error
</Button>
<Button variant="secondary" onClick={() => toast.info('Traces are off')}>
Info
</Button>
</div>
);
}
const meta: Meta<typeof ToastProvider> = {
title: 'UI/Toast',
component: ToastProvider,
parameters: { layout: 'centered' },
tags: ['autodocs'],
args: { durationMs: 3500, children: <ToastButtons /> },
};
export default meta;
type Story = StoryObj<typeof ToastProvider>;
export const Default: Story = {};
export const ShowsToast: Story = {
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
await userEvent.click(canvas.getByRole('button', { name: 'Success' }));
await expect(await within(document.body).findByText('Scenario run started')).toBeVisible();
},
};
@@ -0,0 +1,63 @@
import type { Meta, StoryObj } from '@storybook/react-vite';
import { useState } from 'react';
import { expect, within } from 'storybook/test';
import { Button } from '../../src/ui/Button/Button';
import { UuidBadge } from '../../src/ui/UuidBadge/UuidBadge';
const meta: Meta<typeof UuidBadge> = {
title: 'UI/UuidBadge',
component: UuidBadge,
parameters: { layout: 'centered' },
tags: ['autodocs'],
};
export default meta;
type Story = StoryObj<typeof UuidBadge>;
export const Default: Story = {
args: { id: '61d2b1c2-7664-4dca-974f-436c2ee90b2e' },
play: async ({ canvasElement }) => {
// Shows a shortened id and keeps the full one in the tooltip
const badge = within(canvasElement).getByTitle('61d2b1c2-7664-4dca-974f-436c2ee90b2e');
await expect(badge).toHaveTextContent('61d2…0b2e');
},
};
const SAMPLE_IDS = [
'61d2b1c2-7664-4dca-974f-436c2ee90b2e',
'e83f0a5d-1b9c-4f27-8d6e-2a4c9b7f1e03',
'0c7a94f1-3e52-4b8d-a1f6-9d2e5c8b4a70',
'f4b21e8c-9a07-4c63-b5d2-7e1f0a3c6d98',
'8d5e3a10-c4f7-4e29-9b81-5f6a2d0c7e14',
'2a9fc067-58d3-4a1e-86b4-c3e7f19d5b2a',
];
function Gallery() {
const [ids, setIds] = useState(SAMPLE_IDS);
return (
<div style={{ display: 'flex', flexDirection: 'column', alignItems: 'flex-start', gap: 12 }}>
<div style={{ display: 'flex', flexWrap: 'wrap', gap: 16 }}>
{ids.map((id) => (
<UuidBadge key={id} id={id} />
))}
</div>
<Button
size="sm"
variant="secondary"
onClick={() => setIds(ids.map(() => crypto.randomUUID()))}
>
Randomize
</Button>
</div>
);
}
export const Colors: Story = {
render: () => <Gallery />,
play: async ({ canvasElement }) => {
// Each sample id gets its own badge
const canvas = within(canvasElement);
for (const id of SAMPLE_IDS) {
await expect(canvas.getByTitle(id)).toBeInTheDocument();
}
},
};
+34
View File
@@ -0,0 +1,34 @@
import js from '@eslint/js';
import tseslint from 'typescript-eslint';
import reactHooks from 'eslint-plugin-react-hooks';
import reactRefresh from 'eslint-plugin-react-refresh';
import prettier from 'eslint-plugin-prettier';
import prettierConfig from 'eslint-config-prettier';
export default tseslint.config(
{ ignores: ['dist', 'storybook-static'] },
// Base JS rules
js.configs.recommended,
// TypeScript rules
...tseslint.configs.recommended,
// React rules
{
plugins: {
'react-hooks': reactHooks,
'react-refresh': reactRefresh,
prettier,
},
rules: {
...reactHooks.configs.recommended.rules,
'react-refresh/only-export-components': ['warn', { allowConstantExport: true }],
'prettier/prettier': 'warn',
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }],
},
},
// Disable ESLint formatting rules that conflict with Prettier
prettierConfig,
);
+22
View File
@@ -0,0 +1,22 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Liqa</title>
<script>
(function () {
var stored = localStorage.getItem('qa-bot-theme');
var theme = stored === 'light' || stored === 'dark'
? stored
: window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
document.documentElement.setAttribute('data-theme', theme);
})();
</script>
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
+59
View File
@@ -0,0 +1,59 @@
{
"name": "liqa-client",
"private": true,
"license": "MIT",
"author": "Andrii Arsenin",
"type": "module",
"scripts": {
"dev": "vite",
"dev:compose-api": "VITE_API_URL=http://localhost:13000/api/v1 vite",
"build": "tsc -b && vite build",
"preview": "vite preview",
"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build",
"test:compile": "tsc --noEmit",
"test:storybook": "vitest run --project storybook",
"lint": "eslint src .storybook",
"lint:fix": "eslint src .storybook --fix",
"format": "prettier --write \"src/**/*.{ts,tsx}\" \".storybook/**/*.{ts,tsx}\""
},
"dependencies": {
"@monaco-editor/react": "^4.7.0",
"@tanstack/react-query": "^5.99.0",
"highlight.js": "^11.11.1",
"i18next": "^26.0.4",
"lucide-react": "^1.7.0",
"moment": "^2.30.1",
"react": "^19.1.0",
"react-dom": "^19.1.0",
"react-i18next": "^17.0.2",
"react-markdown": "^10.1.0",
"react-router-dom": "^7.14.0",
"remark-gfm": "^4.0.1",
"yaml": "^2.8.3"
},
"devDependencies": {
"@eslint/js": "^9.39.4",
"@storybook/addon-a11y": "^10.3.5",
"@storybook/addon-docs": "^10.3.5",
"@storybook/addon-vitest": "^10.3.5",
"@storybook/react-vite": "^10.3.5",
"@types/react": "^19.1.2",
"@types/react-dom": "^19.1.2",
"@vitejs/plugin-react": "^4.4.1",
"@vitest/browser-playwright": "^4.1.3",
"@vitest/coverage-v8": "^4.1.3",
"eslint": "^10.2.0",
"eslint-config-prettier": "^10.1.8",
"eslint-plugin-prettier": "^5.5.5",
"eslint-plugin-react-hooks": "^7.0.1",
"eslint-plugin-react-refresh": "^0.5.2",
"playwright": "^1.59.1",
"prettier": "^3.8.1",
"storybook": "^10.3.5",
"typescript": "~5.8.3",
"typescript-eslint": "^8.58.1",
"vite": "^6.3.1",
"vitest": "^4.1.3"
}
}
+62
View File
@@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
version="1.1"
id="svg92"
width="421.86172"
height="421.86172"
viewBox="0 0 421.86173 421.86172"
sodipodi:docname="liqa-mini.svg"
inkscape:version="1.2.2 (b0a8486541, 2022-12-01)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<defs
id="defs96" />
<sodipodi:namedview
id="namedview94"
pagecolor="#ffffff"
bordercolor="#000000"
borderopacity="0.25"
inkscape:showpageshadow="false"
inkscape:pageopacity="0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1"
showgrid="false"
showborder="false"
borderlayer="false"
shape-rendering="auto"
inkscape:zoom="0.60813025"
inkscape:cx="-51.798114"
inkscape:cy="-76.463882"
inkscape:window-width="2544"
inkscape:window-height="1355"
inkscape:window-x="20"
inkscape:window-y="20"
inkscape:window-maximized="0"
inkscape:current-layer="g98" />
<g
inkscape:groupmode="layer"
inkscape:label="Image"
id="g98"
transform="translate(-270.03557,-210.1151)">
<circle
style="fill:#e6edea;fill-opacity:1;stroke-width:0.926933"
id="path331"
cx="480.96643"
cy="421.04596"
r="210.93086" />
<path
style="fill:#39196b"
d="m 453.91034,593.79867 c -34.08673,-5.09427 -70.45402,-12.61452 -97.32495,-35.64384 -9.91285,-8.49217 -10.39503,-22.11427 -9.93686,-34.15838 -29.11758,-32.44273 -47.40043,-75.91137 -44.17964,-119.94221 -0.1082,-69.39624 50.26509,-133.2096 115.02861,-155.43859 65.94576,-23.97068 145.13988,-7.25178 194.05946,43.53493 33.75034,34.13894 52.73157,82.84814 48.59098,130.92571 -2.05053,36.83319 -19.00255,72.10194 -42.95534,99.74833 0.59009,14.27144 -0.67496,30.5898 -14.31879,38.78996 -29.95318,20.71235 -66.75963,30.54233 -102.80366,32.85732 -15.37106,0.58367 -30.83524,0.86962 -46.15981,-0.67323 z m 60,-25.40946 c 63.80512,-11.608 115.95832,-65.21248 129.69191,-127.96784 13.52875,-65.57348 -19.88327,-136.69388 -77.86044,-169.61945 -62.09585,-37.00081 -148.54942,-29.25016 -200.28124,22.40983 -39.98962,37.54618 -58.68926,96.3072 -45.60991,149.85388 15.1241,64.40785 71.02087,118.19945 137.36624,126.41525 18.58372,2.99672 38.14468,1.6814 56.69344,-1.09167 z m -47.5,-2.22871 c -38.4767,-4.43103 -77.04078,-22.16808 -101.12198,-53.12116 -3.19125,-10.71063 13.54949,-17.36711 -0.27511,-27.21578 -8.26021,-16.11409 -8.83665,-33.71408 -14.27833,-50.67086 -0.2541,-18.10794 20.10105,-26.35624 25.6663,-43.23729 6.35587,-8.46898 -3.9027,-20.33944 -0.39344,-30.42399 2.15786,-25.3474 4.36566,-52.60471 18.52953,-74.47265 14.78936,-16.29232 35.47458,0.7495 45.63689,13.63324 11.08594,12.42904 21.91316,33.6459 41.91941,25.85866 15.44797,-0.25083 30.76053,2.11785 38.30644,-15.26956 12.94844,-12.26049 29.58114,-33.49814 49.51863,-25.31725 15.14143,14.78032 23.40098,35.53589 30.24631,55.23997 4.55565,15.36852 4.6391,31.94493 3.28453,47.62379 9.36324,3.04253 19.5843,3.12362 29.33081,4.80945 4.13961,36.35364 -6.87221,74.41869 -29.06057,103.34533 6.1277,-6.57686 -11.08201,-8.1108 -10.42592,-13.41902 -3.13078,8.77758 6.94663,20.41165 8.2868,16.46805 -0.56187,16.28936 -17.32423,27.53773 -29.07955,37.58785 -29.98728,22.19243 -69.09541,32.24465 -106.09075,28.58122 z m 45.894,-11.81034 c 33.41589,-6.42529 64.06763,-23.96926 87.606,-48.31107 -8.2548,8.75218 -16.68941,10.99135 -19.0901,-3.25812 -6.74621,-5.75317 4.24595,-28.93739 -7.93245,-14.80685 -12.56916,8.84191 6.92924,-12.74278 9.10243,-19.35578 10.01143,-17.42491 0.0574,-37.62462 -13.95795,-49.29114 -14.6216,-12.15862 17.42439,7.41163 7.0361,-3.83503 -3.38412,-4.97478 -17.07811,-12.87071 -3.49938,-12.93686 13.39611,-15.67737 9.03047,-38.51699 7.49334,-57.46672 -2.84393,-16.45555 -4.77538,-34.52556 -15.35747,-48.05543 -16.01154,-1.14314 -26.08547,16.38647 -36.61497,26.39715 -5.70545,5.13719 -20.49899,28.37559 -21.75329,21.0369 3.13269,-11.75191 -28.76493,7.02326 -18.04711,-7.35592 -10.84777,9.86053 -22.17174,2.09875 -33.04263,1.86322 -2.31736,12.36385 -11.29846,-13.13312 -16.5778,-17.49645 -8.72025,-8.90768 -19.97374,-34.20851 -33.96144,-25.78405 -11.69397,23.33334 -16.11056,50.56447 -13.69042,76.47881 -0.0602,5.91781 4.34322,13.08008 8.02259,9.96256 -4.67811,10.89105 -12.41488,20.03503 -20.60515,28.45263 22.15351,-6.46272 -6.75848,11.20914 -11.32612,18.11668 -5.55558,6.00011 11.23537,1.21603 0.92918,8.09759 -9.85267,8.82172 0.90225,10.96263 8.1364,5.52234 -4.41896,7.2779 -9.93121,27.69907 -1.30508,20.25982 0.44192,16.24753 13.24689,28.89821 26.07394,36.28908 -10.01689,-1.25504 -15.28697,-1.68273 -5.9142,7.18994 3.70419,9.09923 23.65171,23.14135 23.12198,22.88781 -12.68887,4.52612 -29.20638,-24.63453 -27.10977,-1.62665 -9.20938,-6.00136 -15.0215,-10.95439 -3.62102,-1.07286 31.42731,22.76742 71.23535,34.48211 110.0246,30.09948 5.31264,-0.40711 10.63645,-0.91452 15.85979,-2.00108 z m -79.394,-56.9057 c -18.73446,-5.59419 -23.41478,-28.49195 -31.70439,-43.75488 0.73828,-22.35343 4.08716,18.31153 19.32861,13.3197 10.72041,3.69956 18.56946,-8.44963 4.11462,-10.47485 -18.38015,-9.06725 -5.72431,-34.51184 13.30082,-25.76665 19.67,-4.41443 29.38373,22.02008 8.34506,27.51407 -25.0255,1.82433 5.10704,22.06779 16.86359,15.14318 12.34376,1.24347 30.75969,-17.67713 36.73091,-14.00618 -13.61842,14.55795 -29.70193,27.50096 -47.61646,36.34545 -6.2007,1.87716 -12.93269,2.79172 -19.36276,1.68016 z m 18.05419,-9.22941 c 21.08959,-9.895 -13.07749,-8.33914 -20.416,-11.59804 -26.4844,-5.24126 10.83882,26.8471 20.416,11.59804 z m 36.94581,-67.39043 c -25.50005,-11.63653 30.4889,-32.64656 20.12991,-2.60629 -4.12977,6.69198 -14.22499,6.53985 -20.12991,2.60629 z m 6.91801,-10.3468 c -0.82071,-13.3392 -12.1627,7.55602 0,0 z m -83.17504,3.76276 c -13.79522,-8.61428 4.31712,-27.04557 15.39702,-18.85616 13.6067,12.03589 -1.44836,24.55833 -15.39702,18.85616 z m 7.75703,-12.30697 c -5.2255,-11.64565 -10.19028,9.41998 0,0 z m -42.5,116.01345 c -6.02723,-7.2088 -1.92276,0.67135 0,0 z m 249.36364,-91.2588 c 13.806,-15.02329 -17.50241,-28.77029 -15.20919,-6.0755 0.688,7.20314 9.8789,12.01227 15.20919,6.0755 z"
id="path262"
sodipodi:nodetypes="ssscsssssssssscscsssssssscssssssssssscssssssssssscsssssssssssssssscssssssssssssssssssssssssssss" />
<path
style="fill:#98b322"
d="m 509.53513,538.91636 c -11.96373,-4.91645 8.89339,-3.88826 12.76305,-6.86225 9.28643,-1.97818 -6.4996,-8.86225 -5.56764,-12.40041 5.30229,-0.44489 21.32889,0.97664 9.25743,-4.06036 -4.4293,-2.38922 -8.90334,-4.6942 -13.35565,-7.04008 14.22958,-1.11906 29.14185,-5.34748 39.25328,-15.90169 2.68838,-4.49776 -4.08229,-15.62608 5.03556,-9.22194 7.93306,-6.96815 2.94935,-21.58829 -1.33828,-30.24933 4.40924,-0.25594 16.57977,4.55985 7.33655,-4.04687 -11.00538,-12.31768 -23.14999,-27.52514 -40.87556,-28.89523 -12.38683,-0.11681 -24.80253,7.9637 -36.90946,1.50561 -13.66459,6.45135 -15.89413,-15.41822 -16.10693,-25.52605 0.11257,-17.90444 10.83888,-33.45475 20.92523,-47.40792 -3.05408,-0.24055 -14.13675,6.43308 -7.58956,-2.00266 5.14711,-6.58606 16.1968,-5.55188 24.24745,-6.48256 -0.64652,2.77294 -5.38496,13.38337 1.49882,5.24279 15.35654,-16.366 27.78739,-36.47005 47.56874,-47.96687 13.25414,-5.46069 15.39695,14.72588 18.71219,23.21422 4.97338,21.83679 8.88088,44.88811 4.653,67.17671 -0.42681,8.2555 -8.28775,16.55282 -13.7633,17.08103 3.79273,4.42442 20.53747,19.65551 5.40245,12.0655 -5.32651,-2.18699 -9.60486,-3.59981 -3.31377,1.55124 10.07734,9.32175 19.68413,21.27699 18.4153,35.87995 -0.32668,14.70676 -12.03558,25.33807 -18.87369,37.35808 5.58909,-1.69527 15.58549,-15.93947 11.4519,-2.55177 -3.60074,10.062 11.10418,20.4953 5.86292,28.05887 -22.26582,9.35137 -44.64925,20.52878 -69.03559,22.50306 -1.92036,-0.05 -3.84901,-0.34274 -5.65444,-1.02107 z m 65.78575,-29.48994 c 5.78966,-7.75443 -13.2439,10.9428 -2.23057,2.0827 l 1.25202,-1.10346 z m -68.81054,-89.5018 c 10.3928,-9.60021 -7.59416,-23.65065 -17.40017,-16.92149 -6.0022,5.20108 -14.16395,16.91183 -1.19983,17.82149 5.04579,3.34277 14.31037,4.11548 18.6,-0.9 z m 11.8433,-13.82251 c 4.8073,-13.20848 -17.62579,-19.46625 -25.78482,-10.4034 -8.24468,7.90366 12.43507,0.51199 15.14174,8.29731 2.90454,2.60721 7.25729,6.87958 10.64308,2.10609 z m 40.39101,-19.31318 c 5.78684,-9.84304 14.87824,-18.85981 14.28152,-31.17347 0.29281,-17.2393 -3.29381,-34.47275 -8.87177,-50.70971 -8.2269,-11.71842 -18.48254,9.20895 -24.65918,14.58319 -8.27896,11.14993 -15.97671,24.13537 -16.43162,38.33565 5.81105,9.59348 20.2801,2.52537 22.63335,-7.59849 1.91751,-11.39629 10.56353,-19.72811 14.71934,-30.52016 1.40753,-4.75338 2.7467,-8.65513 3.19367,-1.43954 3.03818,19.50172 2.73205,40.2994 -6.23148,58.32147 -1.42557,1.68784 -2.84962,18.49044 1.36617,10.20106 z m -132.57252,30.28569 c 8.9312,-6.02734 7.48296,-23.09684 -5.07505,-23.64993 -7.30021,-0.58972 -13.70802,6.3178 -14.80605,12.7258 1.80508,5.41863 11.08041,12.34728 0.43734,7.07322 -8.78538,-4.63851 -18.9703,-5.08549 -28.34587,-2.82766 -0.78195,-1.20615 5.95898,-6.38547 7.64726,-9.1958 3.17899,-4.75979 14.14408,-17.04143 10.66391,-19.05896 -8.21587,0.49898 -7.15269,-16.45349 -7.61833,-23.35234 0.38694,-1.92842 0.568,-15.11456 1.50148,-11.0615 2.18799,9.93834 4.54838,20.74835 11.16901,28.59085 7.73714,-10.57308 -5.25092,-24.23902 -0.95866,-36.88296 1.19051,-8.36811 0.86918,-24.11671 5.29194,-27.6918 3.79977,11.14223 8.72133,21.86587 12.7256,32.92008 1.469,13.02823 21.40974,10.49286 17.83409,-2.39696 -3.32571,-15.92393 -12.20464,-30.4869 -22.81624,-42.64305 -1.61447,-5.5579 -16.04555,-2.78383 -6.17414,-7.11693 11.4822,2.4981 18.13579,14.1012 25.27589,22.56913 6.89239,9.91602 14.82304,19.48443 19.27939,30.80078 2.47751,-2.96246 1.89049,-12.09704 8.49383,-6.61144 6.65112,0.58151 16.26357,5.55912 6.89945,11.05947 0.73719,-14.80175 -8.75677,15.1836 -10.62746,8.56225 -0.72867,-12.69039 -5.40734,8.91481 -6.08907,12.65018 -2.18787,18.03406 -8.95803,36.69358 -24.11683,47.78757 l -0.516,-0.66094 z m -14.20337,-23.32605 c 5.77671,-2.92338 22.69464,0.31989 10.56863,-7.78429 -7.14341,-6.64682 -23.87398,-0.74632 -20.72199,9.89207 3.22405,1.98101 7.17289,-0.8495 10.15336,-2.10778 z m 3.70324,21.86879 c 8.31993,-0.40006 2.55621,1.04523 0,0 z"
id="path264"
sodipodi:nodetypes="ssssscssscsssssssssssssscsssssssssssssssssscsssssssssssssssssssssssssssscssssssss" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 10 KiB

+188
View File
@@ -0,0 +1,188 @@
.shell {
display: flex;
height: 100vh;
background: var(--color-bg);
color: var(--color-text);
font-family: var(--font-family);
overflow: hidden;
}
.header {
display: flex;
align-items: center;
justify-content: space-between;
width: 100%;
}
.brand {
height: 28px;
width: auto;
display: block;
background: #E6EDEA;
border-radius: 6px;
padding: 3px 6px;
}
.nav {
display: flex;
flex-direction: column;
gap: 2px;
padding: var(--space-2) 0;
}
.sideContent {
display: flex;
flex-direction: column;
min-height: 100%;
}
.footerButtons {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: var(--space-1);
}
.sideFooter {
margin-top: auto;
padding: var(--space-3) var(--space-2) var(--space-2);
border-top: var(--border-width) solid var(--color-border);
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: space-between;
gap: var(--space-2);
}
.version {
color: var(--color-text-muted);
font-size: var(--font-size-xs);
white-space: nowrap;
}
.versionLink {
color: inherit;
text-decoration: none;
}
.versionLink:hover,
.versionLink:focus-visible {
text-decoration: underline;
}
.signOut,
.expandForSignOut {
display: inline-flex;
align-items: center;
justify-content: center;
width: 44px;
height: 44px;
padding: 0;
color: var(--color-text-muted);
background: transparent;
border: var(--border-width) solid var(--color-border);
border-radius: var(--radius-md);
cursor: pointer;
}
.signOut:hover,
.expandForSignOut:hover {
color: var(--color-text);
background: var(--color-secondary);
}
.signOut:focus-visible,
.expandForSignOut:focus-visible,
.logoutFailure button:focus-visible {
outline: 2px solid var(--color-primary-text);
outline-offset: 2px;
}
.signOut:disabled {
opacity: 0.55;
cursor: wait;
}
.logoutFailure {
display: flex;
align-items: center;
gap: var(--space-2);
padding: var(--space-2);
color: var(--color-error-fg);
background: var(--color-error-bg);
border-radius: var(--radius-sm);
font-size: var(--font-size-xs);
}
.logoutFailure button {
min-height: 32px;
color: inherit;
background: transparent;
border: var(--border-width) solid currentColor;
border-radius: var(--radius-sm);
cursor: pointer;
}
.expandForSignOut {
position: fixed;
left: 8px;
bottom: 12px;
z-index: 20;
background: var(--color-bg-subtle);
box-shadow: var(--shadow-sm);
}
.navItem {
display: flex;
align-items: center;
gap: var(--space-2);
width: 100%;
padding: var(--space-2) var(--space-3);
background: none;
border: none;
border-radius: var(--radius-md);
color: var(--color-text);
font-size: var(--font-size-sm);
font-family: var(--font-family);
text-align: left;
cursor: pointer;
text-decoration: none;
transition: background 120ms ease, color 120ms ease;
}
.navIcon {
flex-shrink: 0;
opacity: 0.65;
transition: opacity 120ms ease;
}
.navItem:hover .navIcon,
.navItemActive .navIcon {
opacity: 1;
}
.navItem:hover {
background: var(--color-bg-subtle);
}
.navItemActive {
background: var(--color-secondary);
color: var(--color-secondary-fg);
font-weight: 600;
}
.navItemActive:hover {
background: var(--color-secondary-hover);
}
.navSeparator {
height: var(--border-width);
background: var(--color-border);
margin: var(--space-2) var(--space-2);
}
.main {
flex: 1;
overflow-y: auto;
padding: var(--space-6);
}
+285
View File
@@ -0,0 +1,285 @@
import { lazy, Suspense, useEffect, useRef, useState } from 'react';
import { LogOut } from 'lucide-react';
import { NavLink, Navigate, Route, Routes, useLocation, useSearchParams } from 'react-router-dom';
import { useTranslation } from 'react-i18next';
import { Globe, Monitor, ClipboardList, Activity, KeyRound, Braces, Upload } from 'lucide-react';
import type { LucideIcon } from 'lucide-react';
import styles from './App.module.css';
import { NotificationToggle, SidePanel, ThemeSwitcher } from './ui';
import liqaLogo from './assets/liqa.svg';
import { useManifest } from './hooks/useManifest';
import { useRunNotifications } from './hooks/useRunNotifications';
import { useAuth } from './auth/useAuth';
import { safeReturnTo } from './auth/returnTo';
import { AuthStatusPage } from './pages/auth/AuthStatusPage';
import { LoginPage } from './pages/auth/LoginPage';
import { SignOutControl } from './pages/auth/SignOutControl';
const EnvironmentsPage = lazy(() =>
import('./pages/environment/EnvironmentsPage').then((m) => ({ default: m.EnvironmentsPage })),
);
const EnvironmentDetailPage = lazy(() =>
import('./pages/environment/EnvironmentDetailPage').then((m) => ({
default: m.EnvironmentDetailPage,
})),
);
const CreateEnvironmentPage = lazy(() =>
import('./pages/environment/CreateEnvironmentPage').then((m) => ({
default: m.CreateEnvironmentPage,
})),
);
const EditEnvironmentPage = lazy(() =>
import('./pages/environment/EditEnvironmentPage').then((m) => ({
default: m.EditEnvironmentPage,
})),
);
const SessionsPage = lazy(() =>
import('./pages/session/SessionsPage').then((m) => ({ default: m.SessionsPage })),
);
const SessionDetailPage = lazy(() =>
import('./pages/session/SessionDetailPage').then((m) => ({ default: m.SessionDetailPage })),
);
const ScenariosPage = lazy(() =>
import('./pages/scenario/ScenariosPage').then((m) => ({ default: m.ScenariosPage })),
);
const ScenarioDetailPage = lazy(() =>
import('./pages/scenario/ScenarioDetailPage').then((m) => ({ default: m.ScenarioDetailPage })),
);
const CreateScenarioPage = lazy(() =>
import('./pages/scenario/CreateScenarioPage').then((m) => ({ default: m.CreateScenarioPage })),
);
const EditScenarioPage = lazy(() =>
import('./pages/scenario/EditScenarioPage').then((m) => ({ default: m.EditScenarioPage })),
);
const CreateStepPage = lazy(() =>
import('./pages/scenario/CreateStepPage').then((m) => ({ default: m.CreateStepPage })),
);
const EditStepPage = lazy(() =>
import('./pages/scenario/EditStepPage').then((m) => ({ default: m.EditStepPage })),
);
const RunsPage = lazy(() => import('./pages/run/RunsPage').then((m) => ({ default: m.RunsPage })));
const RunDetailPage = lazy(() =>
import('./pages/run/RunDetailPage').then((m) => ({ default: m.RunDetailPage })),
);
const AllRunsPage = lazy(() =>
import('./pages/run/AllRunsPage').then((m) => ({ default: m.AllRunsPage })),
);
const CredentialsPage = lazy(() =>
import('./pages/credential/CredentialsPage').then((m) => ({ default: m.CredentialsPage })),
);
const CreateCredentialPage = lazy(() =>
import('./pages/credential/CreateCredentialPage').then((m) => ({
default: m.CreateCredentialPage,
})),
);
const EditCredentialPage = lazy(() =>
import('./pages/credential/EditCredentialPage').then((m) => ({ default: m.EditCredentialPage })),
);
const CredentialDetailPage = lazy(() =>
import('./pages/credential/CredentialDetailPage').then((m) => ({
default: m.CredentialDetailPage,
})),
);
const SnippetsPage = lazy(() =>
import('./pages/snippet/SnippetsPage').then((m) => ({ default: m.SnippetsPage })),
);
const CreateSnippetPage = lazy(() =>
import('./pages/snippet/CreateSnippetPage').then((m) => ({ default: m.CreateSnippetPage })),
);
const EditSnippetPage = lazy(() =>
import('./pages/snippet/EditSnippetPage').then((m) => ({ default: m.EditSnippetPage })),
);
const SnippetDetailPage = lazy(() =>
import('./pages/snippet/SnippetDetailPage').then((m) => ({ default: m.SnippetDetailPage })),
);
const ImportPage = lazy(() =>
import('./pages/import/ImportPage').then((m) => ({ default: m.ImportPage })),
);
const NAV: ({ path: string; labelKey: string; Icon: LucideIcon } | { separator: true })[] = [
{ path: '/runs', labelKey: 'nav.runs', Icon: Activity },
{ path: '/sessions', labelKey: 'nav.sessions', Icon: Monitor },
{ separator: true },
{ path: '/scenarios', labelKey: 'nav.scenarios', Icon: ClipboardList },
{ path: '/snippets', labelKey: 'nav.snippets', Icon: Braces },
{ path: '/credentials', labelKey: 'nav.credentials', Icon: KeyRound },
{ path: '/environments', labelKey: 'nav.environments', Icon: Globe },
{ separator: true },
{ path: '/import', labelKey: 'nav.import', Icon: Upload },
];
export default function App() {
const { t } = useTranslation();
const auth = useAuth();
const location = useLocation();
const [search] = useSearchParams();
const [collapsed, setCollapsed] = useState(false);
const [loggingOut, setLoggingOut] = useState(false);
const [logoutFailed, setLogoutFailed] = useState(false);
const focusSignOut = useRef(false);
const { version } = useManifest();
const notifications = useRunNotifications();
useEffect(() => {
if (!collapsed && focusSignOut.current) {
focusSignOut.current = false;
document.querySelector<HTMLButtonElement>('[data-sign-out="true"]')?.focus();
}
}, [collapsed]);
async function signOut() {
if (loggingOut) return;
setLoggingOut(true);
setLogoutFailed(false);
try {
await auth.logout();
} catch {
setLogoutFailed(true);
} finally {
setLoggingOut(false);
}
}
const onLogin = location.pathname === '/login';
if (auth.enabled && (auth.status === 'checking' || auth.status === 'disabled')) {
return <AuthStatusPage />;
}
if (auth.enabled && auth.status === 'error') {
return <AuthStatusPage failed onRetry={() => void auth.checkSession()} />;
}
if (!auth.enabled && onLogin) return <Navigate to="/scenarios" replace />;
if (auth.enabled && auth.status === 'authenticated' && onLogin) {
return <Navigate to={safeReturnTo(search.get('returnTo')) ?? '/scenarios'} replace />;
}
if (auth.enabled && auth.status === 'unauthenticated' && !onLogin) {
const returnTo =
safeReturnTo(`${location.pathname}${location.search}${location.hash}`) ?? '/scenarios';
return <Navigate to={`/login?returnTo=${encodeURIComponent(returnTo)}`} replace />;
}
if (onLogin) return <LoginPage />;
return (
<div className={styles.shell}>
<SidePanel
collapsed={collapsed}
onCollapsedChange={setCollapsed}
header={
<div className={styles.header}>
<img src={liqaLogo} alt="Liqa" className={styles.brand} />
</div>
}
width={220}
>
<div className={styles.sideContent}>
<nav className={styles.nav}>
{NAV.map((item, index) =>
'separator' in item ? (
<div key={`separator-${index}`} className={styles.navSeparator} />
) : (
<NavLink
key={item.path}
to={item.path}
className={({ isActive }) =>
[styles.navItem, isActive ? styles.navItemActive : ''].filter(Boolean).join(' ')
}
>
<item.Icon size={16} className={styles.navIcon} aria-hidden="true" />
{t(item.labelKey)}
</NavLink>
),
)}
</nav>
<div className={styles.sideFooter}>
<div className={styles.footerButtons}>
<ThemeSwitcher />
{notifications && (
<NotificationToggle state={notifications.state} onToggle={notifications.toggle} />
)}
{auth.enabled && auth.status === 'authenticated' && (
<SignOutControl
pending={loggingOut}
failed={logoutFailed}
onSignOut={() => void signOut()}
/>
)}
</div>
<div className={styles.version}>
<span
title={
version !== __APP_VERSION__
? t('nav.version_mismatch', { client: __APP_VERSION__ })
: undefined
}
>
v{version}
</span>{' '}
·{' '}
<a
className={styles.versionLink}
href="/licenses.txt"
target="_blank"
rel="noopener noreferrer"
>
{t('nav.licenses')}
</a>
</div>
</div>
</div>
</SidePanel>
{collapsed && auth.enabled && auth.status === 'authenticated' && (
<button
type="button"
className={styles.expandForSignOut}
aria-label={t('auth.show_sign_out')}
title={t('auth.show_sign_out')}
onClick={() => {
focusSignOut.current = true;
setCollapsed(false);
}}
>
<LogOut size={18} aria-hidden="true" />
</button>
)}
<main className={styles.main}>
<Suspense fallback={<p>Loading…</p>}>
<Routes>
<Route index element={<Navigate to="/scenarios" replace />} />
<Route path="/environments" element={<EnvironmentsPage />} />
<Route path="/environments/new" element={<CreateEnvironmentPage />} />
<Route path="/environments/:id/edit" element={<EditEnvironmentPage />} />
<Route path="/environments/:id" element={<EnvironmentDetailPage />} />
<Route path="/sessions" element={<SessionsPage />} />
<Route path="/sessions/:id" element={<SessionDetailPage />} />
<Route path="/scenarios" element={<ScenariosPage />} />
<Route path="/scenarios/new" element={<CreateScenarioPage />} />
<Route path="/scenarios/:id/edit" element={<EditScenarioPage />} />
<Route path="/scenarios/:id/steps/new" element={<CreateStepPage />} />
<Route path="/scenarios/:id/steps/:stepId/edit" element={<EditStepPage />} />
<Route path="/scenarios/:id/runs" element={<RunsPage />} />
<Route path="/scenarios/:id/runs/:runId" element={<RunDetailPage />} />
<Route path="/scenarios/:id" element={<ScenarioDetailPage />} />
<Route path="/credentials" element={<CredentialsPage />} />
<Route path="/credentials/new" element={<CreateCredentialPage />} />
<Route path="/credentials/:id/edit" element={<EditCredentialPage />} />
<Route path="/credentials/:id" element={<CredentialDetailPage />} />
<Route path="/snippets" element={<SnippetsPage />} />
<Route path="/import" element={<ImportPage />} />
<Route path="/snippets/new" element={<CreateSnippetPage />} />
<Route path="/snippets/:id/edit" element={<EditSnippetPage />} />
<Route path="/snippets/:id" element={<SnippetDetailPage />} />
<Route path="/runs" element={<AllRunsPage />} />
<Route path="*" element={<Navigate to="/scenarios" replace />} />
</Routes>
</Suspense>
</main>
</div>
);
}
+477
View File
@@ -0,0 +1,477 @@
import type {
PaginatedResponse,
Credential,
Environment,
FileMetadata,
FileListResponse,
ImportResult,
RunDefaults,
ScenarioCredential,
Session,
Scenario,
ScenarioRun,
ScenarioRunDetail,
ScenarioRunStep,
ScenarioStep,
ScenarioVersion,
Snippet,
SnippetVersion,
TraceMode,
UsedSnippet,
} from './types';
import { emitApiErrorToast } from '../lib/toast-events';
// API calls are versioned under /api/v1 by default.
// Set VITE_API_URL (for example, http://localhost:13000/api/v1) to use a different origin.
const BASE_URL = ((import.meta.env.VITE_API_URL as string | undefined) ?? '/api/v1').replace(
/\/$/,
'',
);
/** URL of the server-sent events stream of run lifecycle events. */
export const RUN_EVENTS_URL = `${BASE_URL}/scenarios/runs/events`;
export class ApiError extends Error {
constructor(
public readonly status: number,
message: string,
) {
super(message);
this.name = 'ApiError';
}
}
interface RequestOptions {
quietErrors?: boolean;
}
async function request<T>(
path: string,
init?: RequestInit,
options: RequestOptions = {},
): Promise<T> {
let res: Response;
try {
const headers = new Headers(init?.headers);
if (!(init?.body instanceof FormData) && !headers.has('Content-Type')) {
headers.set('Content-Type', 'application/json');
}
res = await fetch(`${BASE_URL}${path}`, {
...init,
credentials: init?.credentials ?? 'include',
headers,
});
} catch (err) {
const message = (err as Error).message || 'Network request failed';
if (!options.quietErrors) emitApiErrorToast(message);
throw new Error(message);
}
if (!res.ok) {
const text = await res.text().catch(() => res.statusText);
const message = `${res.status} ${text}`;
const error = new ApiError(res.status, message);
if (res.status === 401 && !path.startsWith('/auth/')) {
const event = new CustomEvent('liqa:unauthorized', { cancelable: true });
const handled = !window.dispatchEvent(event);
if (!handled && !options.quietErrors) emitApiErrorToast(message);
} else if (!options.quietErrors && !path.startsWith('/auth/')) {
emitApiErrorToast(message);
}
throw error;
}
const contentLength = res.headers.get('content-length');
if (res.status === 204 || contentLength === '0') return undefined as T;
const contentType = res.headers.get('content-type')?.toLowerCase() ?? '';
const text = await res.text();
if (!text) return undefined as T;
if (contentType.includes('application/json')) {
return JSON.parse(text) as T;
}
return text as T;
}
export interface AuthUser {
id: string;
username: string;
createdAt: string;
updatedAt: string;
}
export const auth = {
async login(username: string, password: string): Promise<AuthUser> {
const response = await request<{ user: AuthUser }>(
'/auth/login',
{ method: 'POST', body: JSON.stringify({ username, password }) },
{ quietErrors: true },
);
return response.user;
},
me(): Promise<AuthUser> {
return request('/auth/me', undefined, { quietErrors: true });
},
logout(): Promise<void> {
return request('/auth/logout', { method: 'POST' }, { quietErrors: true });
},
};
// ── Credentials ───────────────────────────────────────────────────────────────
export const credentials = {
list(page = 1, limit = 50): Promise<PaginatedResponse<Credential>> {
return request(`/credentials?page=${page}&limit=${limit}`);
},
get(id: string): Promise<Credential> {
return request(`/credentials/${id}`);
},
create(name: string, data?: string): Promise<Credential> {
return request('/credentials', {
method: 'POST',
body: JSON.stringify({ name, data }),
});
},
update(id: string, patch: Partial<Pick<Credential, 'name' | 'data'>>): Promise<Credential> {
return request(`/credentials/${id}`, {
method: 'PATCH',
body: JSON.stringify(patch),
});
},
remove(id: string): Promise<void> {
return request(`/credentials/${id}`, { method: 'DELETE' });
},
exportCredential(id: string): Promise<unknown> {
return request(`/credentials/${id}/export`);
},
};
// ── Snippets ──────────────────────────────────────────────────────────────────
export const snippets = {
list(page = 1, limit = 50): Promise<PaginatedResponse<Snippet>> {
return request(`/snippets?page=${page}&limit=${limit}`);
},
get(id: string): Promise<Snippet> {
return request(`/snippets/${id}`);
},
create(
payload: Pick<Snippet, 'alias' | 'title' | 'code'> & { description?: string },
): Promise<Snippet> {
return request('/snippets', {
method: 'POST',
body: JSON.stringify(payload),
});
},
update(
id: string,
patch: Partial<Pick<Snippet, 'alias' | 'title' | 'description' | 'code'>>,
): Promise<Snippet> {
return request(`/snippets/${id}`, {
method: 'PATCH',
body: JSON.stringify(patch),
});
},
remove(id: string): Promise<void> {
return request(`/snippets/${id}`, { method: 'DELETE' });
},
versions(id: string): Promise<SnippetVersion[]> {
return request(`/snippets/${id}/versions`);
},
exportSnippet(id: string, version?: number): Promise<unknown> {
const query = version === undefined ? '' : `?version=${version}`;
return request(`/snippets/${id}/export${query}`);
},
};
// ── Environments ──────────────────────────────────────────────────────────────
export const environments = {
list(page = 1, limit = 50): Promise<PaginatedResponse<Environment>> {
return request(`/environments?page=${page}&limit=${limit}`);
},
get(id: string): Promise<Environment> {
return request(`/environments/${id}`);
},
create(name: string, data: Environment['data'], description?: string): Promise<Environment> {
return request('/environments', {
method: 'POST',
body: JSON.stringify({ name, description, data }),
});
},
update(
id: string,
patch: Partial<Pick<Environment, 'name' | 'description' | 'data'>>,
): Promise<Environment> {
return request(`/environments/${id}`, {
method: 'PATCH',
body: JSON.stringify(patch),
});
},
remove(id: string): Promise<void> {
return request(`/environments/${id}`, { method: 'DELETE' });
},
exportEnvironment(id: string): Promise<unknown> {
return request(`/environments/${id}/export`);
},
};
// ── Sessions ──────────────────────────────────────────────────────────────────
export const sessions = {
list(
page = 1,
limit = 50,
orderBy = 'id',
orderDir: 'ASC' | 'DESC' = 'DESC',
): Promise<PaginatedResponse<Session>> {
return request(`/sessions?page=${page}&limit=${limit}&orderBy=${orderBy}&orderDir=${orderDir}`);
},
get(id: string): Promise<Session> {
return request(`/sessions/${id}`);
},
remove(id: string): Promise<void> {
return request(`/sessions/${id}`, { method: 'DELETE' });
},
};
// ── Scenarios ─────────────────────────────────────────────────────────────────
export const scenarios = {
list(
page = 1,
limit = 50,
orderBy = 'updatedAt',
orderDir: 'ASC' | 'DESC' = 'DESC',
): Promise<PaginatedResponse<Scenario>> {
return request(
`/scenarios?page=${page}&limit=${limit}&orderBy=${orderBy}&orderDir=${orderDir}`,
);
},
get(id: string): Promise<Scenario & { steps: ScenarioStep[] }> {
return request(`/scenarios/${id}`);
},
create(name: string, description?: string, environmentId?: string): Promise<Scenario> {
return request('/scenarios', {
method: 'POST',
body: JSON.stringify({ name, description, environmentId }),
});
},
update(
id: string,
patch: Partial<Pick<Scenario, 'name' | 'description' | 'environmentId' | 'timeoutSeconds'>>,
): Promise<Scenario> {
return request(`/scenarios/${id}`, {
method: 'PATCH',
body: JSON.stringify(patch),
});
},
remove(id: string): Promise<void> {
return request(`/scenarios/${id}`, { method: 'DELETE' });
},
run(
id: string,
environmentId: string,
saveSession?: boolean,
traceMode?: TraceMode,
/** Scenario version to run; omit for the latest. */
version?: number,
): Promise<ScenarioRun> {
return request(`/scenarios/${id}/run`, {
method: 'POST',
body: JSON.stringify({ environmentId, saveSession, traceMode, version }),
});
},
versions(id: string): Promise<ScenarioVersion[]> {
return request(`/scenarios/${id}/versions`);
},
runDefaults(): Promise<RunDefaults> {
return request('/scenarios/run-defaults');
},
getRun(scenarioId: string, runId: string): Promise<ScenarioRunDetail> {
return request(`/scenarios/${scenarioId}/run/${runId}`);
},
waitForRun(scenarioId: string, runId: string): Promise<ScenarioRunDetail> {
return request(`/scenarios/${scenarioId}/run/${runId}/wait`, { method: 'POST' });
},
listRuns(
scenarioId: string,
page = 1,
limit = 20,
): Promise<PaginatedResponse<ScenarioRun & { stepRuns: ScenarioRunStep[] }>> {
return request(`/scenarios/${scenarioId}/runs?page=${page}&limit=${limit}`);
},
exportScenario(
id: string,
options: {
includeEnvironment: boolean;
credentialIds: string[];
snippetIds: string[];
version?: number;
} = {
includeEnvironment: false,
credentialIds: [],
snippetIds: [],
},
): Promise<string> {
const params = new URLSearchParams();
params.set('includeEnvironment', String(options.includeEnvironment));
if (options.version !== undefined) {
params.set('version', String(options.version));
}
for (const cid of options.credentialIds) {
params.append('credentialIds', cid);
}
for (const sid of options.snippetIds) {
params.append('snippetIds', sid);
}
return request(`/scenarios/${id}/export?${params.toString()}`);
},
exportE2eTestUrl(id: string, version?: number): string {
const query = version === undefined ? '' : `?version=${version}`;
return `${BASE_URL}/scenarios/${id}/export-e2e${query}`;
},
usedSnippets(id: string): Promise<UsedSnippet[]> {
return request(`/scenarios/${id}/used-snippets`);
},
};
// ── Runs ─────────────────────────────────────────────────────────────────────
export const runs = {
listAll(
page = 1,
limit = 20,
status?: string,
orderBy = 'createdAt',
orderDir: 'ASC' | 'DESC' = 'DESC',
): Promise<PaginatedResponse<ScenarioRun & { scenario: { id: string; name: string } }>> {
const q = new URLSearchParams({ page: String(page), limit: String(limit), orderBy, orderDir });
if (status) q.set('status', status);
return request(`/scenarios/runs?${q}`);
},
list(
scenarioId: string,
page = 1,
limit = 20,
orderBy = 'createdAt',
orderDir: 'ASC' | 'DESC' = 'DESC',
): Promise<PaginatedResponse<ScenarioRun & { stepRuns: ScenarioRunStep[] }>> {
return request(
`/scenarios/${scenarioId}/runs?page=${page}&limit=${limit}&orderBy=${orderBy}&orderDir=${orderDir}`,
);
},
get(scenarioId: string, runId: string, q?: string): Promise<ScenarioRunDetail> {
const qs = q?.trim() ? `?q=${encodeURIComponent(q.trim())}` : '';
return request(`/scenarios/${scenarioId}/run/${runId}${qs}`);
},
exportLogs(scenarioId: string, runId: string, format: 'csv' | 'md'): Promise<string> {
return request(`/scenarios/${scenarioId}/run/${runId}/logs/export?format=${format}`);
},
};
// ── Scenario Credentials ──────────────────────────────────────────────────────
export const scenarioCredentials = {
list(scenarioId: string): Promise<ScenarioCredential[]> {
return request(`/scenarios/${scenarioId}/credentials`);
},
add(scenarioId: string, credentialId: string, alias: string): Promise<ScenarioCredential> {
return request(`/scenarios/${scenarioId}/credentials`, {
method: 'POST',
body: JSON.stringify({ credentialId, alias }),
});
},
remove(scenarioId: string, scCredId: string): Promise<void> {
return request(`/scenarios/${scenarioId}/credentials/${scCredId}`, {
method: 'DELETE',
});
},
};
// ── Scenario Steps ────────────────────────────────────────────────────────────
export interface CreateStepPayload {
title?: string;
execCode?: string;
timeoutSeconds?: number | null;
}
export interface UpdateStepPayload {
title?: string;
order?: number;
execCode?: string;
timeoutSeconds?: number | null;
}
export const steps = {
get(scenarioId: string, stepId: string): Promise<ScenarioStep> {
return request(`/scenarios/${scenarioId}/steps/${stepId}`);
},
create(scenarioId: string, payload: CreateStepPayload): Promise<ScenarioStep> {
return request(`/scenarios/${scenarioId}/steps`, {
method: 'POST',
body: JSON.stringify(payload),
});
},
update(scenarioId: string, stepId: string, payload: UpdateStepPayload): Promise<ScenarioStep> {
return request(`/scenarios/${scenarioId}/steps/${stepId}`, {
method: 'PATCH',
body: JSON.stringify(payload),
});
},
remove(scenarioId: string, stepId: string): Promise<void> {
return request(`/scenarios/${scenarioId}/steps/${stepId}`, { method: 'DELETE' });
},
};
// ── Scenario Files ────────────────────────────────────────────────────────
export const scenarioFiles = {
upload(scenarioId: string, file: File, expiresAt?: Date): Promise<FileMetadata> {
const form = new FormData();
form.append('file', file);
if (expiresAt) form.append('expiresAt', expiresAt.toISOString());
return request(`/scenarios/${scenarioId}/files`, {
method: 'POST',
body: form,
});
},
list(scenarioId: string, limit = 20, offset = 0): Promise<FileListResponse> {
return request(`/scenarios/${scenarioId}/files?limit=${limit}&offset=${offset}`);
},
/** Returns a URL that can be used as an <a href> for direct download. */
contentUrl(scenarioId: string, fileId: string): string {
return `${BASE_URL}/scenarios/${scenarioId}/files/${fileId}/content`;
},
};
// ── Run Files ─────────────────────────────────────────────────────────────
export const runFiles = {
list(scenarioId: string, runId: string, limit = 20, offset = 0): Promise<FileListResponse> {
return request(`/scenarios/${scenarioId}/runs/${runId}/files?limit=${limit}&offset=${offset}`);
},
/** Returns a URL that can be used as an <a href> for direct download. */
contentUrl(scenarioId: string, runId: string, fileId: string): string {
return `${BASE_URL}/scenarios/${scenarioId}/runs/${runId}/files/${fileId}/content`;
},
remove(scenarioId: string, runId: string, fileId: string): Promise<void> {
return request(`/scenarios/${scenarioId}/runs/${runId}/files/${fileId}`, {
method: 'DELETE',
});
},
};
// ── Import ────────────────────────────────────────────────────────────────────
export const imports = {
/**
* Imports any mix of environments, credentials, snippets and scenarios from
* YAML (`---`-separated documents, each one item or a list of items).
*/
yaml(text: string): Promise<ImportResult> {
return request('/import', {
method: 'POST',
headers: { 'Content-Type': 'application/yaml' },
body: text,
});
},
};
+2
View File
@@ -0,0 +1,2 @@
export * from './client';
export * from './types';
+246
View File
@@ -0,0 +1,246 @@
// ── Shared ────────────────────────────────────────────────────────────────────
export interface PaginatedResponse<T> {
data: T[];
total: number;
page: number;
limit: number;
}
// ── Environments ──────────────────────────────────────────────────────────────
export interface EnvironmentData {
[key: string]: string | undefined;
}
export interface Environment {
id: string;
name: string;
description?: string;
data: EnvironmentData;
createdAt: string;
updatedAt: string;
}
// ── Credentials ───────────────────────────────────────────────────────────────
export interface Credential {
id: string;
name: string;
data: string | null;
lastUsedAt: string | null;
createdAt: string;
updatedAt: string;
}
// ── Snippets ──────────────────────────────────────────────────────────────────
export interface Snippet {
id: string;
alias: string;
title: string;
description: string | null;
code: string;
/** Latest version number. */
version: number;
createdAt: string;
updatedAt: string;
}
export interface SnippetVersion {
id: string;
snippetId: string;
version: number;
alias: string;
title: string;
description: string | null;
code: string;
createdAt: string;
}
/** A snippet referenced by a scenario's steps. */
export interface UsedSnippet extends Snippet {
/** Version pinned via runSnippet('alias@N'), or null for the latest. */
pinnedVersion: number | null;
}
// ── Sessions ──────────────────────────────────────────────────────────────────
export type SessionStatus = 'open' | 'closed';
export interface Session {
id: string;
sessionName: string;
token: string;
status: SessionStatus;
lastUsedAt: string | null;
createdAt: string;
updatedAt: string;
}
// ── Scenarios ─────────────────────────────────────────────────────────────────
export interface ScenarioStep {
id: string;
scenarioId: string;
order: number;
title: string | null;
execCode: string | null;
timeoutSeconds: number | null;
createdAt: string;
updatedAt: string;
}
export interface ScenarioCredential {
id: string;
scenarioId: string;
credentialId: string;
alias: string;
credential: Credential;
createdAt: string;
}
export interface Scenario {
id: string;
name: string;
description?: string;
environmentId?: string | null;
timeoutSeconds?: number | null;
/** Latest version number. */
version: number;
environment?: Pick<Environment, 'id' | 'name'>;
steps?: ScenarioStep[];
scenarioCredentials?: ScenarioCredential[];
lastRunStatus?: ScenarioRunStatus | null;
lastRunAt?: string | null;
createdAt: string;
updatedAt: string;
}
export interface ScenarioStepSnapshot {
id: string | null;
order: number;
title: string | null;
execCode: string | null;
timeoutSeconds: number | null;
}
export interface ScenarioVersion {
id: string;
scenarioId: string;
version: number;
name: string;
description: string | null;
environmentId: string | null;
timeoutSeconds: number | null;
steps: ScenarioStepSnapshot[];
createdAt: string;
}
export type ScenarioRunStatus = 'pending' | 'in_progress' | 'pass' | 'fail';
export type TraceMode = 'on' | 'retain-on-failure' | 'off';
export interface RunDefaults {
traceMode: TraceMode;
}
export type RunStepStatus = 'waiting' | 'pending' | 'in_progress' | 'pass' | 'fail' | 'cancelled';
export type LogLevel = 'debug' | 'log' | 'warn' | 'error';
export interface ScenarioRun {
id: string;
scenarioId: string;
environmentId: string | null;
sessionId?: string | null;
saveSession: boolean;
traceMode: TraceMode | null;
/** Scenario version the run executes; null for runs created before versioning. */
scenarioVersion: number | null;
scenario?: Pick<Scenario, 'id' | 'name'>;
environment?: Pick<Environment, 'id' | 'name'>;
session?: { id: string; sessionName: string };
status: ScenarioRunStatus;
stepRuns?: ScenarioRunStep[];
createdAt: string;
updatedAt: string;
}
export interface ScenarioRunStep {
id: string;
runId: string;
/** Live step this run step came from; null once that step is deleted. */
scenarioStepId: string | null;
// Step content as of the run's scenario version
title: string | null;
execCode: string | null;
timeoutSeconds: number | null;
status: RunStepStatus;
order: number;
description: string | null;
output: string | null;
createdAt: string;
updatedAt: string;
}
export interface ScenarioRunLog {
id: string;
runId: string;
stepRunId: string | null;
level: LogLevel;
/** Where the message was generated, e.g. "step:2", "snippet:login", "assertion:pass". */
context: string | null;
message: string;
/** JSON payload attached to the message (e.g. a created file's metadata), as a raw string. */
data: string | null;
createdAt: string;
}
export interface ScenarioRunDetail extends ScenarioRun {
stepRuns: ScenarioRunStep[];
logs: ScenarioRunLog[];
}
// ── Files ─────────────────────────────────────────────────────────────────
export interface FileMetadata {
id: string;
name: string;
mimeType: string;
size: number;
sha256: string;
expiresAt: string | null;
createdAt: string;
}
export interface FileListResponse {
items: FileMetadata[];
total: number;
}
// ── Import ────────────────────────────────────────────────────────────────────
export type ImportKind = 'environment' | 'credential' | 'snippet' | 'scenario';
export interface ImportedItem {
kind: ImportKind;
id: string;
name: string;
/** Version stored for versioned kinds (snippets, scenarios). */
version?: number;
}
export interface ImportResult {
imported: ImportedItem[];
}
/** Run lifecycle event pushed by the server on `GET /scenarios/runs/events`. */
export interface RunEvent {
type: 'run.started' | 'run.finished';
runId: string;
scenarioId: string;
scenarioName: string;
status: ScenarioRunStatus;
at: string;
}
+62
View File
@@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
version="1.1"
id="svg92"
width="421.86172"
height="421.86172"
viewBox="0 0 421.86173 421.86172"
sodipodi:docname="liqa-mini.svg"
inkscape:version="1.2.2 (b0a8486541, 2022-12-01)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<defs
id="defs96" />
<sodipodi:namedview
id="namedview94"
pagecolor="#ffffff"
bordercolor="#000000"
borderopacity="0.25"
inkscape:showpageshadow="false"
inkscape:pageopacity="0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1"
showgrid="false"
showborder="false"
borderlayer="false"
shape-rendering="auto"
inkscape:zoom="0.60813025"
inkscape:cx="-51.798114"
inkscape:cy="-76.463882"
inkscape:window-width="2544"
inkscape:window-height="1355"
inkscape:window-x="20"
inkscape:window-y="20"
inkscape:window-maximized="0"
inkscape:current-layer="g98" />
<g
inkscape:groupmode="layer"
inkscape:label="Image"
id="g98"
transform="translate(-270.03557,-210.1151)">
<circle
style="fill:#e6edea;fill-opacity:1;stroke-width:0.926933"
id="path331"
cx="480.96643"
cy="421.04596"
r="210.93086" />
<path
style="fill:#39196b"
d="m 453.91034,593.79867 c -34.08673,-5.09427 -70.45402,-12.61452 -97.32495,-35.64384 -9.91285,-8.49217 -10.39503,-22.11427 -9.93686,-34.15838 -29.11758,-32.44273 -47.40043,-75.91137 -44.17964,-119.94221 -0.1082,-69.39624 50.26509,-133.2096 115.02861,-155.43859 65.94576,-23.97068 145.13988,-7.25178 194.05946,43.53493 33.75034,34.13894 52.73157,82.84814 48.59098,130.92571 -2.05053,36.83319 -19.00255,72.10194 -42.95534,99.74833 0.59009,14.27144 -0.67496,30.5898 -14.31879,38.78996 -29.95318,20.71235 -66.75963,30.54233 -102.80366,32.85732 -15.37106,0.58367 -30.83524,0.86962 -46.15981,-0.67323 z m 60,-25.40946 c 63.80512,-11.608 115.95832,-65.21248 129.69191,-127.96784 13.52875,-65.57348 -19.88327,-136.69388 -77.86044,-169.61945 -62.09585,-37.00081 -148.54942,-29.25016 -200.28124,22.40983 -39.98962,37.54618 -58.68926,96.3072 -45.60991,149.85388 15.1241,64.40785 71.02087,118.19945 137.36624,126.41525 18.58372,2.99672 38.14468,1.6814 56.69344,-1.09167 z m -47.5,-2.22871 c -38.4767,-4.43103 -77.04078,-22.16808 -101.12198,-53.12116 -3.19125,-10.71063 13.54949,-17.36711 -0.27511,-27.21578 -8.26021,-16.11409 -8.83665,-33.71408 -14.27833,-50.67086 -0.2541,-18.10794 20.10105,-26.35624 25.6663,-43.23729 6.35587,-8.46898 -3.9027,-20.33944 -0.39344,-30.42399 2.15786,-25.3474 4.36566,-52.60471 18.52953,-74.47265 14.78936,-16.29232 35.47458,0.7495 45.63689,13.63324 11.08594,12.42904 21.91316,33.6459 41.91941,25.85866 15.44797,-0.25083 30.76053,2.11785 38.30644,-15.26956 12.94844,-12.26049 29.58114,-33.49814 49.51863,-25.31725 15.14143,14.78032 23.40098,35.53589 30.24631,55.23997 4.55565,15.36852 4.6391,31.94493 3.28453,47.62379 9.36324,3.04253 19.5843,3.12362 29.33081,4.80945 4.13961,36.35364 -6.87221,74.41869 -29.06057,103.34533 6.1277,-6.57686 -11.08201,-8.1108 -10.42592,-13.41902 -3.13078,8.77758 6.94663,20.41165 8.2868,16.46805 -0.56187,16.28936 -17.32423,27.53773 -29.07955,37.58785 -29.98728,22.19243 -69.09541,32.24465 -106.09075,28.58122 z m 45.894,-11.81034 c 33.41589,-6.42529 64.06763,-23.96926 87.606,-48.31107 -8.2548,8.75218 -16.68941,10.99135 -19.0901,-3.25812 -6.74621,-5.75317 4.24595,-28.93739 -7.93245,-14.80685 -12.56916,8.84191 6.92924,-12.74278 9.10243,-19.35578 10.01143,-17.42491 0.0574,-37.62462 -13.95795,-49.29114 -14.6216,-12.15862 17.42439,7.41163 7.0361,-3.83503 -3.38412,-4.97478 -17.07811,-12.87071 -3.49938,-12.93686 13.39611,-15.67737 9.03047,-38.51699 7.49334,-57.46672 -2.84393,-16.45555 -4.77538,-34.52556 -15.35747,-48.05543 -16.01154,-1.14314 -26.08547,16.38647 -36.61497,26.39715 -5.70545,5.13719 -20.49899,28.37559 -21.75329,21.0369 3.13269,-11.75191 -28.76493,7.02326 -18.04711,-7.35592 -10.84777,9.86053 -22.17174,2.09875 -33.04263,1.86322 -2.31736,12.36385 -11.29846,-13.13312 -16.5778,-17.49645 -8.72025,-8.90768 -19.97374,-34.20851 -33.96144,-25.78405 -11.69397,23.33334 -16.11056,50.56447 -13.69042,76.47881 -0.0602,5.91781 4.34322,13.08008 8.02259,9.96256 -4.67811,10.89105 -12.41488,20.03503 -20.60515,28.45263 22.15351,-6.46272 -6.75848,11.20914 -11.32612,18.11668 -5.55558,6.00011 11.23537,1.21603 0.92918,8.09759 -9.85267,8.82172 0.90225,10.96263 8.1364,5.52234 -4.41896,7.2779 -9.93121,27.69907 -1.30508,20.25982 0.44192,16.24753 13.24689,28.89821 26.07394,36.28908 -10.01689,-1.25504 -15.28697,-1.68273 -5.9142,7.18994 3.70419,9.09923 23.65171,23.14135 23.12198,22.88781 -12.68887,4.52612 -29.20638,-24.63453 -27.10977,-1.62665 -9.20938,-6.00136 -15.0215,-10.95439 -3.62102,-1.07286 31.42731,22.76742 71.23535,34.48211 110.0246,30.09948 5.31264,-0.40711 10.63645,-0.91452 15.85979,-2.00108 z m -79.394,-56.9057 c -18.73446,-5.59419 -23.41478,-28.49195 -31.70439,-43.75488 0.73828,-22.35343 4.08716,18.31153 19.32861,13.3197 10.72041,3.69956 18.56946,-8.44963 4.11462,-10.47485 -18.38015,-9.06725 -5.72431,-34.51184 13.30082,-25.76665 19.67,-4.41443 29.38373,22.02008 8.34506,27.51407 -25.0255,1.82433 5.10704,22.06779 16.86359,15.14318 12.34376,1.24347 30.75969,-17.67713 36.73091,-14.00618 -13.61842,14.55795 -29.70193,27.50096 -47.61646,36.34545 -6.2007,1.87716 -12.93269,2.79172 -19.36276,1.68016 z m 18.05419,-9.22941 c 21.08959,-9.895 -13.07749,-8.33914 -20.416,-11.59804 -26.4844,-5.24126 10.83882,26.8471 20.416,11.59804 z m 36.94581,-67.39043 c -25.50005,-11.63653 30.4889,-32.64656 20.12991,-2.60629 -4.12977,6.69198 -14.22499,6.53985 -20.12991,2.60629 z m 6.91801,-10.3468 c -0.82071,-13.3392 -12.1627,7.55602 0,0 z m -83.17504,3.76276 c -13.79522,-8.61428 4.31712,-27.04557 15.39702,-18.85616 13.6067,12.03589 -1.44836,24.55833 -15.39702,18.85616 z m 7.75703,-12.30697 c -5.2255,-11.64565 -10.19028,9.41998 0,0 z m -42.5,116.01345 c -6.02723,-7.2088 -1.92276,0.67135 0,0 z m 249.36364,-91.2588 c 13.806,-15.02329 -17.50241,-28.77029 -15.20919,-6.0755 0.688,7.20314 9.8789,12.01227 15.20919,6.0755 z"
id="path262"
sodipodi:nodetypes="ssscsssssssssscscsssssssscssssssssssscssssssssssscsssssssssssssssscssssssssssssssssssssssssssss" />
<path
style="fill:#98b322"
d="m 509.53513,538.91636 c -11.96373,-4.91645 8.89339,-3.88826 12.76305,-6.86225 9.28643,-1.97818 -6.4996,-8.86225 -5.56764,-12.40041 5.30229,-0.44489 21.32889,0.97664 9.25743,-4.06036 -4.4293,-2.38922 -8.90334,-4.6942 -13.35565,-7.04008 14.22958,-1.11906 29.14185,-5.34748 39.25328,-15.90169 2.68838,-4.49776 -4.08229,-15.62608 5.03556,-9.22194 7.93306,-6.96815 2.94935,-21.58829 -1.33828,-30.24933 4.40924,-0.25594 16.57977,4.55985 7.33655,-4.04687 -11.00538,-12.31768 -23.14999,-27.52514 -40.87556,-28.89523 -12.38683,-0.11681 -24.80253,7.9637 -36.90946,1.50561 -13.66459,6.45135 -15.89413,-15.41822 -16.10693,-25.52605 0.11257,-17.90444 10.83888,-33.45475 20.92523,-47.40792 -3.05408,-0.24055 -14.13675,6.43308 -7.58956,-2.00266 5.14711,-6.58606 16.1968,-5.55188 24.24745,-6.48256 -0.64652,2.77294 -5.38496,13.38337 1.49882,5.24279 15.35654,-16.366 27.78739,-36.47005 47.56874,-47.96687 13.25414,-5.46069 15.39695,14.72588 18.71219,23.21422 4.97338,21.83679 8.88088,44.88811 4.653,67.17671 -0.42681,8.2555 -8.28775,16.55282 -13.7633,17.08103 3.79273,4.42442 20.53747,19.65551 5.40245,12.0655 -5.32651,-2.18699 -9.60486,-3.59981 -3.31377,1.55124 10.07734,9.32175 19.68413,21.27699 18.4153,35.87995 -0.32668,14.70676 -12.03558,25.33807 -18.87369,37.35808 5.58909,-1.69527 15.58549,-15.93947 11.4519,-2.55177 -3.60074,10.062 11.10418,20.4953 5.86292,28.05887 -22.26582,9.35137 -44.64925,20.52878 -69.03559,22.50306 -1.92036,-0.05 -3.84901,-0.34274 -5.65444,-1.02107 z m 65.78575,-29.48994 c 5.78966,-7.75443 -13.2439,10.9428 -2.23057,2.0827 l 1.25202,-1.10346 z m -68.81054,-89.5018 c 10.3928,-9.60021 -7.59416,-23.65065 -17.40017,-16.92149 -6.0022,5.20108 -14.16395,16.91183 -1.19983,17.82149 5.04579,3.34277 14.31037,4.11548 18.6,-0.9 z m 11.8433,-13.82251 c 4.8073,-13.20848 -17.62579,-19.46625 -25.78482,-10.4034 -8.24468,7.90366 12.43507,0.51199 15.14174,8.29731 2.90454,2.60721 7.25729,6.87958 10.64308,2.10609 z m 40.39101,-19.31318 c 5.78684,-9.84304 14.87824,-18.85981 14.28152,-31.17347 0.29281,-17.2393 -3.29381,-34.47275 -8.87177,-50.70971 -8.2269,-11.71842 -18.48254,9.20895 -24.65918,14.58319 -8.27896,11.14993 -15.97671,24.13537 -16.43162,38.33565 5.81105,9.59348 20.2801,2.52537 22.63335,-7.59849 1.91751,-11.39629 10.56353,-19.72811 14.71934,-30.52016 1.40753,-4.75338 2.7467,-8.65513 3.19367,-1.43954 3.03818,19.50172 2.73205,40.2994 -6.23148,58.32147 -1.42557,1.68784 -2.84962,18.49044 1.36617,10.20106 z m -132.57252,30.28569 c 8.9312,-6.02734 7.48296,-23.09684 -5.07505,-23.64993 -7.30021,-0.58972 -13.70802,6.3178 -14.80605,12.7258 1.80508,5.41863 11.08041,12.34728 0.43734,7.07322 -8.78538,-4.63851 -18.9703,-5.08549 -28.34587,-2.82766 -0.78195,-1.20615 5.95898,-6.38547 7.64726,-9.1958 3.17899,-4.75979 14.14408,-17.04143 10.66391,-19.05896 -8.21587,0.49898 -7.15269,-16.45349 -7.61833,-23.35234 0.38694,-1.92842 0.568,-15.11456 1.50148,-11.0615 2.18799,9.93834 4.54838,20.74835 11.16901,28.59085 7.73714,-10.57308 -5.25092,-24.23902 -0.95866,-36.88296 1.19051,-8.36811 0.86918,-24.11671 5.29194,-27.6918 3.79977,11.14223 8.72133,21.86587 12.7256,32.92008 1.469,13.02823 21.40974,10.49286 17.83409,-2.39696 -3.32571,-15.92393 -12.20464,-30.4869 -22.81624,-42.64305 -1.61447,-5.5579 -16.04555,-2.78383 -6.17414,-7.11693 11.4822,2.4981 18.13579,14.1012 25.27589,22.56913 6.89239,9.91602 14.82304,19.48443 19.27939,30.80078 2.47751,-2.96246 1.89049,-12.09704 8.49383,-6.61144 6.65112,0.58151 16.26357,5.55912 6.89945,11.05947 0.73719,-14.80175 -8.75677,15.1836 -10.62746,8.56225 -0.72867,-12.69039 -5.40734,8.91481 -6.08907,12.65018 -2.18787,18.03406 -8.95803,36.69358 -24.11683,47.78757 l -0.516,-0.66094 z m -14.20337,-23.32605 c 5.77671,-2.92338 22.69464,0.31989 10.56863,-7.78429 -7.14341,-6.64682 -23.87398,-0.74632 -20.72199,9.89207 3.22405,1.98101 7.17289,-0.8495 10.15336,-2.10778 z m 3.70324,21.86879 c 8.31993,-0.40006 2.55621,1.04523 0,0 z"
id="path264"
sodipodi:nodetypes="ssssscssscsssssssssssssscsssssssssssssssssscsssssssssssssssssssssssssssscssssssss" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 10 KiB

+67
View File
@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
version="1.1"
id="svg92"
width="982.44299"
height="421.86172"
viewBox="0 0 982.443 421.86172"
sodipodi:docname="liqa.svg"
inkscape:version="1.2.2 (b0a8486541, 2022-12-01)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<defs
id="defs96" />
<sodipodi:namedview
id="namedview94"
pagecolor="#ffffff"
bordercolor="#000000"
borderopacity="0.25"
inkscape:showpageshadow="false"
inkscape:pageopacity="0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1"
showgrid="false"
showborder="false"
borderlayer="false"
shape-rendering="auto"
inkscape:zoom="0.60813025"
inkscape:cx="-51.798114"
inkscape:cy="-76.463882"
inkscape:window-width="2544"
inkscape:window-height="1355"
inkscape:window-x="20"
inkscape:window-y="20"
inkscape:window-maximized="0"
inkscape:current-layer="g98" />
<g
inkscape:groupmode="layer"
inkscape:label="Image"
id="g98"
transform="translate(-270.03557,-210.1151)">
<circle
style="fill:#e6edea;fill-opacity:1;stroke-width:0.926933"
id="path331"
cx="480.96643"
cy="421.04596"
r="210.93086" />
<path
style="fill:#39196b"
d="m 453.91034,593.79867 c -34.08673,-5.09427 -70.45402,-12.61452 -97.32495,-35.64384 -9.91285,-8.49217 -10.39503,-22.11427 -9.93686,-34.15838 -29.11758,-32.44273 -47.40043,-75.91137 -44.17964,-119.94221 -0.1082,-69.39624 50.26509,-133.2096 115.02861,-155.43859 65.94576,-23.97068 145.13988,-7.25178 194.05946,43.53493 33.75034,34.13894 52.73157,82.84814 48.59098,130.92571 -2.05053,36.83319 -19.00255,72.10194 -42.95534,99.74833 0.59009,14.27144 -0.67496,30.5898 -14.31879,38.78996 -29.95318,20.71235 -66.75963,30.54233 -102.80366,32.85732 -15.37106,0.58367 -30.83524,0.86962 -46.15981,-0.67323 z m 60,-25.40946 c 63.80512,-11.608 115.95832,-65.21248 129.69191,-127.96784 13.52875,-65.57348 -19.88327,-136.69388 -77.86044,-169.61945 -62.09585,-37.00081 -148.54942,-29.25016 -200.28124,22.40983 -39.98962,37.54618 -58.68926,96.3072 -45.60991,149.85388 15.1241,64.40785 71.02087,118.19945 137.36624,126.41525 18.58372,2.99672 38.14468,1.6814 56.69344,-1.09167 z m -47.5,-2.22871 c -38.4767,-4.43103 -77.04078,-22.16808 -101.12198,-53.12116 -3.19125,-10.71063 13.54949,-17.36711 -0.27511,-27.21578 -8.26021,-16.11409 -8.83665,-33.71408 -14.27833,-50.67086 -0.2541,-18.10794 20.10105,-26.35624 25.6663,-43.23729 6.35587,-8.46898 -3.9027,-20.33944 -0.39344,-30.42399 2.15786,-25.3474 4.36566,-52.60471 18.52953,-74.47265 14.78936,-16.29232 35.47458,0.7495 45.63689,13.63324 11.08594,12.42904 21.91316,33.6459 41.91941,25.85866 15.44797,-0.25083 30.76053,2.11785 38.30644,-15.26956 12.94844,-12.26049 29.58114,-33.49814 49.51863,-25.31725 15.14143,14.78032 23.40098,35.53589 30.24631,55.23997 4.55565,15.36852 4.6391,31.94493 3.28453,47.62379 9.36324,3.04253 19.5843,3.12362 29.33081,4.80945 4.13961,36.35364 -6.87221,74.41869 -29.06057,103.34533 6.1277,-6.57686 -11.08201,-8.1108 -10.42592,-13.41902 -3.13078,8.77758 6.94663,20.41165 8.2868,16.46805 -0.56187,16.28936 -17.32423,27.53773 -29.07955,37.58785 -29.98728,22.19243 -69.09541,32.24465 -106.09075,28.58122 z m 45.894,-11.81034 c 33.41589,-6.42529 64.06763,-23.96926 87.606,-48.31107 -8.2548,8.75218 -16.68941,10.99135 -19.0901,-3.25812 -6.74621,-5.75317 4.24595,-28.93739 -7.93245,-14.80685 -12.56916,8.84191 6.92924,-12.74278 9.10243,-19.35578 10.01143,-17.42491 0.0574,-37.62462 -13.95795,-49.29114 -14.6216,-12.15862 17.42439,7.41163 7.0361,-3.83503 -3.38412,-4.97478 -17.07811,-12.87071 -3.49938,-12.93686 13.39611,-15.67737 9.03047,-38.51699 7.49334,-57.46672 -2.84393,-16.45555 -4.77538,-34.52556 -15.35747,-48.05543 -16.01154,-1.14314 -26.08547,16.38647 -36.61497,26.39715 -5.70545,5.13719 -20.49899,28.37559 -21.75329,21.0369 3.13269,-11.75191 -28.76493,7.02326 -18.04711,-7.35592 -10.84777,9.86053 -22.17174,2.09875 -33.04263,1.86322 -2.31736,12.36385 -11.29846,-13.13312 -16.5778,-17.49645 -8.72025,-8.90768 -19.97374,-34.20851 -33.96144,-25.78405 -11.69397,23.33334 -16.11056,50.56447 -13.69042,76.47881 -0.0602,5.91781 4.34322,13.08008 8.02259,9.96256 -4.67811,10.89105 -12.41488,20.03503 -20.60515,28.45263 22.15351,-6.46272 -6.75848,11.20914 -11.32612,18.11668 -5.55558,6.00011 11.23537,1.21603 0.92918,8.09759 -9.85267,8.82172 0.90225,10.96263 8.1364,5.52234 -4.41896,7.2779 -9.93121,27.69907 -1.30508,20.25982 0.44192,16.24753 13.24689,28.89821 26.07394,36.28908 -10.01689,-1.25504 -15.28697,-1.68273 -5.9142,7.18994 3.70419,9.09923 23.65171,23.14135 23.12198,22.88781 -12.68887,4.52612 -29.20638,-24.63453 -27.10977,-1.62665 -9.20938,-6.00136 -15.0215,-10.95439 -3.62102,-1.07286 31.42731,22.76742 71.23535,34.48211 110.0246,30.09948 5.31264,-0.40711 10.63645,-0.91452 15.85979,-2.00108 z m -79.394,-56.9057 c -18.73446,-5.59419 -23.41478,-28.49195 -31.70439,-43.75488 0.73828,-22.35343 4.08716,18.31153 19.32861,13.3197 10.72041,3.69956 18.56946,-8.44963 4.11462,-10.47485 -18.38015,-9.06725 -5.72431,-34.51184 13.30082,-25.76665 19.67,-4.41443 29.38373,22.02008 8.34506,27.51407 -25.0255,1.82433 5.10704,22.06779 16.86359,15.14318 12.34376,1.24347 30.75969,-17.67713 36.73091,-14.00618 -13.61842,14.55795 -29.70193,27.50096 -47.61646,36.34545 -6.2007,1.87716 -12.93269,2.79172 -19.36276,1.68016 z m 18.05419,-9.22941 c 21.08959,-9.895 -13.07749,-8.33914 -20.416,-11.59804 -26.4844,-5.24126 10.83882,26.8471 20.416,11.59804 z m 36.94581,-67.39043 c -25.50005,-11.63653 30.4889,-32.64656 20.12991,-2.60629 -4.12977,6.69198 -14.22499,6.53985 -20.12991,2.60629 z m 6.91801,-10.3468 c -0.82071,-13.3392 -12.1627,7.55602 0,0 z m -83.17504,3.76276 c -13.79522,-8.61428 4.31712,-27.04557 15.39702,-18.85616 13.6067,12.03589 -1.44836,24.55833 -15.39702,18.85616 z m 7.75703,-12.30697 c -5.2255,-11.64565 -10.19028,9.41998 0,0 z m -42.5,116.01345 c -6.02723,-7.2088 -1.92276,0.67135 0,0 z m 249.36364,-91.2588 c 13.806,-15.02329 -17.50241,-28.77029 -15.20919,-6.0755 0.688,7.20314 9.8789,12.01227 15.20919,6.0755 z"
id="path262"
sodipodi:nodetypes="ssscsssssssssscscsssssssscssssssssssscssssssssssscsssssssssssssssscssssssssssssssssssssssssssss" />
<path
style="fill:#98b322"
d="m 509.53513,538.91636 c -11.96373,-4.91645 8.89339,-3.88826 12.76305,-6.86225 9.28643,-1.97818 -6.4996,-8.86225 -5.56764,-12.40041 5.30229,-0.44489 21.32889,0.97664 9.25743,-4.06036 -4.4293,-2.38922 -8.90334,-4.6942 -13.35565,-7.04008 14.22958,-1.11906 29.14185,-5.34748 39.25328,-15.90169 2.68838,-4.49776 -4.08229,-15.62608 5.03556,-9.22194 7.93306,-6.96815 2.94935,-21.58829 -1.33828,-30.24933 4.40924,-0.25594 16.57977,4.55985 7.33655,-4.04687 -11.00538,-12.31768 -23.14999,-27.52514 -40.87556,-28.89523 -12.38683,-0.11681 -24.80253,7.9637 -36.90946,1.50561 -13.66459,6.45135 -15.89413,-15.41822 -16.10693,-25.52605 0.11257,-17.90444 10.83888,-33.45475 20.92523,-47.40792 -3.05408,-0.24055 -14.13675,6.43308 -7.58956,-2.00266 5.14711,-6.58606 16.1968,-5.55188 24.24745,-6.48256 -0.64652,2.77294 -5.38496,13.38337 1.49882,5.24279 15.35654,-16.366 27.78739,-36.47005 47.56874,-47.96687 13.25414,-5.46069 15.39695,14.72588 18.71219,23.21422 4.97338,21.83679 8.88088,44.88811 4.653,67.17671 -0.42681,8.2555 -8.28775,16.55282 -13.7633,17.08103 3.79273,4.42442 20.53747,19.65551 5.40245,12.0655 -5.32651,-2.18699 -9.60486,-3.59981 -3.31377,1.55124 10.07734,9.32175 19.68413,21.27699 18.4153,35.87995 -0.32668,14.70676 -12.03558,25.33807 -18.87369,37.35808 5.58909,-1.69527 15.58549,-15.93947 11.4519,-2.55177 -3.60074,10.062 11.10418,20.4953 5.86292,28.05887 -22.26582,9.35137 -44.64925,20.52878 -69.03559,22.50306 -1.92036,-0.05 -3.84901,-0.34274 -5.65444,-1.02107 z m 65.78575,-29.48994 c 5.78966,-7.75443 -13.2439,10.9428 -2.23057,2.0827 l 1.25202,-1.10346 z m -68.81054,-89.5018 c 10.3928,-9.60021 -7.59416,-23.65065 -17.40017,-16.92149 -6.0022,5.20108 -14.16395,16.91183 -1.19983,17.82149 5.04579,3.34277 14.31037,4.11548 18.6,-0.9 z m 11.8433,-13.82251 c 4.8073,-13.20848 -17.62579,-19.46625 -25.78482,-10.4034 -8.24468,7.90366 12.43507,0.51199 15.14174,8.29731 2.90454,2.60721 7.25729,6.87958 10.64308,2.10609 z m 40.39101,-19.31318 c 5.78684,-9.84304 14.87824,-18.85981 14.28152,-31.17347 0.29281,-17.2393 -3.29381,-34.47275 -8.87177,-50.70971 -8.2269,-11.71842 -18.48254,9.20895 -24.65918,14.58319 -8.27896,11.14993 -15.97671,24.13537 -16.43162,38.33565 5.81105,9.59348 20.2801,2.52537 22.63335,-7.59849 1.91751,-11.39629 10.56353,-19.72811 14.71934,-30.52016 1.40753,-4.75338 2.7467,-8.65513 3.19367,-1.43954 3.03818,19.50172 2.73205,40.2994 -6.23148,58.32147 -1.42557,1.68784 -2.84962,18.49044 1.36617,10.20106 z m -132.57252,30.28569 c 8.9312,-6.02734 7.48296,-23.09684 -5.07505,-23.64993 -7.30021,-0.58972 -13.70802,6.3178 -14.80605,12.7258 1.80508,5.41863 11.08041,12.34728 0.43734,7.07322 -8.78538,-4.63851 -18.9703,-5.08549 -28.34587,-2.82766 -0.78195,-1.20615 5.95898,-6.38547 7.64726,-9.1958 3.17899,-4.75979 14.14408,-17.04143 10.66391,-19.05896 -8.21587,0.49898 -7.15269,-16.45349 -7.61833,-23.35234 0.38694,-1.92842 0.568,-15.11456 1.50148,-11.0615 2.18799,9.93834 4.54838,20.74835 11.16901,28.59085 7.73714,-10.57308 -5.25092,-24.23902 -0.95866,-36.88296 1.19051,-8.36811 0.86918,-24.11671 5.29194,-27.6918 3.79977,11.14223 8.72133,21.86587 12.7256,32.92008 1.469,13.02823 21.40974,10.49286 17.83409,-2.39696 -3.32571,-15.92393 -12.20464,-30.4869 -22.81624,-42.64305 -1.61447,-5.5579 -16.04555,-2.78383 -6.17414,-7.11693 11.4822,2.4981 18.13579,14.1012 25.27589,22.56913 6.89239,9.91602 14.82304,19.48443 19.27939,30.80078 2.47751,-2.96246 1.89049,-12.09704 8.49383,-6.61144 6.65112,0.58151 16.26357,5.55912 6.89945,11.05947 0.73719,-14.80175 -8.75677,15.1836 -10.62746,8.56225 -0.72867,-12.69039 -5.40734,8.91481 -6.08907,12.65018 -2.18787,18.03406 -8.95803,36.69358 -24.11683,47.78757 l -0.516,-0.66094 z m -14.20337,-23.32605 c 5.77671,-2.92338 22.69464,0.31989 10.56863,-7.78429 -7.14341,-6.64682 -23.87398,-0.74632 -20.72199,9.89207 3.22405,1.98101 7.17289,-0.8495 10.15336,-2.10778 z m 3.70324,21.86879 c 8.31993,-0.40006 2.55621,1.04523 0,0 z"
id="path264"
sodipodi:nodetypes="ssssscssscsssssssssssssscsssssssssssssssssscsssssssssssssssssssssssssssscssssssss" />
<path
d="m 1024.2783,547.21642 c -9.6474,-14.6212 -6.632,-40.42073 -4.8502,-53.76535 2.6928,-16.90372 -3.3202,-12.12461 -13.6577,-4.45447 -25.01447,12.27949 -59.18425,4.28457 -72.04163,-21.68733 -10.2406,-17.71164 -8.40772,-39.31392 -6.28209,-58.79606 6.45645,-29.86765 33.30762,-52.02721 63.40527,-54.57572 23.99335,-2.09972 48.62905,-0.44983 71.62095,7.06815 0.091,62.23891 0.5942,124.48041 0.1981,186.71765 -12.6287,0.43508 -26.0071,2.19718 -38.3927,-0.50687 z m -19.2972,-85.14028 c 8.9811,-3.69403 17.2196,-10.77319 14.5221,-21.15186 -0.2965,-18.90657 0.8377,-37.93383 -1.0647,-56.74097 -17.6803,-4.80898 -39.46324,1.42399 -45.83356,20.20953 -5.84919,19.35871 -7.2627,47.76691 14.0742,58.19247 5.98319,1.52206 12.40867,1.30531 18.30196,-0.50917 z m 114.7494,31.20018 c -34.0059,-8.04356 -45.9919,-48.32423 -39.5447,-79.17262 4.3945,-28.8021 27.3959,-53.05095 56.1731,-58.26248 25.86,-6.01589 53.0851,-1.80688 77.8616,6.72508 0.5883,33.54678 -0.8778,67.22968 1.7215,100.66471 4.7565,10.75749 21.7529,2.5844 16.5612,17.85564 3.817,12.07463 -6.9999,13.24912 -16.9182,13.03401 -16.0647,3.64109 -33.3851,-6.02131 -41.0468,-16.02871 -13.8775,14.34702 -35.5941,19.64241 -54.8077,15.18437 z m 40.5023,-32.20953 c 9.4402,-3.42968 11.2078,-10.92943 11.2078,-21.12672 l -0.4374,-55.71678 c -18.9818,-5.02361 -42.4004,3.77993 -46.5039,24.80962 -8.42,21.69593 1.1213,62.6043 31.4405,53.73703 1.4729,-0.46468 2.8792,-1.08873 4.293,-1.70315 z m -422.72957,31.72665 c -18.80084,-7.53055 -6.7665,-35.95425 -10.3367,-52.35268 0.099,-46.1716 0.30201,-92.34293 0.45214,-138.5144 14.30782,-1.61194 31.93718,-5.49591 44.37628,3.17584 3.51117,5.47623 0.51565,13.38784 1.50829,19.80673 v 134.81436 h 76 v 32.70051 c -37.24011,2.12636 -74.73098,1.27931 -112.00001,0.36964 z m 132.75001,0.19481 c -8.92902,1.39282 -3.09221,-10.86174 -4.75,-16.18938 V 357.88248 c 13.82936,-0.68735 31.04568,-5.74109 42.2204,4.10116 2.66309,43.37133 1.18106,86.97172 1.8489,130.44397 -13.04795,1.46659 -26.22936,1.3221 -39.3193,0.56064 z m 10.0451,-150.25092 c -20.83065,-2.20719 -27.42012,-33.88436 -8.55042,-43.73165 18.44309,-10.35465 48.41166,4.6393 39.315,28.01944 -4.07387,12.71854 -18.43094,18.32981 -30.76458,15.71221 z"
style="fill:#98b322"
id="path529"
sodipodi:nodetypes="ccccccccccccccccccccccccccccccccccccccccccccccccc" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 13 KiB

+133
View File
@@ -0,0 +1,133 @@
import { useCallback, useEffect, useRef, useState, type ReactNode } from 'react';
import { useLocation, useNavigate } from 'react-router-dom';
import { useQueryClient } from '@tanstack/react-query';
import { ApiError, auth as authApi, type AuthUser } from '../api/client';
import { refreshManifest } from '../lib/manifest';
import { useManifest } from '../hooks/useManifest';
import { loginPath, safeReturnTo } from './returnTo';
import { AuthContext } from './context';
import type { AuthStatus } from './context';
export function AuthProvider({ children }: { children: ReactNode }) {
const { auth: manifestAuth } = useManifest();
const enabled = manifestAuth.enabled;
const location = useLocation();
const navigate = useNavigate();
const queryClient = useQueryClient();
const [status, setStatus] = useState<AuthStatus>('checking');
const [user, setUser] = useState<AuthUser | null>(null);
const statusRef = useRef(status);
const enabledRef = useRef(enabled);
const handledUnauthorized = useRef(false);
const checkInFlight = useRef<Promise<void> | null>(null);
useEffect(() => {
enabledRef.current = enabled;
statusRef.current = status;
}, [enabled, status]);
const updateStatus = useCallback((next: AuthStatus) => {
statusRef.current = next;
setStatus(next);
}, []);
const checkSession = useCallback(async () => {
if (!enabledRef.current) {
setUser(null);
updateStatus('disabled');
return;
}
if (checkInFlight.current) return checkInFlight.current;
updateStatus('checking');
const check = authApi
.me()
.then((account) => {
setUser(account);
handledUnauthorized.current = false;
updateStatus('authenticated');
})
.catch((error: unknown) => {
setUser(null);
updateStatus(
error instanceof ApiError && error.status === 401 ? 'unauthenticated' : 'error',
);
})
.finally(() => {
checkInFlight.current = null;
});
checkInFlight.current = check;
return check;
}, [updateStatus]);
useEffect(() => {
if (!enabled) {
// This synchronizes the session state with the server's feature flag.
// eslint-disable-next-line react-hooks/set-state-in-effect
setUser(null);
updateStatus('disabled');
queryClient.clear();
return;
}
void checkSession();
}, [enabled, checkSession, queryClient, updateStatus]);
useEffect(() => {
const onUnauthorized = (event: Event) => {
if (!enabledRef.current) return;
if (handledUnauthorized.current) {
event.preventDefault();
return;
}
if (statusRef.current !== 'authenticated') return;
event.preventDefault();
handledUnauthorized.current = true;
queryClient.clear();
setUser(null);
updateStatus('unauthenticated');
const target =
safeReturnTo(`${location.pathname}${location.search}${location.hash}`) ?? '/scenarios';
navigate(loginPath(target, true), { replace: true });
};
window.addEventListener('liqa:unauthorized', onUnauthorized);
return () => window.removeEventListener('liqa:unauthorized', onUnauthorized);
}, [location.hash, location.pathname, location.search, navigate, queryClient, updateStatus]);
const login = useCallback(
async (username: string, password: string) => {
let account: AuthUser;
try {
account = await authApi.login(username, password);
} catch (error) {
if (error instanceof ApiError && error.status === 404) await refreshManifest();
throw error;
}
queryClient.clear();
handledUnauthorized.current = false;
setUser(account);
updateStatus('authenticated');
},
[queryClient, updateStatus],
);
const logout = useCallback(async () => {
try {
await authApi.logout();
} catch (error) {
if (!(error instanceof ApiError && error.status === 401)) {
await checkSession();
throw error;
}
}
queryClient.clear();
setUser(null);
updateStatus('unauthenticated');
handledUnauthorized.current = false;
navigate('/login?notice=signedOut', { replace: true });
}, [checkSession, navigate, queryClient, updateStatus]);
return (
<AuthContext.Provider value={{ enabled, status, user, login, logout, checkSession }}>
{children}
</AuthContext.Provider>
);
}
+15
View File
@@ -0,0 +1,15 @@
import { createContext } from 'react';
import type { AuthUser } from '../api/client';
export type AuthStatus = 'disabled' | 'checking' | 'authenticated' | 'unauthenticated' | 'error';
export interface AuthContextValue {
enabled: boolean;
status: AuthStatus;
user: AuthUser | null;
login: (username: string, password: string) => Promise<void>;
logout: () => Promise<void>;
checkSession: () => Promise<void>;
}
export const AuthContext = createContext<AuthContextValue | null>(null);
+45
View File
@@ -0,0 +1,45 @@
/** Return only a well-formed route on this app's origin. */
export function safeReturnTo(value: string | null | undefined): string | null {
if (
!value ||
!value.startsWith('/') ||
value.startsWith('//') ||
value.includes('\\') ||
/%(?:2f|5c)/i.test(value)
)
return null;
let decoded = value;
try {
for (let pass = 0; pass < 3; pass += 1) {
const next = decodeURIComponent(decoded);
if (next === decoded) break;
decoded = next;
}
} catch {
return null;
}
const containsControl = [...decoded].some((character) => {
const code = character.charCodeAt(0);
return code < 32 || code === 127;
});
if (decoded.startsWith('//') || decoded.includes('\\') || containsControl) {
return null;
}
try {
const target = new URL(value, window.location.origin);
if (target.origin !== window.location.origin) return null;
if (/^\/(?:login|auth)(?:\/|$)/i.test(target.pathname)) return null;
return `${target.pathname}${target.search}${target.hash}`;
} catch {
return null;
}
}
export function loginPath(returnTo: string, expired = false): string {
const query = new URLSearchParams();
query.set('returnTo', safeReturnTo(returnTo) ?? '/scenarios');
if (expired) query.set('expired', '1');
return `/login?${query.toString()}`;
}
+8
View File
@@ -0,0 +1,8 @@
import { useContext } from 'react';
import { AuthContext } from './context';
export function useAuth() {
const value = useContext(AuthContext);
if (!value) throw new Error('useAuth must be used inside AuthProvider');
return value;
}
@@ -0,0 +1,20 @@
.helpButton {
display: inline-flex;
align-items: center;
justify-content: center;
padding: 2px;
border: none;
border-radius: var(--radius-sm);
background: none;
color: var(--color-text-muted);
cursor: pointer;
}
.helpButton:hover {
color: var(--color-primary);
}
.helpButton:focus-visible {
outline: none;
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.35);
}
@@ -0,0 +1,54 @@
import { useState } from 'react';
import { useTranslation } from 'react-i18next';
import { CircleHelp, X } from 'lucide-react';
import { Modal, Button, MarkdownContent } from '../../ui';
import content from './code-help.md?raw';
import styles from './CodeHelpModal.module.css';
export interface CodeHelpModalProps {
open: boolean;
onClose: () => void;
}
/** Reference for the script runtime (`context`, `expect`, ...) available to step and snippet code. */
export function CodeHelpModal({ open, onClose }: CodeHelpModalProps) {
const { t } = useTranslation();
return (
<Modal
open={open}
size="lg"
title={t('code_help.title')}
onClose={onClose}
footer={
<Button variant="secondary" onClick={onClose}>
<X size={14} />
{t('code_help.close')}
</Button>
}
>
<MarkdownContent content={content} />
</Modal>
);
}
/** A (?) button that opens the {@link CodeHelpModal}; place it next to a code field label. */
export function CodeHelpButton() {
const { t } = useTranslation();
const [open, setOpen] = useState(false);
return (
<>
<button
type="button"
className={styles.helpButton}
onClick={() => setOpen(true)}
aria-label={t('code_help.open')}
title={t('code_help.open')}
>
<CircleHelp size={16} />
</button>
<CodeHelpModal open={open} onClose={() => setOpen(false)} />
</>
);
}
@@ -0,0 +1,45 @@
import { useTranslation } from 'react-i18next';
import { X, Trash2 } from 'lucide-react';
import { Modal, Button } from '../../ui';
export interface DeleteConfirmationModalProps {
open: boolean;
title: string;
message: string;
onClose: () => void;
onConfirm: () => void;
isDeleting: boolean;
}
export function DeleteConfirmationModal({
open,
title,
message,
onClose,
onConfirm,
isDeleting,
}: DeleteConfirmationModalProps) {
const { t } = useTranslation();
return (
<Modal
open={open}
title={title}
onClose={() => !isDeleting && onClose()}
footer={
<>
<Button variant="secondary" onClick={onClose} disabled={isDeleting}>
<X size={14} />
{t('common.button_cancel')}
</Button>
<Button variant="danger" onClick={onConfirm} disabled={isDeleting}>
<Trash2 size={14} />
{t('common.button_delete')}
</Button>
</>
}
>
{message}
</Modal>
);
}
@@ -0,0 +1,27 @@
.section {
display: flex;
flex-direction: column;
gap: 0.5rem;
}
.sectionTitle {
font-size: 0.8125rem;
font-weight: 600;
color: var(--text-muted, #888);
margin: 0;
text-transform: uppercase;
letter-spacing: 0.04em;
}
.radioRow {
display: flex;
align-items: center;
gap: 0.5rem;
font-size: 0.875rem;
cursor: pointer;
}
.radioRow input[type='radio'] {
cursor: pointer;
accent-color: var(--color-primary);
}
@@ -0,0 +1,68 @@
import { useTranslation } from 'react-i18next';
import { X, Download } from 'lucide-react';
import { Modal, Button } from '../../ui';
import styles from './ExportLogsModal.module.css';
export type LogExportFormat = 'md' | 'csv';
export interface ExportLogsModalProps {
open: boolean;
format: LogExportFormat;
onFormatChange: (format: LogExportFormat) => void;
onClose: () => void;
onExport: () => void;
isExporting: boolean;
}
export function ExportLogsModal({
open,
format,
onFormatChange,
onClose,
onExport,
isExporting,
}: ExportLogsModalProps) {
const { t } = useTranslation();
return (
<Modal
open={open}
title={t('runs.export_logs_modal_title')}
onClose={() => !isExporting && onClose()}
footer={
<>
<Button variant="secondary" onClick={onClose} disabled={isExporting}>
<X size={14} />
{t('common.button_cancel')}
</Button>
<Button variant="primary" onClick={onExport} disabled={isExporting}>
<Download size={14} />
{t('runs.action_export')}
</Button>
</>
}
>
<div className={styles.section}>
<h4 className={styles.sectionTitle}>{t('runs.export_logs_format')}</h4>
<label className={styles.radioRow}>
<input
type="radio"
name="log-export-format"
checked={format === 'md'}
onChange={() => onFormatChange('md')}
/>
<span>{t('runs.export_logs_format_md')}</span>
</label>
<label className={styles.radioRow}>
<input
type="radio"
name="log-export-format"
checked={format === 'csv'}
onChange={() => onFormatChange('csv')}
/>
<span>{t('runs.export_logs_format_csv')}</span>
</label>
</div>
</Modal>
);
}
@@ -0,0 +1,68 @@
.exportModal {
display: flex;
flex-direction: column;
gap: 1.25rem;
}
.scenarioMeta {
display: flex;
flex-direction: column;
gap: 0.5rem;
padding: 0.75rem 1rem;
background: var(--color-primary);
border-radius: 6px;
}
.metaRow {
display: flex;
align-items: center;
gap: 0.75rem;
}
.metaLabel {
font-size: 0.75rem;
font-weight: 600;
color: var(--color-primary-fg);
opacity: 0.7;
min-width: 4rem;
text-transform: uppercase;
letter-spacing: 0.04em;
}
.metaValue {
font-size: 0.875rem;
color: var(--color-primary-fg);
}
.section {
display: flex;
flex-direction: column;
gap: 0.5rem;
}
.sectionTitle {
font-size: 0.8125rem;
font-weight: 600;
color: var(--text-muted, #888);
margin: 0;
text-transform: uppercase;
letter-spacing: 0.04em;
}
.checkboxRow {
display: flex;
align-items: center;
gap: 0.5rem;
font-size: 0.875rem;
cursor: pointer;
}
.checkboxRow input[type='checkbox'] {
cursor: pointer;
accent-color: var(--color-primary);
}
.versions {
color: var(--color-text-muted);
font-size: var(--font-size-xs);
}
@@ -0,0 +1,140 @@
import { useTranslation } from 'react-i18next';
import { X, Upload } from 'lucide-react';
import { Modal, Button, UuidBadge } from '../../ui';
import type { Scenario, ScenarioCredential, UsedSnippet } from '../../api';
import styles from './ExportScenarioModal.module.css';
export interface ExportScenarioModalProps {
open: boolean;
scenario: Scenario | null;
scenarioCredentials: ScenarioCredential[];
environment: Pick<{ id: string; name: string }, 'id' | 'name'> | null;
includeEnvironment: boolean;
onIncludeEnvironmentChange: (v: boolean) => void;
includedCredentialIds: Set<string>;
onCredentialToggle: (id: string, checked: boolean) => void;
usedSnippets: UsedSnippet[];
includedSnippetIds: Set<string>;
onSnippetToggle: (id: string, checked: boolean) => void;
onClose: () => void;
onExport: () => void;
isExporting: boolean;
}
export function ExportScenarioModal({
open,
scenario,
scenarioCredentials,
environment,
includeEnvironment,
onIncludeEnvironmentChange,
includedCredentialIds,
onCredentialToggle,
usedSnippets,
includedSnippetIds,
onSnippetToggle,
onClose,
onExport,
isExporting,
}: ExportScenarioModalProps) {
const { t } = useTranslation();
// One row per snippet, listing every version the scenario uses (latest or pinned)
const snippetRows = new Map<string, { alias: string; versions: number[] }>();
for (const s of usedSnippets) {
const row = snippetRows.get(s.id) ?? { alias: s.alias, versions: [] };
const version = s.pinnedVersion ?? s.version;
if (!row.versions.includes(version)) row.versions.push(version);
snippetRows.set(s.id, row);
}
return (
<Modal
open={open}
title={t('scenarios.export_modal_title')}
onClose={() => !isExporting && onClose()}
footer={
<>
<Button variant="secondary" onClick={onClose} disabled={isExporting}>
<X size={14} />
{t('common.button_cancel')}
</Button>
<Button variant="primary" onClick={onExport} disabled={isExporting}>
<Upload size={14} />
{t('scenarios.action_export')}
</Button>
</>
}
>
{scenario && (
<div className={styles.exportModal}>
<div className={styles.scenarioMeta}>
<div className={styles.metaRow}>
<span className={styles.metaLabel}>{t('scenarios.field_name')}</span>
<span className={styles.metaValue}>{scenario.name}</span>
</div>
<div className={styles.metaRow}>
<span className={styles.metaLabel}>{t('scenarios.field_id')}</span>
<span className={styles.metaValue}>
<UuidBadge id={scenario.id} />
</span>
</div>
<div className={styles.metaRow}>
<span className={styles.metaLabel}>{t('scenarios.field_version')}</span>
<span className={styles.metaValue}>v{scenario.version}</span>
</div>
</div>
{environment && (
<div className={styles.section}>
<h4 className={styles.sectionTitle}>{t('scenarios.export_include_environment')}</h4>
<label className={styles.checkboxRow}>
<input
type="checkbox"
checked={includeEnvironment}
onChange={(e) => onIncludeEnvironmentChange(e.target.checked)}
/>
<span>{environment.name}</span>
</label>
</div>
)}
{scenarioCredentials.length > 0 && (
<div className={styles.section}>
<h4 className={styles.sectionTitle}>{t('scenarios.export_include_credentials')}</h4>
{scenarioCredentials.map((sc) => (
<label key={sc.credentialId} className={styles.checkboxRow}>
<input
type="checkbox"
checked={includedCredentialIds.has(sc.credentialId)}
onChange={(e) => onCredentialToggle(sc.credentialId, e.target.checked)}
/>
<span>{sc.credential?.name ?? sc.alias}</span>
</label>
))}
</div>
)}
{snippetRows.size > 0 && (
<div className={styles.section}>
<h4 className={styles.sectionTitle}>{t('scenarios.export_include_snippets')}</h4>
{[...snippetRows].map(([snippetId, row]) => (
<label key={snippetId} className={styles.checkboxRow}>
<input
type="checkbox"
checked={includedSnippetIds.has(snippetId)}
onChange={(e) => onSnippetToggle(snippetId, e.target.checked)}
/>
<span>{row.alias}</span>
<span className={styles.versions}>
{row.versions.map((v) => `v${v}`).join(', ')}
</span>
</label>
))}
</div>
)}
</div>
)}
</Modal>
);
}
@@ -0,0 +1,128 @@
import { useTranslation } from 'react-i18next';
import { X, Play } from 'lucide-react';
import { Modal, Button, Select } from '../../ui';
import type { Environment, ScenarioVersion, TraceMode } from '../../api';
const TRACE_MODES: TraceMode[] = ['on', 'retain-on-failure', 'off'];
export interface RunScenarioModalProps {
open: boolean;
environments: Environment[];
selectedEnvId: string;
onEnvSelect: (envId: string) => void;
saveSessionFlag: boolean;
onSaveSessionChange: (flag: boolean) => void;
/** Scenario versions, newest first; empty while loading. */
versions: Pick<ScenarioVersion, 'version' | 'createdAt'>[];
/** Selected version, or null for the latest. */
selectedVersion: number | null;
onVersionChange: (version: number | null) => void;
traceMode: TraceMode;
defaultTraceMode: TraceMode | null;
onTraceModeChange: (mode: TraceMode) => void;
onClose: () => void;
onRun: () => void;
isRunning: boolean;
actionLabel?: string;
}
export function RunScenarioModal({
open,
environments,
selectedEnvId,
onEnvSelect,
saveSessionFlag,
onSaveSessionChange,
versions,
selectedVersion,
onVersionChange,
traceMode,
defaultTraceMode,
onTraceModeChange,
onClose,
onRun,
isRunning,
actionLabel,
}: RunScenarioModalProps) {
const { t } = useTranslation();
return (
<Modal
open={open}
title={t('scenarios.run_modal_title')}
onClose={() => !isRunning && onClose()}
footer={
<>
<Button variant="secondary" onClick={onClose} disabled={isRunning}>
<X size={14} />
{t('common.button_cancel')}
</Button>
<Button variant="primary" onClick={onRun} disabled={isRunning || !selectedEnvId}>
<Play size={14} />
{actionLabel || t('scenarios.action_run')}
</Button>
</>
}
>
{environments.length === 0 ? (
<p>{t('scenarios.run_modal_no_env')}</p>
) : (
<>
<Select
label={t('scenarios.run_modal_env_label')}
value={selectedEnvId}
onChange={(e) => onEnvSelect(e.target.value)}
options={environments.map((env) => ({ value: env.id, label: env.name }))}
/>
<div style={{ marginTop: '1rem' }}>
<Select
label={t('scenarios.run_modal_version_label')}
value={selectedVersion == null ? '' : String(selectedVersion)}
onChange={(e) => onVersionChange(e.target.value ? Number(e.target.value) : null)}
options={[
{
value: '',
label: versions[0]
? t('scenarios.run_modal_version_latest_n', { version: versions[0].version })
: t('scenarios.run_modal_version_latest'),
},
...versions.map((v) => ({
value: String(v.version),
label: `v${v.version} — ${new Date(v.createdAt).toLocaleString()}`,
})),
]}
/>
</div>
<label
style={{
display: 'flex',
alignItems: 'center',
marginTop: '1rem',
gap: '0.5rem',
}}
>
<input
type="checkbox"
checked={saveSessionFlag}
onChange={(e) => onSaveSessionChange(e.target.checked)}
/>
<span>{t('common.save_session')}</span>
</label>
<div style={{ marginTop: '1rem' }}>
<Select
label={t('scenarios.run_modal_trace_label')}
value={traceMode}
onChange={(e) => onTraceModeChange(e.target.value as TraceMode)}
options={TRACE_MODES.map((mode) => ({
value: mode,
label:
t(`scenarios.trace_mode_${mode.replace(/-/g, '_')}`) +
(mode === defaultTraceMode ? ` ${t('scenarios.trace_mode_default_suffix')}` : ''),
}))}
/>
</div>
</>
)}
</Modal>
);
}
+195
View File
@@ -0,0 +1,195 @@
Step code and snippet code are the **body of an async function**. Use `await` freely; whatever you `return` becomes the step (or snippet) output.
```js
async (context) => {
// your code here
}
```
All steps of a run share one browser, one browser context and one page, so state carries over from step to step: the current URL, cookies, local storage, open dialogs.
A step **passes** when its code returns, and **fails** when it throws or exceeds its timeout. When a step fails, the remaining steps are cancelled, and a screenshot and the page HTML are saved to the run's files.
## Globals
| Name | Description |
| --- | --- |
| `context` | The run context, described below. |
| `expect` | Playwright's [`expect`](https://playwright.dev/docs/test-assertions), with auto-retrying web assertions. |
| `console` | Writes to the run log: `log`/`info` → `log`, plus `warn`, `error` and `debug`. |
| `args` | **Snippets only.** The extra arguments passed to `context.runSnippet(name, ...args)`. |
Code runs in the server process with Node.js. It is trusted code, not sandboxed.
## Browser
### `context.page`
The Playwright [`Page`](https://playwright.dev/docs/api/class-page) of the run.
```js
await context.page.goto(context.getEnv("base_url"));
await context.page.getByRole("button", { name: "Sign in" }).click();
await expect(context.page.locator("h1")).toHaveText("Dashboard");
```
### `context.browser`
The Playwright [`BrowserContext`](https://playwright.dev/docs/api/class-browsercontext) the page belongs to. Use it for cookies, storage state, extra pages and HTTP requests that share the browser's cookies.
```js
const cookies = await context.browser.cookies();
const res = await context.browser.request.get(context.getEnv("api_url") + "/me");
```
### `context.dumpDom(selector?)` → `Promise<DomNode>`
Returns a simplified tree of the live DOM, starting at `selector` (default `"body"`). Decorative and layout elements are filtered out. The tree keeps landmarks, interactive elements, and elements with `role`, `data-testid`, `data-qa`, `data-action` or `data-element-id`. Each node has `tag` and `children`, plus `role`, `testid`, `id`, `name`, `type`, `text`, `href`, `checked`, `disabled`, etc. when they are present. This is useful for finding selectors without a screenshot.
If nothing matches `selector`, it returns a node with `tag: "ERROR"` instead of throwing.
```js
context.log("Login form:", await context.dumpDom("form"));
```
## Environment
### `context.env`
A copy of the selected environment's key/value map, `{}` when there is none. A missing key reads as `undefined`.
### `context.getEnv(key)` → `string`
Returns the environment value for `key`, and **throws** if it is not defined. Prefer it over `context.env[key]` for required settings: the step then fails with a clear message.
```js
const baseUrl = context.getEnv("base_url");
const locale = context.env.locale ?? "en";
```
## Credentials
### `context.getCredential(alias)` → `unknown`
Returns the payload of the credential assigned to this scenario under `alias` (see **Credentials** on the scenario page). JSON data is returned parsed, anything else as a string. **Throws** if no credential has that alias.
```js
const { username, password } = context.getCredential("admin");
await context.page.getByLabel("Username").fill(username);
await context.page.getByLabel("Password").fill(password);
```
## Step outputs
### `context.getStepOutput(order)` → `Promise<unknown>`
Returns the output (the return value) of another step in the same run. **It is async, so `await` it.**
- A positive `order` is absolute: `1` is the first step.
- A negative `order` is relative: `-1` is the previous step.
Returns `null` if that step does not exist, has not run, or returned nothing. A step's output is stored as JSON, so only JSON-serializable values come back as they were returned (no functions, `Date` becomes a string, Playwright objects are not usable).
```js
// step 2
return { orderId: await context.page.locator("#order-id").textContent() };
// step 3
const { orderId } = await context.getStepOutput(-1);
```
## Logging
### `context.log(...args)`, `context.warn(...args)`, `context.error(...args)`, `context.debug(...args)`
Write an entry with that level to the run log. `console.*` does the same. Strings, numbers and booleans are joined with spaces into the message. Objects and arrays are kept separate as structured **data**, shown pretty-printed under the message: one object is stored as is, several are stored as an array.
```js
context.log("Created user", user.id, user); // message "Created user 42", data = user
```
Every entry is tagged with where it came from: `step:<N>`, or `snippet:<alias>` while a snippet runs.
## Assertions
### `context.assert(fn, description, details?)` → `Promise<void>`
Runs `fn` (sync or async) and requires it to return exactly `true`.
- On success, it logs `description` (tagged `assertion:pass`).
- If `fn` returns anything else or throws, it logs `Assertion failed: <description>` as an error (tagged `assertion:fail`) and throws, which fails the step. The entry's data holds `details` (if given) and the exception message as `error` (if `fn` threw).
Await it, or a failure will not stop the step.
```js
await context.assert(
async () => (await context.page.locator(".cart-item").count()) === 3,
"Cart contains 3 items",
);
```
Pass large diagnostics (e.g. a response body) as `details` rather than in `description`, so the message stays short:
```js
await context.assert(() => response.ok(), "Validation must pass", {
status: response.status(),
body: await response.json(),
});
```
Use `expect` instead for assertions that wait and retry until the page matches, e.g. `await expect(locator).toBeVisible()`.
## Snippets
### `context.runSnippet(name, ...args)` → `Promise<unknown>`
Runs a stored snippet with the same `context` (same page, environment and credentials) and returns the snippet's return value. Extra arguments are available inside the snippet as `args`.
- `name` is the snippet alias, which runs its latest version.
- `alias@<version>` (e.g. `login@3`) pins a specific version.
Start, finish and failure are logged. If the snippet throws, the error propagates and fails the calling step unless you catch it. Snippets can call other snippets.
```js
// step code
const user = await context.runSnippet("login", "admin", { remember: true });
// snippet "login"
const [alias, opts] = args;
const { username, password } = context.getCredential(alias);
// ...
return { username };
```
## Files
### `context.getScenarioFiles(opts?)` → `Promise<{ items, total }>`
Lists the files uploaded to this scenario (see **Files** on the scenario page). `opts` takes `limit` and `offset` for paging. Each item has `id`, `name`, `mimeType`, `size`, `sha256` and `path`, the absolute path on the server's disk, which you can pass to Playwright:
```js
const { items } = await context.getScenarioFiles();
const doc = items.find((f) => f.name === "contract.pdf");
await context.page.locator("input[type=file]").setInputFiles(doc.path);
```
### `context.downloadFile(url, opts?)` → `Promise<FileInfo>`
Fetches `url` on the server and saves the response as a file of the current run. It returns the same fields as a scenario file (`id`, `name`, `mimeType`, `size`, `sha256`, `path`).
- `opts`: `method`, `headers`, `body` (a string) and `filename`. Without `filename`, the last segment of the URL path is used, and the MIME type is derived from the file extension.
- Redirects are followed. Any final status other than 200 throws. The limits are 100 MB and a 30 s timeout.
- `url` may be a `data:` URI (`data:<type>;base64,<data>` or `data:<type>,<percent-encoded>`), which saves content generated in the script without a network request. Pass `filename` in this case.
- Only works during a real scenario run. It throws in ad-hoc execution such as the `exec_code` MCP tool.
- This is a server-side request: it does **not** send the browser's cookies. Pass them in `headers` if the URL needs a session.
```js
await context.downloadFile(
"data:application/json;base64," + btoa(JSON.stringify(report)),
{ filename: "report.json" },
);
```
## Timeouts
Each step has its own timeout, or else the scenario's timeout, or else 60 s. The whole run fails once it exceeds the scenario's timeout (600 s by default). That check happens between steps.
+10
View File
@@ -0,0 +1,10 @@
export { DeleteConfirmationModal } from './DeleteConfirmationModal';
export type { DeleteConfirmationModalProps } from './DeleteConfirmationModal';
export { ExportScenarioModal } from './ExportScenarioModal';
export type { ExportScenarioModalProps } from './ExportScenarioModal';
export { RunScenarioModal } from './RunScenarioModal';
export type { RunScenarioModalProps } from './RunScenarioModal';
export { ExportLogsModal } from './ExportLogsModal';
export type { ExportLogsModalProps, LogExportFormat } from './ExportLogsModal';
export { CodeHelpModal, CodeHelpButton } from './CodeHelpModal';
export type { CodeHelpModalProps } from './CodeHelpModal';
+10
View File
@@ -0,0 +1,10 @@
declare module '*.css' {
const styles: Record<string, string>;
export default styles;
}
interface ImportMetaEnv {
readonly VITE_API_URL?: string;
}
declare const __APP_VERSION__: string;
+43
View File
@@ -0,0 +1,43 @@
import type { ChangeEvent } from 'react';
import { useNavigate } from 'react-router-dom';
import { useTranslation } from 'react-i18next';
import { imports } from '../api';
import type { ImportedItem, ImportKind } from '../api';
import { useToast } from '../ui';
/** Detail page path of an imported item. */
export function importedItemPath(item: ImportedItem): string {
return `/${item.kind}s/${item.id}`;
}
/**
* Returns a file input `onChange` handler that imports the chosen YAML file
* through the central import. When the file holds exactly one item of `kind`
* (e.g. a scenario export with its environment), opens that item; otherwise
* opens the import page with the full result.
*/
export function useImportFile(kind: ImportKind) {
const navigate = useNavigate();
const toast = useToast();
const { t } = useTranslation();
return async (e: ChangeEvent<HTMLInputElement>) => {
const file = e.target.files?.[0];
if (!file) return;
e.target.value = '';
try {
const result = await imports.yaml(await file.text());
const own = result.imported.filter((item) => item.kind === kind);
if (own.length === 1) {
if (result.imported.length > 1) {
toast.success(t('import.imported_count', { count: result.imported.length }));
}
navigate(importedItemPath(own[0]));
} else {
navigate('/import', { state: { results: [{ fileName: file.name, result }] } });
}
} catch {
// error toast is already emitted by the API client
}
};
}
+10
View File
@@ -0,0 +1,10 @@
import { useSyncExternalStore } from 'react';
import { getManifest, subscribeManifest, type Manifest } from '../lib/manifest';
/**
* Public client configuration from the server's /manifest.json: the cached
* copy (or defaults) at first, updated once the fresh one arrives.
*/
export function useManifest(): Manifest {
return useSyncExternalStore(subscribeManifest, getManifest);
}
+17
View File
@@ -0,0 +1,17 @@
import { useEffect } from 'react';
const APP_NAME = 'Liqa';
/**
* Sets document.title to "<title> | Liqa" for the current page.
* Pass undefined or empty string to fall back to just "Liqa".
*/
export function usePageTitle(title: string | null | undefined): void {
useEffect(() => {
const prev = document.title;
document.title = title ? `${title} | ${APP_NAME}` : APP_NAME;
return () => {
document.title = prev;
};
}, [title]);
}
+26
View File
@@ -0,0 +1,26 @@
import { useEffect, useState } from 'react';
import { scenarios } from '../api';
import type { RunDefaults } from '../api';
// Server run defaults don't change while the app is open; fetch them once
let cached: Promise<RunDefaults> | null = null;
/**
* Returns the server-configured defaults for new scenario runs, or null
* while they are loading (or if the request failed).
*/
export function useRunDefaults(): RunDefaults | null {
const [defaults, setDefaults] = useState<RunDefaults | null>(null);
useEffect(() => {
let cancelled = false;
cached ??= scenarios.runDefaults().catch((err: unknown) => {
cached = null;
throw err;
});
cached.then((d) => !cancelled && setDefaults(d)).catch(() => undefined);
return () => {
cancelled = true;
};
}, []);
return defaults;
}
+184
View File
@@ -0,0 +1,184 @@
import { useCallback, useEffect, useRef, useState } from 'react';
import { useQueryClient } from '@tanstack/react-query';
import { useNavigate } from 'react-router-dom';
import { useTranslation } from 'react-i18next';
import { RUN_EVENTS_URL } from '../api/client';
import type { RunEvent } from '../api/types';
import type { NotificationToggleState } from '../ui';
import { useAuth } from '../auth/useAuth';
const STORAGE_KEY = 'liqa-run-notifications';
const RETRY_MIN_MS = 1_000;
const RETRY_MAX_MS = 30_000;
export function createRunEventSource(): EventSource {
return new EventSource(RUN_EVENTS_URL, { withCredentials: true });
}
function supported(): boolean {
return typeof window !== 'undefined' && 'Notification' in window && 'EventSource' in window;
}
/** The stored choice: `null` until the user toggles notifications explicitly. */
function readEnabled(): boolean | null {
try {
const value = localStorage.getItem(STORAGE_KEY);
return value === null ? null : value === '1';
} catch {
return null;
}
}
function writeEnabled(enabled: boolean): void {
try {
localStorage.setItem(STORAGE_KEY, enabled ? '1' : '0');
} catch {
// storage unavailable: the choice just doesn't persist
}
}
/**
* Opt-in browser notifications for run start/finish, driven by the server's
* run events stream (so runs started from the API, MCP or the scheduler are
* covered too). Returns `null` when the browser lacks Notification/EventSource.
*/
export function useRunNotifications(): {
state: NotificationToggleState;
toggle: () => void;
} | null {
const auth = useAuth();
const isSupported = supported();
const { t } = useTranslation();
const navigate = useNavigate();
const queryClient = useQueryClient();
const [stored, setStored] = useState(readEnabled);
const [permission, setPermission] = useState<NotificationPermission>(() =>
isSupported ? Notification.permission : 'denied',
);
// Permission granted outside the toggle (browser prompt or site settings)
// enables notifications unless the user turned them off explicitly
const enabled = stored ?? permission === 'granted';
// Follow permission changes made in the browser's site settings
useEffect(() => {
if (!isSupported) return;
const sync = () => setPermission(Notification.permission);
let status: PermissionStatus | undefined;
let cancelled = false;
navigator.permissions
?.query({ name: 'notifications' })
.then((s) => {
if (cancelled) return;
status = s;
status.addEventListener('change', sync);
})
.catch(() => {});
window.addEventListener('focus', sync);
return () => {
cancelled = true;
status?.removeEventListener('change', sync);
window.removeEventListener('focus', sync);
};
}, [isSupported]);
// Latest callbacks without reopening the stream when they change
const handlers = useRef({ t, navigate });
useEffect(() => {
handlers.current = { t, navigate };
});
const active =
isSupported &&
enabled &&
permission === 'granted' &&
(!auth.enabled || auth.status === 'authenticated');
useEffect(() => {
if (!active) return;
let source: EventSource;
let retryTimer: ReturnType<typeof setTimeout> | undefined;
let retryDelay = RETRY_MIN_MS;
const onEvent = (message: MessageEvent<string>) => {
let event: RunEvent;
try {
event = JSON.parse(message.data) as RunEvent;
} catch {
return;
}
if (event.type === 'run.finished') {
void queryClient.invalidateQueries({ queryKey: ['runs'] });
}
const { t: translate, navigate: go } = handlers.current;
const key =
event.type === 'run.started'
? 'run_started'
: event.status === 'pass'
? 'run_pass'
: 'run_fail';
const notification = new Notification(
translate(`notifications.${key}_title`, { scenario: event.scenarioName }),
{
body: translate(`notifications.${key}_body`),
// finished replaces started for the same run
tag: event.runId,
},
);
notification.onclick = () => {
window.focus();
go(`/scenarios/${event.scenarioId}/runs/${event.runId}`);
notification.close();
};
};
const connect = () => {
source = createRunEventSource();
source.addEventListener('open', () => {
retryDelay = RETRY_MIN_MS;
});
// The browser retries transient errors itself, but some failures close
// the stream for good (e.g. Firefox drops quiet connections after a
// network change), so reopen it with backoff
source.addEventListener('error', () => {
if (source.readyState !== EventSource.CLOSED) return;
retryTimer = setTimeout(connect, retryDelay);
retryDelay = Math.min(retryDelay * 2, RETRY_MAX_MS);
});
source.addEventListener('run.started', onEvent as EventListener);
source.addEventListener('run.finished', onEvent as EventListener);
};
connect();
return () => {
clearTimeout(retryTimer);
source.close();
};
}, [active, queryClient]);
const toggle = useCallback(() => {
if (!isSupported) return;
if (Notification.permission === 'default') {
void Notification.requestPermission().then((result) => {
setPermission(result);
if (result === 'granted') {
setStored(true);
writeEnabled(true);
}
});
return;
}
if (Notification.permission !== 'granted') {
setPermission(Notification.permission);
return;
}
const next = !enabled;
setStored(next);
writeEnabled(next);
}, [isSupported, enabled]);
if (!isSupported) return null;
return {
state: permission === 'denied' ? 'blocked' : active ? 'on' : 'off',
toggle,
};
}
+26
View File
@@ -0,0 +1,26 @@
import { useState, useEffect } from 'react';
type Theme = 'light' | 'dark';
const STORAGE_KEY = 'qa-bot-theme';
function getInitialTheme(): Theme {
const stored = localStorage.getItem(STORAGE_KEY);
if (stored === 'light' || stored === 'dark') return stored;
return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
}
export function useTheme() {
const [theme, setTheme] = useState<Theme>(getInitialTheme);
useEffect(() => {
document.documentElement.setAttribute('data-theme', theme);
localStorage.setItem(STORAGE_KEY, theme);
}, [theme]);
function toggleTheme() {
setTheme((t) => (t === 'light' ? 'dark' : 'light'));
}
return { theme, toggleTheme } as const;
}
+12
View File
@@ -0,0 +1,12 @@
import i18n from 'i18next';
import { initReactI18next } from 'react-i18next';
import en from './locales/en.json';
i18n.use(initReactI18next).init({
resources: { en: { translation: en } },
lng: 'en',
fallbackLng: 'en',
interpolation: { escapeValue: false },
});
export default i18n;
+413
View File
@@ -0,0 +1,413 @@
{
"auth": {
"page_title": "Sign in",
"sign_in": "Sign in",
"signing_in": "Signing in…",
"username": "Username",
"password": "Password",
"username_required": "Enter your username.",
"password_required": "Enter your password.",
"invalid_credentials": "Username or password is incorrect.",
"sign_in_failed": "Couldn't sign in. Check your connection and try again.",
"checking_session": "Checking your session…",
"session_check_failed": "Couldn't check your session. Try again.",
"retry": "Retry",
"session_expired": "Your session has expired. Sign in again to continue.",
"sign_out": "Sign out",
"signing_out": "Signing out…",
"signed_out": "You have signed out.",
"sign_out_failed": "Couldn't sign out. Try again.",
"show_sign_out": "Expand the menu to sign out"
},
"common": {
"button_cancel": "Cancel",
"button_confirm": "Confirm",
"button_delete": "Delete",
"confirm_delete_credential": "Are you sure you want to delete this credential?",
"confirm_delete_environment": "Are you sure you want to delete this environment?",
"confirm_delete_scenario": "Are you sure you want to delete this scenario?",
"confirm_delete_step": "Are you sure you want to delete this step?",
"confirm_delete_session": "Are you sure you want to delete this session?",
"confirm_delete_snippet": "Are you sure you want to delete this snippet?",
"confirm_remove_credential": "Are you sure you want to remove this credential from scenario?",
"save_session": "Save session"
},
"code_help": {
"open": "Code reference",
"title": "Code reference",
"close": "Close"
},
"errors": {
"not_found": "Not found",
"not_found_session": "Session {{id}} does not exist or has been deleted.",
"not_found_environment": "Environment {{id}} does not exist or has been deleted.",
"not_found_credential": "Credential {{id}} does not exist or has been deleted.",
"not_found_scenario": "Scenario {{id}} does not exist or has been deleted.",
"not_found_snippet": "Snippet {{id}} does not exist or has been deleted.",
"generic": "Something went wrong. Please try again."
},
"nav": {
"licenses": "Licenses",
"version_mismatch": "Server version; this page was built for v{{client}}. Reload to update.",
"environments": "Environments",
"credentials": "Credentials",
"snippets": "Snippets",
"keys": "Keys",
"sessions": "Sessions",
"scenarios": "Scenarios",
"runs": "Runs",
"import": "Import"
},
"import": {
"title": "Import",
"action_choose": "Choose files",
"description": "Import exported environments, credentials, snippets and scenarios. Each YAML file may hold several items as ---separated documents, and each document may hold one item or a list of items. JSON files work too.",
"description_validation": "Every item in a file is checked before anything is imported: if one item is invalid, nothing from that file is imported. Items are imported in dependency order (environments, credentials, snippets, scenarios), and snippets and scenarios keep the version they were exported with.",
"imported_count_one": "Imported {{count}} item",
"imported_count_other": "Imported {{count}} items",
"col_file": "File",
"col_kind": "Kind",
"col_name": "Name",
"col_version": "Version",
"kind_environment": "Environment",
"kind_credential": "Credential",
"kind_snippet": "Snippet",
"kind_scenario": "Scenario"
},
"environments": {
"title": "Environments",
"created": "Environment created",
"updated": "Environment updated",
"col_id": "ID",
"col_name": "Name",
"col_description": "Description",
"col_data": "Data",
"col_updated": "Updated",
"empty": "No environments yet.",
"loading": "Loading…",
"no_data": "No data configured.",
"menu_label": "Environment options",
"action_view": "View details",
"action_delete": "Delete",
"action_add": "Add environment",
"action_edit": "Edit",
"action_export": "Export",
"action_import": "Import",
"action_save": "Create",
"action_update": "Save",
"action_cancel": "Cancel",
"create_title": "New Environment",
"edit_title": "Edit Environment",
"form_name": "Name",
"form_name_placeholder": "e.g. staging, production",
"form_name_required": "Name is required",
"form_description": "Description",
"form_description_placeholder": "Describe this environment",
"form_data": "Data (JSON)",
"form_data_invalid_json": "Must be a valid JSON object",
"back": "Environments",
"field_id": "ID",
"field_description": "Description",
"field_created": "Created",
"field_updated": "Updated",
"section_data": "Data"
},
"credentials": {
"title": "Credentials",
"created": "Credential created",
"updated": "Credential updated",
"empty": "No credentials yet.",
"loading": "Loading…",
"menu_label": "Credential options",
"action_edit": "Edit",
"action_delete": "Delete",
"action_add": "Add credential",
"action_save": "Create",
"action_update": "Save",
"action_cancel": "Cancel",
"create_title": "New Credential",
"edit_title": "Edit Credential",
"form_name": "Name",
"form_name_placeholder": "e.g. staging-api-key",
"form_name_required": "Name is required",
"form_data": "Data (JSON)",
"form_data_placeholder": "{\"token\": \"…\"}",
"form_data_invalid_json": "Must be valid JSON",
"field_id": "ID",
"field_last_used": "Last Used",
"field_created": "Created",
"field_updated": "Updated",
"section_data": "Data",
"action_export": "Export",
"action_import": "Import",
"import_error": "Failed to import credential"
},
"keys": {
"col_name": "Key name",
"empty": "No key files found."
},
"sessions": {
"title": "Sessions",
"col_id": "ID",
"col_name": "Name",
"col_status": "Status",
"col_lastUsed": "Last Used",
"empty": "No sessions yet.",
"loading": "Loading…",
"action_delete": "Delete",
"field_id": "ID",
"field_name": "Name",
"field_token": "Token",
"field_status": "Status",
"field_created": "Created",
"field_updated": "Updated",
"field_lastUsed": "Last Used"
},
"scenarios": {
"title": "Scenarios",
"created": "Scenario created",
"updated": "Scenario updated",
"run_started": "Scenario run started",
"col_id": "ID",
"col_name": "Name",
"col_version": "Version",
"col_description": "Description",
"col_last_run": "Last Run",
"col_updated": "Updated",
"empty": "No scenarios yet.",
"loading": "Loading…",
"action_run": "Run",
"action_delete": "Delete",
"field_id": "ID",
"field_name": "Name",
"field_version": "Version",
"field_description": "Description",
"field_steps": "Steps",
"field_created": "Created",
"field_updated": "Updated",
"steps_heading": "Steps",
"step_order": "#",
"step_title": "Title",
"step_type": "Type",
"step_session": "Session",
"step_updated": "Updated",
"action_add": "New scenario",
"action_edit": "Edit",
"action_runs": "Runs",
"action_export": "Export",
"action_export_e2e": "Export e2e test",
"action_import": "Import",
"import_error": "Failed to import scenario",
"action_save": "Create",
"action_update": "Save",
"action_cancel": "Cancel",
"create_title": "New Scenario",
"edit_title": "Edit Scenario",
"form_description": "Description",
"form_description_placeholder": "Describe this scenario",
"form_environment": "Default Environment",
"form_environment_none": "None (no default environment)",
"field_environment": "Default Environment",
"form_name": "Name",
"form_name_placeholder": "e.g. Login flow",
"form_name_required": "Name is required",
"credentials_heading": "Credentials",
"used_snippets_heading": "Used Snippets",
"used_snippet_pinned": "v{{version}} (pinned)",
"used_snippet_latest": "Latest (v{{version}})",
"cred_empty": "No credentials assigned.",
"cred_col_alias": "Alias",
"cred_col_name": "Credential",
"cred_col_added": "Added",
"cred_action_add": "Add credential",
"cred_action_remove": "Remove",
"cred_action_save": "Add",
"cred_action_cancel": "Cancel",
"cred_form_cred": "Credential",
"cred_form_cred_placeholder": "Select credential…",
"cred_form_cred_required": "Select a credential",
"cred_form_alias": "Alias",
"cred_form_alias_placeholder": "e.g. api_key",
"cred_form_alias_required": "Alias is required",
"run_modal_title": "Select environment",
"run_modal_env_label": "Environment",
"run_modal_no_env": "No environments found. Create an environment before running a scenario.",
"run_modal_env_required": "Please select an environment",
"run_modal_version_label": "Version",
"run_modal_version_latest": "Latest",
"run_modal_version_latest_n": "Latest (v{{version}})",
"run_modal_trace_label": "Playwright trace",
"trace_mode_on": "Always keep",
"trace_mode_retain_on_failure": "Keep on failure",
"trace_mode_off": "Off",
"trace_mode_default_suffix": "(default)",
"export_modal_title": "Export Scenario",
"export_include_environment": "Include Environment",
"export_include_credentials": "Include Credentials",
"export_include_snippets": "Include Snippets",
"form_timeout": "Scenario Timeout (seconds)",
"form_timeout_placeholder": "Default: 600",
"form_timeout_hint": "Max seconds for the entire scenario run (default: 600)"
},
"theme": {
"switch_to_light": "Switch to light theme",
"switch_to_dark": "Switch to dark theme",
"light_mode": "Light mode",
"dark_mode": "Dark mode"
},
"notifications": {
"enable": "Enable browser notifications for runs",
"disable": "Disable browser notifications for runs",
"blocked": "Notifications are blocked in your browser settings",
"run_started_title": "Run started: {{scenario}}",
"run_started_body": "The scenario run is in progress.",
"run_pass_title": "Run passed: {{scenario}}",
"run_pass_body": "All steps passed.",
"run_fail_title": "Run failed: {{scenario}}",
"run_fail_body": "The scenario run failed."
},
"revealable": {
"hidden": "Hidden so secrets aren't exposed on screen.",
"reveal": "Reveal",
"hide": "Hide"
},
"pagination": {
"prev": "Previous page",
"next": "Next page",
"range": "{{from}}–{{to}} of {{total}}",
"per_page": "{{count}} per page",
"page_size": "Items per page"
},
"steps": {
"created": "Step created",
"updated": "Step updated",
"create_title": "Add Step",
"edit_title": "Edit Step #{{order}}",
"loading": "Loading…",
"action_add": "Add step",
"action_edit": "Edit",
"action_delete": "Delete",
"action_save": "Add step",
"action_update": "Save",
"action_cancel": "Cancel",
"form_order": "Order",
"form_order_invalid": "Order must be a non-negative integer",
"form_title": "Title",
"form_title_placeholder": "e.g. Check login page",
"form_type": "Type",
"form_session": "Session name",
"form_session_placeholder": "e.g. my-session",
"form_session_required": "Session name is required",
"form_exec_code": "Exec code",
"form_exec_code_placeholder": "return await page.title();",
"form_timeout": "Step Timeout (seconds)",
"form_timeout_placeholder": "Default: 60",
"form_timeout_hint": "Max seconds for this step (default: 60)"
},
"runs": {
"title": "Runs",
"loading": "Loading…",
"empty": "No runs yet.",
"action_run": "Run scenario",
"col_id": "ID",
"col_scenario": "Scenario",
"col_status": "Status",
"col_steps": "Steps",
"col_version": "Version",
"col_created": "Started",
"field_id": "ID",
"field_status": "Status",
"field_steps": "Steps",
"field_created": "Started",
"field_updated": "Updated",
"field_trace": "Playwright trace",
"field_scenario_version": "Scenario version",
"steps_heading": "Step runs",
"step_title": "Title",
"logs_heading": "Logs",
"logs_search_placeholder": "Filter logs…",
"step_order": "#",
"step_type": "Type",
"step_session": "Session",
"step_status": "Status",
"step_description": "Result",
"log_level": "Level",
"log_message": "Message",
"log_time": "Time",
"action_download_logs": "Download logs",
"action_copy_logs": "Copy logs",
"logs_copied": "Logs copied to clipboard",
"logs_copy_failed": "Could not copy logs to clipboard",
"logs_expand_data": "Expand data",
"logs_collapse_data": "Collapse data",
"logs_show_data_one": "Show data ({{size}}, {{count}} line)",
"logs_show_data_other": "Show data ({{size}}, {{count}} lines)",
"logs_hide_data": "Hide data",
"action_repeat": "Repeat run",
"repeat_no_environment": "The environment used by this run no longer exists",
"export_logs_modal_title": "Export logs",
"export_logs_format": "Format",
"export_logs_format_md": "Markdown (.md)",
"export_logs_format_csv": "CSV (.csv)",
"action_export": "Export"
},
"snippets": {
"title": "Snippets",
"created": "Snippet created",
"updated": "Snippet updated",
"empty": "No snippets yet.",
"loading": "Loading…",
"menu_label": "Snippet options",
"action_edit": "Edit",
"action_delete": "Delete",
"action_add": "Add snippet",
"action_save": "Create",
"action_update": "Save",
"action_cancel": "Cancel",
"create_title": "New Snippet",
"edit_title": "Edit Snippet",
"form_alias": "Alias",
"form_alias_placeholder": "e.g. clickLoginButton",
"form_alias_required": "Alias is required",
"form_title": "Title",
"form_title_placeholder": "e.g. Click Login Button",
"form_title_required": "Title is required",
"form_description": "Description",
"form_description_placeholder": "What does this snippet do?",
"form_code": "Code",
"form_code_placeholder": "await page.click('#login-btn');",
"form_code_required": "Code is required",
"field_id": "ID",
"field_alias": "Alias",
"field_version": "Version",
"field_title": "Title",
"field_description": "Description",
"field_created": "Created",
"field_updated": "Updated",
"section_code": "Code",
"action_export": "Export",
"action_import": "Import",
"import_error": "Failed to import snippet"
},
"files": {
"title": "Files",
"upload": "Upload",
"uploadTitle": "Upload File",
"uploadSuccess": "File uploaded successfully",
"name": "Name",
"mimeType": "MIME Type",
"size": "Size",
"expiresAt": "Expires At",
"expiresAtLabel": "Expires At (optional)",
"createdAt": "Created",
"download": "Download",
"delete": "Delete",
"deleteTitle": "Delete file",
"confirmDelete": "Are you sure you want to delete \"{{name}}\" from this run?",
"deleteSuccess": "File deleted",
"expiredTooltip": "File is expired",
"empty": "No files uploaded.",
"totalCount": "Total: {{count}} file(s)",
"artifactsTitle": "Artifacts"
}
}
+8
View File
@@ -0,0 +1,8 @@
import hljs from 'highlight.js/lib/core';
import javascript from 'highlight.js/lib/languages/javascript';
import json from 'highlight.js/lib/languages/json';
hljs.registerLanguage('javascript', javascript);
hljs.registerLanguage('json', json);
export default hljs;
+130
View File
@@ -0,0 +1,130 @@
import { DEFAULT_LOG_DATA_LIMITS, type LogDataLimits } from '../ui/LogOutput/logText';
/** Public client configuration served by the server at /manifest.json. */
export interface Manifest {
name: string;
/** Server version; can differ from the client build's __APP_VERSION__ until the page is reloaded. */
version: string;
runLogs: {
dataLimits: LogDataLimits;
};
auth: {
enabled: boolean;
};
}
export const DEFAULT_MANIFEST: Manifest = {
name: 'liqa',
version: __APP_VERSION__,
runLogs: { dataLimits: DEFAULT_LOG_DATA_LIMITS },
auth: { enabled: false },
};
const STORAGE_KEY = 'liqa-manifest';
/** A tab coming back into view refetches the manifest if it is older than this. */
const REFRESH_AFTER_MS = 5 * 60 * 1000;
// Served next to the API's /api/v1 (so "/manifest.json" by default, or on
// VITE_API_URL's origin when the client talks to another server)
const MANIFEST_URL = new URL(
'../../manifest.json',
new URL(
`${(import.meta.env.VITE_API_URL ?? '/api/v1').replace(/\/$/, '')}/`,
window.location.href,
),
).toString();
/** Fills fields missing from `raw` (e.g. a manifest cached by an older version) with defaults. */
function normalize(raw: unknown): Manifest | null {
if (typeof raw !== 'object' || raw === null) return null;
const m = raw as Partial<Manifest>;
const limits: Partial<LogDataLimits> = m.runLogs?.dataLimits ?? {};
const num = (v: unknown, fallback: number) => (typeof v === 'number' && v >= 0 ? v : fallback);
return {
name: typeof m.name === 'string' ? m.name : DEFAULT_MANIFEST.name,
version: typeof m.version === 'string' ? m.version : DEFAULT_MANIFEST.version,
auth: { enabled: m.auth?.enabled === true },
runLogs: {
dataLimits: {
bytes: num(limits.bytes, DEFAULT_LOG_DATA_LIMITS.bytes),
lines: num(limits.lines, DEFAULT_LOG_DATA_LIMITS.lines),
},
},
};
}
// Storage can be unavailable (private mode, blocked site data): the manifest
// then just comes from the network on every page load
function readCache(): Manifest | null {
try {
const stored = localStorage.getItem(STORAGE_KEY);
return stored ? normalize(JSON.parse(stored)) : null;
} catch {
return null;
}
}
function writeCache(manifest: Manifest) {
try {
localStorage.setItem(STORAGE_KEY, JSON.stringify(manifest));
} catch {
// ignore, see readCache
}
}
let current: Manifest = readCache() ?? DEFAULT_MANIFEST;
let fetchedAt = 0;
let inFlight: Promise<void> | null = null;
const listeners = new Set<() => void>();
/**
* Fetches the manifest and notifies subscribers if it changed. Failures are
* silent: the cached (or default) manifest stays in use.
*/
export function refreshManifest(): Promise<void> {
inFlight ??= fetch(MANIFEST_URL, {
headers: { Accept: 'application/json' },
credentials: 'include',
})
.then((res) => (res.ok ? res.json() : null))
.then((raw: unknown) => {
const next = normalize(raw);
if (!next) return;
fetchedAt = Date.now();
writeCache(next);
if (JSON.stringify(next) !== JSON.stringify(current)) {
current = next;
listeners.forEach((l) => l());
}
})
.catch(() => undefined)
.finally(() => {
inFlight = null;
});
return inFlight;
}
function onVisibilityChange() {
if (document.visibilityState === 'visible' && Date.now() - fetchedAt > REFRESH_AFTER_MS) {
void refreshManifest();
}
}
/**
* Stale-while-revalidate: subscribers get the localStorage copy right away,
* and the manifest is refetched once per page load (the server answers 304
* while it is unchanged) and when the tab becomes visible again after a while.
*/
export function subscribeManifest(listener: () => void): () => void {
if (listeners.size === 0) document.addEventListener('visibilitychange', onVisibilityChange);
listeners.add(listener);
if (fetchedAt === 0) void refreshManifest();
return () => {
listeners.delete(listener);
if (listeners.size === 0) document.removeEventListener('visibilitychange', onVisibilityChange);
};
}
export function getManifest(): Manifest {
return current;
}
+30
View File
@@ -0,0 +1,30 @@
export const API_ERROR_TOAST_EVENT = 'liqa:api-error-toast';
export interface ApiErrorToastDetail {
message: string;
}
export function emitApiErrorToast(message: string): void {
if (typeof window === 'undefined') return;
window.dispatchEvent(
new CustomEvent<ApiErrorToastDetail>(API_ERROR_TOAST_EVENT, {
detail: { message },
}),
);
}
export function subscribeApiErrorToasts(handler: (message: string) => void): () => void {
if (typeof window === 'undefined') return () => {};
const listener = (event: Event) => {
const custom = event as CustomEvent<ApiErrorToastDetail>;
const message = custom.detail?.message;
if (message) handler(message);
};
window.addEventListener(API_ERROR_TOAST_EVENT, listener);
return () => {
window.removeEventListener(API_ERROR_TOAST_EVENT, listener);
};
}
+33
View File
@@ -0,0 +1,33 @@
import { StrictMode } from 'react';
import { createRoot } from 'react-dom/client';
import { BrowserRouter } from 'react-router-dom';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import './i18n';
import './ui/tokens.css';
import App from './App';
import { ToastProvider } from './ui';
import { AuthProvider } from './auth/AuthContext';
import { ApiError } from './api/client';
const queryClient = new QueryClient({
defaultOptions: {
queries: {
retry: (failureCount, error) =>
error instanceof ApiError && error.status === 401 ? false : failureCount < 3,
},
},
});
createRoot(document.getElementById('root')!).render(
<StrictMode>
<QueryClientProvider client={queryClient}>
<ToastProvider>
<BrowserRouter>
<AuthProvider>
<App />
</AuthProvider>
</BrowserRouter>
</ToastProvider>
</QueryClientProvider>
</StrictMode>,
);
+373
View File
@@ -0,0 +1,373 @@
.heading {
margin: 0 0 var(--space-4);
font-size: var(--font-size-lg);
font-weight: 700;
color: var(--color-text);
}
.sectionHeading {
margin: 0 0 var(--space-3);
line-height: 1;
font-size: var(--font-size-md);
font-weight: 600;
color: var(--color-text);
}
.stepsSection {
margin-top: var(--space-6);
}
.sectionHeadingRow {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: var(--space-3);
}
.breadcrumbs {
margin-bottom: var(--space-4);
}
.pageToolbar {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: var(--space-4);
}
.toolbarActions {
display: flex;
align-items: center;
gap: var(--space-2);
}
.error {
margin-bottom: var(--space-4);
padding: var(--space-3) var(--space-4);
background: var(--color-error-bg);
color: var(--color-error-fg);
border-radius: var(--radius-md);
font-size: var(--font-size-sm);
}
.muted {
color: var(--color-text-muted);
font-size: var(--font-size-sm);
}
.codeInline {
font-family: var(--font-mono, ui-monospace, monospace);
font-size: 0.85em;
padding: 0.15em 0.45em;
background: var(--color-code-bg, color-mix(in srgb, var(--color-bg-raised) 60%, var(--color-secondary) 40%));
border: 1px solid var(--color-border);
border-radius: var(--radius-sm);
color: var(--color-secondary-fg);
word-break: break-all;
}
/* ── Environment cards ──────────────────────────────────────── */
.envGrid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
gap: var(--space-4);
}
.envCard {
display: flex;
flex-direction: column;
gap: var(--space-3);
}
.envCardAdd {
display: flex;
align-items: center;
justify-content: center;
min-height: 120px;
border: 2px dashed var(--color-border);
border-radius: var(--radius-lg);
transition: border-color var(--transition), background var(--transition);
}
.envCardAdd:hover {
border-color: var(--color-primary);
background: color-mix(in srgb, var(--color-primary) 6%, transparent);
}
.envCardHeader {
display: flex;
align-items: center;
gap: var(--space-2);
flex: 1;
min-width: 0;
}
.envCardId {
font-size: var(--font-size-xs);
font-weight: 700;
color: var(--color-text-muted);
flex-shrink: 0;
border: var(--border-width) solid var(--color-border);
border-radius: 9999px;
padding: 1px var(--space-2);
line-height: 1.6;
}
.envCardFooter {
display: flex;
align-items: center;
justify-content: space-between;
width: 100%;
}
.envCardHeader button {
color: inherit;
padding: var(--space-1);
aspect-ratio: 1;
margin-right: calc(-1 * var(--space-1));
}
.pageTitle {
margin: 0;
font-size: var(--font-size-lg);
font-weight: 700;
color: var(--color-text);
}
.linkCell {
color: var(--color-link);
cursor: pointer;
text-decoration: underline;
text-underline-offset: 2px;
}
.linkCell:hover {
color: var(--color-link-hover);
}
.dragHandle {
display: inline-flex;
align-items: center;
justify-content: center;
width: 24px;
height: 24px;
border-radius: var(--radius-sm);
cursor: grab;
color: var(--color-text-muted);
}
.dragHandle:hover {
background: color-mix(in srgb, var(--color-secondary) 18%, transparent);
color: var(--color-text);
}
.dragHandle:active {
cursor: grabbing;
}
.dragHandleDisabled {
opacity: 0.45;
cursor: not-allowed;
}
.dragOverRow {
background: color-mix(in srgb, var(--color-primary) 16%, transparent) !important;
}
.envCardHeader button:hover {
background: color-mix(in srgb, currentColor 15%, transparent) !important;
}
.envCardName {
font-weight: 700;
font-size: var(--font-size-sm);
flex: 1;
}
.envCardUrls {
margin: 0;
display: flex;
flex-direction: column;
gap: var(--space-1);
}
.envCardUrlRow {
display: flex;
gap: var(--space-2);
align-items: baseline;
font-size: var(--font-size-xs);
}
.envCardUrlKey {
color: var(--color-text-muted);
white-space: nowrap;
flex-shrink: 0;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.04em;
}
.envCardUrlVal {
margin: 0;
color: var(--color-text);
word-break: break-all;
}
.envCardEmpty {
margin: 0;
font-size: var(--font-size-xs);
color: var(--color-text-muted);
}
/* ── Environment form ───────────────────────────────────────────────────── */
.formCard {
max-width: 540px;
}
.formCardFull {
max-width: none;
}
.formFields {
display: flex;
flex-direction: column;
gap: var(--space-4);
margin-bottom: var(--space-6);
}
.formActions {
display: flex;
gap: var(--space-3);
justify-content: flex-end;
}
.formField {
display: flex;
flex-direction: column;
gap: var(--space-1);
}
.fieldLabel {
font-size: var(--font-size-sm);
font-weight: 500;
color: var(--color-text);
}
.labelRow {
display: flex;
align-items: center;
gap: var(--space-1);
}
.textarea {
width: 100%;
padding: var(--space-2) var(--space-3);
font-family: var(--font-mono, ui-monospace, monospace);
font-size: var(--font-size-sm);
color: var(--color-text);
background: var(--color-bg-input, var(--color-bg-raised));
border: var(--border-width) solid var(--color-border);
border-radius: var(--radius-md);
resize: vertical;
transition: border-color var(--transition), box-shadow var(--transition);
box-sizing: border-box;
}
.textarea:focus {
outline: none;
border-color: var(--color-primary);
box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary) 20%, transparent);
}
/* ── Section toolbar ─────────────────────────────────────────────────────── */
.sectionToolbar {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: var(--space-3);
}
/* ── Environment detail page ────────────────────────────────────────────── */
.detailToolbar {
margin-bottom: var(--space-4);
}
.detailHeader {
display: flex;
align-items: center;
gap: var(--space-4);
margin-bottom: var(--space-4);
}
.detailHeader .heading {
margin: 0;
flex: 1;
}
.detailMeta {
display: grid;
grid-template-columns: max-content 1fr;
gap: var(--space-1) var(--space-4);
margin-bottom: var(--space-6);
font-size: var(--font-size-sm);
}
.metaLabel {
color: var(--color-text-muted);
font-weight: 600;
text-transform: uppercase;
font-size: var(--font-size-xs);
letter-spacing: 0.04em;
align-self: center;
}
.sectionHeading {
margin: 0 0 var(--space-3);
font-size: var(--font-size-md);
font-weight: 700;
}
.envDetailUrls {
margin: 0;
display: flex;
flex-direction: column;
gap: var(--space-2);
}
.envDetailUrlRow {
display: grid;
grid-template-columns: 140px 1fr;
gap: var(--space-2);
align-items: baseline;
font-size: var(--font-size-sm);
}
.envDetailUrlVal {
margin: 0;
word-break: break-all;
}
.envDetailUrlVal a {
color: var(--color-text-muted);
text-decoration: none;
}
.envDetailUrlVal a:hover {
text-decoration: underline;
}
/* ── Code block ────────────────────────────────────────────────────────── */
.codeBlock {
margin: 0;
font-family: var(--font-mono, ui-monospace, monospace);
font-size: var(--font-size-sm);
color: var(--color-text);
white-space: pre-wrap;
word-break: break-all;
overflow-x: auto;
}
@@ -0,0 +1,57 @@
.page {
min-height: 100vh;
padding: 24px;
display: flex;
flex-direction: column;
color: var(--color-text);
background: var(--color-bg);
font-family: var(--font-family);
}
.header {
display: flex;
align-items: center;
justify-content: space-between;
}
.logo {
display: block;
width: auto;
height: 32px;
padding: 3px 6px;
background: #e6edea;
border-radius: var(--radius-md);
}
.main {
flex: 1;
display: grid;
place-items: center;
padding: var(--space-6) 0;
}
.message {
width: min(100%, 440px);
display: flex;
flex-direction: column;
align-items: stretch;
gap: var(--space-4);
margin: 0;
padding: var(--space-6);
text-align: center;
background: var(--color-bg);
border: var(--border-width) solid var(--color-border);
border-radius: var(--radius-lg);
box-shadow: var(--shadow-sm);
}
.message p {
margin: 0;
color: var(--color-error-fg);
}
@media (max-width: 480px) {
.page {
padding: 16px;
}
}
+38
View File
@@ -0,0 +1,38 @@
import { useTranslation } from 'react-i18next';
import { Button, ThemeSwitcher } from '../../ui';
import { usePageTitle } from '../../hooks/usePageTitle';
import liqaLogo from '../../assets/liqa.svg';
import styles from './AuthStatusPage.module.css';
export function AuthStatusPage({
failed = false,
onRetry,
}: {
failed?: boolean;
onRetry?: () => void;
}) {
const { t } = useTranslation();
usePageTitle(t('auth.page_title'));
return (
<div className={styles.page}>
<header className={styles.header}>
<img src={liqaLogo} alt="Liqa" className={styles.logo} />
<ThemeSwitcher />
</header>
<main className={styles.main} aria-live="polite">
{failed ? (
<section className={styles.message}>
<p role="alert">{t('auth.session_check_failed')}</p>
<Button type="button" size="lg" onClick={onRetry}>
{t('auth.retry')}
</Button>
</section>
) : (
<p className={styles.message} role="status">
{t('auth.checking_session')}
</p>
)}
</main>
</div>
);
}
@@ -0,0 +1,65 @@
.card {
width: min(100%, 400px);
padding: 24px;
color: var(--color-text);
background: var(--color-bg);
border: var(--border-width) solid var(--color-border);
border-radius: var(--radius-lg);
box-shadow: var(--shadow-sm);
}
.title {
margin: 0 0 var(--space-5);
font-size: var(--font-size-lg);
line-height: 1.3;
text-align: center;
}
.title:focus {
outline: 2px solid var(--color-primary-text);
outline-offset: 4px;
border-radius: var(--radius-sm);
}
.notice,
.formError {
margin: 0;
padding: var(--space-3) var(--space-4);
color: var(--color-error-fg);
background: var(--color-error-bg);
border-radius: var(--radius-md);
font-size: var(--font-size-sm);
}
.notice {
margin-bottom: var(--space-4);
}
.form .loginInput {
background: var(--color-bg-subtle);
}
.form {
display: flex;
flex-direction: column;
gap: var(--space-4);
}
.submit {
width: 100%;
}
.status {
margin: 0;
color: var(--color-text-muted);
font-size: var(--font-size-sm);
}
@media (max-width: 480px) {
.card {
padding: var(--space-4);
border: 0;
border-radius: 0;
box-shadow: none;
}
}
+133
View File
@@ -0,0 +1,133 @@
import { useEffect, useRef, useState, type FormEvent } from 'react';
import { useTranslation } from 'react-i18next';
import { ApiError } from '../../api/client';
import { Button, Input } from '../../ui';
import styles from './LoginForm.module.css';
export interface LoginFormProps {
expired?: boolean;
signedOut?: boolean;
onSubmit: (username: string, password: string) => Promise<void>;
}
export function LoginForm({ expired = false, signedOut = false, onSubmit }: LoginFormProps) {
const { t } = useTranslation();
const titleRef = useRef<HTMLHeadingElement>(null);
const formRef = useRef<HTMLFormElement>(null);
const focusPasswordAfterInvalidCredentialsRef = useRef(false);
const [username, setUsername] = useState('');
const [password, setPassword] = useState('');
const [usernameError, setUsernameError] = useState('');
const [passwordError, setPasswordError] = useState('');
const [formError, setFormError] = useState('');
const [submitting, setSubmitting] = useState(false);
useEffect(() => {
titleRef.current?.focus();
}, []);
useEffect(() => {
if (!submitting && focusPasswordAfterInvalidCredentialsRef.current) {
focusPasswordAfterInvalidCredentialsRef.current = false;
formRef.current?.querySelector<HTMLInputElement>('input[name="password"]')?.focus();
}
}, [submitting]);
function focusInput(name: string) {
formRef.current?.querySelector<HTMLInputElement>(`input[name="${name}"]`)?.focus();
}
async function handleSubmit(event: FormEvent<HTMLFormElement>) {
event.preventDefault();
if (submitting) return;
setFormError('');
const missingUsername = username.trim().length === 0;
const missingPassword = password.length === 0;
setUsernameError(missingUsername ? t('auth.username_required') : '');
setPasswordError(missingPassword ? t('auth.password_required') : '');
if (missingUsername || missingPassword) {
focusInput(missingUsername ? 'username' : 'password');
return;
}
setSubmitting(true);
try {
await onSubmit(username, password);
} catch (error) {
if (error instanceof ApiError && error.status === 401) {
setFormError(t('auth.invalid_credentials'));
setPassword('');
focusPasswordAfterInvalidCredentialsRef.current = true;
} else {
setFormError(t('auth.sign_in_failed'));
}
} finally {
setSubmitting(false);
}
}
return (
<section className={styles.card} aria-labelledby="login-title">
<h1 id="login-title" ref={titleRef} tabIndex={-1} className={styles.title}>
{t('auth.sign_in')}
</h1>
{expired && <p className={styles.notice}>{t('auth.session_expired')}</p>}
{signedOut && <p className={styles.notice}>{t('auth.signed_out')}</p>}
<form
ref={formRef}
className={styles.form}
onSubmit={(event) => void handleSubmit(event)}
noValidate
>
<Input
name="username"
className={styles.loginInput}
label={t('auth.username')}
autoComplete="username"
autoCapitalize="none"
autoCorrect="off"
value={username}
onChange={(event) => {
setUsername(event.target.value);
if (usernameError) setUsernameError('');
}}
error={usernameError || undefined}
disabled={submitting}
/>
<Input
name="password"
className={styles.loginInput}
type="password"
label={t('auth.password')}
autoComplete="current-password"
value={password}
onChange={(event) => {
setPassword(event.target.value);
if (passwordError) setPasswordError('');
}}
error={passwordError || undefined}
disabled={submitting}
/>
{formError && (
<p className={styles.formError} role="alert">
{formError}
</p>
)}
{submitting && (
<p className={styles.status} role="status" aria-live="polite">
{t('auth.signing_in')}
</p>
)}
<Button
type="submit"
size="lg"
loading={submitting}
disabled={submitting}
className={styles.submit}
>
{t(submitting ? 'auth.signing_in' : 'auth.sign_in')}
</Button>
</form>
</section>
);
}
@@ -0,0 +1,44 @@
.page {
min-height: 100vh;
padding: 24px;
display: flex;
flex-direction: column;
color: var(--color-text);
background: var(--color-bg);
font-family: var(--font-family);
}
.header {
display: flex;
align-items: center;
justify-content: space-between;
gap: var(--space-4);
}
.logo {
display: block;
width: auto;
height: 32px;
padding: 3px 6px;
background: #e6edea;
border-radius: var(--radius-md);
}
.main {
flex: 1;
min-height: 0;
display: grid;
place-items: center;
padding: var(--space-6) 0;
}
@media (max-width: 480px) {
.page {
padding: 16px;
}
.main {
align-items: start;
padding-top: clamp(40px, 12vh, 96px);
}
}
+41
View File
@@ -0,0 +1,41 @@
import { useCallback } from 'react';
import { useNavigate, useSearchParams } from 'react-router-dom';
import { useTranslation } from 'react-i18next';
import { useAuth } from '../../auth/useAuth';
import { safeReturnTo } from '../../auth/returnTo';
import { usePageTitle } from '../../hooks/usePageTitle';
import { ThemeSwitcher } from '../../ui';
import liqaLogo from '../../assets/liqa.svg';
import { LoginForm } from './LoginForm';
import styles from './LoginPage.module.css';
export function LoginPage() {
const auth = useAuth();
const navigate = useNavigate();
const [search] = useSearchParams();
const { t } = useTranslation();
const returnTo = safeReturnTo(search.get('returnTo')) ?? '/scenarios';
const expired = search.get('expired') === '1';
const signedOut = search.get('notice') === 'signedOut';
usePageTitle(t('auth.page_title'));
const handleSubmit = useCallback(
async (username: string, password: string) => {
await auth.login(username, password);
navigate(returnTo, { replace: true });
},
[auth, navigate, returnTo],
);
return (
<div className={styles.page}>
<header className={styles.header}>
<img src={liqaLogo} alt="Liqa" className={styles.logo} />
<ThemeSwitcher />
</header>
<main className={styles.main}>
<LoginForm expired={expired} signedOut={signedOut} onSubmit={handleSubmit} />
</main>
</div>
);
}
@@ -0,0 +1,57 @@
.root {
display: flex;
flex-direction: column;
gap: var(--space-2);
min-width: 0;
}
.button {
min-height: 44px;
display: inline-flex;
align-items: center;
justify-content: center;
gap: var(--space-2);
padding: var(--space-2) var(--space-3);
color: var(--color-text);
background: transparent;
border: var(--border-width) solid var(--color-border);
border-radius: var(--radius-md);
font: inherit;
font-size: var(--font-size-xs);
cursor: pointer;
}
.button:hover:not(:disabled) {
background: var(--color-secondary);
}
.button:focus-visible,
.failure button:focus-visible {
outline: 2px solid var(--color-primary-text);
outline-offset: 2px;
}
.button:disabled {
opacity: 0.55;
cursor: wait;
}
.failure {
display: flex;
align-items: center;
gap: var(--space-2);
padding: var(--space-2);
color: var(--color-error-fg);
background: var(--color-error-bg);
border-radius: var(--radius-sm);
font-size: var(--font-size-xs);
}
.failure button {
min-height: 32px;
color: inherit;
background: transparent;
border: var(--border-width) solid currentColor;
border-radius: var(--radius-sm);
cursor: pointer;
}
+39
View File
@@ -0,0 +1,39 @@
import { LogOut } from 'lucide-react';
import { useTranslation } from 'react-i18next';
import styles from './SignOutControl.module.css';
export function SignOutControl({
pending = false,
failed = false,
onSignOut,
}: {
pending?: boolean;
failed?: boolean;
onSignOut: () => void;
}) {
const { t } = useTranslation();
return (
<div className={styles.root}>
<button
type="button"
className={styles.button}
onClick={onSignOut}
disabled={pending}
data-sign-out="true"
aria-label={t(pending ? 'auth.signing_out' : 'auth.sign_out')}
title={t(pending ? 'auth.signing_out' : 'auth.sign_out')}
>
<LogOut size={16} aria-hidden="true" />
<span>{t(pending ? 'auth.signing_out' : 'auth.sign_out')}</span>
</button>
{failed && (
<div className={styles.failure} role="alert">
<span>{t('auth.sign_out_failed')}</span>
<button type="button" onClick={onSignOut} disabled={pending}>
{t('auth.retry')}
</button>
</div>
)}
</div>
);
}
@@ -0,0 +1,114 @@
import { useState, SubmitEvent } from 'react';
import { useNavigate } from 'react-router-dom';
import { useTranslation } from 'react-i18next';
import { usePageTitle } from '../../hooks/usePageTitle';
import { KeyRound, X, Save } from 'lucide-react';
import { credentials } from '../../api';
import { Breadcrumbs, Button, Card, Input, CodeEditor, useToast } from '../../ui';
import styles from '../Page.module.css';
export function CreateCredentialPage() {
const { t } = useTranslation();
usePageTitle(t('credentials.create_title'));
const navigate = useNavigate();
const toast = useToast();
const [name, setName] = useState('');
const [data, setData] = useState('');
const [nameError, setNameError] = useState('');
const [dataError, setDataError] = useState('');
const [saving, setSaving] = useState(false);
const handleSubmit = async (e: SubmitEvent<HTMLFormElement>) => {
e.preventDefault();
let valid = true;
if (!name.trim()) {
setNameError(t('credentials.form_name_required'));
valid = false;
}
if (data.trim()) {
try {
JSON.parse(data.trim());
} catch {
setDataError(t('credentials.form_data_invalid_json'));
valid = false;
}
}
if (!valid) return;
setSaving(true);
try {
const credential = await credentials.create(name.trim(), data.trim() || undefined);
toast.success(t('credentials.created'));
navigate(`/credentials/${credential.id}`);
} catch (err) {
const message = (err as Error).message;
toast.error(message);
} finally {
setSaving(false);
}
};
return (
<div>
<div className={styles.pageToolbar}>
<Breadcrumbs
items={[
{
label: t('credentials.title'),
icon: <KeyRound size={14} />,
onClick: () => navigate('/credentials'),
},
{ label: t('credentials.create_title') },
]}
/>
</div>
<form onSubmit={handleSubmit} noValidate>
<Card className={styles.formCardFull}>
<div className={styles.formFields}>
<Input
label={t('credentials.form_name')}
placeholder={t('credentials.form_name_placeholder')}
value={name}
onChange={(e) => {
setName(e.target.value);
setNameError('');
}}
error={nameError || undefined}
required
autoFocus
/>
<div className={styles.formField}>
<label className={styles.fieldLabel}>
{t('credentials.form_data')}
<span className={styles.requiredMark}> *</span>
</label>
<CodeEditor
language="json"
value={data}
onChange={(v) => {
setData(v);
setDataError('');
}}
rows={6}
error={!!dataError}
/>
{dataError && <span className={styles.fieldError}>{dataError}</span>}
</div>
</div>
<div className={styles.formActions}>
<Button type="button" variant="secondary" onClick={() => navigate('/credentials')}>
<X size={14} />
{t('credentials.action_cancel')}
</Button>
<Button type="submit" loading={saving}>
<Save size={14} />
{t('credentials.action_save')}
</Button>
</div>
</Card>
</form>
</div>
);
}
@@ -0,0 +1,154 @@
import { useEffect, useState } from 'react';
import { useNavigate, useParams } from 'react-router-dom';
import { useTranslation } from 'react-i18next';
import { usePageTitle } from '../../hooks/usePageTitle';
import { Upload, Pencil, Trash2, KeyRound } from 'lucide-react';
import { stringify as yamlStringify } from 'yaml';
import { credentials } from '../../api';
import type { Credential } from '../../api';
import {
Breadcrumbs,
Button,
Card,
DescriptionList,
RevealableCodeBlock,
Timestamp,
UuidBadge,
} from '../../ui';
import { DeleteConfirmationModal } from '../../components/modals';
import styles from '../Page.module.css';
export function CredentialDetailPage() {
const { t } = useTranslation();
const { id } = useParams<{ id: string }>();
const navigate = useNavigate();
const [credential, setCredential] = useState<Credential | null>(null);
const [loading, setLoading] = useState(true);
usePageTitle(credential?.name ?? null);
const [confirmDeleteOpen, setConfirmDeleteOpen] = useState(false);
const [deleting, setDeleting] = useState(false);
useEffect(() => {
if (!id) return;
credentials
.get(id)
.then(setCredential)
.finally(() => setLoading(false));
}, [id]);
const handleDelete = async () => {
if (!credential) return;
setDeleting(true);
try {
await credentials.remove(credential.id);
navigate('/credentials');
} finally {
setDeleting(false);
setConfirmDeleteOpen(false);
}
};
const handleExport = async () => {
if (!credential) return;
const data = await credentials.exportCredential(credential.id);
const blob = new Blob([yamlStringify(data)], { type: 'application/yaml' });
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = `credential-${credential.name}.yaml`;
a.click();
URL.revokeObjectURL(url);
};
return (
<div>
<div className={styles.pageToolbar}>
<Breadcrumbs
items={[
{
label: t('credentials.title'),
icon: <KeyRound size={14} />,
onClick: () => navigate('/credentials'),
},
{ label: credential?.name ?? `#${id}` },
]}
/>
{credential && (
<div className={styles.toolbarActions}>
<Button variant="secondary" size="sm" onClick={handleExport}>
<Upload size={14} />
{t('credentials.action_export')}
</Button>
<Button
variant="secondary"
size="sm"
onClick={() => navigate(`/credentials/${credential.id}/edit`)}
>
<Pencil size={14} />
{t('credentials.action_edit')}
</Button>
<Button variant="danger" size="sm" onClick={() => setConfirmDeleteOpen(true)}>
<Trash2 size={14} />
{t('credentials.action_delete')}
</Button>
</div>
)}
</div>
{loading && <p className={styles.muted}>{t('credentials.loading')}</p>}
{credential && (
<>
<Card>
<DescriptionList
layout="grid"
items={[
{ term: t('credentials.field_id'), detail: <UuidBadge id={credential.id} /> },
{
term: t('credentials.field_last_used'),
detail: credential.lastUsedAt ? <Timestamp value={credential.lastUsedAt} /> : '—',
},
{
term: t('credentials.field_created'),
detail: <Timestamp value={credential.createdAt} />,
},
{
term: t('credentials.field_updated'),
detail: <Timestamp value={credential.updatedAt} />,
},
]}
/>
</Card>
{credential.data && (
<div className={styles.stepsSection}>
<h2 className={styles.sectionHeading}>{t('credentials.section_data')}</h2>
<Card>
<RevealableCodeBlock
key={credential.id}
language="json"
code={(() => {
try {
return JSON.stringify(JSON.parse(credential.data), null, 2);
} catch {
return credential.data;
}
})()}
/>
</Card>
</div>
)}
</>
)}
<DeleteConfirmationModal
open={confirmDeleteOpen}
title={t('credentials.action_delete')}
message={t('common.confirm_delete_credential')}
onClose={() => setConfirmDeleteOpen(false)}
onConfirm={handleDelete}
isDeleting={deleting}
/>
</div>
);
}
@@ -0,0 +1,179 @@
import { useEffect, useRef, useState } from 'react';
import { useNavigate } from 'react-router-dom';
import { useTranslation } from 'react-i18next';
import { usePageTitle } from '../../hooks/usePageTitle';
import { useImportFile } from '../../hooks/useImportFile';
import { Settings, Pencil, Trash2, Plus, Download, KeyRound } from 'lucide-react';
import { credentials } from '../../api';
import type { Credential } from '../../api';
import {
Breadcrumbs,
Button,
Card,
ContextMenu,
DescriptionList,
Timestamp,
UuidBadge,
} from '../../ui';
import { DeleteConfirmationModal } from '../../components/modals';
import styles from '../Page.module.css';
function CredentialCard({
credential,
onDelete,
}: {
credential: Credential;
onDelete: (id: string) => void;
}) {
const { t } = useTranslation();
const navigate = useNavigate();
const header = (
<div className={styles.envCardHeader}>
<span className={styles.envCardName}>{credential.name}</span>
<div onClick={(e) => e.stopPropagation()}>
<ContextMenu
align="right"
trigger={
<Button variant="ghost" size="sm" aria-label={t('credentials.menu_label')}>
<Settings size={14} />
</Button>
}
items={[
{
label: t('credentials.action_edit'),
icon: <Pencil size={14} />,
onClick: () => navigate(`/credentials/${credential.id}/edit`),
},
{
label: t('credentials.action_delete'),
icon: <Trash2 size={14} />,
variant: 'danger',
onClick: () => onDelete(credential.id),
},
]}
/>
</div>
</div>
);
const footer = (
<div className={styles.envCardFooter}>
<UuidBadge id={credential.id} />
<Timestamp value={credential.updatedAt} />
</div>
);
return (
<Card
className={styles.envCard}
header={header}
headerVariant="primary"
footer={footer}
onClick={() => navigate(`/credentials/${credential.id}`)}
>
<DescriptionList
layout="compact"
truncate
items={[
{
term: t('credentials.field_last_used'),
detail: credential.lastUsedAt ? <Timestamp value={credential.lastUsedAt} /> : '—',
},
]}
/>
</Card>
);
}
function AddCredentialCard() {
const { t } = useTranslation();
const navigate = useNavigate();
return (
<div className={styles.envCardAdd}>
<Button variant="ghost" onClick={() => navigate('/credentials/new')}>
<Plus size={16} />
{t('credentials.action_add')}
</Button>
</div>
);
}
export function CredentialsPage() {
const { t } = useTranslation();
usePageTitle(t('credentials.title'));
const [items, setItems] = useState<Credential[]>([]);
const [loading, setLoading] = useState(true);
const [deleteId, setDeleteId] = useState<string | null>(null);
const [deleting, setDeleting] = useState(false);
const fileInputRef = useRef<HTMLInputElement>(null);
const load = () => {
credentials
.list()
.then((res) => setItems(res.data))
.finally(() => setLoading(false));
};
useEffect(() => {
load();
}, []);
const requestDelete = (id: string) => {
setDeleteId(id);
};
const handleDelete = async () => {
if (!deleteId) return;
setDeleting(true);
try {
await credentials.remove(deleteId);
setItems((prev) => prev.filter((c) => c.id !== deleteId));
setDeleteId(null);
} finally {
setDeleting(false);
}
};
const handleImport = useImportFile('credential');
return (
<div>
<div className={styles.pageToolbar}>
<Breadcrumbs items={[{ label: t('credentials.title'), icon: <KeyRound size={14} /> }]} />
<div className={styles.toolbarActions}>
<input
ref={fileInputRef}
type="file"
accept=".yaml,.yml,.json"
style={{ display: 'none' }}
onChange={handleImport}
/>
<Button variant="secondary" size="sm" onClick={() => fileInputRef.current?.click()}>
<Download size={14} />
{t('credentials.action_import')}
</Button>
</div>
</div>
{loading ? (
<p className={styles.muted}>{t('credentials.loading')}</p>
) : (
<div className={styles.envGrid}>
{items.map((credential) => (
<CredentialCard key={credential.id} credential={credential} onDelete={requestDelete} />
))}
<AddCredentialCard />
</div>
)}
<DeleteConfirmationModal
open={deleteId != null}
title={t('credentials.action_delete')}
message={t('common.confirm_delete_credential')}
onClose={() => setDeleteId(null)}
onConfirm={handleDelete}
isDeleting={deleting}
/>
</div>
);
}
@@ -0,0 +1,149 @@
import { useEffect, useState, SubmitEvent } from 'react';
import { useNavigate, useParams } from 'react-router-dom';
import { useTranslation } from 'react-i18next';
import { usePageTitle } from '../../hooks/usePageTitle';
import { KeyRound, X, Save } from 'lucide-react';
import { credentials } from '../../api';
import type { Credential } from '../../api';
import { Breadcrumbs, Button, Card, Input, CodeEditor, useToast } from '../../ui';
import styles from '../Page.module.css';
export function EditCredentialPage() {
const { t } = useTranslation();
const { id } = useParams<{ id: string }>();
const navigate = useNavigate();
const toast = useToast();
const [credential, setCredential] = useState<Credential | null>(null);
const [name, setName] = useState('');
usePageTitle(
credential
? `${t('credentials.edit_title')} — ${credential.name}`
: t('credentials.edit_title'),
);
const [data, setData] = useState('');
const [nameError, setNameError] = useState('');
const [dataError, setDataError] = useState('');
const [loading, setLoading] = useState(true);
const [saving, setSaving] = useState(false);
useEffect(() => {
if (!id) return;
credentials
.get(id)
.then((c) => {
setCredential(c);
setName(c.name);
setData(c.data ?? '');
})
.finally(() => setLoading(false));
}, [id]);
const handleSubmit = async (e: SubmitEvent<HTMLFormElement>) => {
e.preventDefault();
let valid = true;
if (!name.trim()) {
setNameError(t('credentials.form_name_required'));
valid = false;
}
if (data.trim()) {
try {
JSON.parse(data.trim());
} catch {
setDataError(t('credentials.form_data_invalid_json'));
valid = false;
}
}
if (!valid) return;
setSaving(true);
try {
await credentials.update(id!, {
name: name.trim(),
data: data.trim() || null,
});
toast.success(t('credentials.updated'));
navigate(`/credentials/${id}`);
} catch (err) {
const message = (err as Error).message;
toast.error(message);
} finally {
setSaving(false);
}
};
return (
<div>
<div className={styles.pageToolbar}>
<Breadcrumbs
items={[
{
label: t('credentials.title'),
icon: <KeyRound size={14} />,
onClick: () => navigate('/credentials'),
},
{
label: credential?.name ?? `#${id}`,
onClick: () => navigate(`/credentials/${id}`),
},
{ label: t('credentials.edit_title') },
]}
/>
</div>
{loading && <p className={styles.muted}>{t('credentials.loading')}</p>}
{!loading && credential && (
<form onSubmit={handleSubmit} noValidate>
<Card className={styles.formCardFull}>
<div className={styles.formFields}>
<Input
label={t('credentials.form_name')}
placeholder={t('credentials.form_name_placeholder')}
value={name}
onChange={(e) => {
setName(e.target.value);
setNameError('');
}}
error={nameError || undefined}
required
autoFocus
/>
<div className={styles.formField}>
<label className={styles.fieldLabel}>
{t('credentials.form_data')}
<span className={styles.requiredMark}> *</span>
</label>
<CodeEditor
language="json"
value={data}
onChange={(v) => {
setData(v);
setDataError('');
}}
rows={6}
error={!!dataError}
/>
{dataError && <span className={styles.fieldError}>{dataError}</span>}
</div>
</div>
<div className={styles.formActions}>
<Button
type="button"
variant="secondary"
onClick={() => navigate(`/credentials/${id}`)}
>
<X size={14} />
{t('credentials.action_cancel')}
</Button>
<Button type="submit" loading={saving}>
<Save size={14} />
{t('credentials.action_update')}
</Button>
</div>
</Card>
</form>
)}
</div>
);
}
@@ -0,0 +1,132 @@
import { useState, SubmitEvent } from 'react';
import { useNavigate } from 'react-router-dom';
import { useTranslation } from 'react-i18next';
import { usePageTitle } from '../../hooks/usePageTitle';
import { X, Globe, Save } from 'lucide-react';
import { environments } from '../../api';
import { Breadcrumbs, Button, Card, Input, CodeEditor, useToast } from '../../ui';
import styles from '../Page.module.css';
export function CreateEnvironmentPage() {
const { t } = useTranslation();
usePageTitle(t('environments.create_title'));
const navigate = useNavigate();
const toast = useToast();
const [name, setName] = useState('');
const [description, setDescription] = useState('');
const [dataJson, setDataJson] = useState('{\n "id": "https://id.example.com"\n}');
const [nameError, setNameError] = useState('');
const [dataError, setDataError] = useState('');
const [saving, setSaving] = useState(false);
const handleSubmit = async (e: SubmitEvent<HTMLFormElement>) => {
e.preventDefault();
if (!name.trim()) {
setNameError(t('environments.form_name_required'));
return;
}
let parsedData: Record<string, string | undefined>;
try {
const raw = dataJson.trim() ? JSON.parse(dataJson.trim()) : {};
if (typeof raw !== 'object' || raw === null || Array.isArray(raw)) {
throw new Error('invalid');
}
parsedData = Object.fromEntries(
Object.entries(raw as Record<string, unknown>).map(([k, v]) => [
k,
v == null ? undefined : String(v),
]),
);
setDataError('');
} catch {
setDataError(t('environments.form_data_invalid_json'));
return;
}
setSaving(true);
try {
const env = await environments.create(
name.trim(),
parsedData,
description.trim() || undefined,
);
toast.success(t('environments.created'));
navigate(`/environments/${env.id}`);
} catch (err) {
const message = (err as Error).message;
toast.error(message);
} finally {
setSaving(false);
}
};
return (
<div>
<div className={styles.pageToolbar}>
<Breadcrumbs
items={[
{
label: t('environments.title'),
icon: <Globe size={14} />,
onClick: () => navigate('/environments'),
},
{ label: t('environments.create_title') },
]}
/>
</div>
<form onSubmit={handleSubmit} noValidate>
<Card className={styles.formCardFull}>
<div className={styles.formFields}>
<Input
label={t('environments.form_name')}
placeholder={t('environments.form_name_placeholder')}
value={name}
onChange={(e) => {
setName(e.target.value);
setNameError('');
}}
error={nameError || undefined}
required
autoFocus
/>
<div className={styles.formField}>
<label className={styles.fieldLabel}>{t('environments.form_description')}</label>
<CodeEditor
language="markdown"
value={description}
onChange={setDescription}
rows={6}
/>
</div>
<div className={styles.formField}>
<label className={styles.fieldLabel}>{t('environments.form_data')}</label>
<CodeEditor
language="json"
value={dataJson}
onChange={(v) => {
setDataJson(v);
setDataError('');
}}
rows={8}
error={!!dataError}
/>
{dataError && <span className={styles.fieldError}>{dataError}</span>}
</div>
</div>
<div className={styles.formActions}>
<Button type="button" variant="secondary" onClick={() => navigate('/environments')}>
<X size={14} />
{t('environments.action_cancel')}
</Button>
<Button type="submit" loading={saving}>
<Save size={14} />
{t('environments.action_save')}
</Button>
</div>
</Card>
</form>
</div>
);
}
Loaded 100 of 385 files, more files were not shown because too many files have changed in this diff. Show more