mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-19 22:34:15 +00:00
- Remove 27 deprecated/wrapper methods from ComfyPage - Migrate callers to use helper classes directly: - keyboard.selectAll/bypass/undo/redo/moveUp/moveDown - clipboard.copy/paste - settings.setSetting/getSetting - workflow.loadWorkflow/deleteWorkflow/setupWorkflowsDirectory - contextMenu.clickMenuItem/clickLitegraphMenuItem - nodeOps.resizeNode with DefaultGraphPositions - canvasOps.clickEmptySpace with DefaultGraphPositions - Replace deprecated node click methods with direct canvas clicks - Replace position getter properties with DefaultGraphPositions imports Amp-Thread-ID: https://ampcode.com/threads/T-019c15e7-2319-76ec-855e-098ec75ef18a Co-authored-by: Amp <amp@ampcode.com>
59 lines
1.7 KiB
TypeScript
59 lines
1.7 KiB
TypeScript
import { expect } from '@playwright/test'
|
|
|
|
import { comfyPageFixture as test } from '../fixtures/ComfyPage'
|
|
|
|
test.beforeEach(async ({ comfyPage }) => {
|
|
await comfyPage.settings.setSetting('Comfy.UseNewMenu', 'Disabled')
|
|
})
|
|
|
|
test.describe('Keybindings', { tag: '@keyboard' }, () => {
|
|
test('Should not trigger non-modifier keybinding when typing in input fields', async ({
|
|
comfyPage
|
|
}) => {
|
|
await comfyPage.registerKeybinding({ key: 'k' }, () => {
|
|
window['TestCommand'] = true
|
|
})
|
|
|
|
const textBox = comfyPage.widgetTextBox
|
|
await textBox.click()
|
|
await textBox.fill('k')
|
|
await expect(textBox).toHaveValue('k')
|
|
expect(await comfyPage.page.evaluate(() => window['TestCommand'])).toBe(
|
|
undefined
|
|
)
|
|
})
|
|
|
|
test('Should not trigger modifier keybinding when typing in input fields', async ({
|
|
comfyPage
|
|
}) => {
|
|
await comfyPage.registerKeybinding({ key: 'k', ctrl: true }, () => {
|
|
window['TestCommand'] = true
|
|
})
|
|
|
|
const textBox = comfyPage.widgetTextBox
|
|
await textBox.click()
|
|
await textBox.fill('q')
|
|
await textBox.press('Control+k')
|
|
await expect(textBox).toHaveValue('q')
|
|
expect(await comfyPage.page.evaluate(() => window['TestCommand'])).toBe(
|
|
true
|
|
)
|
|
})
|
|
|
|
test('Should not trigger keybinding reserved by text input when typing in input fields', async ({
|
|
comfyPage
|
|
}) => {
|
|
await comfyPage.registerKeybinding({ key: 'Ctrl+v' }, () => {
|
|
window['TestCommand'] = true
|
|
})
|
|
|
|
const textBox = comfyPage.widgetTextBox
|
|
await textBox.click()
|
|
await textBox.press('Control+v')
|
|
await expect(textBox).toBeFocused()
|
|
expect(await comfyPage.page.evaluate(() => window['TestCommand'])).toBe(
|
|
undefined
|
|
)
|
|
})
|
|
})
|