Repository navigation
fix(tests): Automations fixture tests fail when a presence check or editor write runs before its control appears - #2225
Conversation
…edits Follow-up from the openclaw#2216 review. Presence checks and helper lookups that ran right after a wait on a different control could still miss a Reactor sibling whose UIA peer was not published yet. - 17 Assert.NotNull(Find*(...)) readiness checks now wait for the control. - ExpandAutomation and SetEditorValue become async: they wait for the expander or the enabled value peer, then act once. - The two retention checks (the loaded row after a refresh failure and after going offline) stay immediate reads, so a removed row still fails. Co-authored-by: Copilot App <[email protected]>
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesThis PR makes Automations fixture presence checks, expands, and editor writes wait for their own UI Automation controls. Example: The editor name field appears before AutomationEditorPrompt is reachable through UI Automation.
Review scores
ProductKind: Test only · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR open: it completes useful readiness handling left by the merged predecessor, and the reviewed diff introduces no concrete defect. Maintainer authorship also prevents automatic closure. Priority: P3 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherAutomations fixture tests drive the native Companion against a synthetic Gateway, inspect controls through UI Automation, and assert rendered state and Gateway requests. flowchart LR
A[Fixture scenario] --> B[Synthetic Gateway]
B --> C[Native Companion]
C --> D[UI Automation controls]
D --> E[Existing readiness helpers]
E --> F[Test actions and assertions]
Technical reviewBest possible solution: Keep readiness handling in the existing fixture helpers while preserving single-attempt mutations and immediate retention assertions. Do we have a high-confidence way to reproduce the issue? Main's immediate lookups demonstrably fail if the required UIA peer appears late, but the precise publishing gap at these follow-up sites has no deterministic reproduction or observed failing run. Is this the best way to solve the issue? The patch is a focused extension of the existing readiness strategy: wait for the actual control, retain that capture, and perform mutations once without weakening retention checks. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against bb9cc8acdc1b. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed November 14, 2026, 2:55 AM ET / 07:55 UTC. |
Automations_LargeAgendaPagesBeyondBrowseAndJumpsToInlineRow failed on openclaw#2225's first attempt with "Assert.InRange() Failure: Range (1 - 6), Actual: 0": the agenda list peer was published before its row buttons and the test counted them once. - Wait until the list has at least one agenda row, and keep the 1-6 range assertion on the rows from that same poll. - The expanded-group wait now also requires the target item and captures it, instead of a later .First() read. - The offline "Schedule as of" text is a readiness check after waiting on another control, so it now waits for the text. Co-authored-by: Copilot App <[email protected]>
Related: #2216 (fix(tests): Automations fixture tests fail when an editor control's UI Automation element appears late)
What Problem This Solves
Fixes: Automations Mock Gateway fixture UI tests can still fail when a presence check, an expand or an editor write runs right after a wait on a different control, before UI Automation has published the control the test needs.
User Impact
User impact: there is no product change. Contributors see fewer false Automations fixture failures.
Why This Change Was Made
#2216 converted every
FindById(...)!read inAutomationsUiTests.cs. Its review found the same race in forms the timing guard does not count, and that follow-up was deferred to this PR:Assert.NotNull(Find*(...))checks that ran right after a wait on another control now wait for the control they check.ExpandAutomationbecomesExpandAutomationAsync: it waits for the row's expander, then calls Expand once.SetEditorValuebecomesSetEditorValueAsync: it waits until the editor field is present and enabled, then writes once. A UIA write is never retried. The editor text fields are never disabled by the product, and a write to a disabled field already threw, so this matches what the old code needed.Two presence checks stay immediate on purpose. They are retention checks: the loaded row must still be there after a refresh failure and after going offline. A wait there could hide a row that disappears and comes back, so each keeps its single read with a comment explaining why.
Added after this PR's first CI attempt. Shard B failed
Automations_LargeAgendaPagesBeyondBrowseAndJumpsToInlineRowwithAssert.InRange() Failure: Range (1 - 6), Actual: 0(run 43572367590, job 132379360946). That line was not changed by this PR. The agenda list's UI Automation element appeared before its row buttons, and the test counted the rows once. The same "wait for the container, then read its children once" pattern is now fixed in three places:Assert.InRange(1, 6)then checks the rows from that same poll, so the upper limit is still checked immediately..First()read failed if the item wasn't there yet.Deliberately left as immediate reads:
The remaining
?? throwlookups are left as they are:SaveAutomationsWindow, which has about 30 synchronous call sites and belongs in a separate change.Evidence
main.Change Type
Scope
winnodeRequired proof pools
none: test-only change to Mock Gateway fixture UI tests that CI runs directly.Validation
All runs were local on Windows x64 at 175% DPI, with isolated profiles. Metadata for the real
%APPDATA%/%LOCALAPPDATA%\OpenClawTraywas unchanged after every run.HeroWashandScopesToAgents(12 test cases)Automations_LoadingErrorsRefreshAndOfflineKeepHonestStates(retention checks) on the final sourceAutomations_LargeAgendaPagesBeyondBrowseAndJumpsToInlineRowandAutomations_LoadingErrorsRefreshAndOfflineKeepHonestStatesafter the agenda-row fixAutomations_ScopesToAgentsAndCoversMainStatesmain86b17b750: 2 of 3 runs passed. Every failure is the same intermittent local Axe "BoundingRectangle must be at least 25 pixels" result at a different scan (editor or remove confirmation). This test passed on #2216's CI, including its soak.Automations_HeroWashScrollsWhileTheBackplateStaysAnchoredmaintoo (DPI), as recorded in #2216..\scripts\validate-test-timing-patterns.ps1: passed. These patterns are not counted by the guard, so the baseline is unchanged../build.ps1: all builds succeeded.dotnet test ./tests/OpenClaw.Shared.Tests/OpenClaw.Shared.Tests.csproj: 5876 passed, 0 failed, 29 skipped.dotnet test ./tests/OpenClaw.Tray.Tests/OpenClaw.Tray.Tests.csproj: 6669 passed, 0 failed.Real Behavior Proof
main86b17b750). The test source is identical to the validated tree.dotnet test tests/OpenClaw.Tray.UITests -c Debug -r win-x64 -p:DevBuild=false --no-build --filter "FullyQualifiedName~.Automations_"withOPENCLAW_RUN_GATEWAY_FIXTURE_UI=1, plus the filters above.Yes/No/N/A): N/A (local artifacts only).ScopesToAgentsis pre-existing and not addressed here.Security Impact
Yes/No): NoYes/No): NoYes/No): NoYes/No): NoYes/No): NoYes, explain the risk and mitigation: N/ACompatibility and Migration
Yes/No): YesYes/No): NoYes/No): NoReview Conversations