From 8bec2df73d6f3c1cd191f175881033a776672342 Mon Sep 17 00:00:00 2001 From: Benjamin Lu Date: Tue, 9 Dec 2025 03:38:38 -0800 Subject: [PATCH] nit --- browser_tests/fixtures/ws.ts | 6 +++++- browser_tests/tests/actionbar.spec.ts | 12 +++++++----- browser_tests/tests/queue/queueList.spec.ts | 8 ++++---- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/browser_tests/fixtures/ws.ts b/browser_tests/fixtures/ws.ts index f1ab1a538..7606f73d2 100644 --- a/browser_tests/fixtures/ws.ts +++ b/browser_tests/fixtures/ws.ts @@ -1,7 +1,11 @@ import { test as base } from '@playwright/test' +import type { StatusWsMessage } from '../../src/schemas/apiSchema' + +export type WsMessage = { type: 'status'; data: StatusWsMessage } + export const webSocketFixture = base.extend<{ - ws: { trigger(data: any, url?: string): Promise } + ws: { trigger(data: WsMessage, url?: string): Promise } }>({ ws: [ async ({ page }, use) => { diff --git a/browser_tests/tests/actionbar.spec.ts b/browser_tests/tests/actionbar.spec.ts index bd086b461..23e327b5c 100644 --- a/browser_tests/tests/actionbar.spec.ts +++ b/browser_tests/tests/actionbar.spec.ts @@ -1,9 +1,9 @@ import type { Response } from '@playwright/test' import { expect, mergeTests } from '@playwright/test' -import type { StatusWsMessage } from '../../src/schemas/apiSchema.ts' -import { comfyPageFixture } from '../fixtures/ComfyPage.ts' -import { webSocketFixture } from '../fixtures/ws.ts' +import { comfyPageFixture } from '../fixtures/ComfyPage' +import { webSocketFixture } from '../fixtures/ws' +import type { WsMessage } from '../fixtures/ws' const test = mergeTests(comfyPageFixture, webSocketFixture) @@ -61,7 +61,7 @@ test.describe('Actionbar', () => { // Trigger a status websocket message const triggerStatus = async (queueSize: number) => { - await ws.trigger({ + const message = { type: 'status', data: { status: { @@ -70,7 +70,9 @@ test.describe('Actionbar', () => { } } } - } as StatusWsMessage) + } satisfies WsMessage + + await ws.trigger(message) } // Extract the width from the queue response diff --git a/browser_tests/tests/queue/queueList.spec.ts b/browser_tests/tests/queue/queueList.spec.ts index 6b2aa8e24..e0bb04a9c 100644 --- a/browser_tests/tests/queue/queueList.spec.ts +++ b/browser_tests/tests/queue/queueList.spec.ts @@ -1,9 +1,9 @@ import { expect, mergeTests } from '@playwright/test' import type { ComfyPage } from '../../fixtures/ComfyPage' -import type { StatusWsMessage } from '../../../src/schemas/apiSchema' import { comfyPageFixture } from '../../fixtures/ComfyPage' import { webSocketFixture } from '../../fixtures/ws' +import type { WsMessage } from '../../fixtures/ws' const test = mergeTests(comfyPageFixture, webSocketFixture) @@ -23,7 +23,7 @@ type QueueJob = [ type QueueController = { state: QueueState sync: ( - ws: { trigger(data: any, url?: string): Promise }, + ws: { trigger(data: WsMessage, url?: string): Promise }, nextState: Partial ) => Promise } @@ -134,7 +134,7 @@ const createQueueController = async ( }) const sync = async ( - ws: { trigger(data: any, url?: string): Promise }, + ws: { trigger(data: WsMessage, url?: string): Promise }, nextState: Partial ) => { if (nextState.running) state.running = nextState.running @@ -148,7 +148,7 @@ const createQueueController = async ( data: { status: { exec_info: { queue_remaining: total } } } - } as StatusWsMessage) + }) await queueResponse }