Stricter typing for nodeids

This commit is contained in:
Austin Mroz
2025-09-23 16:45:46 -05:00
parent 109173fad1
commit 5ea7a56b64
8 changed files with 35 additions and 29 deletions

View File

@@ -3,6 +3,8 @@
*/
import type { Locator, Page } from '@playwright/test'
import type { NodeId } from '@/lib/litegraph/src/LGraphNode'
export class VueNodeHelpers {
constructor(private page: Page) {}
@@ -39,7 +41,7 @@ export class VueNodeHelpers {
/**
* Get all Vue node IDs currently in the DOM
*/
async getNodeIds(): Promise<string[]> {
async getNodeIds(): Promise<NodeId[]> {
return await this.nodes.evaluateAll((nodes) =>
nodes
.map((n) => n.getAttribute('data-node-id'))
@@ -50,14 +52,14 @@ export class VueNodeHelpers {
/**
* Select a specific Vue node by ID
*/
async selectNode(nodeId: string): Promise<void> {
async selectNode(nodeId: nodeId): Promise<void> {
await this.page.locator(`[data-node-id="${nodeId}"]`).click()
}
/**
* Select multiple Vue nodes by IDs using Ctrl+click
*/
async selectNodes(nodeIds: string[]): Promise<void> {
async selectNodes(nodeIds: NodeId[]): Promise<void> {
if (nodeIds.length === 0) return
// Select first node normally

View File

@@ -1,6 +1,8 @@
import type { Page } from '@playwright/test'
import { expect } from '@playwright/test'
import type { NodeId } from '@/lib/litegraph/src/LGraphNode'
import { comfyPageFixture as test } from '../fixtures/ComfyPage'
interface ChatHistoryEntry {
@@ -33,7 +35,7 @@ async function renderChatHistory(page: Page, history: ChatHistoryEntry[]) {
}
test.describe('Chat History Widget', () => {
let nodeId: string
let nodeId: NodeId
test.beforeEach(async ({ comfyPage }) => {
nodeId = await renderChatHistory(comfyPage.page, [