Add MSW coverage for the AI panel shell
What
Leaf MR in the Duo Agentic Chat MSW migration. Adds the jsdom replacement for two Capybara shared examples, ahead of their removal.
The shared harness, !248777 (merged), has merged. This MR now targets !249406 (closed), which shares the beforeEach and afterEach bodies these specs use (setupDuoChatTest / teardownDuoChatTest), and will be re-targeted to master once that merges.
Replaces
| Capybara shared example | Replaced by |
|---|---|
'user can navigate AI panel using navigation rail' (7 examples) |
ai_duo_panel/navigation_rail_spec.js (6 tests) |
'user sees agentic chat blocked state' → Duo-disabled empty state |
ai_duo_panel/blocked_state_spec.js (2 tests) |
'user sees agentic chat blocked state' → panel state survives reload |
already covered by panel_visibility_persistence_spec.js on master |
Two assertions are stronger than the originals
The Capybara version, and the first JS draft of it, awaited the chat-history testid as the probe for "the history tab rendered". That testid is the inner wrapper of chat-component and is already in the DOM in chat mode, so the assertion passed even if the toggle did nothing — which also made the follow-up "no thread boxes after returning to chat" assertion vacuous. Both now gate on thread boxes. Verified by mutation: deleting the historyToggle.click() makes the test fail, where previously it passed.
Why the handler change is here
handlers/ai_duo_panel.js gains empty getUserAgentFlows and getFlowTypes handlers. navigation_rail_spec.js is the only spec that navigates as far as the Sessions tab, which mounts the agent-sessions views and fires those two operations. Unhandled operations become a console.warn that ConsoleWatcher turns into a failure, so the tab cannot render without them. They ship with their sole consumer.
Verification
yarn jest:msw-integration ee/spec/frontend/msw_integration/ai_duo_panel/ — green.
Notes
Test-only, so no changelog entry.
Part of #603605 (closed)