Comfy-Org / Comfy-Org/ComfyUI_frontend

fix(test): tighten /Promote Widget/ regex in subgraphPromotion.spec.ts to avoid false match on 'Un-Promote Widget'

Open
#9,898 0 comments 0 reactions 1 assignee Claimed by @christian-byrne View on GitHub
area:subgraph area:testing developer experience
Dominant language
TypeScript
Stars
2k
Forks
699
Avg merge
1d 7h
Merged PRs (30d)
490

Description

## Problem

In `browser_tests/tests/subgraphPromotion.spec.ts`, the locator filter uses the regex `/Promote Widget/` to find the context-menu entry:

```ts
const promoteEntry = comfyPage.page
.locator('.litemenu-entry, .p-contextmenu .p-menuitem-text')
.filter({ hasText: /Promote Widget/ })

await expect(promoteEntry.first()).toBeVisible({ timeout: 5000 })
```

Because `/Promote Widget/` is a substring match, it also matches the **Un-Promote Widget** menu item. This means the assertion `toBeVisible` can pass even when the widget is already promoted and the menu is showing the "Un-Promote Widget" option — i.e. the test can report success in the wrong menu state.

## Expected behaviour

The regex (or text filter) should only match the literal **"Promote Widget"** entry and must **not** match **"Un-Promote Widget"**.

## Suggested fix

Use a word-boundary or anchored regex that excludes the "Un-" prefix, for example:

```ts
.filter({ hasText: /(?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.