-
Notifications
You must be signed in to change notification settings - Fork 192
test: verify comfyui.db creation after install #1552
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,7 +1,11 @@ | ||||||
| import { stat } from 'node:fs/promises'; | ||||||
| import path from 'node:path'; | ||||||
| import { pathExists } from 'tests/shared/utils'; | ||||||
|
|
||||||
| import { expect, test } from '../testExtensions'; | ||||||
|
|
||||||
| test.describe('Install App', () => { | ||||||
| test('Can install app', async ({ installWizard, installedApp, serverStart, testEnvironment }) => { | ||||||
| test('Can install app', async ({ installWizard, installedApp, serverStart, testEnvironment, window }) => { | ||||||
| test.slow(); | ||||||
|
|
||||||
| await installWizard.clickGetStarted(); | ||||||
|
|
@@ -34,5 +38,24 @@ test.describe('Install App', () => { | |||||
| // Confirm post-install app state is as expected | ||||||
| await expect(installedApp.firstTimeTemplateWorkflowText).toBeVisible({ timeout: 30 * 1000 }); | ||||||
| await expect(installedApp.templatesGrid).toBeVisible({ timeout: 30 * 1000 }); | ||||||
|
|
||||||
| const dbPath = path.join(testEnvironment.installLocation.path, 'user', 'comfyui.db'); | ||||||
| await expect.poll(async () => await pathExists(dbPath), { timeout: 30 * 1000 }).toBe(true); | ||||||
| await expect | ||||||
| .poll( | ||||||
| async () => { | ||||||
| try { | ||||||
| const fileStat = await stat(dbPath); | ||||||
| return fileStat.size; | ||||||
| } catch { | ||||||
| return 0; | ||||||
| } | ||||||
| }, | ||||||
| { timeout: 30 * 1000 } | ||||||
| ) | ||||||
| .toBeGreaterThan(0); | ||||||
| const appUrl = new URL(window.url()); | ||||||
| const response = await window.request.get(`${appUrl.origin}/object_info`); | ||||||
| expect(response.ok()).toBe(true); | ||||||
|
||||||
| expect(response.ok()).toBe(true); | |
| await expect(response).toBeOK(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
find tests/integration -name "installApp.spec.ts" -type fRepository: Comfy-Org/desktop
Length of output: 105
🏁 Script executed:
fd installApp.spec.ts tests/integrationRepository: Comfy-Org/desktop
Length of output: 161
🏁 Script executed:
git ls-files tests/integration | head -20Repository: Comfy-Org/desktop
Length of output: 1566
🏁 Script executed:
cat -n tests/integration/install/installApp.spec.ts | sed -n '35,70p'Repository: Comfy-Org/desktop
Length of output: 1213
🏁 Script executed:
wc -l tests/integration/install/installApp.spec.tsRepository: Comfy-Org/desktop
Length of output: 108
🏁 Script executed:
grep -r "object_info" tests/integration --include="*.ts" -B 2 -A 2Repository: Comfy-Org/desktop
Length of output: 477
🏁 Script executed:
grep -r "window.request.get" tests/integration --include="*.ts" -B 2 -A 2 | head -40Repository: Comfy-Org/desktop
Length of output: 477
🏁 Script executed:
grep -r "expect.poll" tests/integration --include="*.ts" -A 5 | head -60Repository: Comfy-Org/desktop
Length of output: 543
🏁 Script executed:
cat -n tests/integration/install/installApp.spec.ts | sed -n '1,40p'Repository: Comfy-Org/desktop
Length of output: 1978
🏁 Script executed:
grep -r "response.dispose()" tests/integration --include="*.ts" -B 2 -A 2 | head -30Repository: Comfy-Org/desktop
Length of output: 43
🏁 Script executed:
grep -r "window.request" tests/integration --include="*.ts" | wc -lRepository: Comfy-Org/desktop
Length of output: 62
🏁 Script executed:
grep -r "\.dispose()" tests/integration --include="*.ts"Repository: Comfy-Org/desktop
Length of output: 43
🏁 Script executed:
grep -r "request\\.get\\|request\\.post" tests/integration --include="*.ts" -A 3Repository: Comfy-Org/desktop
Length of output: 367
🏁 Script executed:
cat -n tests/integration/testExtensions.ts | head -50Repository: Comfy-Org/desktop
Length of output: 2317
🏁 Script executed:
cd tests/integration && grep -r "await response" --include="*.ts"Repository: Comfy-Org/desktop
Length of output: 43
🏁 Script executed:
grep -r "APIResponse" tests/integration --include="*.ts"Repository: Comfy-Org/desktop
Length of output: 43
🏁 Script executed:
cat -n tests/integration/testExtensions.ts | sed -n '30,100p'Repository: Comfy-Org/desktop
Length of output: 3172
🏁 Script executed:
grep -r "APIResponse\|response\\.ok\|window\\.request" tests --include="*.ts" --include="*.js"Repository: Comfy-Org/desktop
Length of output: 267
🏁 Script executed:
grep -r "waitUntilLoaded" tests/integration --include="*.ts" -A 3 -B 1Repository: Comfy-Org/desktop
Length of output: 2038
🏁 Script executed:
cat -n tests/integration/testInstalledApp.ts | head -100Repository: Comfy-Org/desktop
Length of output: 1333
🏁 Script executed:
grep -r "Playwright\|APIResponse" tests --include="*.ts" --include="*.json" | head -20Repository: Comfy-Org/desktop
Length of output: 922
🏁 Script executed:
grep -r "response\\.dispose\|response\\.status\|response\\.text\|response\\.json" tests --include="*.ts"Repository: Comfy-Org/desktop
Length of output: 43
🏁 Script executed:
cat -n tests/integration/install/installApp.spec.ts | sed -n '55,61p'Repository: Comfy-Org/desktop
Length of output: 313
🏁 Script executed:
grep -r "expectLoaded\|graphCanvas" tests/integration/testGraphCanvas.ts -A 5 -B 1Repository: Comfy-Org/desktop
Length of output: 350
🏁 Script executed:
git log --oneline tests/integration/install/installApp.spec.ts | head -10Repository: Comfy-Org/desktop
Length of output: 115
🏁 Script executed:
grep -r "object_info\|backend\|server.*ready" tests/integration --include="*.md"Repository: Comfy-Org/desktop
Length of output: 43
Stabilize /object_info check with polling to avoid flakiness.
UI readiness (canvas visible, spinner hidden) doesn't guarantee the backend endpoint is accepting requests yet, creating a potential race condition.
🔧 Suggested stabilization using expect.poll
const dbPath = path.join(testEnvironment.installLocation.path, 'user', 'comfyui.db');
await expect.poll(async () => await pathExists(dbPath), { timeout: 30 * 1000 }).toBe(true);
await expect
.poll(
async () => {
try {
const fileStat = await stat(dbPath);
return fileStat.size;
} catch {
return 0;
}
},
{ timeout: 30 * 1000 }
)
.toBeGreaterThan(0);
const appUrl = new URL(window.url());
- const response = await window.request.get(`${appUrl.origin}/object_info`);
- expect(response.ok()).toBe(true);
+ await expect
+ .poll(
+ async () => {
+ const response = await window.request.get(`${appUrl.origin}/object_info`);
+ const ok = response.ok();
+ await response.dispose();
+ return ok;
+ },
+ { timeout: 30 * 1000 }
+ )
+ .toBe(true);🤖 Prompt for AI Agents
In `@tests/integration/install/installApp.spec.ts` around lines 42 - 59, The test
currently calls window.request.get(`${appUrl.origin}/object_info`) once which
can race with backend readiness; replace that single request with a polling
check using expect.poll to repeatedly call window.request.get or a small helper
that fetches `${appUrl.origin}/object_info` and returns response.ok(), waiting
until it returns true (or a timeout) before asserting; update the block that
follows the DB size check (references: dbPath, pathExists, stat, appUrl,
window.request.get, /object_info) so the test only proceeds when the endpoint
responds successfully.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The double await is redundant. Since pathExists already returns a Promise, the inner await is unnecessary. Consider simplifying to:
async () => pathExists(dbPath)