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
68 changes: 68 additions & 0 deletions browser_tests/tests/remoteWidgetWebSession.spec.ts

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is there a more specific domain we can use for placing this test?

Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import { expect } from '@playwright/test'

import { webSessionTest } from '@e2e/fixtures/webSessionFixture'
import { jsonRoute } from '@e2e/fixtures/utils/jsonRoute'

const TEAM_WORKSPACE_ID = 'ws-team'
const TEAM_OPTIONS = ['team-checkpoint.safetensors']
const PERSONAL_OPTIONS = ['personal-checkpoint.safetensors']

const test = webSessionTest.extend({
page: async ({ page }, use) => {
await page.route('**/api/settings', (route) => route.fulfill(jsonRoute({})))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Low — Fulfilling **/api/settings with {} discards every setting the comfyPage fixture seeds via /api/devtools/set_settings (Comfy.UseNewMenu, Comfy.TutorialCompleted, Comfy.OnboardingCoachmarks.Seen, etc.), since the app reads them back through GET /api/settings — so this spec boots with onboarding and the tutorial re-enabled unlike every other spec. The glob also swallows POST /api/settings (acked but dropped) while not matching POST /api/settings/<id>, which still reaches the backend; stub only what the test needs, or merge the fixture defaults into the response. Raised by 1 of 8 reviewers (claude-opus-5-thinking-max edge-case).

await page.route('**/api/userdata**', (route) =>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Low — **/api/userdata** matches every userdata path and every verb but always answers 200 with an array: single-file reads (GET /api/userdata/<file>) get [] instead of their real body or a 404, and PUT/POST/DELETE writes are silently acked without happening, so a persistence regression would stay invisible behind a green test. Scope the route to the listing requests the boot path actually needs. Raised by 2 of 8 reviewers (claude-opus-5-thinking-max adversarial, claude-opus-5-thinking-max edge-case).

route.fulfill(jsonRoute([]))
)
await use(page)
}
})
Comment on lines +10 to +18

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Note to self: Another routing fixture to add to the standardization work.


test.describe(
'Remote widget web-session routing',
{ tag: ['@cloud', '@widget'] },

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Or does @cloud imply @vue-nodes?

Suggested change
{ tag: ['@cloud', '@widget'] },
{ tag: ['@cloud', '@widget', '@vue-nodes'] },

() => {
test.describe.configure({ timeout: 120_000 })

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

These can't all actually need this long a timeout.
If our tests are this bad, we should just set the long timeout globally and then do periodic audits.


test.use({
initialLocalStorage: {
'Comfy.Workspace.LastWorkspaceId': TEAM_WORKSPACE_ID
}
})

test('shows options from the selected team workspace', async ({

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Low — The suite is named for workspace routing but contains a single positive load and never switches workspaces, so the PERSONAL_OPTIONS branch of the route handler is dead and the cross-tenant case goes untested. Since useRemoteWidget's cache key is route;r=<refresh>;<params> with no workspace component and no invalidation on workspace change, a switch-then-reassert case is exactly the scenario most likely to expose a real bug here. Raised by 1 of 8 reviewers (claude-opus-5-thinking-max adversarial).

comfyPage
}) => {
await comfyPage.page.route(
'**/api/models/checkpoints**',
async (route) => {
const workspaceId = await route
.request()
.headerValue('x-comfy-workspace-id')
await route.fulfill(
jsonRoute(
workspaceId === TEAM_WORKSPACE_ID
? TEAM_OPTIONS
: PERSONAL_OPTIONS
)
)
}
)
Comment on lines +35 to +49

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Normally I would expect a matching route promise binding and a subsequent await.


await comfyPage.workflow.loadWorkflow('inputs/remote_widget')

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Low — The workflow is loaded without first waiting for the web session and workspace scope to be established. useRemoteWidget.fetchData calls api.fetchOnWebSession, which returns undefined while webSessionRequests().scope() is unresolved and falls back to a plain axios.get carrying no x-comfy-workspace-id; because this node's remote config has no refresh the cached entry is permanent, so one early header-less request pins PERSONAL_OPTIONS and the poll can never recover. Gate the loadWorkflow on the session/workspace being ready so a lost race reads as a product failure only when it really is one. Raised by 1 of 8 reviewers (claude-opus-5-thinking-max edge-case).


await expect

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Medium — test.describe.configure({ timeout: 120_000 }) raises only the test timeout; expect.poll is bounded by the separate expect timeout, which the cloud project does not override (only cloud-live sets expect: { timeout: 30_000 }), so this poll gives up after Playwright's 5s default regardless of the 120s budget. On a slow web-session boot the test fails at the poll long before the intended budget — pass an explicit { timeout } to expect.poll. Raised by 2 of 8 reviewers (claude-opus-5-thinking-max edge-case, kimi-k3-max edge-case).

.poll(() =>
comfyPage.page.evaluate(() => {
const node = window.app!.graph.nodes.find(
({ title }) => title === 'Remote Widget Node'
)
Comment on lines +56 to +58

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Don't we have a utility for this that we could use?

return {
options: node?.widgets?.[0].options.values,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Medium — node?.widgets?.[0].options.values is not fully null-safe: optional chaining short-circuits only on nullish operands, so when widgets is an empty array [0] is undefined and .options throws a TypeError inside page.evaluate rather than yielding a value the poll can compare. Use node?.widgets?.[0]?.options?.values (and the same for .value on the next line) so a transient empty-widgets window produces a clean mismatch instead of an opaque evaluate error. Raised by 3 of 8 reviewers (claude-opus-5-thinking-max adversarial, claude-opus-5-thinking-max edge-case, kimi-k3-max edge-case).

value: node?.widgets?.[0].value
}
})
)
.toEqual({ options: TEAM_OPTIONS, value: TEAM_OPTIONS[0] })
})
}
)
Loading