Add playwright undo tests (#638)

This commit is contained in:
Chenlei Hu
2024-08-26 10:47:37 -04:00
committed by GitHub
parent f9ae5aaa0f
commit 03ac6eea19
2 changed files with 46 additions and 0 deletions

View File

@@ -413,6 +413,27 @@ export class ComfyPage {
await this.nextFrame()
}
async ctrlZ() {
await this.page.keyboard.down('Control')
await this.page.keyboard.press('KeyZ')
await this.page.keyboard.up('Control')
await this.nextFrame()
}
async ctrlArrowUp() {
await this.page.keyboard.down('Control')
await this.page.keyboard.press('ArrowUp')
await this.page.keyboard.up('Control')
await this.nextFrame()
}
async ctrlArrowDown() {
await this.page.keyboard.down('Control')
await this.page.keyboard.press('ArrowDown')
await this.page.keyboard.up('Control')
await this.nextFrame()
}
async closeMenu() {
await this.page.click('button.comfy-close-menu-btn')
await this.nextFrame()

View File

@@ -217,3 +217,28 @@ test.describe('Canvas Interaction', () => {
await expect(comfyPage.canvas).toHaveScreenshot('panned-back-to-one.png')
})
})
test.describe('Widget Interaction', () => {
test('Undo text input', async ({ comfyPage }) => {
const textBox = comfyPage.widgetTextBox
await textBox.click()
await textBox.fill('')
await expect(textBox).toHaveValue('')
await textBox.fill('Hello World')
await expect(textBox).toHaveValue('Hello World')
await comfyPage.ctrlZ()
await expect(textBox).toHaveValue('')
})
test('Undo attention edit', async ({ comfyPage }) => {
const textBox = comfyPage.widgetTextBox
await textBox.click()
await textBox.fill('1girl')
await expect(textBox).toHaveValue('1girl')
await textBox.selectText()
await comfyPage.ctrlArrowUp()
await expect(textBox).toHaveValue('(1girl:1.1)')
await comfyPage.ctrlZ()
await expect(textBox).toHaveValue('1girl')
})
})