Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
43 changes: 15 additions & 28 deletions browser_tests/tests/templates.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,45 +181,32 @@ test.describe('Templates', () => {
}) => {
// Open templates dialog
await comfyPage.executeCommand('Comfy.BrowseTemplates')
await expect(comfyPage.templates.content).toBeVisible()

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These tests will make sense more on the base modal

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test case was originally about ensuring the grid was visible. The bug from a long time ago was the nav bar fully covering the grid. I think checking the template base modal visibility is covered in other test cases, so it should error rather than fail expectation in this case if not visible.

const firstCard = comfyPage.page
.locator('[data-testid^="template-workflow-"]')
.first()
await expect(firstCard).toBeVisible({ timeout: 5000 })

// Get the template grid
const templateGrid = comfyPage.page.locator(
'[data-testid="template-workflows-content"]'
)
await expect(templateGrid).toBeVisible()
const nav = comfyPage.page
.locator('header')
.filter({ hasText: 'Templates' })

// Check grid layout at desktop size (default)
const desktopGridClass = await templateGrid.getAttribute('class')
expect(desktopGridClass).toContain('grid')
expect(desktopGridClass).toContain(
'grid-cols-[repeat(auto-fill,minmax(16rem,1fr))]'
)

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

// Check cards at mobile viewport size
await comfyPage.page.setViewportSize({ width: 640, height: 800 })
const mobileSize = { width: 640, height: 800 }
await comfyPage.page.setViewportSize(mobileSize)
expect(cardCount).toBeGreaterThan(0)
await expect(templateGrid).toBeVisible()
// Grid should still be responsive at mobile size
const mobileGridClass = await templateGrid.getAttribute('class')
expect(mobileGridClass).toContain('grid')
await expect(nav).not.toBeVisible() // Nav should collapse at mobile size

// Check cards at tablet size
await comfyPage.page.setViewportSize({ width: 1024, height: 800 })
const tabletSize = { width: 1024, height: 800 }
await comfyPage.page.setViewportSize(tabletSize)
expect(cardCount).toBeGreaterThan(0)
await expect(templateGrid).toBeVisible()
// Grid should still be responsive at tablet size
const tabletGridClass = await templateGrid.getAttribute('class')
expect(tabletGridClass).toContain('grid')
await expect(nav).toBeVisible() // Nav should be visible at tablet size
})

test('hover effects work on template cards', async ({ comfyPage }) => {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.