[Test] [Performance] Apply perf monitor wrappers to test files (3/4) (#4126)

This commit is contained in:
Christian Byrne
2025-06-10 15:30:06 -07:00
committed by GitHub
parent a5ad9b5ad9
commit ef3d3069bb
3 changed files with 292 additions and 55 deletions

View File

@@ -1,6 +1,7 @@
import { expect } from '@playwright/test'
import { comfyPageFixture as test } from '../fixtures/ComfyPage'
import { PerformanceMonitor } from '../helpers/performanceMonitor'
function listenForEvent(): Promise<Event> {
return new Promise<Event>((resolve) => {
@@ -11,27 +12,49 @@ function listenForEvent(): Promise<Event> {
}
test.describe('Canvas Event', () => {
test('Emit litegraph:canvas empty-release', async ({ comfyPage }) => {
test('@perf Emit litegraph:canvas empty-release', async ({ comfyPage }) => {
const perfMonitor = new PerformanceMonitor(comfyPage.page)
const testName = 'canvas-empty-release'
await perfMonitor.startMonitoring(testName)
const eventPromise = comfyPage.page.evaluate(listenForEvent)
const disconnectPromise = comfyPage.disconnectEdge()
await perfMonitor.measureOperation('disconnect-edge', async () => {
await comfyPage.disconnectEdge()
})
const event = await eventPromise
await disconnectPromise
expect(event).not.toBeNull()
// No further check on event content as the content is dropped by
// playwright for some reason.
// See https://github.com/microsoft/playwright/issues/31580
await perfMonitor.finishMonitoring(testName)
})
test('Emit litegraph:canvas empty-double-click', async ({ comfyPage }) => {
test('@perf Emit litegraph:canvas empty-double-click', async ({
comfyPage
}) => {
const perfMonitor = new PerformanceMonitor(comfyPage.page)
const testName = 'canvas-double-click'
await perfMonitor.startMonitoring(testName)
const eventPromise = comfyPage.page.evaluate(listenForEvent)
const doubleClickPromise = comfyPage.doubleClickCanvas()
await perfMonitor.measureOperation('double-click-canvas', async () => {
await comfyPage.doubleClickCanvas()
})
const event = await eventPromise
await doubleClickPromise
expect(event).not.toBeNull()
// No further check on event content as the content is dropped by
// playwright for some reason.
// See https://github.com/microsoft/playwright/issues/31580
await perfMonitor.finishMonitoring(testName)
})
})