test(assistant): keep long model names stable across redraws

This commit is contained in:
abaishu0730 committed 2026-10-29 14:10:02 +08:00
1 parent fc9b8af3dd
commit 3b3cf74013
1 file changed
+12 -4
+12 -4
View File
@@ -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);
},
);