Repository navigation
test(autogrow): grown slots and their links survive a round-trip #17521
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
8e8dd71
test(autogrow): grown slots and their links survive a round-trip
christian-byrne eda23dc
test: strengthen autogrow persistence assertions
ampagent c7a9dd8
test: read the autogrow starting state from the fixture, not from memory
christian-byrne a260fdc
test: derive the autogrow baseline instead of restating the fixture
christian-byrne 0862ce5
test: export ConnectedInput, which AutogrowInputGroup already exposes
christian-byrne File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
107 changes: 107 additions & 0 deletions
107
browser_tests/tests/links/autogrowInputPersistence.spec.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,107 @@ | ||
| import { | ||
| comfyExpect as expect, | ||
| comfyPageFixture as baseTest | ||
| } from '@e2e/fixtures/ComfyPage' | ||
| import { | ||
| AUTOGROW_REFERENCE_NODE_ID, | ||
| AUTOGROW_REFERENCE_WORKFLOW, | ||
| BYTEDANCE_REFERENCE_NODE_TYPE, | ||
| REFERENCE_IMAGES_PREFIX, | ||
| byteDanceReferenceNodeDef | ||
| } from '@e2e/fixtures/data/byteDanceReferenceNodeDef' | ||
| import { readAutogrowInputGroup } from '@e2e/fixtures/utils/nodeInputLinks' | ||
| import { routeObjectInfoFromSetupApi } from '@e2e/fixtures/utils/objectInfo' | ||
|
|
||
| const test = baseTest.extend({ | ||
| page: async ({ page }, use) => { | ||
| const unrouteObjectInfo = await routeObjectInfoFromSetupApi( | ||
| page, | ||
| (objectInfo) => { | ||
| objectInfo[BYTEDANCE_REFERENCE_NODE_TYPE] = byteDanceReferenceNodeDef | ||
| } | ||
| ) | ||
| try { | ||
| await use(page) | ||
| } finally { | ||
| await unrouteObjectInfo() | ||
| } | ||
| } | ||
| }) | ||
|
|
||
| test.describe( | ||
| 'Autogrow input persistence', | ||
| { tag: ['@canvas', '@node'] }, | ||
| () => { | ||
| test.beforeEach(async ({ comfyPage }) => { | ||
| await comfyPage.workflow.loadWorkflow(AUTOGROW_REFERENCE_WORKFLOW) | ||
| }) | ||
|
|
||
| test('grown slots and their links survive a serialize round-trip', async ({ | ||
| comfyPage | ||
| }) => { | ||
| // Read the starting state instead of restating it. The workflow is shared | ||
| // with the subgraph-unpack tests and has already gained a link once; a | ||
| // spec that hard-codes its contents fails the next time that happens, and | ||
| // the failure reads as a product regression rather than a stale | ||
| // expectation. | ||
| const before = await readAutogrowInputGroup( | ||
| comfyPage, | ||
| AUTOGROW_REFERENCE_NODE_ID, | ||
| REFERENCE_IMAGES_PREFIX | ||
| ) | ||
|
|
||
| // The invariant under test, stated as one: autogrow keeps exactly one | ||
| // empty slot after the connected ones. | ||
| expect(before.connections.length).toBeGreaterThan(0) | ||
| expect(before.slotNames).toHaveLength(before.connections.length + 1) | ||
|
|
||
| const loadImage = await comfyPage.nodeOps.getNodeRefById('18') | ||
| const referenceNode = await comfyPage.nodeOps.getNodeRefById( | ||
| AUTOGROW_REFERENCE_NODE_ID | ||
| ) | ||
| await loadImage.connectOutput(0, referenceNode, before.trailingSlotIndex) | ||
|
|
||
| const grownConnections = [ | ||
| ...before.connections, | ||
| { | ||
| name: before.slotNames[before.trailingSlotIndex], | ||
| originNodeId: '18' | ||
| } | ||
| ] | ||
| const grownSlotCount = before.slotNames.length + 1 | ||
|
|
||
| await expect | ||
| .poll(async () => { | ||
| const grown = await readAutogrowInputGroup( | ||
| comfyPage, | ||
| AUTOGROW_REFERENCE_NODE_ID, | ||
| REFERENCE_IMAGES_PREFIX | ||
| ) | ||
| return { | ||
| connections: grown.connections, | ||
| slotCount: grown.slotNames.length | ||
| } | ||
| }) | ||
| .toEqual({ | ||
| connections: grownConnections, | ||
| slotCount: grownSlotCount | ||
| }) | ||
|
|
||
| const serialized = await comfyPage.workflow.getExportedWorkflow() | ||
| await comfyPage.workflow.loadGraphData(serialized) | ||
|
|
||
| // The point of the test: the grown slot and its link are still there | ||
| // after a round trip, and the group still ends in exactly one empty slot. | ||
| const after = await readAutogrowInputGroup( | ||
| comfyPage, | ||
| AUTOGROW_REFERENCE_NODE_ID, | ||
| REFERENCE_IMAGES_PREFIX | ||
| ) | ||
| expect(after.connections).toEqual(grownConnections) | ||
| expect(after.slotNames).toHaveLength(grownSlotCount) | ||
| expect(after.slotNames.slice(0, before.slotNames.length)).toEqual( | ||
| before.slotNames | ||
| ) | ||
| }) | ||
| } | ||
| ) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.