Skip to content

Commit 5cc1a8d

Browse files
[test] Add release notification browser tests (#4311)
Co-authored-by: Claude <[email protected]>
1 parent 959ab3b commit 5cc1a8d

File tree

2 files changed

+133
-1
lines changed

2 files changed

+133
-1
lines changed

browser_tests/fixtures/ComfyPage.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,6 @@ export class ComfyPage {
285285
url.includes('api.comfy.org') ||
286286
url.includes('stagingapi.comfy.org')
287287
) {
288-
console.log('Mocking releases API')
289288
await route.fulfill({
290289
status: 200,
291290
contentType: 'application/json',
Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
import { expect } from '@playwright/test'
2+
3+
import { comfyPageFixture as test } from '../fixtures/ComfyPage'
4+
5+
test.describe('Release Notifications', () => {
6+
test.beforeEach(async ({ comfyPage }) => {
7+
await comfyPage.setSetting('Comfy.UseNewMenu', 'Top')
8+
})
9+
10+
test('should show help center with release information', async ({
11+
comfyPage
12+
}) => {
13+
// Mock release API with test data instead of empty array
14+
await comfyPage.page.route('**/releases**', async (route) => {
15+
const url = route.request().url()
16+
if (
17+
url.includes('api.comfy.org') ||
18+
url.includes('stagingapi.comfy.org')
19+
) {
20+
await route.fulfill({
21+
status: 200,
22+
contentType: 'application/json',
23+
body: JSON.stringify([
24+
{
25+
id: 1,
26+
project: 'comfyui',
27+
version: 'v0.3.44',
28+
attention: 'medium',
29+
content:
30+
'## New Features\n\n- Added awesome feature\n- Fixed important bug',
31+
published_at: new Date().toISOString()
32+
}
33+
])
34+
})
35+
} else {
36+
await route.continue()
37+
}
38+
})
39+
40+
// Setup with release mocking disabled for this test
41+
await comfyPage.setup({ mockReleases: false })
42+
43+
// Open help center
44+
const helpCenterButton = comfyPage.page.locator('.comfy-help-center-btn')
45+
await helpCenterButton.waitFor({ state: 'visible' })
46+
await helpCenterButton.click()
47+
48+
// Verify help center menu appears
49+
const helpMenu = comfyPage.page.locator('.help-center-menu')
50+
await expect(helpMenu).toBeVisible()
51+
52+
// Verify "What's New?" section shows the release
53+
const whatsNewSection = comfyPage.page.locator('.whats-new-section')
54+
await expect(whatsNewSection).toBeVisible()
55+
56+
// Should show the release version
57+
await expect(
58+
whatsNewSection.locator('text=Comfy v0.3.44 Release')
59+
).toBeVisible()
60+
61+
// Close help center by dismissable mask
62+
await comfyPage.page.click('.help-center-backdrop')
63+
await expect(helpMenu).not.toBeVisible()
64+
})
65+
66+
test('should not show release notifications when mocked (default behavior)', async ({
67+
comfyPage
68+
}) => {
69+
// Use default setup (mockReleases: true)
70+
await comfyPage.setup()
71+
72+
// Open help center
73+
const helpCenterButton = comfyPage.page.locator('.comfy-help-center-btn')
74+
await helpCenterButton.waitFor({ state: 'visible' })
75+
await helpCenterButton.click()
76+
77+
// Verify help center menu appears
78+
const helpMenu = comfyPage.page.locator('.help-center-menu')
79+
await expect(helpMenu).toBeVisible()
80+
81+
// Verify "What's New?" section shows no releases
82+
const whatsNewSection = comfyPage.page.locator('.whats-new-section')
83+
await expect(whatsNewSection).toBeVisible()
84+
85+
// Should show "No recent releases" message
86+
await expect(
87+
whatsNewSection.locator('text=No recent releases')
88+
).toBeVisible()
89+
90+
// Should not show any popups or toasts
91+
await expect(comfyPage.page.locator('.whats-new-popup')).not.toBeVisible()
92+
await expect(
93+
comfyPage.page.locator('.release-notification-toast')
94+
).not.toBeVisible()
95+
})
96+
97+
test('should handle release API errors gracefully', async ({ comfyPage }) => {
98+
// Mock API to return an error
99+
await comfyPage.page.route('**/releases**', async (route) => {
100+
const url = route.request().url()
101+
if (
102+
url.includes('api.comfy.org') ||
103+
url.includes('stagingapi.comfy.org')
104+
) {
105+
await route.fulfill({
106+
status: 500,
107+
contentType: 'application/json',
108+
body: JSON.stringify({ error: 'Server error' })
109+
})
110+
} else {
111+
await route.continue()
112+
}
113+
})
114+
115+
// Setup with release mocking disabled
116+
await comfyPage.setup({ mockReleases: false })
117+
118+
// Open help center
119+
const helpCenterButton = comfyPage.page.locator('.comfy-help-center-btn')
120+
await helpCenterButton.waitFor({ state: 'visible' })
121+
await helpCenterButton.click()
122+
123+
// Verify help center still works despite API error
124+
const helpMenu = comfyPage.page.locator('.help-center-menu')
125+
await expect(helpMenu).toBeVisible()
126+
127+
// Should show no releases due to error
128+
const whatsNewSection = comfyPage.page.locator('.whats-new-section')
129+
await expect(
130+
whatsNewSection.locator('text=No recent releases')
131+
).toBeVisible()
132+
})
133+
})

0 commit comments

Comments
 (0)