mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-20 14:30:41 +00:00
## Summary
Harden 98 E2E spec files and 8 fixtures/helpers for deterministic CI
runs by replacing race-prone patterns with retry-safe alternatives.
No source code changes -- only `browser_tests/` is touched.
## Changes
- **E2E spec hardening** (98 spec files, 6 fixtures, 2 helpers):
| Fix class | Sites | Examples |
|-----------|-------|---------:|
| `expect(await ...)` -> `expect.poll()` | ~153 | interaction,
defaultKeybindings, workflows, featureFlags |
| `const x = await loc.count(); expect(x)` -> `toHaveCount()` | ~19 |
menu, linkInteraction, assets, bottomPanelShortcuts |
| `nextFrame()` -> `waitForHidden()` after menu clicks | ~22 |
contextMenu, rightClickMenu, subgraphHelper |
| Redundant `nextFrame()` removed | many | defaultKeybindings, minimap,
builderSaveFlow |
| `expect(async () => { ... }).toPass()` retry blocks | 5 | interaction
(graphdialog dismiss guard) |
| `force:true` removed from `BaseDialog.close()` | 1 | BaseDialog
fixture |
| ContextMenu `waitForHidden` simplified (check-then-act race removed) |
1 | ContextMenu fixture |
| Non-deterministic node order -> proximity-based selection | 1 |
interaction (toggle dom widget) |
| Tight poll timeout (250ms) -> >=2000ms | 2 | templates |
- **Helper improvements**: Exposed locator getters on
`ComfyPage.domWidgets`, `ToastHelper.toastErrors`, and
`WorkflowsSidebarTab.activeWorkflowLabel` so callers can use retrying
assertions (`toHaveCount()`, `toHaveText()`) directly.
- **Flake pattern catalog**: Added section 7 table to
`browser_tests/FLAKE_PREVENTION_RULES.md` documenting 8 pattern classes
for reviewers and future authors.
- **Docs**: Fixed bad examples in `browser_tests/README.md` to use
`expect.poll()`.
- **Breaking**: None
- **Dependencies**: None
## Review Focus
- All fixes follow the rules in
`browser_tests/FLAKE_PREVENTION_RULES.md`
- No behavioral changes to tests -- only timing/retry strategy is
updated
- The `ContextMenu.waitForHidden` simplification removes a
swallowed-error anti-pattern; both locators now use direct `waitFor({
state: 'hidden' })`
---------
Co-authored-by: Amp <amp@ampcode.com>
Co-authored-by: github-actions <github-actions@github.com>
84 lines
2.9 KiB
TypeScript
84 lines
2.9 KiB
TypeScript
import {
|
|
comfyExpect as expect,
|
|
comfyPageFixture as test
|
|
} from '@e2e/fixtures/ComfyPage'
|
|
|
|
const PIN_HOTKEY = 'p'
|
|
const PIN_INDICATOR = '[data-testid="node-pin-indicator"]'
|
|
|
|
test.describe('Vue Node Pin', () => {
|
|
test.beforeEach(async ({ comfyPage }) => {
|
|
await comfyPage.settings.setSetting('Comfy.VueNodes.Enabled', true)
|
|
await comfyPage.vueNodes.waitForNodes()
|
|
})
|
|
|
|
test('should allow toggling pin on a selected node with hotkey', async ({
|
|
comfyPage
|
|
}) => {
|
|
await comfyPage.page.getByText('Load Checkpoint').click()
|
|
await comfyPage.page.keyboard.press(PIN_HOTKEY)
|
|
|
|
const checkpointNode = comfyPage.vueNodes.getNodeByTitle('Load Checkpoint')
|
|
const pinIndicator = checkpointNode.locator(PIN_INDICATOR)
|
|
|
|
await expect(pinIndicator).toBeVisible()
|
|
|
|
await comfyPage.page.keyboard.press(PIN_HOTKEY)
|
|
await expect(pinIndicator).not.toBeVisible()
|
|
})
|
|
|
|
test('should allow toggling pin on multiple selected nodes with hotkey', async ({
|
|
comfyPage
|
|
}) => {
|
|
await comfyPage.page.getByText('Load Checkpoint').click()
|
|
await comfyPage.page.getByText('KSampler').click({ modifiers: ['Control'] })
|
|
|
|
const checkpointNode = comfyPage.vueNodes.getNodeByTitle('Load Checkpoint')
|
|
const ksamplerNode = comfyPage.vueNodes.getNodeByTitle('KSampler')
|
|
|
|
await comfyPage.page.keyboard.press(PIN_HOTKEY)
|
|
const pinIndicator1 = checkpointNode.locator(PIN_INDICATOR)
|
|
await expect(pinIndicator1).toBeVisible()
|
|
const pinIndicator2 = ksamplerNode.locator(PIN_INDICATOR)
|
|
await expect(pinIndicator2).toBeVisible()
|
|
|
|
await comfyPage.page.keyboard.press(PIN_HOTKEY)
|
|
await expect(pinIndicator1).not.toBeVisible()
|
|
await expect(pinIndicator2).not.toBeVisible()
|
|
})
|
|
|
|
test('should not allow dragging pinned nodes', async ({ comfyPage }) => {
|
|
const checkpointNodeHeader = comfyPage.page.getByText('Load Checkpoint')
|
|
await checkpointNodeHeader.click()
|
|
await comfyPage.page.keyboard.press(PIN_HOTKEY)
|
|
|
|
// Try to drag the node
|
|
const headerPos = await checkpointNodeHeader.boundingBox()
|
|
if (!headerPos) throw new Error('Failed to get header position')
|
|
await comfyPage.canvasOps.dragAndDrop(
|
|
{ x: headerPos.x, y: headerPos.y },
|
|
{ x: headerPos.x + 256, y: headerPos.y + 256 }
|
|
)
|
|
|
|
// Verify the node is not dragged (same position before and after click-and-drag)
|
|
await expect
|
|
.poll(async () => await checkpointNodeHeader.boundingBox())
|
|
.toEqual(headerPos)
|
|
|
|
// Unpin the node with the hotkey
|
|
await checkpointNodeHeader.click()
|
|
await comfyPage.page.keyboard.press(PIN_HOTKEY)
|
|
|
|
// Try to drag the node again
|
|
await comfyPage.canvasOps.dragAndDrop(
|
|
{ x: headerPos.x, y: headerPos.y },
|
|
{ x: headerPos.x + 256, y: headerPos.y + 256 }
|
|
)
|
|
|
|
// Verify the node is dragged
|
|
await expect
|
|
.poll(async () => await checkpointNodeHeader.boundingBox())
|
|
.not.toEqual(headerPos)
|
|
})
|
|
})
|