fix(接口测试): 修复插件单步不执行问题

--bug=1009245 --user=赵勇 【github#8813】插件加载websocket插件之后创建的场景jmx与jmeter的生成的参数一样,但是没法在MS上单独运行而且运行一直处于测试中,只能整体调试 https://www.tapd.cn/55049933/s/1089421
This commit is contained in:
fit2-zhao 2022-01-04 13:29:35 +08:00 committed by fit2-zhao
parent 5cafda49be
commit fc42ad0527
3 changed files with 77 additions and 72 deletions

View File

@ -583,6 +583,7 @@ export default {
} }
} }
} }
this.request.debug = true;
this.request.active = true; this.request.active = true;
this.loading = true; this.loading = true;
this.runData = []; this.runData = [];

View File

@ -258,6 +258,9 @@ export default {
environmentId: this.currentEnvironmentId, environmentId: this.currentEnvironmentId,
hashTree: [this.controller], hashTree: [this.controller],
}; };
if (this.node && this.node.data) {
this.node.data.debug = true;
}
this.reportId = getUUID().substring(0, 8); this.reportId = getUUID().substring(0, 8);
}, },

View File

@ -1,93 +1,93 @@
<template> <template>
<api-base-component <div>
@copy="copyRow" <api-base-component
@remove="remove" @copy="copyRow"
@active="active" @remove="remove"
:data="request" @active="active"
:draggable="draggable" :data="request"
:color="defColor" :draggable="draggable"
:is-max="isMax" :color="defColor"
:show-btn="showBtn" :is-max="isMax"
:background-color="defBackgroundColor" :show-btn="showBtn"
:title="pluginName"> :background-color="defBackgroundColor"
:title="pluginName">
<template v-slot:request> <template v-slot:request>
<legend style="width: 100%"> <legend style="width: 100%">
<p class="tip">{{ $t('api_test.definition.request.req_param') }} </p> <p class="tip">{{ $t('api_test.definition.request.req_param') }} </p>
<div class="ms-form"> <div class="ms-form">
<div class="ms-form-create" v-loading="loading"> <div class="ms-form-create" v-loading="loading">
<formCreate <formCreate
v-model="pluginForm" v-model="pluginForm"
:rule="rules" :rule="rules"
:option="option" :option="option"
:value.sync="data" :value.sync="data"
@prefix-change="change" @prefix-change="change"
@prefix-click="change" @prefix-click="change"
@prefix-visible-change="visibleChange" @prefix-visible-change="visibleChange"
/> />
</div>
</div> </div>
</div> </legend>
</legend> </template>
</template>
<template v-slot:debugStepCode> <template v-slot:debugStepCode>
<span v-if="request.testing" class="ms-test-running"> <span v-if="request.testing" class="ms-test-running">
<i class="el-icon-loading" style="font-size: 16px"/> <i class="el-icon-loading" style="font-size: 16px"/>
{{ $t('commons.testing') }} {{ $t('commons.testing') }}
</span> </span>
<span class="ms-step-debug-code" :class="request.requestResult[0].success?'ms-req-success':'ms-req-error'" v-if="!loading && request.debug && request.requestResult[0] && request.requestResult[0].responseResult"> <span class="ms-step-debug-code" :class="request.requestResult[0].success?'ms-req-success':'ms-req-error'" v-if="!loading && request.debug && request.requestResult[0] && request.requestResult[0].responseResult">
{{ request.requestResult[0].success ? 'success' : 'error' }} {{ request.requestResult[0].success ? 'success' : 'error' }}
</span> </span>
</template> </template>
<template v-slot:button v-if="allSampler.indexOf(request.type) !==-1"> <template v-slot:button v-if="allSampler.indexOf(request.type) !==-1">
<el-tooltip :content="$t('api_test.run')" placement="top" v-if="!loading"> <el-tooltip :content="$t('api_test.run')" placement="top" v-if="!loading">
<el-button :disabled="!request.enable" @click="run" icon="el-icon-video-play" style="padding: 5px" class="ms-btn" size="mini" circle/> <el-button :disabled="!request.enable" @click="run" icon="el-icon-video-play" style="padding: 5px" class="ms-btn" size="mini" circle/>
</el-tooltip> </el-tooltip>
<el-tooltip :content="$t('report.stop_btn')" placement="top" :enterable="false" v-else> <el-tooltip :content="$t('report.stop_btn')" placement="top" :enterable="false" v-else>
<el-button :disabled="!request.enable" @click.once="stop" size="mini" style="color:white;padding: 0 0.1px;width: 24px;height: 24px;" class="stop-btn" circle> <el-button :disabled="!request.enable" @click.once="stop" size="mini" style="color:white;padding: 0 0.1px;width: 24px;height: 24px;" class="stop-btn" circle>
<div style="transform: scale(0.66)"> <div style="transform: scale(0.66)">
<span style="margin-left: -4.5px;font-weight: bold;">STOP</span> <span style="margin-left: -4.5px;font-weight: bold;">STOP</span>
</div>
</el-button>
</el-tooltip>
</template>
<template v-slot:result>
<div v-if="allSampler.indexOf(request.type) !==-1">
<p class="tip">{{ $t('api_test.definition.request.res_param') }} </p>
<div v-if="request.result">
<div v-for="(scenario,h) in request.result.scenarios" :key="h">
<el-tabs v-model="request.activeName" closable class="ms-tabs">
<el-tab-pane v-for="(item,i) in scenario.requestResults" :label="'循环'+(i+1)" :key="i" style="margin-bottom: 5px">
<api-response-component :currentProtocol="request.protocol" :apiActive="true" :result="item"/>
</el-tab-pane>
</el-tabs>
</div>
</div> </div>
</el-button> <div v-else>
</el-tooltip> <el-tabs v-model="request.activeName" closable class="ms-tabs" v-if="request.requestResult && request.requestResult.length > 1">
</template> <el-tab-pane v-for="(item,i) in request.requestResult" :label="'循环'+(i+1)" :key="i" style="margin-bottom: 5px">
<api-response-component
<template v-slot:result> :currentProtocol="request.protocol"
<div v-if="allSampler.indexOf(request.type) !==-1"> :apiActive="true"
<p class="tip">{{ $t('api_test.definition.request.res_param') }} </p> :result="item"
<div v-if="request.result"> />
<div v-for="(scenario,h) in request.result.scenarios" :key="h">
<el-tabs v-model="request.activeName" closable class="ms-tabs">
<el-tab-pane v-for="(item,i) in scenario.requestResults" :label="'循环'+(i+1)" :key="i" style="margin-bottom: 5px">
<api-response-component :currentProtocol="request.protocol" :apiActive="true" :result="item"/>
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
<api-response-component
:currentProtocol="request.protocol"
:apiActive="true"
:result="request.requestResult[0]"
v-else/>
</div> </div>
</div> </div>
<div v-else> </template>
<el-tabs v-model="request.activeName" closable class="ms-tabs" v-if="request.requestResult && request.requestResult.length > 1"> </api-base-component>
<el-tab-pane v-for="(item,i) in request.requestResult" :label="'循环'+(i+1)" :key="i" style="margin-bottom: 5px">
<api-response-component
:currentProtocol="request.protocol"
:apiActive="true"
:result="item"
/>
</el-tab-pane>
</el-tabs>
<api-response-component
:currentProtocol="request.protocol"
:apiActive="true"
:result="request.requestResult[0]"
v-else/>
</div>
</div>
</template>
<ms-run :debug="true" :reportId="reportId" :run-data="runData" :env-map="envMap" <ms-run :debug="true" :reportId="reportId" :run-data="runData" :env-map="envMap"
@runRefresh="runRefresh" @errorRefresh="errorRefresh" ref="runTest"/> @runRefresh="runRefresh" @errorRefresh="errorRefresh" ref="runTest"/>
</div>
</api-base-component>
</template> </template>
<script> <script>
@ -217,6 +217,7 @@ export default {
} }
} }
} }
this.request.debug = true;
this.request.active = true; this.request.active = true;
this.loading = true; this.loading = true;
this.runData = []; this.runData = [];