mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-05-04 05:02:17 +00:00
refactor: extract assetPath as standalone pure function (#10651)
## Summary Extract `assetPath` from a `ComfyPage` method to a standalone pure function, removing unnecessary coupling to the page object. ## Changes - **What**: Moved `assetPath` to `browser_tests/fixtures/utils/paths.ts`. `DragDropHelper` and `WorkflowHelper` import it directly instead of receiving it via `ComfyPage`. `ComfyPage.assetPath` kept as thin delegate for backward compat. ## Review Focus Structural-only refactor — no behavioral changes. The function was already pure (no `this`/`page` usage). ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-10651-refactor-extract-assetPath-as-standalone-pure-function-3316d73d365081c0b0e0ce6dde57ef8e) by [Unito](https://www.unito.io)
This commit is contained in:
@@ -4,12 +4,10 @@ import type { Page } from '@playwright/test'
|
||||
|
||||
import type { Position } from '../types'
|
||||
import { getMimeType } from './mimeTypeUtil'
|
||||
import { assetPath } from '../utils/paths'
|
||||
|
||||
export class DragDropHelper {
|
||||
constructor(
|
||||
private readonly page: Page,
|
||||
private readonly assetPath: (fileName: string) => string
|
||||
) {}
|
||||
constructor(private readonly page: Page) {}
|
||||
|
||||
private async nextFrame(): Promise<void> {
|
||||
await this.page.evaluate(() => {
|
||||
@@ -49,7 +47,7 @@ export class DragDropHelper {
|
||||
} = { dropPosition, preserveNativePropagation }
|
||||
|
||||
if (fileName) {
|
||||
const filePath = this.assetPath(fileName)
|
||||
const filePath = assetPath(fileName)
|
||||
const buffer = readFileSync(filePath)
|
||||
|
||||
evaluateParams.fileName = fileName
|
||||
|
||||
Reference in New Issue
Block a user