diff --git a/tests/assistant/configuration-ui.test.cjs b/tests/assistant/configuration-ui.test.cjs index fa9e362..231300a 100644 --- a/tests/assistant/configuration-ui.test.cjs +++ b/tests/assistant/configuration-ui.test.cjs @@ -27,6 +27,12 @@ test( apiKey: 'TEST_REVIEW_UI_KEY', allowActions: true, }); + const longModelName = 'skyworth-deepseek-v4.1-flash-with-complete-long-model-name'; + const provider = store.providers.read('deepseek'); + store.providers.save({ + ...provider, + models: provider.models.map((model) => ({ ...model, name: longModelName })), + }); assistant.runtime.chat = async () => JSON.stringify({ reply: '建议调整发送时间,请审查风险。', @@ -94,11 +100,12 @@ test( await page.getByText('已停止', { exact: true }).waitFor(); assert.equal(await send.isDisabled(), true); await page.setViewportSize({ width: 390, height: 844 }); - await page.evaluate(() => { + // Re-render from the catalogue instead of injecting transient button text. + await page.evaluate(() => PageLifecycle.refreshRegions('assistant')); + await page.waitForFunction((name) => { const picker = document.querySelector('#assistant-model-picker'); - AssistantModelPicker; - picker.textContent = 'DeepSeek / skyworth-deepseek-v4.1-flash-with-complete-long-model-name'; - }); + return picker?.textContent.includes(name) && picker.scrollWidth <= picker.clientWidth; + }, longModelName); const model = page.locator('#assistant-model-picker'); const full = await model.evaluate((e) => ({ clipped: e.scrollWidth > e.clientWidth, @@ -137,5 +144,6 @@ test( true, ); await latest.waitFor({ state: 'hidden' }); + assert.equal(await model.innerText(), provider.name + ' / ' + longModelName); }, );