mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-05-05 13:41:59 +00:00
Adds `await expect(locator).toBeVisible()` before `.click()` calls across 104 test and fixture files (431 assertions). Gives immediate, descriptive failures instead of generic actionability timeouts. Skips force clicks, canvas/mouse coordinate clicks, custom click methods, catch chains, and toPass retry blocks. Updates FLAKE_PREVENTION_RULES.md with the new rule.
57 lines
1.7 KiB
TypeScript
57 lines
1.7 KiB
TypeScript
import { expect } from '@playwright/test'
|
|
|
|
import { comfyPageFixture as test } from '../fixtures/ComfyPage'
|
|
|
|
test.describe('Paste Image context menu option', { tag: ['@node'] }, () => {
|
|
test.beforeEach(async ({ comfyPage }) => {
|
|
await comfyPage.settings.setSetting('Comfy.VueNodes.Enabled', true)
|
|
})
|
|
|
|
test('shows Paste Image in LoadImage node context menu', async ({
|
|
comfyPage
|
|
}) => {
|
|
await comfyPage.workflow.loadWorkflow('widgets/load_image_widget')
|
|
|
|
const loadImageNode = (
|
|
await comfyPage.nodeOps.getNodeRefsByType('LoadImage')
|
|
)[0]
|
|
|
|
const nodeEl = comfyPage.page.locator(
|
|
`[data-node-id="${loadImageNode.id}"]`
|
|
)
|
|
await expect(nodeEl).toBeVisible()
|
|
await nodeEl.click({ button: 'right' })
|
|
const menu = comfyPage.page.locator('.p-contextmenu')
|
|
await menu.waitFor({ state: 'visible' })
|
|
const menuLabels = await menu
|
|
.locator('[role="menuitem"] span.flex-1')
|
|
.allInnerTexts()
|
|
|
|
expect(menuLabels).toContain('Paste Image')
|
|
})
|
|
|
|
test('does not show Paste Image on output-only image nodes', async ({
|
|
comfyPage
|
|
}) => {
|
|
await comfyPage.workflow.loadWorkflow('nodes/single_save_image_node')
|
|
|
|
const saveImageNode = (
|
|
await comfyPage.nodeOps.getNodeRefsByType('SaveImage')
|
|
)[0]
|
|
|
|
const nodeEl = comfyPage.page.locator(
|
|
`[data-node-id="${saveImageNode.id}"]`
|
|
)
|
|
await expect(nodeEl).toBeVisible()
|
|
await nodeEl.click({ button: 'right' })
|
|
const menu = comfyPage.page.locator('.p-contextmenu')
|
|
await menu.waitFor({ state: 'visible' })
|
|
const menuLabels = await menu
|
|
.locator('[role="menuitem"] span.flex-1')
|
|
.allInnerTexts()
|
|
|
|
expect(menuLabels).not.toContain('Paste Image')
|
|
expect(menuLabels).not.toContain('Open Image')
|
|
})
|
|
})
|