Fix changeTracker modified state (#1481)

* Add jsondiffpatch

* Add logs

* Add graphDiff helper

* Fix changeTracker

* Add loglevel

* Add playwright test

* Fix jest test

* nit

* nit

* Fix test url

* nit
This commit is contained in:
Chenlei Hu
2024-11-08 22:24:35 -05:00
committed by GitHub
parent c12f059940
commit f8ec87ddea
8 changed files with 171 additions and 11 deletions

View File

@@ -16,6 +16,43 @@ async function afterChange(comfyPage: ComfyPage) {
}
test.describe('Change Tracker', () => {
test.describe('Undo/Redo', () => {
test.beforeEach(async ({ comfyPage }) => {
await comfyPage.setSetting('Comfy.UseNewMenu', 'Top')
})
// Flaky https://github.com/Comfy-Org/ComfyUI_frontend/pull/1481
// The collapse can be recognized as several changes.
test.skip('Can undo multiple operations', async ({ comfyPage }) => {
function isModified() {
return comfyPage.page.evaluate(async () => {
return window['app'].extensionManager.workflow.activeWorkflow
.isModified
})
}
await comfyPage.menu.topbar.saveWorkflow('undo-redo-test')
expect(await isModified()).toBe(false)
const node = (await comfyPage.getFirstNodeRef())!
await node.click('collapse')
await expect(node).toBeCollapsed()
expect(await isModified()).toBe(true)
await comfyPage.ctrlB()
await expect(node).toBeBypassed()
expect(await isModified()).toBe(true)
await comfyPage.ctrlZ()
await expect(node).not.toBeBypassed()
expect(await isModified()).toBe(true)
await comfyPage.ctrlZ()
await expect(node).not.toBeCollapsed()
expect(await isModified()).toBe(false)
})
})
test('Can group multiple change actions into a single transaction', async ({
comfyPage
}) => {

View File

@@ -167,7 +167,7 @@ export class ComfyPage {
}
async setupUser(username: string) {
const res = await this.request.get(`${this.url}/users`)
const res = await this.request.get(`${this.url}/api/users`)
if (res.status() !== 200)
throw new Error(`Failed to retrieve users: ${await res.text()}`)
@@ -181,7 +181,7 @@ export class ComfyPage {
}
async createUser(username: string) {
const resp = await this.request.post(`${this.url}/users`, {
const resp = await this.request.post(`${this.url}/api/users`, {
data: { username }
})