test(assistant): keep long model names stable across redraws
This commit is contained in:
1 parent
fc9b8af3dd
commit
3b3cf74013
1 file changed
+12
-4
@@ -27,6 +27,12 @@ test(
|
|||||||
apiKey: 'TEST_REVIEW_UI_KEY',
|
apiKey: 'TEST_REVIEW_UI_KEY',
|
||||||
allowActions: true,
|
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 () =>
|
assistant.runtime.chat = async () =>
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
reply: '建议调整发送时间,请审查风险。',
|
reply: '建议调整发送时间,请审查风险。',
|
||||||
@@ -94,11 +100,12 @@ test(
|
|||||||
await page.getByText('已停止', { exact: true }).waitFor();
|
await page.getByText('已停止', { exact: true }).waitFor();
|
||||||
assert.equal(await send.isDisabled(), true);
|
assert.equal(await send.isDisabled(), true);
|
||||||
await page.setViewportSize({ width: 390, height: 844 });
|
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');
|
const picker = document.querySelector('#assistant-model-picker');
|
||||||
AssistantModelPicker;
|
return picker?.textContent.includes(name) && picker.scrollWidth <= picker.clientWidth;
|
||||||
picker.textContent = 'DeepSeek / skyworth-deepseek-v4.1-flash-with-complete-long-model-name';
|
}, longModelName);
|
||||||
});
|
|
||||||
const model = page.locator('#assistant-model-picker');
|
const model = page.locator('#assistant-model-picker');
|
||||||
const full = await model.evaluate((e) => ({
|
const full = await model.evaluate((e) => ({
|
||||||
clipped: e.scrollWidth > e.clientWidth,
|
clipped: e.scrollWidth > e.clientWidth,
|
||||||
@@ -137,5 +144,6 @@ test(
|
|||||||
true,
|
true,
|
||||||
);
|
);
|
||||||
await latest.waitFor({ state: 'hidden' });
|
await latest.waitFor({ state: 'hidden' });
|
||||||
|
assert.equal(await model.innerText(), provider.name + ' / ' + longModelName);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
Reference in new issue
Block a user