Skip to content

fix(app): stabilize todo dock e2e with composer probe#17267

Merged
Hona merged 5 commits intoanomalyco:devfrom
Hona:fix/todo-dock-e2e-flake
Mar 13, 2026
Merged

fix(app): stabilize todo dock e2e with composer probe#17267
Hona merged 5 commits intoanomalyco:devfrom
Hona:fix/todo-dock-e2e-flake

Conversation

@Hona
Copy link
Member

@Hona Hona commented Mar 13, 2026

Summary

  • add a minimal composer e2e driver/probe so the todo dock test can drive and observe app state directly
  • rewrite the flaky todo dock spec around a fluent todoDock(...) helper instead of wall-clock and lifecycle races
  • document the state-first e2e testing rules in packages/app/e2e/AGENTS.md

Testing

  • bun typecheck
  • bun test:e2e:local -- e2e/session/session-composer-dock.spec.ts -g "todo dock transitions and collapse behavior"
  • bun test:e2e:local -- e2e/session/session-composer-dock.spec.ts -g "todo dock transitions and collapse behavior" (5 consecutive runs)

@Hona Hona requested a review from adamdotdevin as a code owner March 13, 2026 01:25
Copilot AI review requested due to automatic review settings March 13, 2026 01:25
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a lightweight, test-only driver/probe mechanism to make the session “todo dock” behavior observable and controllable in Playwright E2E, reducing reliance on UI/DOM timing for state assertions.

Changes:

  • Introduces packages/app/src/testing/session-composer.ts to support an E2E composer driver (inject state) and probe (read state) keyed by sessionID.
  • Wires the probe into SessionTodoDock and adds a driver override path in createSessionComposerState for deterministic todo/live state during E2E.
  • Updates E2E fixtures to enable the composer driver and rewrites the todo dock E2E test to use driver/probe polling; extends E2E guidance docs.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/app/src/testing/session-composer.ts Adds composer driver/probe state storage under window.__opencode_e2e.composer and a shared composerEvent.
packages/app/src/pages/session/composer/session-todo-dock.tsx Adds sessionID prop and reports dock state via the new composer probe.
packages/app/src/pages/session/composer/session-composer-state.ts Listens for composerEvent and optionally overrides todos/live from the E2E driver.
packages/app/src/pages/session/composer/session-composer-region.tsx Passes sessionID down to SessionTodoDock and refactors useSessionKey usage.
packages/app/e2e/session/session-composer-dock.spec.ts Replaces todo-dock DOM assertions with driver/probe-based state assertions.
packages/app/e2e/fixtures.ts Enables the composer E2E hook via addInitScript alongside the existing terminal hook.
packages/app/e2e/AGENTS.md Documents best practices for waiting on observable state and adding minimal test hooks.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +89 to +96
createEffect(() => {
probe.set({
mounted: true,
collapsed: store.collapsed,
hidden: store.collapsed || off(),
count: props.todos.length,
states: props.todos.map((todo) => todo.status),
})
Comment on lines +64 to +75
const sync = () => {
const next = composerDriver(id)
if (!next) {
setTest({ on: false, live: undefined, todos: undefined })
return
}
setTest({
on: true,
live: next.live,
todos: next.todos?.map((todo) => ({ ...todo })),
})
}
Comment on lines +77 to +85
sync()
const onEvent = (event: Event) => {
const detail = (event as CustomEvent<{ sessionID?: string }>).detail
if (detail?.sessionID !== id) return
sync()
}
window.addEventListener(composerEvent, onEvent)
onCleanup(() => window.removeEventListener(composerEvent, onEvent))
})
@Hona Hona merged commit 96b1d8f into anomalyco:dev Mar 13, 2026
8 checks passed
shellmind112 pushed a commit to shellmind112/opencode that referenced this pull request Mar 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants