修复试玩快捷键测试监听器清理

使用 try/finally 确保错误报告事件监听器始终移除
This commit is contained in:
2026-09-01 15:21:32 +08:00
parent 3b06f03c11
commit 372a38c3e0
@@ -653,12 +653,15 @@ export async function assertPlaytestAndReleaseShortcutFlow(
openedErrorReport = true;
};
window.addEventListener(OPEN_ERROR_REPORT_EVENT, onErrorReportOpen);
try {
submitChat('/bug-report');
expect(
await screen.findByText('已打开“报告问题”面板,请填写遇到的问题。'),
).not.toBeNull();
expect(openedErrorReport).toBe(true);
} finally {
window.removeEventListener(OPEN_ERROR_REPORT_EVENT, onErrorReportOpen);
}
expect(
invoke.mock.calls.filter(
([command]) => command === 'get_local_game_manifest',