feat: allow editing local WeChat card names

This commit is contained in:
鲨鱼辣椒 committed 2026-10-14 14:20:17 +08:00
1 parent 436f7ba1ea
commit f1dabdb358
6 files changed
+314 -11

No files matched your search

+28
View File
@@ -578,6 +578,34 @@ test('WeChat binding cards connect an account and switch its Agent through the c
).toHaveCount(0);
await expect(legacyCard.getByText('状态待确认', { exact: true })).toHaveCount(0);
await expect(spareCard.getByRole('button', { name: '绑定智能体', exact: true })).toBeVisible();
const callsBeforeRemarks = await app.evaluate(() => (globalThis as typeof globalThis & {
cloudChannelFixtureCalls: { operation: string }[];
}).cloudChannelFixtureCalls.filter((item) => item.operation !== 'channelAccounts'));
await spareCard.getByRole('button', { name: '修改微信卡片名称:备用微信', exact: true }).click();
const cardNameField = page.getByRole('textbox', { name: '微信卡片名称', exact: true });
await cardNameField.fill('未保存备注');
await cardNameField.press('Escape');
await expect(cardNameField).toHaveCount(0);
await spareCard.getByRole('button', { name: '修改微信卡片名称:备用微信', exact: true }).click();
await cardNameField.fill('A'.repeat(64));
await app.evaluate(({ BrowserWindow }) => BrowserWindow.getAllWindows()[0].setSize(980, 700));
await page.screenshot({ path: testInfo.outputPath('wechat-card-name-edit-compact.png'), fullPage: true });
await cardNameField.press('Enter');
const remarkedCard = page.getByRole('article', { name: 'A'.repeat(64) + '微信', exact: true });
await expect(remarkedCard).toBeVisible();
expect(await remarkedCard.evaluate((element) => element.scrollWidth <= element.clientWidth)).toBe(true);
await page.reload();
await expect(remarkedCard).toBeVisible();
await expect(remarkedCard.getByRole('button', { name: '绑定智能体', exact: true })).toBeVisible();
await remarkedCard.getByRole('button', { name: '修改微信卡片名称:' + 'A'.repeat(64), exact: true }).click();
await cardNameField.fill('备用微信');
await cardNameField.press('Enter');
await expect(spareCard).toBeVisible();
const callsAfterRemarks = await app.evaluate(() => (globalThis as typeof globalThis & {
cloudChannelFixtureCalls: { operation: string }[];
}).cloudChannelFixtureCalls.filter((item) => item.operation !== 'channelAccounts'));
expect(callsAfterRemarks).toEqual(callsBeforeRemarks);
await app.evaluate(({ BrowserWindow }) => BrowserWindow.getAllWindows()[0].setSize(1366, 900));
await expect(page.getByRole('dialog')).toHaveCount(0);
await expect(page.getByText('活动记录', { exact: true })).toHaveCount(0);
await expect(page.getByRole('button', { name: '微信对话', exact: true })).toHaveCount(0);