Add Hex1bTerminalAutomator imperative testing API#243
Conversation
Introduce Hex1bTerminalAutomator, an imperative async API for terminal test automation that layers on top of the existing input sequencer. Each method executes immediately and records its result in a step history. When a step fails, Hex1bAutomationException provides rich diagnostics: - Full breadcrumb trail of completed steps with timings - Caller file/line via CallerFilePath/CallerLineNumber attributes - Terminal snapshot at the point of failure - Total elapsed time across all steps New types: - Hex1bTerminalAutomator: Main API with wait, key, mouse, and typing methods - Hex1bAutomationException: Rich exception with step history and snapshot - AutomationStepRecord: Immutable record of a completed step The automator supports modifier stacking (Ctrl/Shift/Alt), sequence caching for common keys, and composability via SequenceAsync for inline or pre-built sequences. Extension methods can be built on top for domain-specific helpers. Includes 16 unit tests and updated testing guide documentation. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
📦 PR Packages PublishedPreview packages for this PR have been published to GitHub Packages. Package Version
Packages
Usage ExamplesHex1b - PackageReference (csproj): <PackageReference Include="Hex1b" Version="0.116.0-pr.243.23043055060.555d192.1" />Hex1b - .NET CLI: dotnet add package Hex1b --version 0.116.0-pr.243.23043055060.555d192.1Hex1b.McpServer - Install as global tool: dotnet tool install -g Hex1b.McpServer --version 0.116.0-pr.243.23043055060.555d192.1Hex1b.Tool - Install as global tool: dotnet tool install -g Hex1b.Tool --version 0.116.0-pr.243.23043055060.555d192.1Once installed, the tool is available as: hex1b terminal list
hex1b capture <id> --format svg
hex1b keys <id> --key EnterNuGet ConfigurationTo use this package, you need to configure a NuGet.config file with the GitHub Packages feed: <?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<!--To inherit the global NuGet package sources remove the <clear/> line below -->
<clear />
<add key="nuget" value="https://api.nuget.org/v3/index.json" />
<add key="github-mitchdenny" value="https://nuget.pkg.github.com/mitchdenny/index.json" />
</packageSources>
<packageSourceMapping>
<packageSource key="nuget">
<package pattern="*" />
</packageSource>
<packageSource key="github-mitchdenny">
<package pattern="Hex1b*" />
</packageSource>
</packageSourceMapping>
</configuration>AuthenticationGitHub Packages requires authentication. Make sure your GitHub CLI has the # Check current scopes
gh auth status
# If needed, refresh with packages scope
gh auth refresh -s read:packages
# Configure NuGet to use GitHub auth
dotnet nuget update source github-mitchdenny \
--username YOUR_GITHUB_USERNAME \
--password $(gh auth token) \
--store-password-in-clear-textPackage published at 2026-03-13 08:52:01 UTC |
Demonstrate the new Hex1bTerminalAutomator imperative testing API by converting WaitCommandTests from the Hex1bTerminalInputSequenceBuilder declarative pattern to the automator's step-by-step async pattern. Changes: - Update NuGet.config: Add hex1b-gh-packages feed for PR packages - Update Directory.Packages.props: Hex1b packages to 0.116.0-pr.243 (from mitchdenny/hex1b#243 which adds the automator API) - Add tests/Shared/Hex1bAutomatorTestHelpers.cs: Automator extension methods (WaitForSuccessPromptAsync, DeclineAgentInitPromptAsync, AspireNewAsync, etc.) with descriptive step names for diagnostics - Add tests/.../Helpers/CliE2EAutomatorHelpers.cs: Docker-specific automator extensions (PrepareDockerEnvironmentAsync, InstallAspireCliInDockerAsync) - Convert WaitCommandTests.cs: Replace builder pattern with imperative automator calls. Each step executes immediately with rich error context on failure (step history, terminal snapshot, caller location). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
🚀 Deployment SuccessfulYour PR environment has been deployed to Azure! ResourcesDeployment completed at 2026-03-13 08:59:04 UTC |
🗑️ Environment CleanupThe PR environment This operation runs asynchronously and may take a few minutes to complete. Cleanup initiated at 2026-03-13 09:28:44 UTC |
Demonstrate the new Hex1bTerminalAutomator imperative testing API by converting WaitCommandTests from the Hex1bTerminalInputSequenceBuilder declarative pattern to the automator's step-by-step async pattern. Changes: - Update NuGet.config: Add hex1b-gh-packages feed for PR packages - Update Directory.Packages.props: Hex1b packages to 0.116.0-pr.243 (from mitchdenny/hex1b#243 which adds the automator API) - Add tests/Shared/Hex1bAutomatorTestHelpers.cs: Automator extension methods (WaitForSuccessPromptAsync, DeclineAgentInitPromptAsync, AspireNewAsync, etc.) with descriptive step names for diagnostics - Add tests/.../Helpers/CliE2EAutomatorHelpers.cs: Docker-specific automator extensions (PrepareDockerEnvironmentAsync, InstallAspireCliInDockerAsync) - Convert WaitCommandTests.cs: Replace builder pattern with imperative automator calls. Each step executes immediately with rich error context on failure (step history, terminal snapshot, caller location). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…5206) * Convert WaitCommandTests to Hex1bTerminalAutomator API Demonstrate the new Hex1bTerminalAutomator imperative testing API by converting WaitCommandTests from the Hex1bTerminalInputSequenceBuilder declarative pattern to the automator's step-by-step async pattern. Changes: - Update NuGet.config: Add hex1b-gh-packages feed for PR packages - Update Directory.Packages.props: Hex1b packages to 0.116.0-pr.243 (from mitchdenny/hex1b#243 which adds the automator API) - Add tests/Shared/Hex1bAutomatorTestHelpers.cs: Automator extension methods (WaitForSuccessPromptAsync, DeclineAgentInitPromptAsync, AspireNewAsync, etc.) with descriptive step names for diagnostics - Add tests/.../Helpers/CliE2EAutomatorHelpers.cs: Docker-specific automator extensions (PrepareDockerEnvironmentAsync, InstallAspireCliInDockerAsync) - Convert WaitCommandTests.cs: Replace builder pattern with imperative automator calls. Each step executes immediately with rich error context on failure (step history, terminal snapshot, caller location). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix unresolved XML doc cref for Hex1bTerminalInputSequenceBuilder Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Mitch Denny <mitch@mitchdeny.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…5206) * Convert WaitCommandTests to Hex1bTerminalAutomator API Demonstrate the new Hex1bTerminalAutomator imperative testing API by converting WaitCommandTests from the Hex1bTerminalInputSequenceBuilder declarative pattern to the automator's step-by-step async pattern. Changes: - Update NuGet.config: Add hex1b-gh-packages feed for PR packages - Update Directory.Packages.props: Hex1b packages to 0.116.0-pr.243 (from mitchdenny/hex1b#243 which adds the automator API) - Add tests/Shared/Hex1bAutomatorTestHelpers.cs: Automator extension methods (WaitForSuccessPromptAsync, DeclineAgentInitPromptAsync, AspireNewAsync, etc.) with descriptive step names for diagnostics - Add tests/.../Helpers/CliE2EAutomatorHelpers.cs: Docker-specific automator extensions (PrepareDockerEnvironmentAsync, InstallAspireCliInDockerAsync) - Convert WaitCommandTests.cs: Replace builder pattern with imperative automator calls. Each step executes immediately with rich error context on failure (step history, terminal snapshot, caller location). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix unresolved XML doc cref for Hex1bTerminalInputSequenceBuilder Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Mitch Denny <mitch@mitchdeny.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Introduce
Hex1bTerminalAutomator, an imperative async API for terminal test automation that layers on top of the existing input sequencer.Each method executes immediately and records its result in a step history. When a step fails,
Hex1bAutomationExceptionprovides rich diagnostics including:CallerFilePath/CallerLineNumberattributesNew Types
Hex1bTerminalAutomator— Main API with wait, key, mouse, and typing methodsHex1bAutomationException— Rich exception with step history and snapshotAutomationStepRecord— Immutable record of a completed stepThe automator supports modifier stacking (Ctrl/Shift/Alt), sequence caching for common keys, and composability via
SequenceAsyncfor inline or pre-built sequences.