test(settings-dialog): mock system_stats to verify version rendering

Address PR review: use page.route to mock the /system_stats response
with a known version string and assert it renders in the About panel,
making this a proper E2E test of the server→UI data flow.
This commit is contained in:
dante01yoon
2026-04-08 20:34:26 +09:00
parent 0d2cbb2ae3
commit 4a1e14e55b

View File

@@ -1,16 +1,33 @@
import { expect } from '@playwright/test'
import { comfyPageFixture as test } from '../../fixtures/ComfyPage'
import { mockSystemStats } from '../../fixtures/data/systemStats'
const MOCK_COMFYUI_VERSION = '9.99.0-e2e-test'
test.describe('Settings dialog', { tag: '@ui' }, () => {
test('About panel shows version badges', async ({ comfyPage }) => {
test('About panel renders mocked version from server', async ({
comfyPage
}) => {
const stats = {
...mockSystemStats,
system: {
...mockSystemStats.system,
comfyui_version: MOCK_COMFYUI_VERSION
}
}
await comfyPage.page.route('**/system_stats**', async (route) => {
await route.fulfill({ json: stats })
})
await comfyPage.setup()
const dialog = comfyPage.settingDialog
await dialog.open()
await dialog.goToAboutPanel()
const aboutPanel = comfyPage.page.getByTestId('about-panel')
await expect(aboutPanel).toBeVisible()
await expect(aboutPanel.locator('.about-badge').first()).toBeVisible()
await expect(aboutPanel).toContainText(MOCK_COMFYUI_VERSION)
await expect(aboutPanel).toContainText('ComfyUI_frontend')
})