实现项目真机预览与待审版本扫码验收

需求:接管客户端未提交 WIP,保留真机预览,移除旧登录原型并维持 2.0.0。

实现:由 Main 核对项目与精确 Release,签发短时 Owner preview;补充一键提交映射能力及 Windows ZIP 预检兼容。
This commit is contained in:
2026-08-08 17:57:36 +08:00
parent 7b23cce67a
commit 1a19ad9808
20 changed files with 1890 additions and 12 deletions

View File

@@ -0,0 +1,34 @@
import { fireEvent, render, screen } from '@testing-library/react';
import { MemoryRouter, Route, Routes, useLocation } from 'react-router-dom';
import { describe, expect, it, vi } from 'vitest';
import { Chat } from '@/pages/Chat';
vi.mock('@/pages/Chat/OpencodeChatPanel', () => ({
OpencodeChatPanel: ({ onOpenDevicePreview }: { onOpenDevicePreview?: () => void }) => (
<button type="button" onClick={onOpenDevicePreview}>
</button>
),
}));
function LocationProbe() {
const location = useLocation();
return <output data-testid="location-path">{location.pathname}</output>;
}
describe('Chat 真机预览导航', () => {
it('点击真机预览入口后导航到 /device-preview', () => {
render(
<MemoryRouter initialEntries={['/opencode-chat']}>
<Routes>
<Route path="/opencode-chat" element={<Chat />} />
<Route path="*" element={<LocationProbe />} />
</Routes>
</MemoryRouter>,
);
fireEvent.click(screen.getByRole('button', { name: '打开真机预览' }));
expect(screen.getByTestId('location-path')).toHaveTextContent('/device-preview');
});
});