Expand description
§My Canister Dapp Test
Acceptance suite for user-owned dapps built with my-canister-dashboard.
Validates that a WASM module correctly implements every endpoint in the dashboard interface:
http_request— certified asset serving (dashboard HTML/JS/CSS, 404 handling, CSP headers)wasm_status— dapp metadata (name, version, memo)manage_ii_principal— Internet Identity principal CRUD + controller guardmanage_alternative_origins— II alternative origins CRUD + origin validationmanage_top_up_rule— auto top-up rule CRUD + timer-driven ICP→cycles minting
Each WASM is installed into a fresh PocketIC canister with ICP Ledger and CMC system canisters for end-to-end top-up testing.
§Usage
my-canister-dapp-test path/to/my-dapp.wasm.gzOr via cargo:
cargo run -p my-canister-dapp-test -- path/to/my-dapp.wasm.gz§License
MIT
Structs§
- Asset
Hashes - Hashes of the three dashboard frontend assets, for verification and debugging.
Constants§
- CMC_
CANISTER_ ID_ TEXT - Cycles Minting Canister (CMC) ID.
- ICP_
INDEX_ CANISTER_ ID_ TEXT - ICP Index canister ID.
- ICP_
LEDGER_ CANISTER_ ID_ TEXT - ICP Ledger canister ID.
- II_
CANISTER_ ID_ TEXT - Internet Identity canister ID.
- LEDGER_
INIT_ TRANSFER_ FEE_ E8S - ICP ledger transfer fee in e8s (0.0001 ICP).
- LEDGER_
PREFUND_ E8S - Amount of ICP (in e8s) pre-funded to the canister for top-up tests (200 ICP).
- MIN_
CANISTER_ CREATION_ BALANCE - Minimum cycles required to create a canister on PocketIC.
Functions§
- compute_
asset_ hash - SHA-256 hash of
data, returned as a lowercase hex string. - compute_
frontend_ asset_ hashes - Computes SHA-256 hashes for the three main dashboard assets.
- ii_
principal_ at_ installer_ app - Principal simulating the installer app (the initial controller that installs the dapp WASM).
- ii_
principal_ at_ user_ controlled_ dapp - Principal simulating the dapp owner (the II-authenticated end user).
- run_
acceptance_ suite - Runs the full acceptance suite against a single dapp WASM.
- stranger_
principal - Principal simulating an unauthorized caller (should be rejected by all guards).
- validate_
css_ structure - Validates that CSS content is non-empty, valid UTF-8, and contains at least one style rule.
- validate_
frontend_ assets - Validates all three main dashboard assets and returns their SHA-256 hashes.
- validate_
html_ structure - Validates that HTML content has the expected structure for a canister dashboard page.
- validate_
js_ structure - Validates that JavaScript content is non-empty, reasonably sized, and valid UTF-8.
- verify_
asset_ hashes_ match_ known_ version - Verifies that the given asset hashes match at least one entry in
asset-hashes.json.