From cc988144a0bc40f353e1769aa08cabd55f841ff9 Mon Sep 17 00:00:00 2001 From: Paul Bakaus Date: Fri, 4 Sep 2026 19:29:46 -0700 Subject: [PATCH] Fix: wait for settled Svelte test variants Reuse the shared mount-aware cycling helper before subsequent clicks and reload. Keep the DeepSeek request limits scoped to that provider so other provider defaults stay unchanged. Prepared with AI assistance under maintainer direction. --- tests/live-e2e/agents/llm-agent.mjs | 4 ++-- tests/live-svelte-adapter-deepseek.test.mjs | 15 ++++++--------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/tests/live-e2e/agents/llm-agent.mjs b/tests/live-e2e/agents/llm-agent.mjs index d9fa82acf..796830419 100644 --- a/tests/live-e2e/agents/llm-agent.mjs +++ b/tests/live-e2e/agents/llm-agent.mjs @@ -620,10 +620,10 @@ export async function createLlmAgent(opts = {}) { max_tokens: 4096, system: systemBlocks(STEER_SYSTEM_INSTRUCTIONS), messages: [{ role: 'user', content: userMessage }], - }, { + }, provider === 'deepseek' ? { maxRetries: LLM_REQUEST_MAX_RETRIES, timeout: MANUAL_EDIT_REQUEST_TIMEOUT_MS, - }); + } : {}); const cacheRead = response.usage?.cache_read_input_tokens ?? 0; const inputTokens = response.usage?.input_tokens ?? 0; diff --git a/tests/live-svelte-adapter-deepseek.test.mjs b/tests/live-svelte-adapter-deepseek.test.mjs index af37031ed..af77c8c49 100644 --- a/tests/live-svelte-adapter-deepseek.test.mjs +++ b/tests/live-svelte-adapter-deepseek.test.mjs @@ -27,7 +27,7 @@ import { clickExitLiveMode, clickGo, clickNext, - clickPrev, + cycleToVariant, clickSaveEdit, drawAnnotationPinAndStroke, editTextLeaf, @@ -40,6 +40,7 @@ import { waitForBarHidden, waitForCycling, waitForHandshake, + waitForVariantSettled, } from './live-e2e/ui.mjs'; const __dirname = dirname(fileURLToPath(import.meta.url)); @@ -514,14 +515,10 @@ async function clickPendingTrash(page) { } async function cycleTo(page, target) { - for (let i = 0; i < 6; i++) { - const visible = await getVisibleVariant(page); - if (visible === target) return; - if (visible == null) await page.waitForTimeout(250); - else if (visible < target) await clickNext(page); - else await clickPrev(page); - } - assert.equal(await getVisibleVariant(page), target, `variant ${target} visible`); + // Component imports finish after the counter changes. Do not send the next + // click (or reload) while the previous variant is still mounting. + await cycleToVariant(page, target, 3); + await waitForVariantSettled(page, target, 3); } async function waitForVisibleCycling(page, count, { timeout }) {