Skip to content

Commit 2e51122

Browse files
huchenleichristian-byrnegithub-actions
authored
Add browser tests for litegraph changes (#580) (#585) (#587)
* Add browser tests for litegraph changes (#580) (#585) * Zoom speed tests * Merge * Prompt dialog test * Update test expectations [skip ci] --------- Co-authored-by: bymyself <[email protected]> Co-authored-by: github-actions <[email protected]>
1 parent 8f8eac0 commit 2e51122

9 files changed

+67
-1
lines changed

browser_tests/ComfyPage.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,12 @@ export class ComfyPage {
185185
)
186186
}
187187

188+
async getSetting(settingId: string) {
189+
return await this.page.evaluate(async (id) => {
190+
return await window['app'].ui.settings.getSettingValue(id)
191+
}, settingId)
192+
}
193+
188194
async reload() {
189195
await this.page.reload({ timeout: 15000 })
190196
await this.setup()
@@ -201,7 +207,7 @@ export class ComfyPage {
201207
}
202208

203209
async delay(ms: number) {
204-
return new Promise(resolve => setTimeout(resolve, ms));
210+
return new Promise((resolve) => setTimeout(resolve, ms))
205211
}
206212

207213
async loadWorkflow(workflowName: string) {

browser_tests/interaction.spec.ts

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,23 @@ test.describe('Node Interaction', () => {
113113
'text-encode-toggled-back-open.png'
114114
)
115115
})
116+
117+
test('Can close prompt dialog with canvas click', async ({ comfyPage }) => {
118+
await comfyPage.canvas.click({
119+
position: {
120+
x: 724,
121+
y: 645
122+
}
123+
})
124+
await expect(comfyPage.canvas).toHaveScreenshot('prompt-dialog-opened.png')
125+
await comfyPage.canvas.click({
126+
position: {
127+
x: 10,
128+
y: 10
129+
}
130+
})
131+
await expect(comfyPage.canvas).toHaveScreenshot('prompt-dialog-closed.png')
132+
})
116133
})
117134

118135
test.describe('Canvas Interaction', () => {
@@ -147,6 +164,36 @@ test.describe('Canvas Interaction', () => {
147164
await comfyPage.page.keyboard.up('Shift')
148165
})
149166

167+
test('Can zoom in/out after decreasing canvas zoom speed setting', async ({
168+
comfyPage
169+
}) => {
170+
await comfyPage.setSetting('Comfy.Graph.ZoomSpeed', 1.05)
171+
await comfyPage.zoom(-100, 4)
172+
await expect(comfyPage.canvas).toHaveScreenshot(
173+
'zoomed-in-low-zoom-speed.png'
174+
)
175+
await comfyPage.zoom(100, 8)
176+
await expect(comfyPage.canvas).toHaveScreenshot(
177+
'zoomed-out-low-zoom-speed.png'
178+
)
179+
await comfyPage.setSetting('Comfy.Graph.ZoomSpeed', 1.1)
180+
})
181+
182+
test('Can zoom in/out after increasing canvas zoom speed', async ({
183+
comfyPage
184+
}) => {
185+
await comfyPage.setSetting('Comfy.Graph.ZoomSpeed', 1.5)
186+
await comfyPage.zoom(-100, 4)
187+
await expect(comfyPage.canvas).toHaveScreenshot(
188+
'zoomed-in-high-zoom-speed.png'
189+
)
190+
await comfyPage.zoom(100, 8)
191+
await expect(comfyPage.canvas).toHaveScreenshot(
192+
'zoomed-out-high-zoom-speed.png'
193+
)
194+
await comfyPage.setSetting('Comfy.Graph.ZoomSpeed', 1.1)
195+
})
196+
150197
test('Can pan', async ({ comfyPage }) => {
151198
await comfyPage.pan({ x: 200, y: 200 })
152199
await expect(comfyPage.canvas).toHaveScreenshot('panned.png')
96.4 KB
Loading
101 KB
Loading
32.3 KB
Loading
94.3 KB
Loading
33.6 KB
Loading
94.9 KB
Loading

browser_tests/menu.spec.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,4 +92,17 @@ test.describe('Menu', () => {
9292
// Verify the node is added to the canvas
9393
expect(await comfyPage.getGraphNodesCount()).toBe(count + 1)
9494
})
95+
96+
test('Can change canvas zoom speed setting', async ({ comfyPage }) => {
97+
const [defaultSpeed, maxSpeed] = [1.1, 2.5]
98+
expect(await comfyPage.getSetting('Comfy.Graph.ZoomSpeed')).toBe(
99+
defaultSpeed
100+
)
101+
await comfyPage.setSetting('Comfy.Graph.ZoomSpeed', maxSpeed)
102+
expect(await comfyPage.getSetting('Comfy.Graph.ZoomSpeed')).toBe(maxSpeed)
103+
await comfyPage.page.reload()
104+
await comfyPage.setup()
105+
expect(await comfyPage.getSetting('Comfy.Graph.ZoomSpeed')).toBe(maxSpeed)
106+
await comfyPage.setSetting('Comfy.Graph.ZoomSpeed', defaultSpeed)
107+
})
95108
})

0 commit comments

Comments
 (0)