diff --git a/package-lock.json b/package-lock.json index 40594d3..bc70eae 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,6 +19,7 @@ "@testing-library/dom": "^10.4.2", "@testing-library/jest-dom": "latest", "@testing-library/react": "latest", + "@testing-library/user-event": "latest", "@types/react": "latest", "@types/react-dom": "latest", "eslint": "latest", @@ -1159,6 +1160,20 @@ } } }, + "node_modules/@testing-library/user-event": { + "version": "14.6.8", + "resolved": "https://registry.npmjs.org/@testing-library/user-event/-/user-event-14.6.8.tgz", + "integrity": "sha512-vgSSqnANMnkcYR/vUNDbwS7aM3OErRLNUG8vCVVlj4oc6cKffUrccX7UAS5AmJQQNZTSibi9z5GvvRZ0aYgUCQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12", + "npm": ">=6" + }, + "peerDependencies": { + "@testing-library/dom": ">=7.21.4" + } + }, "node_modules/@types/aria-query": { "version": "5.0.4", "resolved": "https://registry.npmjs.org/@types/aria-query/-/aria-query-5.0.4.tgz", diff --git a/package.json b/package.json index 8f7ac0d..e9a2585 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,7 @@ "@testing-library/dom": "^10.4.2", "@testing-library/jest-dom": "latest", "@testing-library/react": "latest", + "@testing-library/user-event": "latest", "@types/react": "latest", "@types/react-dom": "latest", "eslint": "latest", diff --git a/src/App.test.tsx b/src/App.test.tsx index c650f91..199a3d5 100644 --- a/src/App.test.tsx +++ b/src/App.test.tsx @@ -1,4 +1,5 @@ -import { fireEvent, render, screen, waitFor } from "@testing-library/react"; +import { fireEvent, render, screen, waitFor, within } from "@testing-library/react"; +import userEvent from "@testing-library/user-event"; import { afterEach, describe, expect, it, vi } from "vitest"; import App from "./App"; diff --git a/src/App.tsx b/src/App.tsx index 068d21c..ea9fe49 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -25,14 +25,35 @@ export default function App() { const [ramp, setRamp] = useState("recipients"); const [strict, setStrict] = useState(true); const [copied, setCopied] = useState(false); + const [copiedStep, setCopiedStep] = useState(null); const [moduleFilter, setModuleFilter] = useState(""); const [activeWorkflow, setActiveWorkflow] = useState("coverage"); - const generated = useMemo( - () => buildCommand({ command, path, format, open, fn, ramp, strict }), + const options = useMemo( + () => ({ command, path, format, open, fn, ramp, strict }), [command, path, format, open, fn, ramp, strict], ); + const generated = useMemo(() => buildCommand(options), [options]); + + const summaryRows = useMemo(() => summarizeConfiguration(options), [options]); + const defaultRows = useMemo(() => effectiveDefaults(options), [options]); + const appliedDefaults = defaultRows.filter((row) => row.applied).length; + const configBCommand = useMemo( + () => (configB ? buildCommand(configB) : ""), + [configB], + ); + const comparisonRows = useMemo( + () => (configB ? compareConfigurations(options, configB) : []), + [options, configB], + ); + + useEffect(() => { + if (compareOpen) { + comparePanelRef.current?.focus(); + } + }, [compareOpen]); + const filteredModules = useMemo(() => { const q = moduleFilter.trim().toLowerCase(); if (!q) return modules; @@ -81,6 +102,7 @@ export default function App() { Soroban Testkit
+ Install Modules Commands GitHub ↗ @@ -107,6 +129,38 @@ export default function App() {
+
+
+

First-time setup

+

From a clean machine to your first command.

+

+ Six ordered steps install the Testkit CLI and its prerequisites. Every + step runs locally and keeps contract tests deterministic and offline. +

+
+
    + {installationSteps.map((step, index) => ( +
  1. + +

    {step.title}

    +

    {step.description}

    +
    + {step.command} + +
    +
  2. + ))} +
+
+

One prelude. Seven focused modules.

@@ -255,6 +309,33 @@ resolver = "2" ))}

{descriptions[command]}

+ +
+

Command summary

+

{command}

+
+ {summaryRows.map((row) => ( +
+
{row.label}
+
{row.value}
+
+ ))} +
+

+ Updates live from the builder. Values marked (default) apply when a + field is left empty. +

+
+ +
} + +
+
+

Effective defaults

+ {defaultRows.length > 0 && ( + + {appliedDefaults} of {defaultRows.length} applied + + )} +
+ {defaultRows.length === 0 ? ( +

+ This workflow has no empty-field fallbacks. The copied command uses + the values you set above, exactly. +

+ ) : ( +
+ {defaultRows.map((row) => ( +
+
{row.label}
+
+ {row.applied ? `(empty) → ${row.value}` : row.value} + + {row.applied ? "Default applied" : "From your input"} + +
+
+ ))} +
+ )} +
+
{generated}
+ + {compareOpen && configB && ( +
+
+

Compare two configurations

+

+ Configuration A is the workbench above. Edit configuration B and the + table marks every setting that differs; both commands update as you + type. +

+
+ +
+ Configuration B +
+ + +
+ {configB.command === "coverage" && ( +
+ + +
+ )} + {configB.command === "limits" && ( +
+ + +
+ )} + {configB.command === "audit" && ( + + )} + +
+ +
+ + + + + + + + + + + {comparisonRows.map((row) => ( + + + + + + + ))} + +
SettingConfiguration AConfiguration BStatus
{row.label}{row.a}{row.b} + {row.changed ? ( + Changed + ) : ( + Matches + )} +
+
+ +
+
+

Configuration A command

+
{generated}
+
+
+

Configuration B command

+
{configBCommand}
+
+
+
+ )}
Built for the Stellar developer ecosystem.Apache-2.0
diff --git a/src/styles.css b/src/styles.css index 7824b17..b8592d9 100644 --- a/src/styles.css +++ b/src/styles.css @@ -151,6 +151,18 @@ h1 { margin: var(--space-xl) 0 var(--space-3xl); font-size: clamp(3.4rem, 6.5vw, .terminal b, .muted { color: var(--color-accent); font-weight: 400; } .pass { padding: var(--space-base) var(--space-3xl); background: var(--color-accent-surface); border-top: 1px solid var(--color-accent-border); color: var(--color-accent); font-size: .75rem; } +/* Install / First-time setup */ +.install { padding: var(--space-section) var(--page-padding); border-top: 1px solid var(--color-border-subtle); } +.install-intro { color: var(--color-text-secondary); line-height: 1.7; } +.install-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-xl); } +.install-step { display: flex; flex-direction: column; gap: var(--space-sm); padding: var(--space-3xl); background: var(--color-surface-card); border: 1px solid var(--color-border-default); border-radius: var(--radius-lg); } +.install-step-number { color: var(--color-accent); letter-spacing: .14em; font: 500 .72rem var(--font-mono); } +.install-step h3 { margin: 0; font-size: 1rem; letter-spacing: -.01em; } +.install-step p { margin: 0 0 var(--space-sm); color: var(--color-text-body); font-size: .84rem; line-height: 1.6; flex: 1; } +.install-command { display: flex; align-items: center; gap: var(--space-sm); padding: var(--space-md) var(--space-base); background: var(--color-surface-output); border-radius: var(--radius-md); } +.install-command code { flex: 1; color: var(--color-accent); font: .7rem/1.5 var(--font-mono); overflow-wrap: anywhere; } +.install-command button { color: var(--color-canvas); background: var(--color-accent); border: 0; border-radius: var(--radius-xs); padding: var(--space-2xs) var(--space-sm); cursor: pointer; font-size: .68rem; font-weight: 600; white-space: nowrap; } + /* Modules */ .modules, .commands { padding: var(--space-section) var(--page-padding); border-top: 1px solid var(--color-border-subtle); } section header { max-width: 650px; margin-bottom: 50px; } @@ -239,6 +251,31 @@ h2 { margin: var(--space-md) 0; font-size: clamp(2rem, 4vw, 4rem); letter-spacin .command-copy > p:not(.eyebrow) { color: var(--color-text-body); line-height: 1.7; } .command-tabs { display: flex; gap: var(--space-sm); margin-top: 36px; } .description { min-height: 48px; } + +/* Command summary card */ +.summary-card { margin-top: var(--space-2xl); padding: var(--space-3xl); background: var(--color-surface-card); border: 1px solid var(--color-border-default); border-radius: var(--radius-lg); } +.summary-card h3 { margin: 0; color: var(--color-text-muted); font: 500 .68rem var(--font-mono); text-transform: uppercase; letter-spacing: .12em; } +.summary-workflow { margin: var(--space-sm) 0 var(--space-lg); color: var(--color-accent); font: 500 1rem var(--font-mono); } +.summary-settings { margin: 0; display: grid; gap: var(--space-sm); } +.summary-row { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-lg); } +.summary-row dt { color: var(--color-text-muted); font-size: .78rem; } +.summary-row dd { margin: 0; color: var(--color-text-primary); font: .76rem var(--font-mono); text-align: right; overflow-wrap: anywhere; } +.summary-note { margin: var(--space-lg) 0 0; color: var(--color-text-muted); font-size: .7rem; line-height: 1.5; } + +.comparison-toggle { margin-top: var(--space-2xl); padding: 10px var(--space-base); background: transparent; border: 1px solid var(--color-border-strong); border-radius: var(--radius-sm); color: var(--color-text-secondary); cursor: pointer; font-size: .8rem; } +.comparison-toggle:hover, .comparison-toggle[aria-expanded="true"] { color: var(--color-accent); border-color: var(--color-accent); } + +/* Effective defaults preview */ +.defaults-preview { margin-bottom: var(--space-2xl); padding: var(--space-lg) var(--space-xl); background: var(--color-input-bg); border: 1px solid var(--color-border-default); border-radius: var(--radius-md); } +.defaults-preview-header { display: flex; align-items: center; justify-content: space-between; gap: var(--space-sm); } +.defaults-preview h3 { margin: 0; color: var(--color-text-muted); font: 500 .68rem var(--font-mono); text-transform: uppercase; letter-spacing: .12em; } +.defaults-count { color: var(--color-text-muted); font-size: .7rem; } +.defaults-list { margin: var(--space-md) 0 0; display: grid; gap: 9px; } +.defaults-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-md); } +.defaults-row dt { color: var(--color-text-muted); font-size: .76rem; } +.defaults-row dd { margin: 0; flex: 1; display: flex; align-items: center; justify-content: flex-end; gap: var(--space-sm); } +.defaults-row code { color: var(--color-text-code); font: .7rem var(--font-mono); overflow-wrap: anywhere; } +.defaults-empty { margin: var(--space-md) 0 0; color: var(--color-text-muted); font-size: .78rem; line-height: 1.5; } .builder { padding: var(--space-5xl); background: var(--color-canvas); border: 1px solid var(--color-border-default); border-radius: var(--radius-lg); } /* Field & Required/Optional distinction */ @@ -280,6 +317,30 @@ input:focus, select:focus { border-color: var(--color-accent); } .output { display: flex; align-items: center; gap: 15px; padding: var(--space-lg); background: var(--color-surface-output); border-radius: var(--radius-md); } .output code { flex: 1; color: var(--color-accent); font: .75rem/1.6 var(--font-mono); overflow-wrap: anywhere; } .output button { color: var(--color-canvas); background: var(--color-accent); border: 0; border-radius: var(--radius-xs); padding: var(--space-sm) var(--space-md); cursor: pointer; font-weight: 600; } + +/* Configuration comparison */ +.comparison { grid-column: 1 / -1; min-width: 0; padding-top: var(--space-5xl); border-top: 1px solid var(--color-border-subtle); } +.comparison-header h3 { margin: 0 0 var(--space-sm); font-size: 1.2rem; } +.comparison-header p { margin: 0; max-width: 640px; color: var(--color-text-body); font-size: .87rem; line-height: 1.6; } +.comparison-config { margin: var(--space-3xl) 0 0; padding: var(--space-xl) var(--space-3xl) var(--space-md); border: 1px solid var(--color-border-default); border-radius: var(--radius-lg); } +.comparison-config legend { padding: 0 var(--space-sm); color: var(--color-text-label); font-size: .78rem; } +.comparison-sync { margin-bottom: var(--space-2xl); } +.comparison-table-wrap { margin-top: var(--space-3xl); overflow-x: auto; border: 1px solid var(--color-border-default); border-radius: var(--radius-lg); } +.comparison-table { width: 100%; min-width: 640px; border-collapse: collapse; } +.comparison-table th, .comparison-table td { padding: var(--space-base) var(--space-xl); text-align: left; border-bottom: 1px solid var(--color-border-subtle); vertical-align: middle; } +.comparison-table thead th { background: var(--color-surface-card); color: var(--color-text-muted); font: 500 .66rem var(--font-mono); text-transform: uppercase; letter-spacing: .08em; } +.comparison-table tbody th { color: var(--color-text-label); font-size: .78rem; font-weight: 500; } +.comparison-table td { color: var(--color-text-primary); font: .74rem/1.5 var(--font-mono); overflow-wrap: anywhere; } +.comparison-table tbody tr:last-child th, .comparison-table tbody tr:last-child td { border-bottom: 0; } +.comparison-table tbody tr[data-changed="true"] th, .comparison-table tbody tr[data-changed="true"] td { background: var(--color-accent-subtle); } +.comparison-status { color: var(--color-text-muted); font-size: .74rem; } +.comparison-commands { margin-top: var(--space-3xl); display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-xl); } +.comparison-commands h4 { margin: 0 0 var(--space-sm); color: var(--color-text-muted); font: 500 .68rem var(--font-mono); text-transform: uppercase; letter-spacing: .1em; } +.comparison-command { margin: 0; padding: var(--space-lg); background: var(--color-surface-output); border-radius: var(--radius-md); white-space: pre-wrap; } +.comparison-command code { color: var(--color-accent); font: .72rem/1.6 var(--font-mono); overflow-wrap: anywhere; } + +/* Visible keyboard focus for the interactive controls added alongside the workbench */ +.install-command button:focus-visible, .comparison-toggle:focus-visible, .comparison-sync:focus-visible, .comparison-table-wrap:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; } .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border-width: 0; } footer { display: flex; justify-content: space-between; padding: 34px var(--page-padding); border-top: 1px solid var(--color-border-subtle); color: var(--color-text-muted); font-size: .78rem; } @@ -290,6 +351,8 @@ footer { display: flex; justify-content: space-between; padding: 34px var(--page .hero { padding-top: 70px; } .module-grid { grid-template-columns: repeat(2, 1fr); } .nav-links a { max-width: 140px; } + .install-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); } + .comparison-commands { grid-template-columns: 1fr; } } @media (max-width: 600px) { @@ -309,9 +372,14 @@ footer { display: flex; justify-content: space-between; padding: 34px var(--page } @media (max-width: 540px) { - nav, .hero, .modules, .commands { padding-left: 22px; padding-right: 22px; } + nav, .hero, .modules, .commands, .install { padding-left: 22px; padding-right: 22px; } .module-grid { grid-template-columns: 1fr; } + .install-steps { grid-template-columns: 1fr; } .row { grid-template-columns: 1fr; } + .defaults-row, .summary-row { flex-direction: column; align-items: flex-start; gap: var(--space-2xs); } + .defaults-row dd { justify-content: flex-start; } + .summary-row dd { text-align: left; } + .comparison-config { padding: var(--space-xl); } .actions { flex-direction: column; } .terminal pre { padding: 22px; font-size: .7rem; } footer { gap: 20px; } diff --git a/src/testkit.test.ts b/src/testkit.test.ts index 8a1ff81..c37bebe 100644 --- a/src/testkit.test.ts +++ b/src/testkit.test.ts @@ -2,8 +2,13 @@ import { describe, expect, it } from "vitest"; import { buildCommand, cliCompatibility, + compareConfigurations, + effectiveDefaults, formatCommandLine, + installationSteps, localFileGuides, + summarizeConfiguration, + type CommandOptions, } from "./testkit"; describe("buildCommand", () => { @@ -194,4 +199,221 @@ describe("localFileGuides", () => { }); }); +const baseOptions: CommandOptions = { + command: "coverage", + path: ".", + format: "html", + open: true, + fn: "", + ramp: "", + strict: false, +}; + +const options = (overrides: Partial = {}): CommandOptions => ({ + ...baseOptions, + ...overrides, +}); + +describe("installationSteps", () => { + it("documents the first-time installation workflow in order", () => { + expect(installationSteps.length).toBeGreaterThanOrEqual(4); + expect(installationSteps[0].command).toBe("rustup target add wasm32v1-none"); + + for (const step of installationSteps) { + expect(step.title).toBeTruthy(); + expect(step.description).toBeTruthy(); + expect(step.command).toBeTruthy(); + } + + const commands = installationSteps.map((step) => step.command); + expect(commands).toContain("cargo install soroban-testkit-cli --locked"); + expect(commands).toContain("cargo install cargo-llvm-cov"); + expect(commands).toContain("cargo add --dev soroban-testkit"); + expect(commands).toContain("soroban-testkit --help"); + }); + + it("ends on the command the workbench generates by default", () => { + const last = installationSteps[installationSteps.length - 1]; + expect(last.command).toBe(buildCommand(options())); + }); +}); + +describe("effectiveDefaults", () => { + it("returns no fallback rows for coverage", () => { + expect(effectiveDefaults(options())).toEqual([]); + }); + + it("previews every limits fallback when the inputs are empty", () => { + const rows = effectiveDefaults( + options({ command: "limits", path: "", fn: "", ramp: "" }), + ); + + expect(rows.map((row) => row.value)).toEqual([ + "target/wasm32v1-none/release/contract.wasm", + "batch_payout", + "recipients", + ]); + expect(rows.every((row) => row.applied)).toBe(true); + }); + + it("marks typed limits values as coming from the input", () => { + const rows = effectiveDefaults( + options({ + command: "limits", + path: "target/release/my_contract.wasm", + fn: "execute_equal", + ramp: "", + }), + ); + + expect(rows.find((row) => row.key === "path")).toMatchObject({ + value: "target/release/my_contract.wasm", + applied: false, + }); + expect(rows.find((row) => row.key === "fn")).toMatchObject({ + input: "execute_equal", + value: "execute_equal", + applied: false, + }); + expect(rows.find((row) => row.key === "ramp")).toMatchObject({ + value: "recipients", + applied: true, + }); + }); + + it("previews the audit source fallback only when the path is empty", () => { + expect(effectiveDefaults(options({ command: "audit", path: "" }))).toEqual([ + { + key: "path", + label: "Project path", + input: "", + value: "./src", + applied: true, + }, + ]); + + const rows = effectiveDefaults( + options({ command: "audit", path: "./contracts" }), + ); + expect(rows[0]).toMatchObject({ value: "./contracts", applied: false }); + }); +}); + +describe("summarizeConfiguration", () => { + it("summarizes the coverage settings", () => { + expect(summarizeConfiguration(options())).toEqual([ + { label: "Project or contract path", value: "." }, + { label: "Report format", value: "html" }, + { label: "Open report when complete", value: "On" }, + ]); + }); + + it("marks an omitted coverage path", () => { + expect(summarizeConfiguration(options({ path: "" }))[0]).toEqual({ + label: "Project or contract path", + value: "(omitted)", + }); + }); + + it("summarizes limits fallbacks with a default marker", () => { + expect( + summarizeConfiguration( + options({ command: "limits", path: "", fn: "", ramp: "" }), + ), + ).toEqual([ + { + label: "Contract artifact", + value: "target/wasm32v1-none/release/contract.wasm (default)", + }, + { label: "Function", value: "batch_payout (default)" }, + { label: "Ramp parameter", value: "recipients (default)" }, + ]); + }); + + it("summarizes audit settings", () => { + expect( + summarizeConfiguration( + options({ command: "audit", path: "./src", strict: true }), + ), + ).toEqual([ + { label: "Project path", value: "./src" }, + { label: "Fail on warnings", value: "On" }, + ]); + }); +}); + +describe("compareConfigurations", () => { + it("marks identical configurations as matching", () => { + const rows = compareConfigurations(options(), options()); + + expect(rows.map((row) => row.key)).toEqual([ + "command", + "path", + "format", + "open", + ]); + expect(rows.every((row) => !row.changed)).toBe(true); + }); + + it("flags the settings that differ between two configurations", () => { + const rows = compareConfigurations( + options(), + options({ path: "./contracts/escrow" }), + ); + + expect(rows.find((row) => row.key === "path")).toMatchObject({ + a: ".", + b: "./contracts/escrow", + changed: true, + }); + expect(rows.find((row) => row.key === "format")?.changed).toBe(false); + }); + + it("includes a setting once either workflow uses it", () => { + const rows = compareConfigurations(options(), options({ command: "limits" })); + + expect(rows.map((row) => row.key)).toEqual([ + "command", + "path", + "format", + "open", + "fn", + "ramp", + ]); + expect(rows.find((row) => row.key === "command")?.changed).toBe(true); + expect(rows.find((row) => row.key === "format")).toMatchObject({ + a: "html", + b: "n/a", + changed: true, + }); + }); + + it("shows audit-only rows when either side audits", () => { + const rows = compareConfigurations( + options({ command: "audit", path: "./src", strict: true }), + options({ command: "audit", path: "./contracts", strict: false }), + ); + + expect(rows.map((row) => row.key)).toEqual(["command", "path", "strict"]); + expect(rows.find((row) => row.key === "strict")).toMatchObject({ + a: "On", + b: "Off", + changed: true, + }); + }); + + it("renders empty values as (empty) instead of blank cells", () => { + const rows = compareConfigurations( + options({ command: "limits", path: "", fn: "", ramp: "" }), + options({ command: "limits", path: "", fn: "", ramp: "" }), + ); + + expect(rows.find((row) => row.key === "path")).toMatchObject({ + a: "(empty)", + b: "(empty)", + changed: false, + }); + }); +}); + diff --git a/src/testkit.ts b/src/testkit.ts index 15f369d..869cbd4 100644 --- a/src/testkit.ts +++ b/src/testkit.ts @@ -98,6 +98,17 @@ export const modules = [ const quote = (value: string) => (value.includes(" ") ? `"${value}"` : value); +/** + * Values `buildCommand` substitutes when a field is left empty. Exported so + * the workbench can preview the effective command before copying it. + */ +export const fallbackValues = { + limitsContract: "target/wasm32v1-none/release/contract.wasm", + limitsFunction: "batch_payout", + limitsRamp: "recipients", + auditPath: "./src", +} as const; + export function buildCommand(options: CommandOptions): string { if (options.command === "coverage") { return [ @@ -114,17 +125,17 @@ export function buildCommand(options: CommandOptions): string { return [ "soroban-testkit limits", "--contract", - quote(options.path || "target/wasm32v1-none/release/contract.wasm"), + quote(options.path || fallbackValues.limitsContract), "--fn", - options.fn || "batch_payout", + options.fn || fallbackValues.limitsFunction, "--ramp", - options.ramp || "recipients", + options.ramp || fallbackValues.limitsRamp, ].join(" "); } return [ "soroban-testkit audit", - quote(options.path || "./src"), + quote(options.path || fallbackValues.auditPath), options.strict && "--strict", ] .filter(Boolean) @@ -156,11 +167,9 @@ export function formatCommandLine( } if (options.command === "limits") { - const contractPath = quote( - options.path || "target/wasm32v1-none/release/contract.wasm", - ); - const fn = options.fn || "batch_payout"; - const ramp = options.ramp || "recipients"; + const contractPath = quote(options.path || fallbackValues.limitsContract); + const fn = options.fn || fallbackValues.limitsFunction; + const ramp = options.ramp || fallbackValues.limitsRamp; return [ "soroban-testkit limits \\", @@ -171,7 +180,7 @@ export function formatCommandLine( } // audit - const auditPath = quote(options.path || "./src"); + const auditPath = quote(options.path || fallbackValues.auditPath); if (options.strict) { return [ "soroban-testkit audit \\", @@ -342,6 +351,55 @@ export const cliCompatibility: readonly CliCompatibility[] = [ }, ]; +export interface InstallStep { + title: string; + description: string; + command: string; +} + +/** + * First-time installation workflow, mirrored from the CLI documentation in + * `testkit-blockchain`. Ordered: each step builds on the previous one. + */ +export const installationSteps: readonly InstallStep[] = [ + { + title: "Add the WebAssembly target", + description: + "Testkit probes compiled contracts on the pinned Rust stable toolchain, so the wasm32v1-none target has to be present.", + command: "rustup target add wasm32v1-none", + }, + { + title: "Install the soroban-testkit CLI", + description: + "Installs the companion binary from crates.io. From a workspace checkout, install the local crate instead with: cargo install --path crates/cli --locked", + command: "cargo install soroban-testkit-cli --locked", + }, + { + title: "Install the coverage wrapper", + description: + "The coverage workflow shells out to cargo-llvm-cov, which Testkit calls but does not bundle. Skip this step if you only use limits or audit.", + command: "cargo install cargo-llvm-cov", + }, + { + title: "Add the crate to your contract", + description: + "Adds Testkit as a dev-dependency so contract tests can import the prelude and the focused testing modules.", + command: "cargo add --dev soroban-testkit", + }, + { + title: "Verify the installation", + description: + "Confirms the binary resolves on your PATH and lists the supported subcommands.", + command: "soroban-testkit --help", + }, + { + title: "Build your first command", + description: + "The workbench below generates coverage, limits, and audit commands, previews every default that will be applied, and copies the exact line to your terminal.", + command: "soroban-testkit coverage . --format html --open", + }, +]; + export interface LocalFileGuide { command: CommandName; title: string; diff --git a/tests/visual/__screenshots__/commands-audit.png b/tests/visual/__screenshots__/commands-audit.png index d04a558..b81f95c 100644 Binary files a/tests/visual/__screenshots__/commands-audit.png and b/tests/visual/__screenshots__/commands-audit.png differ diff --git a/tests/visual/__screenshots__/commands-coverage.png b/tests/visual/__screenshots__/commands-coverage.png index 8efa941..1dca00a 100644 Binary files a/tests/visual/__screenshots__/commands-coverage.png and b/tests/visual/__screenshots__/commands-coverage.png differ diff --git a/tests/visual/__screenshots__/commands-limits.png b/tests/visual/__screenshots__/commands-limits.png index 7e5162e..377d2f5 100644 Binary files a/tests/visual/__screenshots__/commands-limits.png and b/tests/visual/__screenshots__/commands-limits.png differ diff --git a/tests/visual/__screenshots__/full-page.png b/tests/visual/__screenshots__/full-page.png index 6ec1d5d..6d37424 100644 Binary files a/tests/visual/__screenshots__/full-page.png and b/tests/visual/__screenshots__/full-page.png differ diff --git a/tests/visual/__screenshots__/hero.png b/tests/visual/__screenshots__/hero.png index c86ed82..74fd54a 100644 Binary files a/tests/visual/__screenshots__/hero.png and b/tests/visual/__screenshots__/hero.png differ diff --git a/tests/visual/__screenshots__/modules.png b/tests/visual/__screenshots__/modules.png index cf26324..416b1c9 100644 Binary files a/tests/visual/__screenshots__/modules.png and b/tests/visual/__screenshots__/modules.png differ