新增 pc-client:畅联 PC 端工程(Electron+React,按确认效果图改造,B-59)

- 基于 openim-electron-demo 改造:工号+密码登录(自研账号服务)、会话列表/聊天窗/通讯录界面重做
- 文字/语音/文件/图片消息、文件拖拽发送、表情面板、一对一语音通话(LiveKit)
- RTC 令牌对接账号服务带鉴权版 /api/rtc_token(Bearer imToken + {room,identity})
- account-service: CORS Allow-Headers 补 authorization(浏览器/渲染进程跨域调 rtc_token 需要)
- 附本地 mock 账号服务(scripts/mock-account-server.js)与截图联调脚本
This commit is contained in:
KIMI
2026-08-09 09:11:06 +08:00
parent b95159f7eb
commit 7ce40e356f
284 changed files with 31599 additions and 7 deletions
+21
View File
@@ -0,0 +1,21 @@
const { chromium } = require("@playwright/test");
(async () => {
const browser = await chromium.launch({
executablePath:
"C:/Users/MoBai/AppData/Local/ms-playwright/chromium_headless_shell-1228/chrome-headless-shell-win64/chrome-headless-shell.exe",
});
const page = await browser.newPage({ viewport: { width: 1200, height: 800 } });
page.on("console", (msg) => console.log("[" + msg.type() + "]", msg.text().slice(0, 300)));
page.on("pageerror", (err) => console.log("[pageerror]", String(err).slice(0, 500)));
await page.goto("http://localhost:5173/");
await page.waitForTimeout(6000);
const html = await page.content();
console.log("body length:", html.length);
console.log(html.slice(0, 800));
await browser.close();
})().catch((e) => {
console.error(e);
process.exit(1);
});
+8
View File
@@ -0,0 +1,8 @@
import { test, expect, _electron as electron } from "@playwright/test";
test("homepage has title and links to intro page", async () => {
const app = await electron.launch({ args: [".", "--no-sandbox"] });
const page = await app.firstWindow();
expect(await page.title()).toBe("OpenCorp");
await page.screenshot({ path: "e2e/screenshots/example.png" });
});
+46
View File
@@ -0,0 +1,46 @@
/* 临时截图脚本:mock 登录后截取登录页/主界面/通讯录 */
const { chromium } = require("@playwright/test");
(async () => {
const browser = await chromium.launch({
executablePath:
"C:/Users/MoBai/AppData/Local/ms-playwright/chromium_headless_shell-1228/chrome-headless-shell-win64/chrome-headless-shell.exe",
});
const page = await browser.newPage({ viewport: { width: 1200, height: 800 } });
page.on("console", (msg) => {
if (msg.type() === "error") console.log("[console.error]", msg.text().slice(0, 200));
});
await page.goto("http://localhost:5173/", { waitUntil: "networkidle" });
await page.waitForTimeout(2000);
await page.screenshot({ path: "e2e/screenshots/01-login.png" });
await page.fill('input[placeholder="请输入工号"]', "test001");
await page.fill('input[placeholder="请输入您的密码"]', "test123");
await page.click('button:has-text("登录")');
// 等 SDK 登录 + 同步
await page.waitForTimeout(18000);
await page.screenshot({ path: "e2e/screenshots/02-main.png" });
// 进入会话
await page.click('text=测试二号');
await page.waitForTimeout(4000);
await page.screenshot({ path: "e2e/screenshots/04-chat.png" });
// 发一条文字消息看气泡
await page.fill("textarea", "好,我开完会就看,下午给你回复");
await page.keyboard.press("Enter");
await page.waitForTimeout(2500);
await page.screenshot({ path: "e2e/screenshots/05-chat-sent.png" });
await page.goto("http://localhost:5173/#/contact");
await page.waitForTimeout(4000);
await page.screenshot({ path: "e2e/screenshots/03-contact.png" });
await browser.close();
console.log("done");
})().catch((e) => {
console.error(e);
process.exit(1);
});
+44
View File
@@ -0,0 +1,44 @@
const { chromium } = require("@playwright/test");
(async () => {
const browser = await chromium.launch({
executablePath:
"C:/Users/MoBai/AppData/Local/ms-playwright/chromium_headless_shell-1228/chrome-headless-shell-win64/chrome-headless-shell.exe",
});
const page = await browser.newPage({ viewport: { width: 1200, height: 800 } });
await page.goto("http://localhost:5173/");
await page.waitForTimeout(1500);
const hasLogin = await page.$('input[placeholder="请输入工号"]');
if (hasLogin) {
await page.fill('input[placeholder="请输入工号"]', "test001");
await page.fill('input[placeholder="请输入您的密码"]', "test123");
await page.click('button:has-text("登录")');
await page.waitForTimeout(15000);
} else {
await page.waitForTimeout(12000);
}
await page.click("text=测试二号");
await page.waitForTimeout(3000);
// 「…」菜单
await page.click(".anticon-more");
await page.waitForTimeout(800);
await page.screenshot({ path: "e2e/screenshots/06-header-menu.png" });
await page.keyboard.press("Escape");
await page.waitForTimeout(500);
// 表情面板
await page.click(".anticon-smile");
await page.waitForTimeout(800);
await page.screenshot({ path: "e2e/screenshots/07-emoji.png" });
await page.keyboard.press("Escape");
await browser.close();
console.log("done");
})().catch((e) => {
console.error(e);
process.exit(1);
});