diff --git a/scripts/ci/python_shards.json b/scripts/ci/python_shards.json index c2b76342c..470bc6a29 100644 --- a/scripts/ci/python_shards.json +++ b/scripts/ci/python_shards.json @@ -4,6 +4,7 @@ "core": [ "tests/test_a2_repros.py", "tests/test_app_settings.py", + "tests/test_ark_availability.py", "tests/test_ark_plan_models.py", "tests/test_asset_names.py", "tests/test_atlascloud.py", @@ -103,6 +104,7 @@ "tests/test_self_hosted_proxy.py", "tests/test_self_hosted_queue.py", "tests/test_structure_reference.py", + "tests/test_trace_job_queries.py", "tests/test_vllm_omni_h3.py", "tests/test_vllm_omni_image.py", "tests/test_voice_library.py", @@ -136,7 +138,8 @@ "tests/test_native_runtime.py", "tests/test_native_sessions.py", "tests/test_pi_runtime.py", - "tests/test_skill_snapshot.py" + "tests/test_skill_snapshot.py", + "tests/test_wait_outcome.py" ], "media": [ "tests/test_canvas_text_cli_http.py", diff --git a/src/canvas/DraftAvailabilityCheck.tsx b/src/canvas/DraftAvailabilityCheck.tsx index 6230c01fa..9d93d86a4 100644 --- a/src/canvas/DraftAvailabilityCheck.tsx +++ b/src/canvas/DraftAvailabilityCheck.tsx @@ -5,10 +5,8 @@ import { } from "../backend/models.ts"; import type { ModelAvailability } from "../backend/availability.ts"; import { errorMessage } from "../backend/api.ts"; -import { ModelAvailabilityCard } from "./ModelAvailabilityCard"; -/** A draft check never publishes an observation into the saved model catalog. */ -export function DraftAvailabilityCheck({ +export function useDraftAvailability({ connection, configId, modelId, @@ -27,6 +25,10 @@ export function DraftAvailabilityCheck({ observation: ModelAvailability; } | null>(null); const [pending, setPending] = useState(null); + const [duration, setDuration] = useState<{ + signature: string; + ms: number; + } | null>(null); const [failure, setFailure] = useState<{ signature: string; message: string; @@ -39,6 +41,7 @@ export function DraftAvailabilityCheck({ }, []); const check = async () => { const attempt = ++serial.current; + const started = performance.now(); setPending(signature); setFailure(null); try { @@ -50,8 +53,13 @@ export function DraftAvailabilityCheck({ alive.current && latest.current === signature && serial.current === attempt - ) + ) { setValue({ signature, observation }); + setDuration({ + signature, + ms: Math.max(0, Math.round(performance.now() - started)), + }); + } } catch (error) { if ( alive.current && @@ -59,18 +67,21 @@ export function DraftAvailabilityCheck({ serial.current === attempt ) { setValue(null); + setDuration({ + signature, + ms: Math.max(0, Math.round(performance.now() - started)), + }); setFailure({ signature, message: errorMessage(error) }); } } finally { if (alive.current && serial.current === attempt) setPending(null); } }; - return ( - void check()} - error={failure?.signature === signature ? failure.message : undefined} - /> - ); + return { + value: value?.signature === signature ? value.observation : null, + checking: pending === signature, + durationMs: duration?.signature === signature ? duration.ms : undefined, + error: failure?.signature === signature ? failure.message : undefined, + check: () => void check(), + }; } diff --git a/src/canvas/ModelAvailabilityCard.tsx b/src/canvas/ModelAvailabilityCard.tsx index fbc311366..d314776ae 100644 --- a/src/canvas/ModelAvailabilityCard.tsx +++ b/src/canvas/ModelAvailabilityCard.tsx @@ -20,12 +20,14 @@ export function ModelAvailabilityCard({ checking = false, title, error, + actions = true, }: { value?: ModelAvailability | null; onRefresh?: () => void; checking?: boolean; title?: string; error?: string; + actions?: boolean; }) { const { t, locale } = useI18n(); const [tick, setTick] = useState(0); @@ -55,8 +57,35 @@ export function ModelAvailabilityCard({ aria-label={t("availability.title")} >
- {title ?? t("availability.title")} - {onRefresh && ( +
+ {title ?? t("availability.title")} + {current?.operations.length ? ( + + {current.operations.map((item) => { + const chip = availabilityRow(item, notice); + return ( + + + {availabilityProfile(item.profile)} + + + {chip.text} + + + ); + })} + + ) : null} +
+ {actions && onRefresh && (
-
- {status &&

{status}

} -
+ {(!compact || !redundantStatus) && ( +
+ {status &&

{status}

} +
+ )} {error && (

{error} @@ -186,18 +193,22 @@ export function ModelPicker({ onChange={(event) => setQuery(event.target.value)} /> - + {!compact && ( + + )}

- {t("generation.picker.count", { count: visible.length })} + {denseCount && loaded && !loading && !error && available.length + ? t("generation.picker.fetched", { count: available.length }) + : t("generation.picker.count", { count: visible.length })} + )} +
+ {t("models.service.capabilityDetails")} + + {children} +
+ + ); +} diff --git a/src/canvas/ModelServiceForm.tsx b/src/canvas/ModelServiceForm.tsx index 9ae49e7c5..68904a827 100644 --- a/src/canvas/ModelServiceForm.tsx +++ b/src/canvas/ModelServiceForm.tsx @@ -1,4 +1,3 @@ -import { DraftAvailabilityCheck } from "./DraftAvailabilityCheck"; import { ProviderPicker } from "./ProviderPicker"; import { useId, useLayoutEffect, useState, type FormEvent, type Ref } from "react"; import { errorMessage } from "../backend/api.ts"; @@ -16,6 +15,7 @@ import { type ModelKind, } from "../backend/rules.ts"; import { ModelCapabilityCard } from "./ModelCapabilityCard"; +import { ModelRowDetails } from "./ModelRowDetails"; import { PROVIDER_PRESETS, matchingConnections, @@ -552,28 +552,32 @@ export function ModelServiceForm({ }} onTest={kind === "agent" ? (id) => void test(id) : undefined} results={results} + compact renderDetails={(id) => ( - <> - - - setModelOptions((current) => ({ - ...current, - [id]: { ...current[id], ...patch }, - })) - } - onValidity={(message) => - setModelErrors((current) => ({ ...current, [id]: message })) - } - /> - + > + + setModelOptions((current) => ({ + ...current, + [id]: { ...current[id], ...patch }, + })) + } + onValidity={(message) => + setModelErrors((current) => ({ ...current, [id]: message })) + } + /> + )} /> {segmentation && ( diff --git a/src/canvas/model-settings.css b/src/canvas/model-settings.css index 9ddb679f1..87179b855 100644 --- a/src/canvas/model-settings.css +++ b/src/canvas/model-settings.css @@ -416,7 +416,7 @@ } .cw-model-editor .cw-model-row-test { min-height: 28px; - padding: 2px 6px; + padding: 2px; font-size: var(--settings-caption-size); } .cw-model-empty-state { @@ -676,12 +676,92 @@ .cw-model-editor-scroll > .cw-model-connection-details { margin: 0 0 16px; } .cw-model-editor-scroll > .cw-provider-key { margin: 0 0 18px; } +.cw-model-option > .cw-model-row-details { + flex: 0 0 auto; + margin-left: auto; +} +.cw-model-option > .cw-model-row-details[open] { + flex-basis: 100%; + margin-left: 0; +} +.cw-model-row-details > summary { + display: flex; + align-items: center; + gap: 6px; + cursor: pointer; + list-style: none; + color: var(--settings-muted); + font-size: var(--settings-caption-size); + white-space: nowrap; +} +.cw-model-row-details > summary::-webkit-details-marker { + display: none; +} +.cw-model-row-details > summary::before { + content: "▸"; + font-size: 10px; + line-height: 1; +} +.cw-model-row-details[open] > summary::before { + content: "▾"; +} +.cw-model-row-details[open] > summary { + margin-bottom: 8px; +} + .cw-model-availability { padding: 12px 0; font-size: var(--settings-label-size, 13px); } .cw-model-option > .cw-model-availability { flex-basis: 100%; width: 100%; min-width: 0; border-top: 1px solid var(--settings-border); } .cw-model-availability-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; } +.cw-model-availability-title { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; min-width: 0; } +.cw-availability-chips { display: flex; flex-wrap: wrap; gap: 6px; } +.cw-availability-chip { + display: inline-flex; + align-items: center; + gap: 7px; + padding: 3px 10px; + border: 1px solid var(--settings-border); + border-radius: 999px; + background: var(--settings-input); + color: var(--settings-text); + font-size: var(--settings-caption-size); + line-height: 1.5; + white-space: nowrap; +} +.cw-availability-chip .cw-availability-op { color: inherit; } +.cw-availability-chip[data-availability="available"] { + border-color: color-mix(in srgb, var(--settings-positive) 45%, transparent); + background: var(--settings-positive-background); + color: var(--settings-positive); +} +.cw-availability-chip[data-availability="unavailable"] { + border-color: color-mix(in srgb, var(--settings-negative) 45%, transparent); + background: var(--settings-negative-background); + color: var(--settings-negative); +} +.cw-availability-chip[data-availability="unknown"] { color: var(--settings-text); } .cw-model-availability p, .cw-model-availability small { color: var(--settings-muted); } .cw-model-availability ul { display: grid; gap: 8px; margin: 10px 0; padding: 0; list-style: none; } .cw-model-availability li { display: grid; grid-template-columns: minmax(80px, 1fr) minmax(0, 3fr); gap: 12px; overflow-wrap: anywhere; } +.cw-availability-state { + display: inline-flex; + align-items: center; + gap: 5px; + color: var(--settings-muted); +} +.cw-availability-state::before { + content: ""; + width: 5px; + height: 5px; + flex: none; + border-radius: 50%; + background: currentColor; +} +.cw-availability-state[data-availability="available"] { color: var(--settings-positive); } +.cw-availability-state[data-availability="unavailable"] { + color: var(--settings-negative); + font-weight: 500; +} +.cw-availability-state[data-availability="unknown"] { color: var(--settings-muted); } .cw-model-availability-details { padding: 12px 16px; border-top: 1px solid var(--settings-border); } .cw-model-availability-details summary { cursor: pointer; } .cw-model-availability [data-availability="unavailable"] { color: var(--cw-danger, #b45336); } @@ -693,3 +773,5 @@ .cw-model-input-details dd { margin: 0; } .cw-model-input-details small { display: block; } .cw-model-input-details summary small { display: inline; margin-inline-start: 8px; } + +.cw-model-row-test { margin-inline-start: auto; } diff --git a/src/canvas/themes.css b/src/canvas/themes.css index e8096fc82..74ac0a933 100644 --- a/src/canvas/themes.css +++ b/src/canvas/themes.css @@ -10,6 +10,10 @@ --settings-input: #19191b; --settings-warning: #f3b7a6; --settings-warning-background: #45332c; + --settings-positive: #8ed3a8; + --settings-positive-background: #24382e; + --settings-negative: #f0a3a3; + --settings-negative-background: #43282a; } :root[data-theme="light"] { color-scheme: light; @@ -25,6 +29,10 @@ --settings-input: #fafbfc; --settings-warning: #9a4d36; --settings-warning-background: #fff1e9; + --settings-positive: #2f7a4f; + --settings-positive-background: #eaf6ee; + --settings-negative: #a63c3c; + --settings-negative-background: #fdeeee; } :root[data-theme="light"] .cw-workspace { background: #f7f8fa; diff --git a/src/i18n/messages/en-US/availability.ts b/src/i18n/messages/en-US/availability.ts index d54d31528..b3560cb69 100644 --- a/src/i18n/messages/en-US/availability.ts +++ b/src/i18n/messages/en-US/availability.ts @@ -50,6 +50,12 @@ export const availability = { "availability.checkedAt": "Last checked: {time}", "availability.status.available": "Supported", "availability.status.unknown": "Unknown", + "availability.rowTest": "Test", + "availability.rowTested": "Tested", + "availability.rowExpired": "Expired", + "availability.rowOutcome.passed": "Passed", + "availability.rowOutcome.unsupported": "Not supported", + "availability.rowOutcome.unknown": "Unknown", "availability.reason.not_checked": "Not checked", "availability.reason.supported": "Supported", "availability.reason.operation_unsupported": "Not supported", diff --git a/src/i18n/messages/en-US/models.ts b/src/i18n/messages/en-US/models.ts index 2202e46c3..19e34cd67 100644 --- a/src/i18n/messages/en-US/models.ts +++ b/src/i18n/messages/en-US/models.ts @@ -138,6 +138,7 @@ export const models = { "models.service.reuseConnection": "Reuse saved connection · {model}", "models.service.reuseHint": "Otherwise this will be saved as a separate connection.", + "models.service.capabilityDetails": "Capabilities and parameters", "models.service.loadSupportedModels": "Load supported models", "models.service.minimaxNote": "The model list comes from the built-in declaration. Loading it does not verify the key or create a video task.", diff --git a/src/i18n/messages/zh-CN/availability.ts b/src/i18n/messages/zh-CN/availability.ts index 0f453af53..03a533542 100644 --- a/src/i18n/messages/zh-CN/availability.ts +++ b/src/i18n/messages/zh-CN/availability.ts @@ -50,6 +50,12 @@ export const availability = { "availability.checkedAt": "最近检查:{time}", "availability.status.available": "支持", "availability.status.unknown": "待确认", + "availability.rowTest": "测试", + "availability.rowTested": "已测试", + "availability.rowExpired": "已过期", + "availability.rowOutcome.passed": "通过", + "availability.rowOutcome.unsupported": "不支持", + "availability.rowOutcome.unknown": "待确认", "availability.reason.not_checked": "尚未检查", "availability.reason.supported": "支持", "availability.reason.operation_unsupported": "不支持", diff --git a/src/i18n/messages/zh-CN/models.ts b/src/i18n/messages/zh-CN/models.ts index 73fbc9de2..47fc51a38 100644 --- a/src/i18n/messages/zh-CN/models.ts +++ b/src/i18n/messages/zh-CN/models.ts @@ -115,6 +115,7 @@ export const models = { "models.service.existingConnections": "已有相同地址的连接", "models.service.reuseConnection": "复用已保存连接 · {model}", "models.service.reuseHint": "不复用则保存为独立连接。", + "models.service.capabilityDetails": "服务能力与参数", "models.service.loadSupportedModels": "载入支持的模型", "models.service.minimaxNote": "模型列表来自内置声明,载入不验证密钥,也不创建视频任务。", diff --git a/tests/browser/capability_discovery.mjs b/tests/browser/capability_discovery.mjs index 3f153e4c6..9a2e0ce38 100644 --- a/tests/browser/capability_discovery.mjs +++ b/tests/browser/capability_discovery.mjs @@ -260,7 +260,52 @@ try { .locator(".cw-model-manual") .getByRole("button", { name: "Add", exact: true }) .click(); + const test = page.locator(".cw-model-row-test").first(); + await test.waitFor(); + assert.equal( + (await test.textContent())?.trim(), + "Test", + "a model that was never checked offers the check action", + ); + const row = page.locator(".cw-model-option").first(); + const fold = row.locator(".cw-model-row-details"); + await fold.waitFor(); + assert.equal( + await fold.evaluate((element) => element.open), + false, + "capability details stay folded by default", + ); + assert.equal( + await row.locator("button").count(), + 1, + "the folded row offers exactly one action", + ); + assert.equal( + (await fold.locator("> summary").innerText()).trim(), + "Capabilities and parameters", + "the fold is labelled", + ); + await fold.locator("> summary").click(); const draft = page.locator(".cw-model-editor .cw-model-availability"); + await draft.waitFor(); + const checkRow = () => page.locator(".cw-model-row-test").first().click(); + async function captureFoldedRow(state) { + if (!process.env.CREATION_SCREENSHOT) return; + const target = process.env.CREATION_SCREENSHOT; + await fold.locator("> summary").click(); + await row.screenshot({ + path: join( + dirname(target), + `${basename(target, extname(target))}-row-${state}${extname(target)}`, + ), + }); + await fold.locator("> summary").click(); + } + assert.equal( + await row.locator("button").count(), + 1, + "opening the fold does not add a second action", + ); async function presentInBothLanguages(state, expected) { for (const locale of ["en-US", "zh-CN"]) { await page.evaluate((next) => { @@ -336,7 +381,7 @@ try { ); assert.ok( bounds.labelWidth >= bounds.cardWidth * 0.9, - `${state}: model identity retains the available width`, + `${state}: model identity retains the available width ${JSON.stringify(bounds)}`, ); assert.ok( bounds.cardTop >= bounds.visibleTop - 1 && @@ -385,9 +430,7 @@ try { const lateDraft = page.waitForResponse((response) => response.url().endsWith("/model-configs/availability/check"), ); - await draft - .getByRole("button", { name: /^(Check|Refresh|Retry)$/, exact: true }) - .click(); + await checkRow(); await page .getByLabel("Service URL (Base URL)", { exact: true }) .fill(serviceUrl + "/changed"); @@ -402,10 +445,18 @@ try { .getByLabel("Service URL (Base URL)", { exact: true }) .fill(serviceUrl); delay = 0; - await draft - .getByRole("button", { name: /^(Check|Refresh|Retry)$/, exact: true }) - .click(); + await checkRow(); await draft.getByText("Not supported").first().waitFor(); + assert.equal( + await page.locator(".cw-model-row-test").first().getAttribute("data-outcome"), + "unsupported", + "the folded row reports an unsupported outcome without opening the card", + ); + assert.match( + (await page.locator(".cw-model-row-test").first().textContent())?.trim() ?? "", + /^✕(?:\d+ms|\d+\.\d s)$/, + ); + await captureFoldedRow("unsupported"); assert.equal( (await call("/api/model-configs")).some((item) => item.modelId === served), false, @@ -424,10 +475,10 @@ try { const draftUrl = page.getByLabel("Service URL (Base URL)", { exact: true }); async function checkDraft(nextMode) { mode = nextMode; - await draft - .getByRole("button", { name: /^(Check|Refresh|Retry)$/, exact: true }) - .click(); - await until(async () => !(await draft.getByRole("button").isDisabled())); + await checkRow(); + await until( + async () => !(await page.locator(".cw-model-row-test").first().isDisabled()), + ); assert.equal(await draftUrl.inputValue(), serviceUrl); assert.equal( (await call("/api/model-configs")).some( @@ -437,6 +488,17 @@ try { ); } await checkDraft("supported"); + assert.equal( + await page.locator(".cw-model-row-test").first().getAttribute("data-outcome"), + "passed", + "the folded row reports a passing outcome", + ); + assert.match( + (await page.locator(".cw-model-row-test").first().textContent())?.trim() ?? "", + /^✓(?:\d+ms|\d+\.\d s)$/, + "the folded row shows the check duration", + ); + await captureFoldedRow("passed"); assert.equal( await draft.getByRole("status").count(), 0, @@ -447,8 +509,16 @@ try { "Single-image editing", "Multi-image editing", ]) - assert.equal(await draft.getByText(label, { exact: true }).count(), 1); - assert.equal(await draft.locator("[data-availability=available]").count(), 3); + assert.equal( + await draft.getByText(label, { exact: true }).count(), + 1, + `${label} appears once, with its state beside it`, + ); + assert.equal( + await draft.locator(".cw-availability-chip[data-availability=available]").count(), + 3, + "every supported capability is marked on its chip", + ); await draft.getByText("Input requirements", { exact: true }).click(); await presentInBothLanguages("normal", null); assert.equal( @@ -474,7 +544,7 @@ try { }), ); }); - await draft.getByText("多图编辑", { exact: true }).waitFor(); + await draft.locator(".cw-availability-op", { hasText: "多图编辑" }).waitFor(); assert.equal(await draft.getByText("选区输入", { exact: true }).count(), 1); assert.equal(await draft.getByText("1–3 张", { exact: true }).count(), 1); assert.equal(await draft.getByText("服务声明", { exact: true }).count(), 1); @@ -491,7 +561,7 @@ try { }), ); }); - await draft.getByText("Multi-image editing", { exact: true }).waitFor(); + await draft.locator(".cw-availability-op", { hasText: "Multi-image editing" }).waitFor(); await checkDraft("partial"); assert.equal(await draft.getByRole("status").count(), 0); assert.equal( @@ -505,12 +575,45 @@ try { await draft.getByText("Service paused", { exact: true }).count(), 0, ); - assert.equal(await draft.locator("[data-availability=available]").count(), 3); + assert.equal( + await draft.locator(".cw-availability-chip[data-availability=available]").count(), + 3, + ); await checkDraft("partial"); await presentInBothLanguages("partial", { "en-US": "Image count not confirmed", "zh-CN": "多图数量待确认", }); + await page.route( + draftCheckUrl, + async (route) => { + await new Promise((resolve) => setTimeout(resolve, 300)); + await route.fulfill({ + status: 503, + contentType: "application/json", + body: JSON.stringify({ detail: "Fixture check failed" }), + }); + }, + { times: 1 }, + ); + await checkRow(); + await until( + async () => + (await page.locator(".cw-model-row-test").first().getAttribute("data-outcome")) === + "failed", + ); + const failureRow = + (await page.locator(".cw-model-row-test").first().textContent())?.trim() ?? ""; + assert.match( + failureRow, + /^Check failed · (\d+)ms$/, + "a failed check reports a duration", + ); + assert.ok( + Number(/^Check failed · (\d+)ms$/.exec(failureRow)?.[1]) >= 250, + `a failed check times the failed attempt, not the last success: ${failureRow}`, + ); + await page.unroute(draftCheckUrl); // Error observations last two seconds. Hold browser time so both screenshots // inspect the same response, without issuing another check on a locale change. await page.clock.install(); @@ -573,7 +676,7 @@ try { 0, ); assert.equal( - await draft.locator("li [data-availability=unknown]").count(), + await draft.locator(".cw-availability-chip[data-availability=unknown]").count(), 3, ); } @@ -602,11 +705,15 @@ try { // Freeze before the response: advancing to pauseAt after receiving it would // expire the very observation whose two language presentations we inspect. await pauseCapabilityClock(); - await draft.getByRole("button", { name: "Retry", exact: true }).click(); + await checkRow(); assert.equal( - await draft.getByText("Checking…", { exact: true }).count(), + await page + .locator(".cw-model-row-test") + .first() + .getByText("Checking…", { exact: true }) + .count(), 1, - "checking appears only on the button", + "checking appears only on the row action", ); assert.equal(await draft.getByRole("status").count(), 0); await draft.getByText("Service paused", { exact: true }).waitFor(); @@ -630,25 +737,55 @@ try { 0, ); assert.equal( - await draft.locator("[data-availability=available]").count(), + await draft.locator(".cw-availability-chip[data-availability=available]").count(), 3, "pause expiry restores the retained declaration", ); await page.clock.fastForward(25100); - await draft - .getByText("Results expired. Refresh to check again.", { exact: true }) - .waitFor(); - assert.equal( - await draft - .getByText("Results expired. Refresh to check again.", { exact: true }) - .count(), - 1, - ); - assert.equal(await draft.locator("li[data-stale]").count(), 3); + await draft.locator(".cw-availability-chip[data-stale]").first().waitFor(); + assert.equal(await draft.locator(".cw-availability-chip[data-stale]").count(), 3); await presentInBothLanguages("expired", { "en-US": "Results expired. Refresh to check again.", "zh-CN": "检查结果已过期,请刷新", }); + for (const [locale, expected] of [ + ["en-US", "Expired"], + ["zh-CN", "已过期"], + ]) { + await page.evaluate((next) => { + localStorage.setItem("opendirector.locale.v1", next); + window.dispatchEvent( + new StorageEvent("storage", { + key: "opendirector.locale.v1", + newValue: next, + }), + ); + }, locale); + await until( + async () => (await page.locator("html").getAttribute("lang")) === locale, + ); + assert.equal( + await page.locator(".cw-model-row-test").first().getAttribute("data-outcome"), + "expired", + ); + assert.equal( + (await page.locator(".cw-model-row-test").first().textContent())?.trim(), + expected, + `an expired row stays readable in ${locale}`, + ); + } + await page.evaluate(() => { + localStorage.setItem("opendirector.locale.v1", "en-US"); + window.dispatchEvent( + new StorageEvent("storage", { + key: "opendirector.locale.v1", + newValue: "en-US", + }), + ); + }); + await until( + async () => (await page.locator("html").getAttribute("lang")) === "en-US", + ); assert.equal(await draftUrl.inputValue(), serviceUrl); await page.clock.resume(); await page.clock.setSystemTime(new Date()); @@ -830,7 +967,10 @@ try { await page.unroute(refreshUrl); await page.waitForTimeout(100); assert.equal(await serviceCard.getByText("Not supported", { exact: true }).count(), 0); - assert.equal(await serviceCard.locator("[data-availability=available]").count(), 3); + assert.equal( + await serviceCard.locator(".cw-availability-chip[data-availability=available]").count(), + 3, + ); // A remote negative declaration already 21 days old must not block this // saved selection or the actual generation performed below. diff --git a/tests/browser/kling_video.mjs b/tests/browser/kling_video.mjs index 06f9e85b2..5a6f96e38 100644 --- a/tests/browser/kling_video.mjs +++ b/tests/browser/kling_video.mjs @@ -185,6 +185,13 @@ try { await page .getByRole("checkbox", { name: "kling-4.0-flash", exact: true }) .check(); + const flashCard = page + .locator(".cw-model-option") + .filter({ hasText: "kling-4.0-flash" }) + .locator(".cw-model-capability-card") + .first(); + if (!(await flashCard.evaluate((element) => element.open))) + await flashCard.locator("summary").click(); await page.getByText(text.flashSummary, { exact: true }).waitFor(); await page.getByText("720P", { exact: true }).waitFor(); await page diff --git a/tests/browser/provider_settings.mjs b/tests/browser/provider_settings.mjs index 0cb5b4738..562e9ce0c 100644 --- a/tests/browser/provider_settings.mjs +++ b/tests/browser/provider_settings.mjs @@ -105,6 +105,12 @@ try { } finally { await page.unroute(discoveryEndpoint); } + await page.locator(".cw-model-row-test").first().waitFor(); + const firstFold = page.locator(".cw-model-row-details").first(); + await firstFold.waitFor(); + if (!(await firstFold.evaluate((element) => element.open))) + await firstFold.locator("> summary").click(); + await page.locator(".cw-model-editor .cw-model-availability").first().waitFor(); await page .getByText("Text-to-video / first-last frame / multimodal references", { exact: true }).first() .waitFor(); @@ -136,9 +142,21 @@ try { .locator(".cw-model-option") .filter({ hasText: "image-card" }); const textCard = page.locator(".cw-model-option").filter({ hasText: "text-card" }); - await textCard.locator("summary").click(); + const openDetails = async (option) => { + const rowFold = option.locator(".cw-model-row-details").first(); + if ( + (await rowFold.count()) && + !(await rowFold.evaluate((element) => element.open)) + ) + await rowFold.locator("> summary").click(); + const card = option.locator(".cw-model-capability-card").first(); + if (!(await card.count())) return; + if (!(await card.evaluate((element) => element.open))) + await card.locator("summary").click(); + }; + await openDetails(textCard); await textCard.getByRole("checkbox", { name: "Image understanding", exact: true }).uncheck(); - await card.locator("summary").click(); + await openDetails(card); await card.getByRole("checkbox", { name: "Image understanding", exact: true }).check(); await page.screenshot({ path: "/tmp/provider-settings-agent.png" }); await page.getByRole("button", { name: "Save service", exact: true }).click();