Skip to content

Commit

Permalink
Add waits
Browse files Browse the repository at this point in the history
  • Loading branch information
christian-byrne committed Jan 3, 2025
1 parent 55600d2 commit b81d7d8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion browser_tests/fixtures/components/SidebarTab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ export class QueueSidebarTab extends SidebarTab {
}

getGalleryImage(imageFilename: string) {
return this.page.getByAltText(imageFilename).and(this.galleryImage)
return this.galleryImage.and(this.page.getByAltText(imageFilename))
}

getTaskImage(imageFilename: string) {
Expand Down
3 changes: 2 additions & 1 deletion browser_tests/fixtures/utils/taskHistory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,9 @@ export default class TaskHistory {
this.tasks.unshift(task) // Tasks are added to the front of the queue
}

clearTasks() {
clearTasks(): this {
this.tasks = []
return this
}

withTask(
Expand Down
6 changes: 5 additions & 1 deletion browser_tests/menu.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -881,6 +881,7 @@ test.describe('Queue sidebar', () => {
test.beforeEach(async ({ comfyPage }) => {
await comfyPage
.setupHistory()
.clearTasks()
.withTask([secondImage])
.withTask([firstImage])
.setupRoutes()
Expand All @@ -902,8 +903,10 @@ test.describe('Queue sidebar', () => {
const newImage = 'image64x64.webp'
comfyPage.setupHistory().withTask([newImage])
await comfyPage.menu.queueTab.triggerTasksUpdate()
await comfyPage.page.waitForTimeout(256)
const newTask = comfyPage.menu.queueTab.tasks.getByAltText(newImage)
await newTask.waitFor({ state: 'visible' })
await comfyPage.nextFrame()

// The active gallery item should still be the initial image
expect(comfyPage.menu.queueTab.getGalleryImage(firstImage)).toBeVisible()
Expand All @@ -925,8 +928,9 @@ test.describe('Queue sidebar', () => {
test(`can navigate gallery ${description}`, async ({ comfyPage }) => {
for (const direction of path)
await comfyPage.page.keyboard.press(`Arrow${direction}`, {
delay: 64
delay: 256
})
await comfyPage.nextFrame()
expect(comfyPage.menu.queueTab.getGalleryImage(end)).toBeVisible()
})
})
Expand Down

0 comments on commit b81d7d8

Please sign in to comment.