1- import { expect } from '@playwright/test'
2- import fs from 'fs'
1+ import { Page , expect } from '@playwright/test'
32
43import { comfyPageFixture as test } from '../fixtures/ComfyPage'
54
5+ async function checkTemplateFileExists (
6+ page : Page ,
7+ filename : string
8+ ) : Promise < boolean > {
9+ const response = await page . request . head (
10+ new URL ( `/templates/${ filename } ` , page . url ( ) ) . toString ( )
11+ )
12+ return response . ok ( )
13+ }
14+
615test . describe ( 'Templates' , ( ) => {
716 test . beforeEach ( async ( { comfyPage } ) => {
817 await comfyPage . setSetting ( 'Comfy.UseNewMenu' , 'Top' )
@@ -12,42 +21,45 @@ test.describe('Templates', () => {
1221 test ( 'should have a JSON workflow file for each template' , async ( {
1322 comfyPage
1423 } ) => {
24+ test . slow ( )
1525 const templates = await comfyPage . templates . getAllTemplates ( )
1626 for ( const template of templates ) {
17- const workflowPath = comfyPage . templates . getTemplatePath (
27+ const exists = await checkTemplateFileExists (
28+ comfyPage . page ,
1829 `${ template . name } .json`
1930 )
20- expect (
21- fs . existsSync ( workflowPath ) ,
22- `Missing workflow: ${ template . name } `
23- ) . toBe ( true )
31+ expect ( exists , `Missing workflow: ${ template . name } ` ) . toBe ( true )
2432 }
2533 } )
2634
27- test . skip ( 'should have all required thumbnail media for each template' , async ( {
35+ test ( 'should have all required thumbnail media for each template' , async ( {
2836 comfyPage
2937 } ) => {
38+ test . slow ( )
3039 const templates = await comfyPage . templates . getAllTemplates ( )
3140 for ( const template of templates ) {
3241 const { name, mediaSubtype, thumbnailVariant } = template
3342 const baseMedia = `${ name } -1.${ mediaSubtype } `
34- const basePath = comfyPage . templates . getTemplatePath ( baseMedia )
3543
3644 // Check base thumbnail
37- expect (
38- fs . existsSync ( basePath ) ,
39- `Missing base thumbnail: ${ baseMedia } `
40- ) . toBe ( true )
45+ const baseExists = await checkTemplateFileExists (
46+ comfyPage . page ,
47+ baseMedia
48+ )
49+ expect ( baseExists , `Missing base thumbnail: ${ baseMedia } ` ) . toBe ( true )
4150
4251 // Check second thumbnail for variants that need it
4352 if (
4453 thumbnailVariant === 'compareSlider' ||
4554 thumbnailVariant === 'hoverDissolve'
4655 ) {
4756 const secondMedia = `${ name } -2.${ mediaSubtype } `
48- const secondPath = comfyPage . templates . getTemplatePath ( secondMedia )
57+ const secondExists = await checkTemplateFileExists (
58+ comfyPage . page ,
59+ secondMedia
60+ )
4961 expect (
50- fs . existsSync ( secondPath ) ,
62+ secondExists ,
5163 `Missing second thumbnail: ${ secondMedia } required for ${ thumbnailVariant } `
5264 ) . toBe ( true )
5365 }
0 commit comments