fix: pass parallelIndex to ComfyPage constructor instead of accessing fixture

This commit is contained in:
bymyself
2025-11-13 09:58:03 -08:00
parent 34d7f4b7df
commit 730d8c2292
4 changed files with 17 additions and 8 deletions

View File

@@ -8,8 +8,12 @@ import type { FolderStructure } from './ComfyPage'
* Uses Firebase auth persistence and cloud API for settings.
*/
export class CloudComfyPage extends ComfyPage {
constructor(page: Page, request: APIRequestContext) {
super(page, request)
constructor(
page: Page,
request: APIRequestContext,
parallelIndex: number = 0
) {
super(page, request, parallelIndex)
}
async setupUser(username: string): Promise<string | null> {

View File

@@ -158,12 +158,13 @@ export abstract class ComfyPage {
/** Test user ID for the current context */
get id() {
return this.userIds[comfyPageFixture.info().parallelIndex]
return this.userIds[this.parallelIndex]
}
constructor(
public readonly page: Page,
public readonly request: APIRequestContext
public readonly request: APIRequestContext,
public readonly parallelIndex: number = 0
) {
this.url = process.env.PLAYWRIGHT_TEST_URL || 'http://localhost:8188'
this.canvas = page.locator('#graph-canvas')

View File

@@ -8,8 +8,12 @@ import type { FolderStructure } from './ComfyPage'
* Uses devtools API and multi-user mode for test isolation.
*/
export class LocalhostComfyPage extends ComfyPage {
constructor(page: Page, request: APIRequestContext) {
super(page, request)
constructor(
page: Page,
request: APIRequestContext,
parallelIndex: number = 0
) {
super(page, request, parallelIndex)
}
async setupWorkflowsDirectory(structure: FolderStructure): Promise<void> {

View File

@@ -15,9 +15,9 @@ export const comfyPageFixture = base.extend<{
comfyMouse: ComfyMouse
}>({
comfyPage: async ({ page, request }, use, testInfo) => {
const comfyPage = new LocalhostComfyPage(page, request)
const { parallelIndex } = testInfo
const comfyPage = new LocalhostComfyPage(page, request, parallelIndex)
const username = `playwright-test-${parallelIndex}`
const userId = await comfyPage.setupUser(username)
if (userId) {