mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-02 14:27:40 +00:00
Replace fragile CSS selectors with Playwright getByRole() for better accessibility-based testing: - bottomPanelShortcuts.spec.ts: button[aria-label] -> getByRole - execution.spec.ts: .p-dialog-close-button -> getByRole - backgroundImageUpload.spec.ts: button:has(.pi-*) -> getByRole - nodeHelp.spec.ts: button:has(.pi-question) -> getByRole - BaseDialog.ts: closeButton uses getByRole - ComfyNodeSearchBox.ts: Add button uses getByRole - Topbar.ts: close-button uses getByRole Amp-Thread-ID: https://ampcode.com/threads/T-019c155c-92e1-76f3-b6ce-7fc3ffa11582 Co-authored-by: Amp <amp@ampcode.com>
57 lines
2.0 KiB
TypeScript
57 lines
2.0 KiB
TypeScript
import { expect } from '@playwright/test'
|
|
|
|
import { comfyPageFixture as test } from '../fixtures/ComfyPage'
|
|
|
|
test.beforeEach(async ({ comfyPage }) => {
|
|
await comfyPage.setSetting('Comfy.UseNewMenu', 'Disabled')
|
|
})
|
|
|
|
test.describe('Execution', { tag: ['@smoke', '@workflow'] }, () => {
|
|
test(
|
|
'Report error on unconnected slot',
|
|
{ tag: '@screenshot' },
|
|
async ({ comfyPage }) => {
|
|
await comfyPage.disconnectEdge()
|
|
await comfyPage.clickEmptySpace()
|
|
|
|
await comfyPage.executeCommand('Comfy.QueuePrompt')
|
|
await expect(comfyPage.page.locator('.comfy-error-report')).toBeVisible()
|
|
await comfyPage.page
|
|
.locator('.p-dialog')
|
|
.getByRole('button', { name: 'Close' })
|
|
.click()
|
|
await comfyPage.page.locator('.comfy-error-report').waitFor({
|
|
state: 'hidden'
|
|
})
|
|
await expect(comfyPage.canvas).toHaveScreenshot(
|
|
'execution-error-unconnected-slot.png'
|
|
)
|
|
}
|
|
)
|
|
})
|
|
|
|
test.describe(
|
|
'Execute to selected output nodes',
|
|
{ tag: ['@smoke', '@workflow'] },
|
|
() => {
|
|
test('Execute to selected output nodes', async ({ comfyPage }) => {
|
|
await comfyPage.loadWorkflow('execution/partial_execution')
|
|
const input = await comfyPage.nodeOps.getNodeRefById(3)
|
|
const output1 = await comfyPage.nodeOps.getNodeRefById(1)
|
|
const output2 = await comfyPage.nodeOps.getNodeRefById(4)
|
|
expect(await (await input.getWidget(0)).getValue()).toBe('foo')
|
|
expect(await (await output1.getWidget(0)).getValue()).toBe('')
|
|
expect(await (await output2.getWidget(0)).getValue()).toBe('')
|
|
|
|
await output1.click('title')
|
|
|
|
await comfyPage.executeCommand('Comfy.QueueSelectedOutputNodes')
|
|
await expect(async () => {
|
|
expect(await (await input.getWidget(0)).getValue()).toBe('foo')
|
|
expect(await (await output1.getWidget(0)).getValue()).toBe('foo')
|
|
expect(await (await output2.getWidget(0)).getValue()).toBe('')
|
|
}).toPass({ timeout: 2_000 })
|
|
})
|
|
}
|
|
)
|