Skip to content

Local UI Testing & Mock Server

StackPilot includes a dedicated Mock Hub Server (src/hub/tests/mock-server.js) designed for rapid local UI/UX testing, visual prototyping, and regression verification without needing live Linux hosts or real agent daemons.


Quickstart

Start the mock server locally from the repository root:

node src/hub/tests/mock-server.js

By default, the mock server listens on port 8082:

StackPilot mock hub running at http://localhost:8082
Serving UI from /path/to/stackpilot/src/hub/public

Open http://localhost:8082 in your browser to inspect and interact with the full frontend application.

Capture Documentation Screenshots

With the mock server running and Playwright available, generate the checked-in documentation screenshots from the repository root:

node scripts/capture_docs_screenshots.js

The script writes deterministic mock-server images to docs/assets/images/. It captures the fleet dashboard, a host workload view, and settings. Review each image before committing it, because mock fixtures and UI layout intentionally evolve with the product.


Pre-Configured Test Scenarios

The mock server boots with 10 pre-configured hosts covering every edge case in container lifecycle management:

Host IP Scenario Name Highlights & State
10.10.10.11 podman-healthy-hub Healthy multi-container Podman node with 2 available container updates.
10.10.10.21 podman-critical-degraded Critical monitoring host with an exited container (qbittorrent) and degraded pod state.
10.10.10.31 docker-restricted-safety Docker host with destructive actions blocked by default policy.
10.10.10.32 docker-elevated-active Docker host operating with elevated destructive privileges.
10.10.10.41 agent-outdated-upgradeable Legacy agent version (0.9.0) demonstrating one-click agent self-update.
10.10.10.51 firewall-ufw-preflight Port preflight conflict and non-root UFW firewall checks.
10.10.10.61 volume-paths-preflight Volume path inspection and directory pre-creation validation.
10.10.10.71 internal-service-protected Safeguard protecting core stackpilot.service from accidental deletion.
10.10.10.81 quadlet-pod-converter Compose-to-Quadlet converter with shared pod networks and secrets.
10.10.10.99 offline-unreachable-lab Offline host simulating network timeouts and node removal flows.

Interactive Update Lifecycle Simulation

The mock server simulates realistic multi-phase workload updates taking ~14–19 seconds:

  1. Pre-update volume snapshot check and verification.
  2. Registry pull handshake and container layer downloads with simulated streaming percentages (72%, 44%, 18%).
  3. SHA-256 digest validation and archive decompression.
  4. Graceful SIGTERM shutdown and systemd Quadlet unit regeneration.
  5. Readiness probe checks and final healthy state transition.

This timing makes it simple to test: - Minimizing the update modal to the floating tracker pill. - Verifying tracker pill updates in real time. - Navigating between different hosts during background execution. - Restoring the modal and inspecting terminal logs.