Comfy-Org / Comfy-Org/ComfyUI_frontend
test(assets): add partial-success mock coverage for delete confirmation flow
- Dominant language
- TypeScript
- Stars
- 2k
- Forks
- 699
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 490
Description
## Context
This is a follow-up to PR [#10785](https://github.com/Comfy-Org/ComfyUI_frontend/pull/10785) (raised in [this review comment](https://github.com/Comfy-Org/ComfyUI_frontend/pull/10785#discussion_r3019178045)).
## Problem
The `mockDeleteHistory()` helper in `browser_tests/fixtures/helpers/AssetsHelper.ts` currently models only full success — it removes all requested IDs and always returns HTTP 200. This means E2E tests cannot yet cover the partial-success / mixed-failure delete scenario (warning toast on partial failure) described in issue #10781.
The underlying reason for the deferred work: `deleteItem` in `useMediaAssetActions.ts` issues **individual** `POST /api/history` calls per asset via `Promise.allSettled`, so simulating partial failures requires per-request conditional responses from the Playwright route handler, which adds significant complexity beyond what is needed for this PR.
## Proposed work
- Extend `mockDeleteHistory()` (or add a sibling helper) to support per-request conditional responses (e.g., an optional `resolveDelete` callback or a `failingIds` set) so individual calls can be made to fail while others succeed.
- Add E2E tests asserting:
- A **warning toast** is shown when some deletes succeed and some fail.
- Asset cards for failed deletes remain visible after the operation.
- Ensure the new helper still supports the simple full-success path used by existing tests.
## References
- PR #10785 — initial delete-confirmation E2E tests
- Issue #10781 — original test coverage requirements (partial success scenario listed there)
/cc @dante01yoon
┆Issue is synchronized with this [Notion page](https://www.notion.so/Issue-10787-test-assets-add-partial-success-mock-coverage-for-delete-confirmation-flow-3356d73d365081988506e7e154feb894) by [Unito](https://www.unito.io)
Contributor guide
Assessment
This issue has not been assessed yet.