mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-19 22:09:37 +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>
109 lines
3.3 KiB
TypeScript
109 lines
3.3 KiB
TypeScript
import { expect } from '@playwright/test'
|
|
|
|
import { comfyPageFixture as test } from '@e2e/fixtures/ComfyPage'
|
|
import { TestIds } from '@e2e/fixtures/selectors'
|
|
import {
|
|
interceptClipboardWrite,
|
|
getClipboardText
|
|
} from '@e2e/helpers/clipboardSpy'
|
|
import { openErrorsTabViaSeeErrors } from '@e2e/tests/propertiesPanel/ErrorsTabHelper'
|
|
|
|
test.describe('Errors tab - Missing models', { tag: '@ui' }, () => {
|
|
test.beforeEach(async ({ comfyPage }) => {
|
|
await comfyPage.settings.setSetting('Comfy.UseNewMenu', 'Top')
|
|
await comfyPage.settings.setSetting(
|
|
'Comfy.RightSidePanel.ShowErrorsTab',
|
|
true
|
|
)
|
|
await expect
|
|
.poll(async () => {
|
|
return await comfyPage.page.evaluate(async (url: string) => {
|
|
const response = await fetch(`${url}/api/devtools/cleanup_fake_model`)
|
|
return response.ok
|
|
}, comfyPage.url)
|
|
})
|
|
.toBeTruthy()
|
|
})
|
|
|
|
test('Should show missing models group in errors tab', async ({
|
|
comfyPage
|
|
}) => {
|
|
await openErrorsTabViaSeeErrors(comfyPage, 'missing/missing_models')
|
|
|
|
await expect(
|
|
comfyPage.page.getByTestId(TestIds.dialogs.missingModelsGroup)
|
|
).toBeVisible()
|
|
})
|
|
|
|
test('Should display model name with referencing node count', async ({
|
|
comfyPage
|
|
}) => {
|
|
await openErrorsTabViaSeeErrors(comfyPage, 'missing/missing_models')
|
|
|
|
const modelsGroup = comfyPage.page.getByTestId(
|
|
TestIds.dialogs.missingModelsGroup
|
|
)
|
|
await expect(modelsGroup).toContainText(/fake_model\.safetensors\s*\(\d+\)/)
|
|
})
|
|
|
|
test('Should expand model row to show referencing nodes', async ({
|
|
comfyPage
|
|
}) => {
|
|
await openErrorsTabViaSeeErrors(
|
|
comfyPage,
|
|
'missing/missing_models_with_nodes'
|
|
)
|
|
|
|
const locateButton = comfyPage.page.getByTestId(
|
|
TestIds.dialogs.missingModelLocate
|
|
)
|
|
await expect(locateButton.first()).not.toBeVisible()
|
|
|
|
const expandButton = comfyPage.page.getByTestId(
|
|
TestIds.dialogs.missingModelExpand
|
|
)
|
|
await expect(expandButton.first()).toBeVisible()
|
|
await expandButton.first().click()
|
|
|
|
await expect(locateButton.first()).toBeVisible()
|
|
})
|
|
|
|
test('Should copy model name to clipboard', async ({ comfyPage }) => {
|
|
await openErrorsTabViaSeeErrors(comfyPage, 'missing/missing_models')
|
|
await interceptClipboardWrite(comfyPage.page)
|
|
|
|
const copyButton = comfyPage.page.getByTestId(
|
|
TestIds.dialogs.missingModelCopyName
|
|
)
|
|
await expect(copyButton.first()).toBeVisible()
|
|
await copyButton.first().click()
|
|
|
|
const copiedText = await getClipboardText(comfyPage.page)
|
|
expect(copiedText).toContain('fake_model.safetensors')
|
|
})
|
|
|
|
test.describe('OSS-specific', { tag: '@oss' }, () => {
|
|
test('Should show Copy URL button for non-asset models', async ({
|
|
comfyPage
|
|
}) => {
|
|
await openErrorsTabViaSeeErrors(comfyPage, 'missing/missing_models')
|
|
|
|
const copyUrlButton = comfyPage.page.getByTestId(
|
|
TestIds.dialogs.missingModelCopyUrl
|
|
)
|
|
await expect(copyUrlButton.first()).toBeVisible()
|
|
})
|
|
|
|
test('Should show Download button for downloadable models', async ({
|
|
comfyPage
|
|
}) => {
|
|
await openErrorsTabViaSeeErrors(comfyPage, 'missing/missing_models')
|
|
|
|
const downloadButton = comfyPage.page.getByTestId(
|
|
TestIds.dialogs.missingModelDownload
|
|
)
|
|
await expect(downloadButton.first()).toBeVisible()
|
|
})
|
|
})
|
|
})
|