Repository navigation
test(assets): workflow output focus #16270
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
base: main
Are you sure you want to change the base?
Changes from all commits
1d76dd5
64527db
0e00ccb
0dcf057
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,15 +1,19 @@ | ||
| import { expect, mergeTests } from '@playwright/test' | ||
| import type { ListAssetsResponse } from '@comfyorg/ingest-types' | ||
|
|
||
| import { comfyPageFixture } from '@e2e/fixtures/ComfyPage' | ||
| import { ExecutionHelper } from '@e2e/fixtures/helpers/ExecutionHelper' | ||
| import { | ||
| createRouteMockJob, | ||
| jobsRouteFixture | ||
| } from '@e2e/fixtures/jobsRouteFixture' | ||
| import { TestIds } from '@e2e/fixtures/selectors' | ||
| import { webSocketFixture } from '@e2e/fixtures/ws' | ||
| import type { RawJobListItem } from '@/platform/remote/comfyui/jobs/jobTypes' | ||
|
|
||
| const test = mergeTests(comfyPageFixture, jobsRouteFixture) | ||
| const test = mergeTests(comfyPageFixture, jobsRouteFixture, webSocketFixture) | ||
| const mockJobTimestamp = Date.UTC(2026, 0, 1, 12) | ||
| const targetJobId = '00000000-0000-4000-8000-000000000002' | ||
|
|
||
| const MOCK_JOBS: RawJobListItem[] = [ | ||
| createRouteMockJob({ | ||
|
|
@@ -21,11 +25,18 @@ const MOCK_JOBS: RawJobListItem[] = [ | |
| outputs_count: 2 | ||
| }), | ||
| createRouteMockJob({ | ||
| id: 'job-completed-2', | ||
| id: targetJobId, | ||
| status: 'completed', | ||
| create_time: mockJobTimestamp - 120_000, | ||
| execution_start_time: mockJobTimestamp - 120_000, | ||
| execution_end_time: mockJobTimestamp - 115_000, | ||
| preview_output: { | ||
| filename: 'workflow-output.png', | ||
| subfolder: '', | ||
| type: 'output', | ||
| nodeId: '1', | ||
| mediaType: 'images' | ||
| }, | ||
| outputs_count: 1 | ||
| }), | ||
| createRouteMockJob({ | ||
|
|
@@ -49,6 +60,25 @@ const MOCK_JOBS: RawJobListItem[] = [ | |
| test.describe('Queue overlay', () => { | ||
| test.beforeEach(async ({ comfyPage, jobsRoutes }) => { | ||
| await jobsRoutes.mockJobsScenario({ history: MOCK_JOBS, queue: [] }) | ||
| await comfyPage.page.route(/\/api\/assets(?:\?.*)?$/, async (route) => { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. SHOULD FIX — this The Generated tab renders from So the mocked asset id It is also installed in the shared Suggest deleting the whole |
||
| await route.fulfill({ | ||
| json: { | ||
| assets: [ | ||
| { | ||
| id: '10000000-0000-4000-8000-000000000002', | ||
| name: 'workflow-output.png', | ||
| mime_type: 'image/png', | ||
| tags: ['output'], | ||
| job_id: MOCK_JOBS[1].id, | ||
| created_at: '2026-08-30T00:00:00Z', | ||
| updated_at: '2026-08-30T00:00:00Z' | ||
| } | ||
| ], | ||
| total: 1, | ||
| has_more: false | ||
| } satisfies ListAssetsResponse | ||
| }) | ||
| }) | ||
| await comfyPage.settings.setSetting('Comfy.Minimap.Visible', false) | ||
| await comfyPage.settings.setSetting('Comfy.Queue.QPOV2', false) | ||
| await comfyPage.setup() | ||
|
|
@@ -116,6 +146,102 @@ test.describe('Queue overlay', () => { | |
| await expect(comfyPage.page.locator('[data-job-id]').first()).toBeHidden() | ||
| }) | ||
|
|
||
| test.describe('workflow output focus', () => { | ||
| test.use({ | ||
| initialFeatureFlags: { assets: true }, | ||
| initialSettings: { 'Comfy.Assets.UseAssetAPI': true } | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. SHOULD FIX — neither of these gates anything on this code path.
Also worth noting Unless one of these is actually needed, drop both; they make the test look like it is covering asset-API behaviour that it is not. |
||
| }) | ||
|
|
||
| test.afterEach(async ({ comfyPage }) => { | ||
| await comfyPage.workflow.setupWorkflowsDirectory({}) | ||
| }) | ||
|
|
||
| test('focuses the restored workflow output in Assets', async ({ | ||
| comfyPage, | ||
| getWebSocket | ||
| }) => { | ||
| const workflowName = `assets-output-focus-${Date.now().toString(36)}` | ||
| const job = MOCK_JOBS[1] | ||
| const nodeId = '1' | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. SHOULD FIX — hardcoding node id
|
||
| const output = { | ||
| images: [ | ||
| { | ||
| filename: 'workflow-output.png', | ||
| subfolder: '', | ||
| type: 'output' | ||
| } | ||
| ] | ||
| } | ||
| const ws = await getWebSocket() | ||
| const execution = new ExecutionHelper(comfyPage, ws) | ||
|
|
||
| await comfyPage.featureFlags.setServerFlagsPersistent({ assets: true }) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. SHOULD FIX — third mechanism for the same flag: |
||
| await comfyPage.settings.setSetting( | ||
| 'Comfy.Workflow.WorkflowTabsPosition', | ||
| 'Sidebar' | ||
| ) | ||
| await comfyPage.menu.workflowsTab.open() | ||
| await comfyPage.menu.topbar.saveWorkflow(workflowName) | ||
| execution.executed(job.id, nodeId, output) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TRIVIAL — worth knowing so the test is not over-trusted: the So the executed output and the queue job's asset are linked only by matching filenames, not by id. The PR description reads as if the two halves are causally connected; they are not. Not a defect, but the |
||
| await expect | ||
| .poll(() => | ||
| comfyPage.page.evaluate( | ||
| ([id]) => window.app!.nodeOutputs[id], | ||
| [nodeId] | ||
| ) | ||
| ) | ||
| .toEqual(output) | ||
|
|
||
| await comfyPage.command.executeCommand('Comfy.NewBlankWorkflow') | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TRIVIAL — lines 184-215 (save workflow, produce output, The genuinely new coverage is lines 223-241 (queue |
||
| await comfyPage.workflow.waitForWorkflowIdle() | ||
| await expect | ||
| .poll(() => | ||
| comfyPage.page.evaluate( | ||
| ([id]) => window.app!.nodeOutputs[id], | ||
| [nodeId] | ||
| ) | ||
| ) | ||
| .toBeUndefined() | ||
|
|
||
| await comfyPage.menu.workflowsTab.getPersistedItem(workflowName).click() | ||
| await comfyPage.workflow.waitForWorkflowIdle() | ||
| await expect | ||
| .poll(() => | ||
| comfyPage.page.evaluate( | ||
| ([id]) => window.app!.nodeOutputs[id], | ||
| [nodeId] | ||
| ) | ||
| ) | ||
| .toEqual(output) | ||
|
|
||
| await comfyPage.menu.assetsTab.open({ waitForAssets: false }) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. SHOULD FIX — what is this preload for?
If you added this to fix a flake, that flake is worth chasing to root cause rather than warming: the only way it should matter is if the tab's |
||
| await expect( | ||
| comfyPage.menu.assetsTab.getAssetCardByName('workflow-output') | ||
| ).toBeVisible() | ||
| await comfyPage.menu.workflowsTab.open() | ||
|
|
||
| await comfyPage.page.getByTestId(TestIds.queue.overlayToggle).click() | ||
| const jobRow = comfyPage.page.locator(`[data-job-id="${job.id}"]`) | ||
| await jobRow.hover() | ||
| await jobRow.getByRole('button', { name: 'View' }).click() | ||
|
|
||
| await expect(comfyPage.menu.assetsTab.generatedTab).toBeVisible() | ||
| await expect(comfyPage.menu.assetsTab.selectedCards).toHaveCount(1) | ||
| await expect(comfyPage.menu.assetsTab.selectedCards).toHaveAttribute( | ||
| 'data-asset-id', | ||
| job.id | ||
| ) | ||
| await expect | ||
| .poll(() => | ||
| comfyPage.page.evaluate( | ||
| ([id]) => window.app!.nodeOutputs[id], | ||
| [nodeId] | ||
| ) | ||
| ) | ||
| .toEqual(output) | ||
| }) | ||
| }) | ||
|
|
||
| test('Job details popover stays inside the viewport for bottom rows', async ({ | ||
| comfyPage | ||
| }) => { | ||
|
|
||
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.
TRIVIAL — adding
preview_outputto this shared fixture changes the rendered row for the six pre-existing tests in this file: the job now renders a preview tile (fetching/api/view?filename=workflow-output.png, which 404s in the test backend) instead of a state icon, and becomes double-click/View-able. Nothing currently asserts on that, so it is safe today, but it makesMOCK_JOBScarry state that only one nested describe needs. Consider a local fixture for the new test instead of mutating the shared array.