Repository navigation
test(extensions): browser coverage for disabled-extension shortcuts and agent marking #22641
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
christian-byrne
merged 7 commits into
main
from
test/disabled-extension-shortcut-browser
Nov 4, 2026
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
072212e
test(extensions): a disabled extension's shortcut does nothing in the…
christian-byrne c29da06
test(extensions): screenshot the agent-created filter in the Extensio…
christian-byrne fe4e099
[automated] Update screenshot expectations
invalid-email-address 0d561e8
test(extensions): load the shortcut fixture as a real pack script and…
christian-byrne ca304bd
test(extensions): register test extensions through comfyPage.extensions
christian-byrne 71b5b57
test(extensions): expose ExtensionHelper as its own Playwright fixture
christian-byrne faf8752
fix(browser_tests): compose extensionTest via mergeTests
christian-byrne File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| export const DISABLED_SHORTCUT_EXTENSION = 'Test.DisabledShortcutPack' | ||
| export const ENABLED_SHORTCUT_EXTENSION = 'Test.EnabledShortcutPack' | ||
| export const SHORTCUT_PACK_SCRIPT = '/extensions/shortcut-pack/main.js' | ||
|
|
||
| /** Pack script registering two extensions with Alt+J / Alt+K; a run stamps `body[data-ran-shortcut]`. */ | ||
| export const shortcutPackSource = ` | ||
| import { app } from '../../scripts/app.js' | ||
|
|
||
| for (const [name, key] of [ | ||
| ['${DISABLED_SHORTCUT_EXTENSION}', 'j'], | ||
| ['${ENABLED_SHORTCUT_EXTENSION}', 'k'] | ||
| ]) { | ||
| app.registerExtension({ | ||
| name, | ||
| commands: [ | ||
| { | ||
| id: name + '.Run', | ||
| label: name + ' run', | ||
| function: () => { | ||
| document.body.dataset.ranShortcut = name | ||
| } | ||
| } | ||
| ], | ||
| keybindings: [{ combo: { key, alt: true }, commandId: name + '.Run' }] | ||
| }) | ||
| } | ||
| ` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| import { mergeTests } from '@playwright/test' | ||
| import { networkIsolationFixture as base } from '@e2e/fixtures/networkIsolationFixture' | ||
|
|
||
| import { comfyPageFixture } from '@e2e/fixtures/ComfyPage' | ||
| import { ExtensionHelper } from '@e2e/fixtures/helpers/ExtensionHelper' | ||
|
|
||
| const extensionHelperFixture = base.extend<{ | ||
| extensions: ExtensionHelper | ||
| }>({ | ||
| extensions: async ({ page }, use) => { | ||
| await use(new ExtensionHelper(page)) | ||
| } | ||
| }) | ||
|
|
||
| export const extensionTest = mergeTests( | ||
| comfyPageFixture, | ||
| extensionHelperFixture | ||
| ) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| import type { Page } from '@playwright/test' | ||
|
|
||
| import type { ComfyExtension } from '@/types/comfy' | ||
|
|
||
| /** A test extension with no hooks: only data that survives `page.evaluate`. */ | ||
| export type DataOnlyExtension = Pick<ComfyExtension, 'name' | 'provenance'> | ||
|
|
||
| export class ExtensionHelper { | ||
| constructor(private readonly page: Page) {} | ||
|
|
||
| /** Registers each extension through the app, in order. */ | ||
| async register(...extensions: DataOnlyExtension[]): Promise<void> { | ||
| await this.page.evaluate((extensions) => { | ||
| for (const extension of extensions) | ||
| window.app!.registerExtension(extension) | ||
| }, extensions) | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+24.3 KB
...ensionProvenance.spec.ts-snapshots/agent-extensions-filtered-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
68 changes: 68 additions & 0 deletions
68
browser_tests/tests/settings/disabledExtensionShortcut.spec.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| import type { GetExtensionsResponse } from '@comfyorg/ingest-types' | ||
|
|
||
| import { | ||
| comfyExpect as expect, | ||
| comfyPageFixture as test | ||
| } from '@e2e/fixtures/ComfyPage' | ||
| import { | ||
| DISABLED_SHORTCUT_EXTENSION, | ||
| ENABLED_SHORTCUT_EXTENSION, | ||
| SHORTCUT_PACK_SCRIPT, | ||
| shortcutPackSource | ||
| } from '@e2e/fixtures/data/shortcutPackFixture' | ||
|
|
||
| test.use({ | ||
| initialSettings: { 'Comfy.Extension.Disabled': [DISABLED_SHORTCUT_EXTENSION] } | ||
| }) | ||
|
|
||
| test.beforeEach(async ({ page }) => { | ||
| await page.route('**/extensions', (route) => | ||
| route.fulfill({ | ||
| json: [SHORTCUT_PACK_SCRIPT] satisfies GetExtensionsResponse | ||
| }) | ||
| ) | ||
| await page.route(`**${SHORTCUT_PACK_SCRIPT}*`, (route) => | ||
| route.fulfill({ contentType: 'text/javascript', body: shortcutPackSource }) | ||
| ) | ||
| }) | ||
|
|
||
| test.describe( | ||
| 'Disabled third-party extension shortcuts', | ||
| { tag: ['@settings', '@keyboard'] }, | ||
| () => { | ||
| test("a disabled extension's shortcut does nothing and is not listed", async ({ | ||
| comfyPage, | ||
| page | ||
| }) => { | ||
| const body = page.locator('body') | ||
|
|
||
| await test.step('Alt+J (disabled extension) does nothing', async () => { | ||
| await comfyPage.canvas.click({ position: { x: 400, y: 400 } }) | ||
| await comfyPage.canvas.press('Alt+KeyJ') | ||
| await comfyPage.nextFrame() | ||
| await expect(body).not.toHaveAttribute('data-ran-shortcut') | ||
| }) | ||
|
|
||
| await test.step('Alt+K (enabled extension) still runs', async () => { | ||
| await comfyPage.canvas.press('Alt+KeyK') | ||
| await expect(body).toHaveAttribute( | ||
| 'data-ran-shortcut', | ||
| ENABLED_SHORTCUT_EXTENSION | ||
| ) | ||
| }) | ||
|
|
||
| await test.step('Only the enabled shortcut is in Keybindings', async () => { | ||
| const { keybindingPanel } = comfyPage.settingDialog | ||
| await comfyPage.settingDialog.open() | ||
| await comfyPage.settingDialog.category('Keybinding').click() | ||
| await keybindingPanel.search('ShortcutPack') | ||
| await expect( | ||
| keybindingPanel.commandRow(`${ENABLED_SHORTCUT_EXTENSION}.Run`) | ||
| ).toBeVisible() | ||
| await expect( | ||
| keybindingPanel.commandRow(`${DISABLED_SHORTCUT_EXTENSION}.Run`) | ||
| ).toHaveCount(0) | ||
| }) | ||
| }) | ||
| } | ||
| ) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.