Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
test: Retrying for card count in templates test
  • Loading branch information
DrJKL committed Dec 11, 2025
commit 64d1e8b9efedad7dd0243c73e0efed6244b651d4
12 changes: 12 additions & 0 deletions browser_tests/helpers/templates.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { Locator, Page } from '@playwright/test'
import { expect } from '@playwright/test'
import path from 'path'

import type {
Expand All @@ -8,9 +9,20 @@ import type {

export class ComfyTemplates {
readonly content: Locator
readonly allTemplateCards: Locator

constructor(readonly page: Page) {
this.content = page.getByTestId('template-workflows-content')
this.allTemplateCards = page.locator('[data-testid^="template-workflow-"]')
}

async waitForMinimumCardCount(count: number) {
return await expect(async () => {
const cardCount = await this.allTemplateCards.count()
expect(cardCount).toBeGreaterThan(count)
}).toPass({
timeout: 1_000
})
}

async loadTemplate(id: string) {
Expand Down
9 changes: 3 additions & 6 deletions browser_tests/tests/templates.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,22 +188,19 @@ test.describe('Templates', () => {
.locator('header')
.filter({ hasText: 'Templates' })

const cardCount = await comfyPage.page
.locator('[data-testid^="template-workflow-"]')
.count()
expect(cardCount).toBeGreaterThan(0)
await comfyPage.templates.waitForMinimumCardCount(0)
await expect(templateGrid).toBeVisible()
await expect(nav).toBeVisible() // Nav should be visible at desktop size

const mobileSize = { width: 640, height: 800 }
await comfyPage.page.setViewportSize(mobileSize)
expect(cardCount).toBeGreaterThan(0)
await comfyPage.templates.waitForMinimumCardCount(0)
await expect(templateGrid).toBeVisible()
await expect(nav).not.toBeVisible() // Nav should collapse at mobile size

const tabletSize = { width: 1024, height: 800 }
await comfyPage.page.setViewportSize(tabletSize)
expect(cardCount).toBeGreaterThan(0)
await comfyPage.templates.waitForMinimumCardCount(0)
await expect(templateGrid).toBeVisible()
await expect(nav).toBeVisible() // Nav should be visible at tablet size
})
Expand Down
Loading