Repository navigation
test(agent): pin the HTTP-status fallback in an API error notice #19752
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
f78d989
test(agent): pin the HTTP-status fallback in an API error notice
christian-byrne 941a846
test(agent): fixture HTTP status fallback mock
christian-byrne 4673777
test(agent): isolate HTTP fallback E2E
christian-byrne 6a41cdc
test(agent): address HTTP fallback review
christian-byrne 1e49889
Merge remote-tracking branch 'refs/remotes/origin/main' into HEAD
christian-byrne 0526397
Merge remote-tracking branch 'origin/main' into op229/agent-api-error…
christian-byrne c72053e
test(agent): simplify HTTP fallback fetch stub
DrJKL 44d03f8
Merge remote-tracking branch 'origin/main' into op229/agent-api-error…
DrJKL File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| import { expect } from '@playwright/test' | ||
|
|
||
| import enMessages from '@/locales/en/main.json' with { type: 'json' } | ||
|
|
||
| import { agentTest as test } from '@e2e/tests/agent/agentPanelMocks' | ||
|
|
||
| test.beforeEach(async ({ comfyPage }) => { | ||
| await comfyPage.page.evaluate(() => { | ||
| const originalFetch = globalThis.fetch | ||
| globalThis.fetch = async (input, init) => | ||
| init?.method === 'POST' && | ||
| /\/agent\/threads\/[^/]+\/messages$/.test(String(input)) | ||
| ? new Response('', { status: 503 }) | ||
| : originalFetch(input, init) | ||
| }) | ||
| }) | ||
|
|
||
| test( | ||
| 'shows the HTTP status when a failed send has no error message', | ||
| { tag: '@cloud' }, | ||
| async ({ agentPanel }) => { | ||
| await agentPanel.open() | ||
| await agentPanel.selectWorkflow() | ||
|
|
||
| await agentPanel.sendMessage('Build a product photo workflow') | ||
|
|
||
| await expect( | ||
| agentPanel.root.getByText( | ||
| `${enMessages.agent.sendFailed}: Agent request failed (HTTP 503)`, | ||
| { exact: true } | ||
| ) | ||
| ).toBeVisible() | ||
|
christian-byrne marked this conversation as resolved.
Resolved
|
||
| } | ||
| ) | ||
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: I don't think this browser case catches anything the suite misses, and I'd delete it along with
agentMessageHttpErrorMock. The behavior has three parts, and each already has a test at the level that owns it:statusTextbecomesAgent request failed (HTTP 503):agentRestClient.test.ts:465.postMessageandgetMessagesboth go throughrequest()and thentoApiError(agentRestClient.ts:356-362), so that unit case covers the send path too.AgentApiErrormessage becomesMessage failed to send: <message>:useAgentSession.test.ts:4461-4487.fetchApipath:keeps a failed prompt available to retryinagentPanel.spec.ts(a 500 frompage.route), plus the exact full-notice assertion atagentPanel.spec.ts:369-374.recordSendErrorreadserror.messageand never looks at where the message came from. I can't name a wrong implementation that passes those three tests and fails this one. If you keep the browser case anyway, my other comments on this file make it smaller.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keeping the focused browser case: this lane explicitly requires preserving the HTTP-status fallback contract and its black-box proof, and the repository harness-first policy requires visible Agent behavior to be exercised end to end. The current case remains the only proof that the empty-body/empty-status fallback survives the real panel send path and renders as one exact notice. I applied the remaining size and clarity suggestions in 6a41cdc.