test: replace waitForTimeout with retrying assertions

- widget.spec.ts: use expect().toPass() for combo refresh

- subgraph.spec.ts: use comfyPage.setup() after reload

- nodeLibrary.spec.ts: use toHaveCount() for debounced search

- remoteWidgets.spec.ts: use expect().toPass() for backoff test

- litegraphUtils.ts: refactor navigateIntoSubgraph to use toPass()

Amp-Thread-ID: https://ampcode.com/threads/T-019c11f1-e839-772c-8890-b77cfdf70124
Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
Alexander Brown
2026-01-30 18:51:55 -08:00
parent 679288500a
commit 1ec55fdf31
5 changed files with 23 additions and 40 deletions

View File

@@ -257,13 +257,11 @@ test.describe('Remote COMBO Widget', { tag: '@widget' }, () => {
await addRemoteWidgetNode(comfyPage, nodeName)
await waitForWidgetUpdate(comfyPage)
// Wait for timeout and backoff, then force re-render, repeat
const requestTimeout = 512
await comfyPage.page.waitForTimeout(requestTimeout)
await waitForWidgetUpdate(comfyPage)
await comfyPage.page.waitForTimeout(requestTimeout * 2)
await waitForWidgetUpdate(comfyPage)
await comfyPage.page.waitForTimeout(requestTimeout * 3)
// Wait for exponential backoff retries to accumulate timestamps
await expect(async () => {
await waitForWidgetUpdate(comfyPage)
expect(timestamps.length).toBeGreaterThanOrEqual(3)
}).toPass({ timeout: 10000, intervals: [500, 1000, 1500] })
// Verify exponential backoff between retries
const intervals = timestamps.slice(1).map((t, i) => t - timestamps[i])

View File

@@ -336,8 +336,6 @@ test.describe('Node library sidebar', () => {
const tab = comfyPage.menu.nodeLibraryTab
await tab.nodeLibrarySearchBoxInput.fill('KSampler')
// Node search box is debounced and may take some time to update.
await comfyPage.page.waitForTimeout(1000)
expect(await tab.getNode('KSampler (Advanced)').count()).toBe(2)
await expect(tab.getNode('KSampler (Advanced)')).toHaveCount(2)
})
})

View File

@@ -754,7 +754,7 @@ test.describe('Subgraph Operations', { tag: ['@slow', '@subgraph'] }, () => {
// Reload the page
await comfyPage.page.reload()
await comfyPage.page.waitForTimeout(1024)
await comfyPage.setup()
// Navigate into subgraph
const subgraphNode = await comfyPage.getNodeRefById('2')

View File

@@ -52,10 +52,10 @@ test.describe('Combo text widget', { tag: ['@screenshot', '@widget'] }, () => {
await comfyPage.page.keyboard.press('r')
// Wait for nodes' widgets to be updated
await comfyPage.page.waitForTimeout(500)
const refreshedComboValues = await getComboValues()
expect(refreshedComboValues).not.toEqual(initialComboValues)
await expect(async () => {
const refreshedComboValues = await getComboValues()
expect(refreshedComboValues).not.toEqual(initialComboValues)
}).toPass({ timeout: 5000 })
})
test('Should refresh combo values of nodes with v2 combo input spec', async ({