mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-20 14:30:41 +00:00
Add two E2E tests covering the stale collapsedSize cache bug fixed in
2693ec256: toggling bypass on a collapsed node (which changes body width
via the Bypassed badge) previously left the selection bounding box at
the pre-toggle width.
Switch the existing Vue-mode and legacy-mode selection bounding box
tests from programmatic NodeReference.setCollapsed to the Alt+C
keyboard shortcut. Since the keybinding is mode-agnostic, the same
user-action path now drives both modes and removes the divergence
between DOM-driven Vue tests and programmatic legacy tests.
Add KeyboardHelper.collapse() (Alt+C) next to the existing bypass()
(Ctrl+B) so the shortcut has a discoverable helper. Drop the unused
NodeReference.setCollapsed helper introduced earlier in this PR.
59 lines
1.5 KiB
TypeScript
59 lines
1.5 KiB
TypeScript
import type { Locator, Page } from '@playwright/test'
|
|
|
|
export class KeyboardHelper {
|
|
constructor(
|
|
private readonly page: Page,
|
|
private readonly canvas: Locator
|
|
) {}
|
|
|
|
private async nextFrame(): Promise<void> {
|
|
await this.page.evaluate(() => new Promise<number>(requestAnimationFrame))
|
|
}
|
|
|
|
async ctrlSend(
|
|
keyToPress: string,
|
|
locator: Locator | null = this.canvas
|
|
): Promise<void> {
|
|
const target = locator ?? this.page.keyboard
|
|
await target.press(`Control+${keyToPress}`)
|
|
await this.nextFrame()
|
|
}
|
|
|
|
async altSend(
|
|
keyToPress: string,
|
|
locator: Locator | null = this.canvas
|
|
): Promise<void> {
|
|
const target = locator ?? this.page.keyboard
|
|
await target.press(`Alt+${keyToPress}`)
|
|
await this.nextFrame()
|
|
}
|
|
|
|
async selectAll(locator?: Locator | null): Promise<void> {
|
|
await this.ctrlSend('KeyA', locator)
|
|
}
|
|
|
|
async bypass(locator?: Locator | null): Promise<void> {
|
|
await this.ctrlSend('KeyB', locator)
|
|
}
|
|
|
|
async collapse(locator?: Locator | null): Promise<void> {
|
|
await this.altSend('KeyC', locator)
|
|
}
|
|
|
|
async undo(locator?: Locator | null): Promise<void> {
|
|
await this.ctrlSend('KeyZ', locator)
|
|
}
|
|
|
|
async redo(locator?: Locator | null): Promise<void> {
|
|
await this.ctrlSend('KeyY', locator)
|
|
}
|
|
|
|
async moveUp(locator?: Locator | null): Promise<void> {
|
|
await this.ctrlSend('ArrowUp', locator)
|
|
}
|
|
|
|
async moveDown(locator?: Locator | null): Promise<void> {
|
|
await this.ctrlSend('ArrowDown', locator)
|
|
}
|
|
}
|