@@ -130,4 +130,239 @@ test.describe('Release Notifications', () => {
130130 whatsNewSection . locator ( 'text=No recent releases' )
131131 ) . toBeVisible ( )
132132 } )
133+
134+ test ( 'should hide "What\'s New" section when notifications are disabled' , async ( {
135+ comfyPage
136+ } ) => {
137+ // Disable version update notifications
138+ await comfyPage . setSetting ( 'Comfy.Notification.ShowVersionUpdates' , false )
139+
140+ // Mock release API with test data
141+ await comfyPage . page . route ( '**/releases**' , async ( route ) => {
142+ const url = route . request ( ) . url ( )
143+ if (
144+ url . includes ( 'api.comfy.org' ) ||
145+ url . includes ( 'stagingapi.comfy.org' )
146+ ) {
147+ await route . fulfill ( {
148+ status : 200 ,
149+ contentType : 'application/json' ,
150+ body : JSON . stringify ( [
151+ {
152+ id : 1 ,
153+ project : 'comfyui' ,
154+ version : 'v0.3.44' ,
155+ attention : 'high' ,
156+ content : '## New Features\n\n- Added awesome feature' ,
157+ published_at : new Date ( ) . toISOString ( )
158+ }
159+ ] )
160+ } )
161+ } else {
162+ await route . continue ( )
163+ }
164+ } )
165+
166+ await comfyPage . setup ( { mockReleases : false } )
167+
168+ // Open help center
169+ const helpCenterButton = comfyPage . page . locator ( '.comfy-help-center-btn' )
170+ await helpCenterButton . waitFor ( { state : 'visible' } )
171+ await helpCenterButton . click ( )
172+
173+ // Verify help center menu appears
174+ const helpMenu = comfyPage . page . locator ( '.help-center-menu' )
175+ await expect ( helpMenu ) . toBeVisible ( )
176+
177+ // Verify "What's New?" section is hidden
178+ const whatsNewSection = comfyPage . page . locator ( '.whats-new-section' )
179+ await expect ( whatsNewSection ) . not . toBeVisible ( )
180+
181+ // Should not show any popups or toasts
182+ await expect ( comfyPage . page . locator ( '.whats-new-popup' ) ) . not . toBeVisible ( )
183+ await expect (
184+ comfyPage . page . locator ( '.release-notification-toast' )
185+ ) . not . toBeVisible ( )
186+ } )
187+
188+ test ( 'should not make API calls when notifications are disabled' , async ( {
189+ comfyPage
190+ } ) => {
191+ // Disable version update notifications
192+ await comfyPage . setSetting ( 'Comfy.Notification.ShowVersionUpdates' , false )
193+
194+ // Track API calls
195+ let apiCallCount = 0
196+ await comfyPage . page . route ( '**/releases**' , async ( route ) => {
197+ const url = route . request ( ) . url ( )
198+ if (
199+ url . includes ( 'api.comfy.org' ) ||
200+ url . includes ( 'stagingapi.comfy.org' )
201+ ) {
202+ apiCallCount ++
203+ await route . fulfill ( {
204+ status : 200 ,
205+ contentType : 'application/json' ,
206+ body : JSON . stringify ( [ ] )
207+ } )
208+ } else {
209+ await route . continue ( )
210+ }
211+ } )
212+
213+ await comfyPage . setup ( { mockReleases : false } )
214+
215+ // Wait a bit to ensure any potential API calls would have been made
216+ await comfyPage . page . waitForTimeout ( 1000 )
217+
218+ // Verify no API calls were made
219+ expect ( apiCallCount ) . toBe ( 0 )
220+ } )
221+
222+ test ( 'should show "What\'s New" section when notifications are enabled' , async ( {
223+ comfyPage
224+ } ) => {
225+ // Enable version update notifications (default behavior)
226+ await comfyPage . setSetting ( 'Comfy.Notification.ShowVersionUpdates' , true )
227+
228+ // Mock release API with test data
229+ await comfyPage . page . route ( '**/releases**' , async ( route ) => {
230+ const url = route . request ( ) . url ( )
231+ if (
232+ url . includes ( 'api.comfy.org' ) ||
233+ url . includes ( 'stagingapi.comfy.org' )
234+ ) {
235+ await route . fulfill ( {
236+ status : 200 ,
237+ contentType : 'application/json' ,
238+ body : JSON . stringify ( [
239+ {
240+ id : 1 ,
241+ project : 'comfyui' ,
242+ version : 'v0.3.44' ,
243+ attention : 'medium' ,
244+ content : '## New Features\n\n- Added awesome feature' ,
245+ published_at : new Date ( ) . toISOString ( )
246+ }
247+ ] )
248+ } )
249+ } else {
250+ await route . continue ( )
251+ }
252+ } )
253+
254+ await comfyPage . setup ( { mockReleases : false } )
255+
256+ // Open help center
257+ const helpCenterButton = comfyPage . page . locator ( '.comfy-help-center-btn' )
258+ await helpCenterButton . waitFor ( { state : 'visible' } )
259+ await helpCenterButton . click ( )
260+
261+ // Verify help center menu appears
262+ const helpMenu = comfyPage . page . locator ( '.help-center-menu' )
263+ await expect ( helpMenu ) . toBeVisible ( )
264+
265+ // Verify "What's New?" section is visible
266+ const whatsNewSection = comfyPage . page . locator ( '.whats-new-section' )
267+ await expect ( whatsNewSection ) . toBeVisible ( )
268+
269+ // Should show the release
270+ await expect (
271+ whatsNewSection . locator ( 'text=Comfy v0.3.44 Release' )
272+ ) . toBeVisible ( )
273+ } )
274+
275+ test ( 'should toggle "What\'s New" section when setting changes' , async ( {
276+ comfyPage
277+ } ) => {
278+ // Mock release API with test data
279+ await comfyPage . page . route ( '**/releases**' , async ( route ) => {
280+ const url = route . request ( ) . url ( )
281+ if (
282+ url . includes ( 'api.comfy.org' ) ||
283+ url . includes ( 'stagingapi.comfy.org' )
284+ ) {
285+ await route . fulfill ( {
286+ status : 200 ,
287+ contentType : 'application/json' ,
288+ body : JSON . stringify ( [
289+ {
290+ id : 1 ,
291+ project : 'comfyui' ,
292+ version : 'v0.3.44' ,
293+ attention : 'low' ,
294+ content : '## Bug Fixes\n\n- Fixed minor issue' ,
295+ published_at : new Date ( ) . toISOString ( )
296+ }
297+ ] )
298+ } )
299+ } else {
300+ await route . continue ( )
301+ }
302+ } )
303+
304+ // Start with notifications enabled
305+ await comfyPage . setSetting ( 'Comfy.Notification.ShowVersionUpdates' , true )
306+ await comfyPage . setup ( { mockReleases : false } )
307+
308+ // Open help center
309+ const helpCenterButton = comfyPage . page . locator ( '.comfy-help-center-btn' )
310+ await helpCenterButton . waitFor ( { state : 'visible' } )
311+ await helpCenterButton . click ( )
312+
313+ // Verify "What's New?" section is visible
314+ const whatsNewSection = comfyPage . page . locator ( '.whats-new-section' )
315+ await expect ( whatsNewSection ) . toBeVisible ( )
316+
317+ // Close help center
318+ await comfyPage . page . click ( '.help-center-backdrop' )
319+
320+ // Disable notifications
321+ await comfyPage . setSetting ( 'Comfy.Notification.ShowVersionUpdates' , false )
322+
323+ // Reopen help center
324+ await helpCenterButton . click ( )
325+
326+ // Verify "What's New?" section is now hidden
327+ await expect ( whatsNewSection ) . not . toBeVisible ( )
328+ } )
329+
330+ test ( 'should handle edge case with empty releases and disabled notifications' , async ( {
331+ comfyPage
332+ } ) => {
333+ // Disable notifications
334+ await comfyPage . setSetting ( 'Comfy.Notification.ShowVersionUpdates' , false )
335+
336+ // Mock empty releases
337+ await comfyPage . page . route ( '**/releases**' , async ( route ) => {
338+ const url = route . request ( ) . url ( )
339+ if (
340+ url . includes ( 'api.comfy.org' ) ||
341+ url . includes ( 'stagingapi.comfy.org' )
342+ ) {
343+ await route . fulfill ( {
344+ status : 200 ,
345+ contentType : 'application/json' ,
346+ body : JSON . stringify ( [ ] )
347+ } )
348+ } else {
349+ await route . continue ( )
350+ }
351+ } )
352+
353+ await comfyPage . setup ( { mockReleases : false } )
354+
355+ // Open help center
356+ const helpCenterButton = comfyPage . page . locator ( '.comfy-help-center-btn' )
357+ await helpCenterButton . waitFor ( { state : 'visible' } )
358+ await helpCenterButton . click ( )
359+
360+ // Verify help center still works
361+ const helpMenu = comfyPage . page . locator ( '.help-center-menu' )
362+ await expect ( helpMenu ) . toBeVisible ( )
363+
364+ // Section should be hidden regardless of empty releases
365+ const whatsNewSection = comfyPage . page . locator ( '.whats-new-section' )
366+ await expect ( whatsNewSection ) . not . toBeVisible ( )
367+ } )
133368} )
0 commit comments