Gunnar

nordisk/monetize

uitest/Cargo.toml

# monetize's **UI test**: the console's counterpart to gunnar-ui's `uitest/`,
# ported shape for shape (one implementation) — situations as rows, a `Rig` that owns its
# children, a `--live` mode, a matrix sink — and pointed at `UI.md` instead of
# at gunnar's routes.
#
# ## What it is
#
# One re-runnable FUNCTIONAL walk of a LIVE console in a REAL browser: every
# situation is a row, and every row is asserted against what the page actually
# holds — `innerText`, `role="meter"`, a `title` attribute — never against the
# page's own claim about itself. The numbers it looks for come from ONE fixture
# (`src/fixture.rs`) that the console's server tests
# (`crates/monetize-ui-server/tests/screens_*.rs`) assert against too, over the
# same mock (`src/mock.rs`), so the wire and the DOM are checked against the
# same distinct, non-zero figures. A fixture whose meters were all zero could
# not tell a wired-up screen from a dead one — `lfs_bytes` really is 0 on every
# gunnar — so every number here is different from every other.
#
# ## Two halves
#
# * `monetize-uitest` — the harness. It spawns the mock monetize (itself, in
#   `--mock-serve` mode), the REAL `monetize-ui-server` binary against it, a
#   headless Chrome, and walks the four screens. A second, separate rig runs
#   the passkey ceremony (virtual authenticator) and proves the break-glass
#   token retires.
# * `--mock-serve` — the same binary as a gRPC monetize serving the fixture,
#   with the suite bearer enforced, so the BFF is tested presenting it.
#
# ## Why a workspace member and not a detached crate
#
# gunnar-ui's `uitest/` is detached with zero dependencies so it builds on an
# appliance with no crates.io. This one has to SPEAK gRPC (the mock monetize
# lives here), which means tonic and the proto crate; those are already in this
# workspace's lock, so joining the workspace adds nothing to it, and
# `cargo test --workspace` compiles this crate without spawning anything — the
# browser is only ever started from `main`. The CDP, websocket, JSON and HTTP
# clients are still the zero-dependency ones gunnar-ui wrote; they are copied,
# not rewritten, and say so at the top.
#
# ## Run
#
#     cargo run --release -p monetize-uitest -- --ui <monetize-ui-server> --dist <trunk dist>
#     cargo run --release -p monetize-uitest -- --live http://localhost:8091   # an OPEN loopback console with the mock behind it
#     cargo test -p monetize-ui-server --test 'screens_*'                       # the server half, in-process
[package]
name = "monetize-uitest"
description = "The console's browser-level functional matrix, and the mock monetize it runs against"
version.workspace = true
edition.workspace = true
rust-version.workspace = true
repository.workspace = true
license.workspace = true
publish.workspace = true

[[bin]]
name = "monetize-uitest"
path = "src/main.rs"

[dependencies]
# Only what the MOCK needs to be a monetize on the wire. Every one of these is
# already in the workspace lock — nothing new is resolved by this crate.
monetize-proto = { path = "../crates/monetize-proto" }
# The one canonical form a fact's signature covers: the mock signs facts for
# real, so the console's "verified" badge is checking a genuine Ed25519
# signature and not 64 bytes of anything.
monetize-embed = { path = "../crates/monetize-embed" }
# `monetize_product::bytes` — the ONE byte formatter. The fixture carries the
# rendered string beside every raw number, and a self-test proves each pair
# with this formatter, so a browser row that looks for `10.2 GiB` is asserting
# the wire's number and not the page's claim.
monetize-product = { path = "../crates/monetize-product" }
tonic.workspace = true
tokio = { workspace = true, features = ["net", "io-std", "io-util"] }
tokio-stream = { version = "0.1", features = ["sync"] }
ed25519-dalek.workspace = true