From 14255b35123b90f450b7c24c838c6ce5233dd491 Mon Sep 17 00:00:00 2001 From: snomiao Date: Tue, 30 Sep 2025 05:59:23 +0000 Subject: [PATCH] [fix] Revert test changes - tests should use event.key format --- browser_tests/tests/keybindings.spec.ts | 8 ++------ .../services/keybindingService.escape.test.ts | 14 +++++++------- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/browser_tests/tests/keybindings.spec.ts b/browser_tests/tests/keybindings.spec.ts index 8677f5a334..ced2936378 100644 --- a/browser_tests/tests/keybindings.spec.ts +++ b/browser_tests/tests/keybindings.spec.ts @@ -2,15 +2,11 @@ import { expect } from '@playwright/test' import { comfyPageFixture as test } from '../fixtures/ComfyPage' -test.beforeEach(async ({ comfyPage }) => { - await comfyPage.setSetting('Comfy.UseNewMenu', 'Disabled') -}) - test.describe('Keybindings', () => { test('Should not trigger non-modifier keybinding when typing in input fields', async ({ comfyPage }) => { - await comfyPage.registerKeybinding({ key: 'KeyK' }, () => { + await comfyPage.registerKeybinding({ key: 'k' }, () => { window['TestCommand'] = true }) @@ -26,7 +22,7 @@ test.describe('Keybindings', () => { test('Should not trigger modifier keybinding when typing in input fields', async ({ comfyPage }) => { - await comfyPage.registerKeybinding({ key: 'KeyK', ctrl: true }, () => { + await comfyPage.registerKeybinding({ key: 'k', ctrl: true }, () => { window['TestCommand'] = true }) diff --git a/tests-ui/tests/services/keybindingService.escape.test.ts b/tests-ui/tests/services/keybindingService.escape.test.ts index e49eeaa9ab..d777617c68 100644 --- a/tests-ui/tests/services/keybindingService.escape.test.ts +++ b/tests-ui/tests/services/keybindingService.escape.test.ts @@ -12,7 +12,7 @@ import { } from '@/stores/keybindingStore' // Mock stores -vi.mock('@/platform/settings/settingStore', () => ({ +vi.mock('@/stores/settingStore', () => ({ useSettingStore: vi.fn(() => ({ get: vi.fn(() => []) })) @@ -66,7 +66,7 @@ describe('keybindingService - Escape key handling', () => { it('should execute ExitSubgraph command when Escape is pressed', async () => { const event = new KeyboardEvent('keydown', { - code: 'Escape', + key: 'Escape', bubbles: true, cancelable: true }) @@ -83,7 +83,7 @@ describe('keybindingService - Escape key handling', () => { it('should not execute command when Escape is pressed with modifiers', async () => { const event = new KeyboardEvent('keydown', { - code: 'Escape', + key: 'Escape', ctrlKey: true, bubbles: true, cancelable: true @@ -100,7 +100,7 @@ describe('keybindingService - Escape key handling', () => { it('should not execute command when typing in input field', async () => { const inputElement = document.createElement('input') const event = new KeyboardEvent('keydown', { - code: 'Escape', + key: 'Escape', bubbles: true, cancelable: true }) @@ -130,7 +130,7 @@ describe('keybindingService - Escape key handling', () => { document.body.appendChild(dialog) const event = new KeyboardEvent('keydown', { - code: 'Escape', + key: 'Escape', bubbles: true, cancelable: true }) @@ -158,7 +158,7 @@ describe('keybindingService - Escape key handling', () => { ) const event = new KeyboardEvent('keydown', { - code: 'Escape', + key: 'Escape', bubbles: true, cancelable: true }) @@ -185,7 +185,7 @@ describe('keybindingService - Escape key handling', () => { keybindingService = useKeybindingService() const event = new KeyboardEvent('keydown', { - code: 'Escape', + key: 'Escape', bubbles: true, cancelable: true })