Repository navigation
feat: driver package — execute a scenario against a real LiveDocument - #3
Merged
Merged
Conversation
driver.Run(ctx, live, scenario, doSubmit) executes each step in order: - click: resolves the selector (QuerySelector), calls LiveDocument.Click (already a real mousedown/mouseup/click, bubbling). - fill: clears the field's CURRENT value via Backspace (one real keydown/input/keyup per character, same as a user deleting it) before Type-ing the new value — never a bulk assignment, so a controlled React/Vue input sees exactly the sequence a real user retyping the field would produce. - assert: resolves the selector (failing the run if nothing matches); with a text attribute, compares against the element's own value (input/textarea) or text content (anything else). - submit: always computes LiveDocument.PreviewSubmit's own dry-run (method/target/body) first; performs the real LiveDocument.Submit only when doSubmit is true, swapping in the resulting LiveDocument on a real navigation (Submit's own contract already closes the superseded one). A scenario's pin block, if present, is checked FIRST — URL and every selector must already match, or Run refuses with a single error naming every mismatch found, before any step runs. No new engine-level capability: every step is a thin call into LiveDocument's already-existing, already-tested primitives (confirmed directly before writing this package). One real finding while writing the end-to-end test: an inline onclick="..." HTML attribute string is not wired to anything in go-webengine/engine (only addEventListener/the onclick IDL property are) — not a driver bug, just this engine's own documented scope; the test uses addEventListener, matching the engine's own test conventions. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
10 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Third piece of the automation layer:
driver.Run(ctx, live, scenario, doSubmit)executes a parsed scenario's steps against a realengine.LiveDocument.QuerySelector), callsLiveDocument.Click(already a real mousedown/mouseup/click, bubbling).Backspace(one real keydown/input/keyup per character, same as a user deleting it) beforeType-ing the new value — never a bulk assignment, so a controlled React/Vue input sees exactly the sequence a real user retyping the field would produce.textattribute, compares against the element's own value (input/textarea) or text content (anything else).PreviewSubmit's own dry-run (method/target/body) first; performs the realSubmitonly whendoSubmitis true, swapping in the resultingLiveDocumenton a real navigation.A scenario's
pinblock, if present, is checked FIRST — URL and every selector must already match, orRunrefuses with a single error naming every mismatch found, before any step runs.No new engine-level capability: every step is a thin call into
LiveDocument's already-existing, already-tested primitives.One real finding while writing the end-to-end test: an inline
onclick="..."HTML attribute string is not wired to anything in go-webengine/engine (onlyaddEventListener/theonclickIDL property are) — not a driver bug, just this engine's own documented scope; the test usesaddEventListener, matching the engine's own test conventions.Test plan
TestRunClickFillAssert— end to end: fill → click (a realaddEventListenerhandler) → assert the resulting textTestRunFillReplacesExistingValue— fill genuinely replaces a stale value, not appendsTestRunAssertSelectorNotFoundFailsTheRunTestRunPinMismatchStopsBeforeAnyStep/TestRunPinURLMismatchTestRunSubmitDryRunDoesNotTouchNetwork— the test server fails if it ever sees a POSTTestRunSubmitRealRequestNavigates—doSubmit=trueperforms the real request and the returnedLiveDocumentis the new pagego build/go vet/gofmt -l/govulncheck ./...cleango test ./...green (29 tests across all three packages),go test ./... -raceclean🤖 Generated with Claude Code