feat(test): 更新测试实例 WebSocket 连接路径并优化日志显示

master
钟良源 2 months ago
parent 069c45b80e
commit 7aa5efb9ba

@ -31,14 +31,17 @@ const TestInstance = ({ instance, parentId, onBack }: { instance: any; parentId:
// WebSocket hook
const { connect, disconnect, isConnected, sendMessage } = useWebSocket({
onOpen: () => {
console.log('链接成功');
setIsSocketConnected(true);
addLog('连接信息:连接成功!');
},
onClose: () => {
console.log('链接关闭');
setIsSocketConnected(false);
addLog('连接信息:连接已断开');
},
onError: () => {
console.log('链接错误');
addLog('连接错误:连接失败');
},
onMessage: (event) => {
@ -107,10 +110,10 @@ const TestInstance = ({ instance, parentId, onBack }: { instance: any; parentId:
const host = window.location.host;
let wsUrl = '';
if (window.location.host.includes('localhost')) {
wsUrl = `ws://192.168.5.119/wst/test-case/${instance.id}/${cryptoRandom()}`;
wsUrl = `ws://192.168.5.119/ws/v1/bpms-workbench/test-case/${instance.id}/${cryptoRandom()}`;
}
else {
wsUrl = `${protocol}//${host}/wst/test-case/${instance.id}/${cryptoRandom()}`;
wsUrl = `${protocol}//${host}/ws/v1/bpms-workbench/test-case/${instance.id}/${cryptoRandom()}`;
}
@ -510,7 +513,7 @@ const TestInstance = ({ instance, parentId, onBack }: { instance: any; parentId:
{logs.length === 0 ? (
<div className={styles['log-empty']}>
<p></p>
<p>"链接实例"</p>
<p>&#34;&#34;</p>
</div>
) : (
<div className={styles['log-list']}>

Loading…
Cancel
Save