test: add setting to ignore version compatibility toast warnings in e2e tests (#7004)

There's a warning toast shown if the frontend is considered out-of-date
(relative to the version in the requirements.txt of
comfyanonymous/ComfyUI). As a result, e2e tests run on older release
branches (e.g., when backporting or hotfixing) can sometimes trigger the
warning which obviously causes visual regression tests to fail. This PR
adds a hidden setting to disable the warning and sets it to `true` in
the e2e test fixtures.

┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-7004-test-add-setting-to-ignore-version-compatibility-toast-warnings-in-e2e-tests-2b86d73d3650812d9e07f54a0c86b996)
by [Unito](https://www.unito.io)
This commit is contained in:
Christian Byrne
2025-11-29 18:56:19 -08:00
committed by GitHub
parent 5b03d3fcbc
commit 2b751200be
5 changed files with 54 additions and 3 deletions

View File

@@ -3,6 +3,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import { ref } from 'vue'
import { useVersionCompatibilityStore } from '@/platform/updates/common/versionCompatibilityStore'
import { useSettingStore } from '@/platform/settings/settingStore'
import { useSystemStatsStore } from '@/stores/systemStatsStore'
vi.mock('@/config', () => ({
@@ -13,6 +14,13 @@ vi.mock('@/config', () => ({
vi.mock('@/stores/systemStatsStore')
// Mock settingStore
vi.mock('@/platform/settings/settingStore', () => ({
useSettingStore: vi.fn(() => ({
get: vi.fn(() => false) // Default to warnings enabled (false = not disabled)
}))
}))
// Mock useStorage and until from VueUse
const mockDismissalStorage = ref({} as Record<string, number>)
vi.mock('@vueuse/core', () => ({
@@ -23,6 +31,7 @@ vi.mock('@vueuse/core', () => ({
describe('useVersionCompatibilityStore', () => {
let store: ReturnType<typeof useVersionCompatibilityStore>
let mockSystemStatsStore: any
let mockSettingStore: any
beforeEach(() => {
setActivePinia(createPinia())
@@ -36,7 +45,12 @@ describe('useVersionCompatibilityStore', () => {
refetchSystemStats: vi.fn()
}
mockSettingStore = {
get: vi.fn(() => false) // Default to warnings enabled
}
vi.mocked(useSystemStatsStore).mockReturnValue(mockSystemStatsStore)
vi.mocked(useSettingStore).mockReturnValue(mockSettingStore)
store = useVersionCompatibilityStore()
})
@@ -196,6 +210,27 @@ describe('useVersionCompatibilityStore', () => {
expect(store.shouldShowWarning).toBe(false)
})
it('should not show warning when disabled via setting', async () => {
// Enable the disable setting
mockSettingStore.get.mockReturnValue(true)
// Set up version mismatch that would normally show warning
mockSystemStatsStore.systemStats = {
system: {
comfyui_version: '1.25.0',
required_frontend_version: '1.25.0'
}
}
mockSystemStatsStore.isInitialized = true
await store.checkVersionCompatibility()
expect(store.shouldShowWarning).toBe(false)
expect(mockSettingStore.get).toHaveBeenCalledWith(
'Comfy.VersionCompatibility.DisableWarnings'
)
})
})
describe('warning messages', () => {