From 204ffd42bf5d29e8a93e91e2df4148f54b7b61cd Mon Sep 17 00:00:00 2001 From: christian-byrne Date: Sun, 30 Aug 2026 05:12:42 -0700 Subject: [PATCH 1/4] test(assets): cover runtime flag fallback --- browser_tests/tests/sidebar/assets.spec.ts | 59 +++++++++++++++++++++- 1 file changed, 58 insertions(+), 1 deletion(-) diff --git a/browser_tests/tests/sidebar/assets.spec.ts b/browser_tests/tests/sidebar/assets.spec.ts index ec2d9e731e1..9bf84107fb3 100644 --- a/browser_tests/tests/sidebar/assets.spec.ts +++ b/browser_tests/tests/sidebar/assets.spec.ts @@ -1,6 +1,6 @@ import { expect, mergeTests } from '@playwright/test' -import type { Asset } from '@comfyorg/ingest-types' +import type { Asset, ListAssetsResponse } from '@comfyorg/ingest-types' import { assetApiFixture } from '@e2e/fixtures/assetApiFixture' import { comfyPageFixture } from '@e2e/fixtures/ComfyPage' import { @@ -148,6 +148,63 @@ const JOB_GAMMA_DETAIL: JobDetail = { } } +test.describe('Assets sidebar remote flag lifecycle', { tag: '@oss' }, () => { + test('falls back to settled history state when the flag turns off', async ({ + comfyPage, + page + }) => { + test.fail( + true, + 'The Assets sidebar does not refresh history after a runtime flag change' + ) + + const assetListRequests: string[] = [] + const apiAsset = { + id: 'remote-enabled-output', + name: 'remote-enabled.png', + mime_type: 'image/png', + tags: ['output'], + preview_url: '/api/view?filename=remote-enabled.png&type=output', + created_at: '2026-08-29T00:00:00.000Z', + updated_at: '2026-08-29T00:00:00.000Z' + } satisfies Asset + await page.route(/\/api\/assets(?:\?.*)?$/, async (route) => { + assetListRequests.push(route.request().url()) + await route.fulfill({ + json: { + assets: [apiAsset], + total: 1, + has_more: false + } satisfies ListAssetsResponse + }) + }) + await comfyPage.assets.mockOutputHistory([ + createMockJob({ id: 'legacy-after-flag-off' }) + ]) + await comfyPage.assets.mockInputFiles([]) + await comfyPage.setup() + await comfyPage.featureFlags.setServerFlags({ assets: true }) + + const tab = comfyPage.menu.assetsTab + await tab.open({ waitForAssets: false }) + const apiCard = tab.getAssetCardByName('remote-enabled') + await expect(apiCard).toBeVisible() + await apiCard.click() + await expect(tab.selectionFooter).toBeVisible() + const requestCountBeforeFlagOff = assetListRequests.length + + await comfyPage.featureFlags.setServerFlags({ assets: false }) + + await expect( + tab.getAssetCardByName('output_legacy-after-flag-off') + ).toBeVisible() + await expect(apiCard).toHaveCount(0) + await expect(tab.selectionFooter).toHaveCount(0) + await expect(tab.filterButton).toHaveCount(0) + expect(assetListRequests).toHaveLength(requestCountBeforeFlagOff) + }) +}) + // ========================================================================== // 1. Empty states // ========================================================================== From 441613e19a23a38fe953d24a064f98d1f0935c49 Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Thu, 3 Sep 2026 17:48:24 +0000 Subject: [PATCH 2/4] test(assets): allow expected failure to settle --- browser_tests/tests/sidebar/assets.spec.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/browser_tests/tests/sidebar/assets.spec.ts b/browser_tests/tests/sidebar/assets.spec.ts index 9bf84107fb3..30db9f386f3 100644 --- a/browser_tests/tests/sidebar/assets.spec.ts +++ b/browser_tests/tests/sidebar/assets.spec.ts @@ -153,6 +153,7 @@ test.describe('Assets sidebar remote flag lifecycle', { tag: '@oss' }, () => { comfyPage, page }) => { + test.setTimeout(30_000) test.fail( true, 'The Assets sidebar does not refresh history after a runtime flag change' From 3771d412b4b2984a980bd90cdd8763b132234788 Mon Sep 17 00:00:00 2001 From: bymyself Date: Thu, 3 Sep 2026 22:53:51 +0000 Subject: [PATCH 3/4] test(assets): await flag fallback response Addresses https://github.com/Comfy-Org/ComfyUI_frontend/pull/16293#discussion_r3927212794 --- browser_tests/tests/sidebar/assets.spec.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/browser_tests/tests/sidebar/assets.spec.ts b/browser_tests/tests/sidebar/assets.spec.ts index 30db9f386f3..4ad804b59ce 100644 --- a/browser_tests/tests/sidebar/assets.spec.ts +++ b/browser_tests/tests/sidebar/assets.spec.ts @@ -193,8 +193,16 @@ test.describe('Assets sidebar remote flag lifecycle', { tag: '@oss' }, () => { await apiCard.click() await expect(tab.selectionFooter).toBeVisible() const requestCountBeforeFlagOff = assetListRequests.length + const fallbackHistoryResponse = page.waitForResponse((response) => { + const url = new URL(response.url()) + return ( + url.pathname === '/api/jobs' && + url.searchParams.get('status') === 'completed,failed,cancelled' + ) + }) await comfyPage.featureFlags.setServerFlags({ assets: false }) + await fallbackHistoryResponse await expect( tab.getAssetCardByName('output_legacy-after-flag-off') From 27ee06d36f467e21d8a970423e05a050892e9df7 Mon Sep 17 00:00:00 2001 From: bymyself Date: Thu, 3 Sep 2026 23:23:36 +0000 Subject: [PATCH 4/4] test(assets): wait on flag transition boundary Replace the nonexistent fallback request wait with the reactive card-removal boundary before checking that the API asset request count stays unchanged. Refs https://github.com/Comfy-Org/ComfyUI_frontend/pull/16293#discussion_r3927212794 --- browser_tests/tests/sidebar/assets.spec.ts | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/browser_tests/tests/sidebar/assets.spec.ts b/browser_tests/tests/sidebar/assets.spec.ts index 4ad804b59ce..e5c4bf283f9 100644 --- a/browser_tests/tests/sidebar/assets.spec.ts +++ b/browser_tests/tests/sidebar/assets.spec.ts @@ -193,24 +193,15 @@ test.describe('Assets sidebar remote flag lifecycle', { tag: '@oss' }, () => { await apiCard.click() await expect(tab.selectionFooter).toBeVisible() const requestCountBeforeFlagOff = assetListRequests.length - const fallbackHistoryResponse = page.waitForResponse((response) => { - const url = new URL(response.url()) - return ( - url.pathname === '/api/jobs' && - url.searchParams.get('status') === 'completed,failed,cancelled' - ) - }) await comfyPage.featureFlags.setServerFlags({ assets: false }) - await fallbackHistoryResponse - - await expect( - tab.getAssetCardByName('output_legacy-after-flag-off') - ).toBeVisible() await expect(apiCard).toHaveCount(0) await expect(tab.selectionFooter).toHaveCount(0) await expect(tab.filterButton).toHaveCount(0) expect(assetListRequests).toHaveLength(requestCountBeforeFlagOff) + await expect( + tab.getAssetCardByName('output_legacy-after-flag-off') + ).toBeVisible() }) })