Skip to content
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

Update tests with precise node positions / sizes #1408

Merged
merged 5 commits into from
Nov 3, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 25 additions & 15 deletions browser_tests/fixtures/ComfyPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -650,10 +650,14 @@ export class ComfyPage {
x: nodePos.x + nodeSize.width * ratioX,
y: nodePos.y + nodeSize.height * ratioY
}
await this.dragAndDrop(bottomRight, target)
// -1 to be inside the node. -2 because nodes currently get an arbitrary +1 to width.
await this.dragAndDrop(
{ x: bottomRight.x - 2, y: bottomRight.y - 1 },
target
)
await this.nextFrame()
if (revertAfter) {
await this.dragAndDrop(target, bottomRight)
await this.dragAndDrop({ x: target.x - 2, y: target.y - 1 }, bottomRight)
await this.nextFrame()
}
}
Expand All @@ -664,14 +668,20 @@ export class ComfyPage {
revertAfter: boolean = false
) {
const ksamplerPos = {
x: 864,
y: 157
x: 863,
y: 156
}
const ksamplerSize = {
width: 315,
height: 292
}
this.resizeNode(ksamplerPos, ksamplerSize, percentX, percentY, revertAfter)
return this.resizeNode(
ksamplerPos,
ksamplerSize,
percentX,
percentY,
revertAfter
)
}

async resizeLoadCheckpointNode(
Expand All @@ -680,14 +690,14 @@ export class ComfyPage {
revertAfter: boolean = false
) {
const loadCheckpointPos = {
x: 25,
y: 440
x: 26,
y: 444
}
const loadCheckpointSize = {
width: 320,
height: 120
width: 315,
height: 127
}
this.resizeNode(
return this.resizeNode(
loadCheckpointPos,
loadCheckpointSize,
percentX,
Expand All @@ -702,14 +712,14 @@ export class ComfyPage {
revertAfter: boolean = false
) {
const emptyLatentPos = {
x: 475,
y: 580
x: 473,
y: 579
}
const emptyLatentSize = {
width: 303,
height: 132
width: 315,
height: 136
}
this.resizeNode(
return this.resizeNode(
emptyLatentPos,
emptyLatentSize,
percentX,
Expand Down
4 changes: 3 additions & 1 deletion browser_tests/groupNode.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,9 @@ test.describe('Group Node', () => {
}) => {
await comfyPage.loadWorkflow('legacy_group_node')
expect(await comfyPage.getGraphNodesCount()).toBe(1)
expect(comfyPage.page.locator('.comfy-missing-nodes')).not.toBeVisible()
await expect(
comfyPage.page.locator('.comfy-missing-nodes')
).not.toBeVisible()
})

test.describe('Copy and paste', () => {
Expand Down
8 changes: 6 additions & 2 deletions browser_tests/nodeDisplay.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,14 @@ test.describe('Optional input', () => {
test('Only optional inputs', async ({ comfyPage }) => {
await comfyPage.loadWorkflow('only_optional_inputs')
expect(await comfyPage.getGraphNodesCount()).toBe(1)
expect(comfyPage.page.locator('.comfy-missing-nodes')).not.toBeVisible()
await expect(
comfyPage.page.locator('.comfy-missing-nodes')
).not.toBeVisible()

// If the node's multiline text widget is visible, then it was loaded successfully
expect(comfyPage.page.locator('.comfy-multiline-input')).toHaveCount(1)
await expect(comfyPage.page.locator('.comfy-multiline-input')).toHaveCount(
1
)
})
test('Old workflow with converted input', async ({ comfyPage }) => {
await comfyPage.loadWorkflow('old_workflow_converted_input')
Expand Down
2 changes: 2 additions & 0 deletions browser_tests/nodeSearchBox.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ test.describe('Release context menu', () => {

test('Can trigger on link release', async ({ comfyPage }) => {
await comfyPage.disconnectEdge()
await comfyPage.page.mouse.move(10, 10)
await comfyPage.nextFrame()
await expect(comfyPage.canvas).toHaveScreenshot(
'link-release-context-menu.png'
)
Expand Down
Loading