mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-20 06:20:11 +00:00
## Summary
Enable the previously disabled `playwright/no-force-option` lint rule at
error level and resolve all 29 violations across 10 files.
## Changes
### Lint rule
- `.oxlintrc.json`: `playwright/no-force-option` changed from `off` to
`error`
### Shared utility
- `CanvasHelper.ts`: Add `mouseClickAt()` and `mouseDblclickAt()`
methods that convert canvas-element-relative positions to absolute page
coordinates and use `page.mouse` APIs, avoiding Playwright's locator
actionability checks that fail when Vue DOM overlays sit above the
`<canvas>` element
### Force removal (20 violations)
- `selectionToolboxActions.spec.ts`: Remove `force: true` from 8 toolbox
button clicks (the `pointer-events: none` splitter overlay does not
intercept `elementFromPoint()`)
- `selectionToolboxSubmenus.spec.ts`: Remove `force: true` from 2
popover menu item clicks
- `BuilderSelectHelper.ts`: Remove `force: true` from 2 widget/node
clicks (builder mode does not disable pointer events)
- `linkInteraction.spec.ts`: Remove `force: true` from 3 slot `dragTo()`
calls (`::after` pseudo-elements do not intercept `elementFromPoint()`)
- `SidebarTab.ts`: Remove `force: true` from toast dismissal (`.catch()`
already handles failures)
- `nodeHelp.spec.ts`: Remove `force: true` from info button click
(preceding `toBeVisible()` assertion is sufficient)
### Rewrites (3 violations)
- `integerWidget.spec.ts`: Replace force-clicking disabled buttons with
`toBeDisabled()` assertions
- `Topbar.ts`: Replace force-click with `waitFor({ state: 'visible' })`
after hover
### Canvas coordinate clicks (9 violations)
- `litegraphUtils.ts`: Convert `NodeReference.click()` and
`navigateIntoSubgraph()` to use
`canvasOps.mouseClickAt()`/`mouseDblclickAt()`
- `subgraphPromotion.spec.ts`: Convert 3 right-click canvas calls to
`canvasOps.mouseClickAt()`
- `selectionToolboxSubmenus.spec.ts`: Convert 1 canvas dismiss-click to
`canvasOps.mouseClickAt()`
## Rationale
The original `force: true` usages were added defensively based on
incorrect assumptions about the `z-999 pointer-events: none` splitter
overlay intercepting Playwright's actionability checks. In reality,
`elementFromPoint()` skips elements with `pointer-events: none`, so the
overlay is transparent to Playwright's hit-test.
For canvas coordinate clicks, `force: true` on a locator does not tunnel
through DOM overlays — it only skips Playwright's preflight checks.
`page.mouse.click()` is the correct API for coordinate-based canvas
interactions.
┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-11164-fix-enable-playwright-no-force-option-lint-rule-33f6d73d365081e78601c6114121d272)
by [Unito](https://www.unito.io)
---------
Co-authored-by: Amp <amp@ampcode.com>
48 lines
1.7 KiB
TypeScript
48 lines
1.7 KiB
TypeScript
import {
|
|
comfyExpect as expect,
|
|
comfyPageFixture as test
|
|
} from '@e2e/fixtures/ComfyPage'
|
|
|
|
test.describe('Vue Integer Widget', () => {
|
|
test.beforeEach(async ({ comfyPage }) => {
|
|
await comfyPage.settings.setSetting('Comfy.VueNodes.Enabled', true)
|
|
await comfyPage.setup()
|
|
})
|
|
|
|
test('should be disabled and not allow changing value when link connected to slot', async ({
|
|
comfyPage
|
|
}) => {
|
|
await comfyPage.workflow.loadWorkflow('vueNodes/linked-int-widget')
|
|
await comfyPage.vueNodes.waitForNodes()
|
|
|
|
const seedWidget = comfyPage.vueNodes
|
|
.getWidgetByName('KSampler', 'seed')
|
|
.first()
|
|
const controls = comfyPage.vueNodes.getInputNumberControls(seedWidget)
|
|
const initialValue = Number(await controls.input.inputValue())
|
|
|
|
// Verify widget is disabled when linked
|
|
await expect(controls.incrementButton).toBeDisabled()
|
|
await expect(controls.decrementButton).toBeDisabled()
|
|
await expect(controls.input).toHaveValue(initialValue.toString())
|
|
|
|
await expect(seedWidget).toBeVisible()
|
|
|
|
// Delete the node that is linked to the slot (freeing up the widget)
|
|
// Click on the header to select the node (clicking center may land on
|
|
// the widget area where pointerdown.stop prevents node selection)
|
|
await comfyPage.vueNodes
|
|
.getNodeByTitle('Int')
|
|
.locator('.lg-node-header')
|
|
.click()
|
|
await comfyPage.vueNodes.deleteSelected()
|
|
|
|
// Test widget works when unlinked
|
|
await controls.incrementButton.click()
|
|
await expect(controls.input).toHaveValue((initialValue + 1).toString())
|
|
|
|
await controls.decrementButton.click()
|
|
await expect(controls.input).toHaveValue(initialValue.toString())
|
|
})
|
|
})
|