mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-20 14:30:41 +00:00
88 lines
2.4 KiB
TypeScript
88 lines
2.4 KiB
TypeScript
import type { Page } from '@playwright/test'
|
|
|
|
import {
|
|
comfyPageFixture as test,
|
|
comfyExpect as expect
|
|
} from '../fixtures/ComfyPage'
|
|
import type { WorkspaceStore } from '../types/globals'
|
|
|
|
test.describe('Linear Mode', { tag: '@ui' }, () => {
|
|
test.beforeEach(async ({ comfyPage }) => {
|
|
await comfyPage.setup()
|
|
})
|
|
|
|
async function enterAppMode(comfyPage: {
|
|
page: Page
|
|
nextFrame: () => Promise<void>
|
|
}) {
|
|
await comfyPage.page.evaluate(() => {
|
|
const workflow = (window.app!.extensionManager as WorkspaceStore).workflow
|
|
.activeWorkflow
|
|
if (workflow) workflow.activeMode = 'app'
|
|
})
|
|
await comfyPage.nextFrame()
|
|
}
|
|
|
|
async function enterGraphMode(comfyPage: {
|
|
page: Page
|
|
nextFrame: () => Promise<void>
|
|
}) {
|
|
await comfyPage.page.evaluate(() => {
|
|
const workflow = (window.app!.extensionManager as WorkspaceStore).workflow
|
|
.activeWorkflow
|
|
if (workflow) workflow.activeMode = 'graph'
|
|
})
|
|
await comfyPage.nextFrame()
|
|
}
|
|
|
|
test('Displays linear controls when app mode active', async ({
|
|
comfyPage
|
|
}) => {
|
|
await enterAppMode(comfyPage)
|
|
|
|
await expect(
|
|
comfyPage.page.locator('[data-testid="linear-widgets"]')
|
|
).toBeVisible({ timeout: 5000 })
|
|
})
|
|
|
|
test('Run button visible in linear mode', async ({ comfyPage }) => {
|
|
await enterAppMode(comfyPage)
|
|
|
|
await expect(
|
|
comfyPage.page.locator('[data-testid="linear-run-button"]')
|
|
).toBeVisible({ timeout: 5000 })
|
|
})
|
|
|
|
test('Workflow info section visible', async ({ comfyPage }) => {
|
|
await enterAppMode(comfyPage)
|
|
|
|
await expect(
|
|
comfyPage.page.locator('[data-testid="linear-workflow-info"]')
|
|
).toBeVisible({ timeout: 5000 })
|
|
})
|
|
|
|
test('Returns to graph mode', async ({ comfyPage }) => {
|
|
await enterAppMode(comfyPage)
|
|
|
|
await expect(
|
|
comfyPage.page.locator('[data-testid="linear-widgets"]')
|
|
).toBeVisible({ timeout: 5000 })
|
|
|
|
await enterGraphMode(comfyPage)
|
|
|
|
await expect(comfyPage.canvas).toBeVisible({ timeout: 5000 })
|
|
await expect(
|
|
comfyPage.page.locator('[data-testid="linear-widgets"]')
|
|
).not.toBeVisible()
|
|
})
|
|
|
|
test('Canvas not visible in app mode', async ({ comfyPage }) => {
|
|
await enterAppMode(comfyPage)
|
|
|
|
await expect(
|
|
comfyPage.page.locator('[data-testid="linear-widgets"]')
|
|
).toBeVisible({ timeout: 5000 })
|
|
await expect(comfyPage.canvas).not.toBeVisible()
|
|
})
|
|
})
|