Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions browser_tests/tests/maskEditor.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -301,3 +301,30 @@ test.describe('Mask Editor', { tag: '@vue-nodes' }, () => {
}
)
})

test('Will not use stale litegraph previews', async ({ comfyPage }) => {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test isnt inside a describe and doesn't actually test any mask editor functionality so probably better elsewhere or open the mask editor at the end to validate that it is the correct image

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment got eaten 😭

I agree. There's not a (non screenshot/route mock) way to test the image loaded by the mask editor, but the prior structure of the test actually worked out nicely here.

Tragically, the existing mask editor fixture code isn't helpful since it forcibly loads a different workflow.

await comfyPage.menu.topbar.newWorkflowButton.click()
await comfyPage.searchBoxV2.addNode('Preview Image')

async function simulateExecuted(image: object) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe worth adding this to ExecutionHelper?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like ExecutionHelper already had a function to do this and my grep fu had failed me. The fixture code feels a good bit clunkier to use here, but tests an even broader scope which is appreciated.

await comfyPage.page.evaluate((pageImage) => {
const output = { images: [pageImage] }
const detail = { node: '1', output, prompt_id: '', display_node: '1' }
app!.api.dispatchCustomEvent('executed', detail)
app!.canvas.setDirty(true)
}, image)
}
async function getNodeOutput() {
return await comfyPage.page.evaluate(
() => graph!.getNodeById('1')!.images?.[0]?.filename
)
}

await simulateExecuted({ filename: 'test1.png' })
await expect.poll(getNodeOutput).toBe('test1.png')

await comfyPage.settings.setSetting('Comfy.VueNodes.Enabled', true)

await simulateExecuted({ filename: 'example.png', type: 'input' })
await expect.poll(getNodeOutput).toBe('example.png')
})
3 changes: 3 additions & 0 deletions src/stores/nodeOutputStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,9 @@ export const useNodeOutputStore = defineStore('nodeOutput', () => {

node.imgs = [element]
node.imageIndex = activeIndex

const outputs = getNodeOutputs(node)
if (outputs?.images) node.images = outputs.images
}

return {
Expand Down
Loading