Skip to content
Merged
Changes from all 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
25 changes: 24 additions & 1 deletion tests/integration/install/installApp.spec.ts
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();
Expand Down Expand Up @@ -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);
Copy link

Copilot AI Jan 19, 2026

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)

Suggested change
await expect.poll(async () => await pathExists(dbPath), { timeout: 30 * 1000 }).toBe(true);
await expect.poll(async () => pathExists(dbPath), { timeout: 30 * 1000 }).toBe(true);

Copilot uses AI. Check for mistakes.
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);
Copy link

Copilot AI Jan 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Playwright provides a more idiomatic assertion for checking response status. Consider using expect(response).toBeOK() instead of expect(response.ok()).toBe(true) for better readability and consistency with Playwright best practices.

Suggested change
expect(response.ok()).toBe(true);
await expect(response).toBeOK();

Copilot uses AI. Check for mistakes.
Comment on lines +42 to +59
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

find tests/integration -name "installApp.spec.ts" -type f

Repository: Comfy-Org/desktop

Length of output: 105


🏁 Script executed:

fd installApp.spec.ts tests/integration

Repository: Comfy-Org/desktop

Length of output: 161


🏁 Script executed:

git ls-files tests/integration | head -20

Repository: 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.ts

Repository: Comfy-Org/desktop

Length of output: 108


🏁 Script executed:

grep -r "object_info" tests/integration --include="*.ts" -B 2 -A 2

Repository: Comfy-Org/desktop

Length of output: 477


🏁 Script executed:

grep -r "window.request.get" tests/integration --include="*.ts" -B 2 -A 2 | head -40

Repository: Comfy-Org/desktop

Length of output: 477


🏁 Script executed:

grep -r "expect.poll" tests/integration --include="*.ts" -A 5 | head -60

Repository: 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 -30

Repository: Comfy-Org/desktop

Length of output: 43


🏁 Script executed:

grep -r "window.request" tests/integration --include="*.ts" | wc -l

Repository: 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 3

Repository: Comfy-Org/desktop

Length of output: 367


🏁 Script executed:

cat -n tests/integration/testExtensions.ts | head -50

Repository: 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 1

Repository: Comfy-Org/desktop

Length of output: 2038


🏁 Script executed:

cat -n tests/integration/testInstalledApp.ts | head -100

Repository: Comfy-Org/desktop

Length of output: 1333


🏁 Script executed:

grep -r "Playwright\|APIResponse" tests --include="*.ts" --include="*.json" | head -20

Repository: 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 1

Repository: Comfy-Org/desktop

Length of output: 350


🏁 Script executed:

git log --oneline tests/integration/install/installApp.spec.ts | head -10

Repository: 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.

});
});
Loading