Skip to content

Commit 2b75120

Browse files
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)
1 parent 5b03d3f commit 2b75120

File tree

5 files changed

+54
-3
lines changed

5 files changed

+54
-3
lines changed

browser_tests/fixtures/ComfyPage.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1651,7 +1651,10 @@ export const comfyPageFixture = base.extend<{
16511651
// Set tutorial completed to true to avoid loading the tutorial workflow.
16521652
'Comfy.TutorialCompleted': true,
16531653
'Comfy.SnapToGrid.GridSize': testComfySnapToGridGridSize,
1654-
'Comfy.VueNodes.AutoScaleLayout': false
1654+
'Comfy.VueNodes.AutoScaleLayout': false,
1655+
// Disable toast warning about version compatibility, as they may or
1656+
// may not appear - depending on upstream ComfyUI dependencies
1657+
'Comfy.VersionCompatibility.DisableWarnings': true
16551658
})
16561659
} catch (e) {
16571660
console.error(e)

src/platform/settings/constants/coreSettings.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1117,5 +1117,12 @@ export const CORE_SETTINGS: SettingParams[] = [
11171117
tooltip: 'Use new Asset API for model browsing',
11181118
defaultValue: isCloud ? true : false,
11191119
experimental: true
1120+
},
1121+
{
1122+
id: 'Comfy.VersionCompatibility.DisableWarnings',
1123+
name: 'Disable version compatibility warnings',
1124+
type: 'hidden',
1125+
defaultValue: false,
1126+
versionAdded: '1.34.1'
11201127
}
11211128
]

src/platform/updates/common/versionCompatibilityStore.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { gt, valid } from 'semver'
44
import { computed } from 'vue'
55

66
import config from '@/config'
7+
import { useSettingStore } from '@/platform/settings/settingStore'
78
import { useSystemStatsStore } from '@/stores/systemStatsStore'
89

910
const DISMISSAL_DURATION_MS = 7 * 24 * 60 * 60 * 1000 // 7 days
@@ -12,6 +13,7 @@ export const useVersionCompatibilityStore = defineStore(
1213
'versionCompatibility',
1314
() => {
1415
const systemStatsStore = useSystemStatsStore()
16+
const settingStore = useSettingStore()
1517

1618
const frontendVersion = computed(() => config.app_version)
1719
const backendVersion = computed(
@@ -87,7 +89,10 @@ export const useVersionCompatibilityStore = defineStore(
8789
})
8890

8991
const shouldShowWarning = computed(() => {
90-
return hasVersionMismatch.value && !isDismissed.value
92+
const warningsDisabled = settingStore.get(
93+
'Comfy.VersionCompatibility.DisableWarnings'
94+
)
95+
return hasVersionMismatch.value && !isDismissed.value && !warningsDisabled
9196
})
9297

9398
const warningMessage = computed(() => {

src/schemas/apiSchema.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,8 @@ const zSettings = z.object({
523523
'main.sub.setting.name': z.any(),
524524
'single.setting': z.any(),
525525
'LiteGraph.Node.DefaultPadding': z.boolean(),
526-
'LiteGraph.Pointer.TrackpadGestures': z.boolean()
526+
'LiteGraph.Pointer.TrackpadGestures': z.boolean(),
527+
'Comfy.VersionCompatibility.DisableWarnings': z.boolean()
527528
})
528529

529530
export type EmbeddingsResponse = z.infer<typeof zEmbeddingsResponse>

tests-ui/tests/store/versionCompatibilityStore.test.ts

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
33
import { ref } from 'vue'
44

55
import { useVersionCompatibilityStore } from '@/platform/updates/common/versionCompatibilityStore'
6+
import { useSettingStore } from '@/platform/settings/settingStore'
67
import { useSystemStatsStore } from '@/stores/systemStatsStore'
78

89
vi.mock('@/config', () => ({
@@ -13,6 +14,13 @@ vi.mock('@/config', () => ({
1314

1415
vi.mock('@/stores/systemStatsStore')
1516

17+
// Mock settingStore
18+
vi.mock('@/platform/settings/settingStore', () => ({
19+
useSettingStore: vi.fn(() => ({
20+
get: vi.fn(() => false) // Default to warnings enabled (false = not disabled)
21+
}))
22+
}))
23+
1624
// Mock useStorage and until from VueUse
1725
const mockDismissalStorage = ref({} as Record<string, number>)
1826
vi.mock('@vueuse/core', () => ({
@@ -23,6 +31,7 @@ vi.mock('@vueuse/core', () => ({
2331
describe('useVersionCompatibilityStore', () => {
2432
let store: ReturnType<typeof useVersionCompatibilityStore>
2533
let mockSystemStatsStore: any
34+
let mockSettingStore: any
2635

2736
beforeEach(() => {
2837
setActivePinia(createPinia())
@@ -36,7 +45,12 @@ describe('useVersionCompatibilityStore', () => {
3645
refetchSystemStats: vi.fn()
3746
}
3847

48+
mockSettingStore = {
49+
get: vi.fn(() => false) // Default to warnings enabled
50+
}
51+
3952
vi.mocked(useSystemStatsStore).mockReturnValue(mockSystemStatsStore)
53+
vi.mocked(useSettingStore).mockReturnValue(mockSettingStore)
4054

4155
store = useVersionCompatibilityStore()
4256
})
@@ -196,6 +210,27 @@ describe('useVersionCompatibilityStore', () => {
196210

197211
expect(store.shouldShowWarning).toBe(false)
198212
})
213+
214+
it('should not show warning when disabled via setting', async () => {
215+
// Enable the disable setting
216+
mockSettingStore.get.mockReturnValue(true)
217+
218+
// Set up version mismatch that would normally show warning
219+
mockSystemStatsStore.systemStats = {
220+
system: {
221+
comfyui_version: '1.25.0',
222+
required_frontend_version: '1.25.0'
223+
}
224+
}
225+
mockSystemStatsStore.isInitialized = true
226+
227+
await store.checkVersionCompatibility()
228+
229+
expect(store.shouldShowWarning).toBe(false)
230+
expect(mockSettingStore.get).toHaveBeenCalledWith(
231+
'Comfy.VersionCompatibility.DisableWarnings'
232+
)
233+
})
199234
})
200235

201236
describe('warning messages', () => {

0 commit comments

Comments
 (0)