fix(接口自动化) 修复场景停止错误问题

--bug=1006759 --user=赵勇 【接口自动化】调试场景,点击终止过程中,报错“e.websocket.close is not a function” https://www.tapd.cn/55049933/s/1049332
This commit is contained in:
fit2-zhao 2021-09-22 15:52:31 +08:00 committed by fit2-zhao
parent 4dd9594329
commit 0963ee55b6
6 changed files with 68 additions and 48 deletions

View File

@ -98,6 +98,8 @@ export function saveScenario(url, scenario, scenarioDefinition, _this,success) {
if (success) {
success(response);
}
}, error => {
_this.$emit('errorRefresh', {});
});
}

View File

@ -258,7 +258,7 @@
<!--执行组件-->
<ms-run :debug="true" v-if="type!=='detail'" :environment="projectEnvMap" :reportId="reportId" :saved="!debug"
:run-data="debugData"
@runRefresh="runRefresh" ref="runTest"/>
@runRefresh="runRefresh" @errorRefresh="errorRefresh" ref="runTest"/>
<!-- 调试结果 -->
<el-drawer v-if="type!=='detail'" :visible.sync="debugVisible" :destroy-on-close="true" direction="ltr"
:withHeader="true" :modal="false" size="90%">
@ -553,6 +553,7 @@ export default {
let url = "/api/automation/stop/" + this.reportId;
this.$get(url, response => {
this.debugLoading = false;
try {
if (this.websocket) {
this.websocket.close();
}
@ -563,6 +564,9 @@ export default {
this.clearDebug();
this.$success(this.$t('report.test_stop_success'));
this.reload();
} catch (e) {
this.debugLoading = false;
}
});
},
clearDebug() {
@ -889,9 +893,9 @@ export default {
},
fabClick() {
if (this.operatingElements && this.operatingElements.length < 1) {
if(this.selectedTreeNode && this.selectedTreeNode.referenced === 'REF' || this.selectedTreeNode.disabled) {
if (this.selectedTreeNode && this.selectedTreeNode.referenced === 'REF' || this.selectedTreeNode.disabled) {
this.$warning("引用的场景步骤及子步骤都无法添加其他步骤");
}else{
} else {
this.$warning("当前步骤下不能添加其他步骤");
}
}
@ -1391,6 +1395,13 @@ export default {
this.initMessageSocket();
}
},
errorRefresh() {
this.debug = false;
this.isTop = false;
this.debugLoading = false;
this.debugVisible = false;
this.loading = false;
},
showScenarioParameters() {
this.$refs.scenarioParameters.open(this.currentScenario.variables, this.currentScenario.headers);
},

View File

@ -2,19 +2,21 @@
<div class="card-container">
<el-card class="card-content">
<el-button size="small" type="primary" class="ms-api-button" style="float: right;margin-right: 20px" @click="stop" v-if="isStop">
{{ $t('report.stop_btn') }}
</el-button>
<div v-else>
<el-button v-if="scenario" style="float: right;margin-right: 20px" size="small" type="primary"
@click="handleCommand"> {{ $t('commons.test') }}
</el-button>
<el-dropdown v-else split-button type="primary" class="ms-api-buttion" @click="handleCommand"
<el-dropdown v-else split-button type="primary" class="ms-api-button" @click="handleCommand"
@command="handleCommand" size="small" style="float: right;margin-right: 20px">
{{ $t('commons.test') }}
<el-dropdown-menu slot="dropdown">
<el-dropdown-item command="save_as">{{ $t('api_test.definition.request.save_as_case') }}</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<el-button size="small" type="primary" class="ms-api-buttion" style="float: right;margin-right: 20px" @click="stop" v-if="isStop">
{{ $t('report.stop_btn') }}
</el-button>
</div>
<p class="tip">{{ $t('api_test.definition.request.req_param') }} </p>
<div v-loading="loading">
<!-- 请求参数 -->

View File

@ -19,18 +19,18 @@
{{ $t('report.stop_btn') }}
</el-button>
<div v-else>
<el-dropdown split-button type="primary" class="ms-api-buttion" @click="handleCommand"
<el-dropdown split-button type="primary" class="ms-api-button" @click="handleCommand"
@command="handleCommand" size="small" v-if="testCase===undefined && !scenario">
{{ $t('commons.test') }}
<el-dropdown-menu slot="dropdown">
<el-dropdown-item command="save_as">{{ $t('api_test.definition.request.save_as_case') }}</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div>
<el-button v-if="scenario" size="small" type="primary" @click="handleCommand">
{{ $t('commons.test') }}
</el-button>
</div>
</el-form-item>
</el-form>
<div v-loading="loading">

View File

@ -2,19 +2,21 @@
<div class="card-container">
<el-card class="card-content">
<el-button size="small" type="primary" class="ms-api-button" style="float: right;margin-right: 20px" @click="stop" v-if="isStop">
{{ $t('report.stop_btn') }}
</el-button>
<div v-else>
<el-button v-if="scenario" style="float: right;margin-right: 20px" size="small" type="primary"
@click="handleCommand"> {{ $t('commons.test') }}
</el-button>
<el-dropdown v-else split-button type="primary" class="ms-api-buttion" @click="handleCommand"
<el-dropdown v-else split-button type="primary" class="ms-api-button" @click="handleCommand"
@command="handleCommand" size="small" style="float: right;margin-right: 20px">
{{ $t('commons.test') }}
<el-dropdown-menu slot="dropdown">
<el-dropdown-item command="save_as">{{ $t('api_test.definition.request.save_as_case') }}</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<el-button size="small" type="primary" class="ms-api-buttion" style="float: right;margin-right: 20px" @click="stop" v-if="isStop">
{{ $t('report.stop_btn') }}
</el-button>
</div>
<p class="tip">{{ $t('api_test.definition.request.req_param') }} </p>
<div v-loading="loading">
<!-- JDBC 请求参数 -->

View File

@ -11,9 +11,14 @@
<el-input-number v-model="request.port" controls-position="right" :min="0" :max="65535" size="small"/>
</el-form-item>
<el-form-item>
<el-button size="small" type="primary" @click="stop" v-if="isStop">
{{ $t('report.stop_btn') }}
</el-button>
<div v-else>
<el-button v-if="scenario" size="small" type="primary" @click="handleCommand"> {{ $t('commons.test') }}
</el-button>
<el-dropdown v-else split-button type="primary" class="ms-api-buttion" @click="handleCommand"
<el-dropdown v-else split-button type="primary" class="ms-api-button" @click="handleCommand"
@command="handleCommand" size="small" style="float: right;margin-right: 20px">
{{ $t('commons.test') }}
<el-dropdown-menu slot="dropdown">
@ -21,9 +26,7 @@
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<el-button size="small" type="primary" @click="stop" v-if="isStop">
{{ $t('report.stop_btn') }}
</el-button>
</div>
</el-form-item>
</el-form>
<div v-loading="loading">