mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-20 14:30:41 +00:00
## Summary Simplifies test setup for common settings ## Changes - **What**: - add vue-nodes tag to auto enable nodes 2.0 - remove UseNewMenu Top as this is default ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-11184-test-Simplify-vue-node-menu-test-setup-3416d73d3650815487e0c357d28761fe) by [Unito](https://www.unito.io)
58 lines
2.0 KiB
TypeScript
58 lines
2.0 KiB
TypeScript
import {
|
|
comfyExpect as expect,
|
|
comfyPageFixture as test
|
|
} from '@e2e/fixtures/ComfyPage'
|
|
import type { ComfyPage } from '@e2e/fixtures/ComfyPage'
|
|
|
|
test.describe('Vue Multiline String Widget', { tag: '@vue-nodes' }, () => {
|
|
const getFirstClipNode = (comfyPage: ComfyPage) =>
|
|
comfyPage.vueNodes.getNodeByTitle('CLIP Text Encode (Prompt)').first()
|
|
|
|
const getFirstMultilineStringWidget = (comfyPage: ComfyPage) =>
|
|
getFirstClipNode(comfyPage).getByRole('textbox', { name: 'text' })
|
|
|
|
test('should allow entering text', async ({ comfyPage }) => {
|
|
const textarea = getFirstMultilineStringWidget(comfyPage)
|
|
await textarea.fill('Hello World')
|
|
await expect(textarea).toHaveValue('Hello World')
|
|
await textarea.fill('Hello World 2')
|
|
await expect(textarea).toHaveValue('Hello World 2')
|
|
})
|
|
|
|
test('should support entering multiline content', async ({ comfyPage }) => {
|
|
const textarea = getFirstMultilineStringWidget(comfyPage)
|
|
|
|
const multilineValue = ['Line 1', 'Line 2', 'Line 3'].join('\n')
|
|
|
|
await textarea.fill(multilineValue)
|
|
await expect(textarea).toHaveValue(multilineValue)
|
|
})
|
|
|
|
test('should retain value after focus changes', async ({ comfyPage }) => {
|
|
const textarea = getFirstMultilineStringWidget(comfyPage)
|
|
|
|
await textarea.fill('Keep me around')
|
|
|
|
// Click another node
|
|
const loadCheckpointNode =
|
|
comfyPage.vueNodes.getNodeByTitle('Load Checkpoint')
|
|
await loadCheckpointNode.click()
|
|
await getFirstClipNode(comfyPage).click()
|
|
|
|
await expect(textarea).toHaveValue('Keep me around')
|
|
})
|
|
|
|
test('should use native context menu when focused', async ({ comfyPage }) => {
|
|
const textarea = getFirstMultilineStringWidget(comfyPage)
|
|
const vueContextMenu = comfyPage.page.locator('.p-contextmenu')
|
|
|
|
await textarea.focus()
|
|
await textarea.click({ button: 'right' })
|
|
await expect(vueContextMenu).toBeHidden()
|
|
await textarea.blur()
|
|
|
|
await textarea.click({ button: 'right' })
|
|
await expect(vueContextMenu).toBeVisible()
|
|
})
|
|
})
|