feat(v027): AutostartSection 진단 패널 + mismatch 경고
This commit is contained in:
@@ -4,6 +4,7 @@ import { inboxApi } from '../../api.js';
|
||||
|
||||
export function AutostartSection(): React.ReactElement {
|
||||
const [data, setData] = useState<AutostartResponse | null>(null);
|
||||
const [expanded, setExpanded] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
void (async () => {
|
||||
@@ -21,12 +22,58 @@ export function AutostartSection(): React.ReactElement {
|
||||
return <div style={{ fontSize: 12, color: '#666' }}>로딩 중...</div>;
|
||||
}
|
||||
|
||||
const d = data.diagnostic;
|
||||
// v0.2.7 F12 deeper fix — withArgs vs noArgs 의 openAtLogin 불일치, 또는
|
||||
// executableWillLaunchAtLogin = false 면 mismatch 로 간주 (등록은 됐지만 실제론
|
||||
// 로그인 시 실행되지 않을 수 있는 상태).
|
||||
const mismatch = d.withArgs.openAtLogin !== d.noArgs.openAtLogin
|
||||
|| (data.openAtLogin && !d.withArgs.executableWillLaunchAtLogin);
|
||||
|
||||
return (
|
||||
<div>
|
||||
<label style={{ display: 'flex', gap: 8, alignItems: 'center', fontSize: 13 }}>
|
||||
<input type="checkbox" checked={data.openAtLogin} onChange={onToggle} />
|
||||
앱 시작 시 자동으로 실행
|
||||
</label>
|
||||
{mismatch && (
|
||||
<div style={{ color: '#c33', fontSize: 12, marginTop: 4 }}>
|
||||
⚠️ 등록 상태 불일치 감지 — 진단 정보 확인 후 재등록을 시도하세요.
|
||||
</div>
|
||||
)}
|
||||
<button
|
||||
onClick={() => setExpanded(!expanded)}
|
||||
style={{
|
||||
background: 'none',
|
||||
border: 'none',
|
||||
cursor: 'pointer',
|
||||
fontSize: 12,
|
||||
color: '#0a4b80',
|
||||
marginTop: 4,
|
||||
padding: 0
|
||||
}}
|
||||
>
|
||||
{expanded ? '▾' : '▸'} 진단 정보
|
||||
</button>
|
||||
{expanded && (
|
||||
<div
|
||||
style={{
|
||||
fontSize: 11,
|
||||
lineHeight: 1.6,
|
||||
marginTop: 4,
|
||||
fontFamily: 'monospace',
|
||||
background: '#f5f5f5',
|
||||
padding: 8,
|
||||
borderRadius: 4,
|
||||
wordBreak: 'break-all'
|
||||
}}
|
||||
>
|
||||
<div>표준 (--hidden 인자): openAtLogin={String(d.withArgs.openAtLogin)}, willLaunch={String(d.withArgs.executableWillLaunchAtLogin)}</div>
|
||||
<div>비교 (인자 없이): openAtLogin={String(d.noArgs.openAtLogin)}, willLaunch={String(d.noArgs.executableWillLaunchAtLogin)}</div>
|
||||
<div>실행 파일 경로: {d.execPath}</div>
|
||||
{d.registryPath !== undefined && <div>registry 경로: {d.registryPath}</div>}
|
||||
{d.registryValue !== undefined && <div>registry 값: {d.registryValue ?? '(없음)'}</div>}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -43,4 +43,57 @@ describe('AutostartSection', () => {
|
||||
fireEvent.click(toggle);
|
||||
await waitFor(() => expect(inboxApi.setAutostart).toHaveBeenCalledWith(false));
|
||||
});
|
||||
|
||||
it('renders diagnostic panel when expanded, shows mismatch warning + execPath', async () => {
|
||||
const { inboxApi } = await import('../../src/renderer/inbox/api.js');
|
||||
vi.mocked(inboxApi.getAutostart).mockResolvedValueOnce({
|
||||
openAtLogin: true,
|
||||
diagnostic: {
|
||||
withArgs: { openAtLogin: true, executableWillLaunchAtLogin: true },
|
||||
noArgs: { openAtLogin: false, executableWillLaunchAtLogin: true },
|
||||
execPath: '/path/to/Inkling.exe'
|
||||
}
|
||||
});
|
||||
render(<AutostartSection />);
|
||||
await screen.findByRole('checkbox');
|
||||
fireEvent.click(screen.getByRole('button', { name: /진단 정보/ }));
|
||||
expect(await screen.findByText(/⚠️/)).toBeInTheDocument();
|
||||
expect(screen.getByText(/path\/to\/Inkling\.exe/)).toBeInTheDocument();
|
||||
expect(screen.getByText(/표준 \(--hidden 인자\)/)).toBeInTheDocument();
|
||||
expect(screen.getByText(/비교 \(인자 없이\)/)).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('shows registry info when present (Win)', async () => {
|
||||
const { inboxApi } = await import('../../src/renderer/inbox/api.js');
|
||||
vi.mocked(inboxApi.getAutostart).mockResolvedValueOnce({
|
||||
openAtLogin: true,
|
||||
diagnostic: {
|
||||
withArgs: { openAtLogin: true, executableWillLaunchAtLogin: true },
|
||||
noArgs: { openAtLogin: true, executableWillLaunchAtLogin: true },
|
||||
execPath: 'C:\\app.exe',
|
||||
registryPath: 'HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run\\Inkling',
|
||||
registryValue: '"C:\\app.exe" --hidden'
|
||||
}
|
||||
});
|
||||
render(<AutostartSection />);
|
||||
await screen.findByRole('checkbox');
|
||||
fireEvent.click(screen.getByRole('button', { name: /진단 정보/ }));
|
||||
expect(screen.getByText(/registry 경로/)).toBeInTheDocument();
|
||||
expect(screen.getByText(/registry 값/)).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('no mismatch warning when withArgs == noArgs and willLaunch=true', async () => {
|
||||
const { inboxApi } = await import('../../src/renderer/inbox/api.js');
|
||||
vi.mocked(inboxApi.getAutostart).mockResolvedValueOnce({
|
||||
openAtLogin: true,
|
||||
diagnostic: {
|
||||
withArgs: { openAtLogin: true, executableWillLaunchAtLogin: true },
|
||||
noArgs: { openAtLogin: true, executableWillLaunchAtLogin: true },
|
||||
execPath: '/p'
|
||||
}
|
||||
});
|
||||
render(<AutostartSection />);
|
||||
await screen.findByRole('checkbox');
|
||||
expect(screen.queryByText(/⚠️/)).not.toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user