|
1 | | -import { expect } from '@playwright/test' |
| 1 | +import { expect, mergeTests } from '@playwright/test' |
2 | 2 |
|
| 3 | +import { ExecutionHelper } from '@e2e/fixtures/helpers/ExecutionHelper' |
3 | 4 | import { maskEditorTest as test } from '@e2e/fixtures/helpers/MaskEditorHelper' |
| 5 | +import { webSocketFixture } from '@e2e/fixtures/ws' |
| 6 | + |
| 7 | +const wstest = mergeTests(test, webSocketFixture) |
4 | 8 |
|
5 | 9 | test.describe('Mask Editor', { tag: '@vue-nodes' }, () => { |
6 | 10 | test( |
@@ -302,29 +306,38 @@ test.describe('Mask Editor', { tag: '@vue-nodes' }, () => { |
302 | 306 | ) |
303 | 307 | }) |
304 | 308 |
|
305 | | -test('Will not use stale litegraph previews', async ({ comfyPage }) => { |
306 | | - await comfyPage.menu.topbar.newWorkflowButton.click() |
307 | | - await comfyPage.searchBoxV2.addNode('Preview Image') |
308 | | - |
309 | | - async function simulateExecuted(image: object) { |
310 | | - await comfyPage.page.evaluate((pageImage) => { |
311 | | - const output = { images: [pageImage] } |
312 | | - const detail = { node: '1', output, prompt_id: '', display_node: '1' } |
313 | | - app!.api.dispatchCustomEvent('executed', detail) |
314 | | - app!.canvas.setDirty(true) |
315 | | - }, image) |
316 | | - } |
317 | | - async function getNodeOutput() { |
318 | | - return await comfyPage.page.evaluate( |
319 | | - () => graph!.getNodeById('1')!.images?.[0]?.filename |
320 | | - ) |
321 | | - } |
| 309 | +wstest( |
| 310 | + 'Will not use stale litegraph previews', |
| 311 | + async ({ comfyPage, getWebSocket }) => { |
| 312 | + const executionHelper = new ExecutionHelper(comfyPage, await getWebSocket()) |
| 313 | + await comfyPage.menu.topbar.newWorkflowButton.click() |
| 314 | + await comfyPage.searchBoxV2.addNode('Preview Image') |
322 | 315 |
|
323 | | - await simulateExecuted({ filename: 'test1.png' }) |
324 | | - await expect.poll(getNodeOutput).toBe('test1.png') |
| 316 | + async function getNodeOutput() { |
| 317 | + return await comfyPage.page.evaluate( |
| 318 | + () => graph!.getNodeById('1')!.images?.[0]?.filename |
| 319 | + ) |
| 320 | + } |
325 | 321 |
|
326 | | - await comfyPage.settings.setSetting('Comfy.VueNodes.Enabled', true) |
| 322 | + executionHelper.executed('', '1', { images: [{ filename: 'test1.png' }] }) |
| 323 | + await comfyPage.page.evaluate(() => app!.canvas.setDirty(true)) |
| 324 | + await expect.poll(getNodeOutput).toBe('test1.png') |
327 | 325 |
|
328 | | - await simulateExecuted({ filename: 'example.png', type: 'input' }) |
329 | | - await expect.poll(getNodeOutput).toBe('example.png') |
330 | | -}) |
| 326 | + await comfyPage.settings.setSetting('Comfy.VueNodes.Enabled', true) |
| 327 | + |
| 328 | + const resolvableFile = { filename: 'example.png', type: 'input' } |
| 329 | + executionHelper.executed('', '1', { images: [resolvableFile] }) |
| 330 | + await expect.poll(getNodeOutput).toBe('example.png') |
| 331 | + |
| 332 | + const node = await comfyPage.vueNodes.getFixtureByTitle('Preview Image') |
| 333 | + await node.imagePreview.hover() |
| 334 | + await node.imagePreview |
| 335 | + .getByRole('button', { name: 'Edit or mask image' }) |
| 336 | + .click() |
| 337 | + |
| 338 | + // On previous versions, attempting to open the mask editor here would |
| 339 | + // incorrectly reference the non-existant test1.png |
| 340 | + // This causes the mask editor to throw in setup and not display |
| 341 | + await expect(comfyPage.page.locator('.mask-editor-dialog')).toBeVisible() |
| 342 | + } |
| 343 | +) |
0 commit comments