fix(接口自动化): 部分缺陷修复
This commit is contained in:
parent
5299e251d7
commit
8009ed2945
|
@ -15,6 +15,8 @@ public class RunDefinitionRequest {
|
|||
|
||||
private String reportId;
|
||||
|
||||
private String name;
|
||||
|
||||
private String type;
|
||||
|
||||
private String projectId;
|
||||
|
|
|
@ -246,6 +246,7 @@ public class ApiAutomationService {
|
|||
});
|
||||
scenario.setVariables(variables);
|
||||
}
|
||||
group.setEnableCookieShare(scenario.isEnableCookieShare());
|
||||
LinkedList<MsTestElement> scenarios = new LinkedList<>();
|
||||
scenarios.add(scenario);
|
||||
group.setHashTree(scenarios);
|
||||
|
|
|
@ -16,10 +16,13 @@ import io.metersphere.base.mapper.TestPlanApiScenarioMapper;
|
|||
import io.metersphere.base.mapper.ext.ExtApiScenarioReportMapper;
|
||||
import io.metersphere.commons.constants.APITestStatus;
|
||||
import io.metersphere.commons.constants.ApiRunMode;
|
||||
import io.metersphere.commons.constants.ReportTriggerMode;
|
||||
import io.metersphere.commons.exception.MSException;
|
||||
import io.metersphere.commons.utils.DateUtils;
|
||||
import io.metersphere.commons.utils.LogUtil;
|
||||
import io.metersphere.commons.utils.ServiceUtils;
|
||||
import io.metersphere.i18n.Translator;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
@ -28,10 +31,7 @@ import sun.security.util.Cache;
|
|||
import javax.annotation.Resource;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.*;
|
||||
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
|
@ -55,6 +55,13 @@ public class ApiScenarioReportService {
|
|||
MSException.throwException(Translator.get("api_report_is_null"));
|
||||
}
|
||||
APIScenarioReportResult report = (APIScenarioReportResult) obj;
|
||||
if (CollectionUtils.isNotEmpty(result.getScenarios())) {
|
||||
try {
|
||||
report.setName(result.getScenarios().get(0).getName() + "-" + DateUtils.getTimeString(System.currentTimeMillis()));
|
||||
} catch (Exception e) {
|
||||
LogUtil.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
// report detail
|
||||
ApiScenarioReportDetail detail = new ApiScenarioReportDetail();
|
||||
detail.setReportId(result.getTestId());
|
||||
|
@ -72,7 +79,9 @@ public class ApiScenarioReportService {
|
|||
}
|
||||
report.setContent(new String(detail.getContent(), StandardCharsets.UTF_8));
|
||||
this.save(report, runMode);
|
||||
cache.put(report.getId(), report);
|
||||
if (!report.getTriggerMode().equals(ReportTriggerMode.SCHEDULE.name())) {
|
||||
cache.put(report.getId(), report);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
package io.metersphere.job.sechedule;
|
||||
|
||||
import io.metersphere.api.dto.SaveAPITestRequest;
|
||||
import io.metersphere.api.dto.automation.ExecuteType;
|
||||
import io.metersphere.api.dto.automation.RunScenarioRequest;
|
||||
import io.metersphere.api.service.APITestService;
|
||||
import io.metersphere.api.service.ApiAutomationService;
|
||||
import io.metersphere.commons.constants.ReportTriggerMode;
|
||||
import io.metersphere.commons.constants.ScheduleGroup;
|
||||
|
@ -56,7 +54,7 @@ public class ApiScenarioTestJob extends MsScheduleJob {
|
|||
request.setId(id);
|
||||
request.setReportId(id);
|
||||
request.setProjectId(projectID);
|
||||
request.setTriggerMode(ReportTriggerMode.MANUAL.name());
|
||||
request.setTriggerMode(ReportTriggerMode.SCHEDULE.name());
|
||||
request.setExecuteType(ExecuteType.Completed.name());
|
||||
request.setScenarioIds(this.scenarioIds);
|
||||
request.setReportUserID(this.userId);
|
||||
|
|
|
@ -69,7 +69,7 @@
|
|||
import MsContainer from "../../../common/components/MsContainer";
|
||||
import MsMainContainer from "../../../common/components/MsMainContainer";
|
||||
import MsApiReportStatus from "./ApiReportStatus";
|
||||
import {_filter, _sort} from "@/common/js/utils";
|
||||
import {_filter, _sort,getCurrentProjectID} from "@/common/js/utils";
|
||||
import MsTableOperatorButton from "../../../common/components/MsTableOperatorButton";
|
||||
import ReportTriggerModeItem from "../../../common/tableItem/ReportTriggerModeItem";
|
||||
import {REPORT_CONFIGS} from "../../../common/components/search/search-components";
|
||||
|
@ -130,6 +130,7 @@
|
|||
if (this.testId !== 'all') {
|
||||
this.condition.testId = this.testId;
|
||||
}
|
||||
this.condition.projectId = getCurrentProjectID();
|
||||
let url = "/api/scenario/report/list/" + this.currentPage + "/" + this.pageSize;
|
||||
this.result = this.$post(url, this.condition, response => {
|
||||
let data = response.data;
|
||||
|
|
|
@ -19,19 +19,14 @@
|
|||
<el-tabs v-model="activeName" v-show="isActive" v-if="hasSub">
|
||||
<el-tab-pane :label="$t('api_report.sub_result')" name="sub">
|
||||
<ms-request-sub-result class="sub-result" v-for="(sub, index) in request.subRequestResults"
|
||||
:key="index" :request="sub"/>
|
||||
:key="index" :indexNumber="index" :request="sub"/>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane :label="$t('api_report.request_result')" name="result">
|
||||
<ms-request-metric :request="request"/>
|
||||
<ms-request-text :request="request"/>
|
||||
<br>
|
||||
<ms-response-text :request-type="requestType" :response="request.responseResult"/>
|
||||
<ms-response-text :request-type="requestType" :response="request.responseResult" :request="request"/>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
<div v-else>
|
||||
<ms-request-text v-if="isCodeEditAlive" :request="request"/>
|
||||
<br>
|
||||
<ms-response-text :request-type="requestType" v-if="isCodeEditAlive" :response="request.responseResult"/>
|
||||
<ms-response-text :request-type="requestType" v-if="isCodeEditAlive" :response="request.responseResult" :request="request"/>
|
||||
</div>
|
||||
</div>
|
||||
</el-collapse-transition>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<p class="el-divider--horizontal"></p>
|
||||
<div @click="active">
|
||||
<el-row :gutter="10" type="flex" align="middle" class="info">
|
||||
<el-col :span="14" v-if="indexNumber!=undefined">
|
||||
<el-col :span="6" v-if="indexNumber!=undefined">
|
||||
<div class="method">
|
||||
<div class="el-step__icon is-text ms-api-col" v-if="indexNumber%2 ==0">
|
||||
<div class="el-step__icon-inner"> {{ indexNumber+1 }}</div>
|
||||
|
@ -14,7 +14,16 @@
|
|||
{{ request.name }}
|
||||
</div>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="2">
|
||||
<div>
|
||||
{{ request.method }}
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<div class="url">
|
||||
{{ request.url }}
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="5">
|
||||
<el-tooltip effect="dark" :content="request.responseResult.responseCode" placement="bottom" :open-delay="800">
|
||||
<div class="url" style="color: #5daf34">{{ request.responseResult.responseCode }}</div>
|
||||
|
|
|
@ -1,18 +1,19 @@
|
|||
<template>
|
||||
<div class="text-container">
|
||||
<div @click="active" class="collapse">
|
||||
<i class="icon el-icon-arrow-right" :class="{'is-active': isActive}"/>
|
||||
{{ $t('api_report.response') }}
|
||||
</div>
|
||||
<el-collapse-transition>
|
||||
<el-tabs v-model="activeName" v-show="isActive">
|
||||
<el-tab-pane :class="'body-pane'" label="Body" name="body" class="pane">
|
||||
<el-tab-pane :label="$t('api_test.definition.request.response_header')" name="headers" class="pane">
|
||||
<pre>{{ response.headers }}</pre>
|
||||
</el-tab-pane>
|
||||
|
||||
<el-tab-pane :class="'body-pane'" :label="$t('api_test.definition.request.response_body')" name="body" class="pane">
|
||||
<ms-sql-result-table v-if="isSqlType" :body="response.body"/>
|
||||
<ms-code-edit v-if="!isSqlType" :mode="mode" :read-only="true" :data="response.body" :modes="modes" ref="codeEdit"/>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="Headers" name="headers" class="pane">
|
||||
<pre>{{ response.headers }}</pre>
|
||||
<el-tab-pane :label="$t('api_test.definition.request.console')" name="console" class="pane">
|
||||
<pre>{{response.console}}</pre>
|
||||
</el-tab-pane>
|
||||
|
||||
<el-tab-pane :label="$t('api_report.assertions')" name="assertions" class="pane assertions">
|
||||
<ms-assertion-results :assertions="response.assertions"/>
|
||||
</el-tab-pane>
|
||||
|
@ -21,79 +22,97 @@
|
|||
<pre>{{response.vars}}</pre>
|
||||
</el-tab-pane>
|
||||
|
||||
<el-tab-pane :label="$t('api_report.request_body')" name="request_body" class="pane">
|
||||
<div class="ms-div">
|
||||
{{$t('api_test.request.address')}} :
|
||||
<pre>{{ request.url }}</pre>
|
||||
</div>
|
||||
<div class="ms-div">
|
||||
{{$t('api_test.scenario.headers')}} :
|
||||
<pre>{{ request.headers }}</pre>
|
||||
</div>
|
||||
<div class="ms-div">
|
||||
Cookies :
|
||||
<pre>{{request.cookies}}</pre>
|
||||
</div>
|
||||
<div class="ms-div">
|
||||
Body :
|
||||
<pre>{{request.body}}</pre>
|
||||
</div>
|
||||
|
||||
</el-tab-pane>
|
||||
|
||||
<el-tab-pane v-if="activeName == 'body'" :disabled="true" name="mode" class="pane assertions">
|
||||
<template v-slot:label>
|
||||
<ms-dropdown v-if="!isSqlType" :commands="modes" :default-command="mode" @command="modeChange"/>
|
||||
<ms-dropdown v-if="isSqlType" :commands="sqlModes" :default-command="mode" @command="sqlModeChange"/>
|
||||
</template>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane :label="$t('api_test.definition.request.console')" name="console" class="pane">
|
||||
<pre>{{response.console}}</pre>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</el-collapse-transition>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import MsAssertionResults from "./AssertionResults";
|
||||
import MsCodeEdit from "../../../../common/components/MsCodeEdit";
|
||||
import MsDropdown from "../../../../common/components/MsDropdown";
|
||||
import {BODY_FORMAT, RequestFactory, Request, SqlRequest} from "../../../definition/model/ApiTestModel";
|
||||
import MsSqlResultTable from "./SqlResultTable";
|
||||
import MsAssertionResults from "./AssertionResults";
|
||||
import MsCodeEdit from "../../../../common/components/MsCodeEdit";
|
||||
import MsDropdown from "../../../../common/components/MsDropdown";
|
||||
import {BODY_FORMAT, RequestFactory, Request, SqlRequest} from "../../../definition/model/ApiTestModel";
|
||||
import MsSqlResultTable from "./SqlResultTable";
|
||||
|
||||
export default {
|
||||
name: "MsResponseText",
|
||||
export default {
|
||||
name: "MsResponseText",
|
||||
|
||||
components: {
|
||||
MsSqlResultTable,
|
||||
MsDropdown,
|
||||
MsCodeEdit,
|
||||
MsAssertionResults,
|
||||
},
|
||||
|
||||
props: {
|
||||
requestType: String,
|
||||
response: Object
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
isActive: true,
|
||||
activeName: "body",
|
||||
modes: ['text', 'json', 'xml', 'html'],
|
||||
sqlModes: ['text', 'table'],
|
||||
mode: BODY_FORMAT.TEXT
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
active() {
|
||||
this.isActive = !this.isActive;
|
||||
components: {
|
||||
MsSqlResultTable,
|
||||
MsDropdown,
|
||||
MsCodeEdit,
|
||||
MsAssertionResults,
|
||||
},
|
||||
modeChange(mode) {
|
||||
this.mode = mode;
|
||||
|
||||
props: {
|
||||
requestType: String,
|
||||
request: {},
|
||||
response: Object
|
||||
},
|
||||
sqlModeChange(mode) {
|
||||
this.mode = mode;
|
||||
}
|
||||
},
|
||||
|
||||
mounted() {
|
||||
if (!this.response.headers) {
|
||||
return;
|
||||
}
|
||||
if (this.response.headers.indexOf("Content-Type: application/json") > 0) {
|
||||
this.mode = BODY_FORMAT.JSON;
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
isActive: true,
|
||||
activeName: "body",
|
||||
modes: ['text', 'json', 'xml', 'html'],
|
||||
sqlModes: ['text', 'table'],
|
||||
mode: BODY_FORMAT.TEXT
|
||||
}
|
||||
},
|
||||
|
||||
computed: {
|
||||
isSqlType() {
|
||||
return (this.requestType === RequestFactory.TYPES.SQL && this.response.responseCode === '200');
|
||||
methods: {
|
||||
active() {
|
||||
this.isActive = !this.isActive;
|
||||
},
|
||||
modeChange(mode) {
|
||||
this.mode = mode;
|
||||
},
|
||||
sqlModeChange(mode) {
|
||||
this.mode = mode;
|
||||
}
|
||||
},
|
||||
|
||||
mounted() {
|
||||
if (!this.response.headers) {
|
||||
return;
|
||||
}
|
||||
if (this.response.headers.indexOf("Content-Type: application/json") > 0) {
|
||||
this.mode = BODY_FORMAT.JSON;
|
||||
}
|
||||
},
|
||||
|
||||
computed: {
|
||||
isSqlType() {
|
||||
return (this.requestType === RequestFactory.TYPES.SQL && this.response.responseCode === '200');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
@ -134,4 +153,7 @@ export default {
|
|||
margin: 0;
|
||||
}
|
||||
|
||||
.ms-div {
|
||||
margin-top: 20px;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -5,15 +5,22 @@
|
|||
<div class="el-step__icon is-text ms-api-col" v-if="request.referenced!=undefined && request.referenced==='Deleted' || request.referenced=='REF' || request.referenced==='Copy'">
|
||||
<div class="el-step__icon-inner">{{request.index}}</div>
|
||||
</div>
|
||||
<div class="el-step__icon is-text ms-api-col-ot-import" v-else-if="request.referenced!=undefined && request.referenced==='OT_IMPORT'">
|
||||
<div class="el-step__icon-inner">{{request.index}}</div>
|
||||
</div>
|
||||
<div class="el-step__icon is-text ms-api-col-create" v-else>
|
||||
<div class="el-step__icon-inner">{{request.index}}</div>
|
||||
</div>
|
||||
|
||||
<el-button v-if="request.referenced!=undefined && request.referenced==='Deleted' || request.referenced=='REF' || request.referenced==='Copy'" class="ms-left-buttion" size="small">
|
||||
<el-button v-if="request.referenced!=undefined && request.referenced==='Deleted' || request.referenced=='REF' || request.referenced==='Copy'" class="ms-left-button" size="small">
|
||||
{{$t('api_test.automation.api_list_import')}}
|
||||
</el-button>
|
||||
|
||||
<el-button v-if="request.referenced==undefined || request.referenced==='Created' " class="ms-create-buttion" size="small">
|
||||
<el-button v-if="request.referenced!=undefined && request.referenced==='OT_IMPORT'" class="ms-api-col-ot-import-button" size="small">
|
||||
{{$t('api_test.automation.external_import')}}
|
||||
</el-button>
|
||||
|
||||
<el-button v-if="request.referenced==undefined || request.referenced==='Created' " class="ms-create-button" size="small">
|
||||
{{$t('api_test.automation.customize_req')}}
|
||||
</el-button>
|
||||
|
||||
|
@ -196,7 +203,7 @@
|
|||
color: #F56C6C;
|
||||
}
|
||||
|
||||
.ms-left-buttion {
|
||||
.ms-left-button {
|
||||
color: #F56C6C;
|
||||
background-color: #FCF1F1;
|
||||
margin-right: 20px;
|
||||
|
@ -209,6 +216,19 @@
|
|||
color: #008080;
|
||||
}
|
||||
|
||||
.ms-api-col-ot-import {
|
||||
background-color: #EEF5FE;
|
||||
border-color: #409EFF;
|
||||
margin-right: 10px;
|
||||
color: #409EFF;
|
||||
}
|
||||
|
||||
.ms-api-col-ot-import-button {
|
||||
background-color: #EEF5FE;
|
||||
margin-right: 20px;
|
||||
color: #409EFF;
|
||||
}
|
||||
|
||||
/deep/ .el-card__body {
|
||||
padding: 15px;
|
||||
}
|
||||
|
@ -217,7 +237,7 @@
|
|||
transform: rotate(90deg);
|
||||
}
|
||||
|
||||
.ms-create-buttion {
|
||||
.ms-create-button {
|
||||
color: #008080;
|
||||
background-color: #EBF2F2;
|
||||
margin-right: 20px;
|
||||
|
|
|
@ -782,7 +782,7 @@
|
|||
apiImport(importData) {
|
||||
if (importData && importData.data) {
|
||||
importData.data.forEach(item => {
|
||||
this.setApiParameter(item, "API", "Copy");
|
||||
this.setApiParameter(item, "API", "OT_IMPORT");
|
||||
})
|
||||
this.sort();
|
||||
this.reload();
|
||||
|
|
|
@ -78,10 +78,10 @@
|
|||
|
||||
<!-- 测试-->
|
||||
<div v-else-if="item.type=== 'TEST'" class="ms-api-div">
|
||||
<ms-run-test-http-page :currentProtocol="currentProtocol" :api-data="item.api" @saveAsApi="editApi" v-if="currentProtocol==='HTTP'"/>
|
||||
<ms-run-test-tcp-page :currentProtocol="currentProtocol" :api-data="item.api" @saveAsApi="editApi" v-if="currentProtocol==='TCP'"/>
|
||||
<ms-run-test-sql-page :currentProtocol="currentProtocol" :api-data="item.api" @saveAsApi="editApi" v-if="currentProtocol==='SQL'"/>
|
||||
<ms-run-test-dubbo-page :currentProtocol="currentProtocol" :api-data="item.api" @saveAsApi="editApi" v-if="currentProtocol==='DUBBO'"/>
|
||||
<ms-run-test-http-page :currentProtocol="currentProtocol" :api-data="item.api" @saveAsApi="editApi" @refresh="refresh" v-if="currentProtocol==='HTTP'"/>
|
||||
<ms-run-test-tcp-page :currentProtocol="currentProtocol" :api-data="item.api" @saveAsApi="editApi" @refresh="refresh" v-if="currentProtocol==='TCP'"/>
|
||||
<ms-run-test-sql-page :currentProtocol="currentProtocol" :api-data="item.api" @saveAsApi="editApi" @refresh="refresh" v-if="currentProtocol==='SQL'"/>
|
||||
<ms-run-test-dubbo-page :currentProtocol="currentProtocol" :api-data="item.api" @saveAsApi="editApi" @refresh="refresh" v-if="currentProtocol==='DUBBO'"/>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
|
|
|
@ -172,9 +172,9 @@
|
|||
}
|
||||
}
|
||||
this.apiCaseList = response.data;
|
||||
// if (this.apiCaseList.length == 0) {
|
||||
// this.addCase();
|
||||
// }
|
||||
if (this.apiCaseList.length == 0 && !this.loaded) {
|
||||
this.addCase();
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
<!-- 请求参数 -->
|
||||
<p class="tip">{{$t('api_test.definition.request.req_param')}} </p>
|
||||
<ms-basis-parameters :request="request"/>
|
||||
<ms-basis-parameters :showScript="false" :request="request"/>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
|
|
@ -77,7 +77,7 @@
|
|||
<!-- 请求参数 -->
|
||||
<div>
|
||||
<p class="tip">{{$t('api_test.definition.request.req_param')}} </p>
|
||||
<ms-api-request-form :request="request" :headers="request.headers" :isShowEnable="isShowEnable"/>
|
||||
<ms-api-request-form :showScript="false" :request="request" :headers="request.headers" :isShowEnable="isShowEnable"/>
|
||||
</div>
|
||||
|
||||
</el-form>
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
<!-- 请求参数 -->
|
||||
<p class="tip">{{$t('api_test.definition.request.req_param')}} </p>
|
||||
<ms-basis-parameters :request="request"/>
|
||||
<ms-basis-parameters :showScript="false" :request="request"/>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
|
|
@ -77,7 +77,7 @@
|
|||
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="3" class="ms-left-cell">
|
||||
<el-col :span="3" class="ms-left-cell" v-if="showScript">
|
||||
|
||||
<el-button class="ms-left-buttion" size="small" style="color: #B8741A;background-color: #F9F1EA" @click="addPre">+{{$t('api_test.definition.request.pre_script')}}</el-button>
|
||||
<br/>
|
||||
|
@ -120,6 +120,10 @@
|
|||
request: {},
|
||||
basisData: {},
|
||||
moduleOptions: Array,
|
||||
showScript: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
isReadOnly: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
|
@ -172,7 +176,7 @@
|
|||
this.reload();
|
||||
},
|
||||
copyRow(row) {
|
||||
let obj =JSON.parse(JSON.stringify(row));
|
||||
let obj = JSON.parse(JSON.stringify(row));
|
||||
obj.id = getUUID();
|
||||
this.request.hashTree.push(obj);
|
||||
this.reload();
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
</div>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="3" class="ms-left-cell">
|
||||
<el-col :span="3" class="ms-left-cell" v-if="showScript">
|
||||
<el-button class="ms-left-buttion" size="small" style="color: #B8741A;background-color: #F9F1EA" @click="addPre">+{{$t('api_test.definition.request.pre_script')}}</el-button>
|
||||
<br/>
|
||||
<el-button class="ms-left-buttion" size="small" style="color: #783887;background-color: #F2ECF3" @click="addPost">+{{$t('api_test.definition.request.post_script')}}</el-button>
|
||||
|
@ -105,6 +105,10 @@
|
|||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
showScript: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
@ -141,7 +145,7 @@
|
|||
this.reload();
|
||||
},
|
||||
copyRow(row) {
|
||||
let obj =JSON.parse(JSON.stringify(row));
|
||||
let obj = JSON.parse(JSON.stringify(row));
|
||||
obj.id = getUUID();
|
||||
this.request.hashTree.push(obj);
|
||||
this.reload();
|
||||
|
|
|
@ -85,7 +85,7 @@
|
|||
</div>
|
||||
</el-col>
|
||||
<!--操作按钮-->
|
||||
<el-col :span="3" class="ms-left-cell" v-if="!referenced">
|
||||
<el-col :span="3" class="ms-left-cell" v-if="!referenced && showScript">
|
||||
<el-button class="ms-left-buttion" size="small" @click="addPre">+{{$t('api_test.definition.request.pre_script')}}</el-button>
|
||||
<br/>
|
||||
<el-button class="ms-left-buttion" size="small" @click="addPost">+{{$t('api_test.definition.request.post_script')}}</el-button>
|
||||
|
@ -131,6 +131,7 @@
|
|||
},
|
||||
props: {
|
||||
request: {},
|
||||
showScript: Boolean,
|
||||
headers: {
|
||||
type: Array,
|
||||
default() {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<div class="request-form">
|
||||
<component :is="component" :is-read-only="isReadOnly" :referenced="referenced" :request="request" :headers="headers" :isShowEnable="isShowEnable"/>
|
||||
<component :is="component" :showScript="showScript" :is-read-only="isReadOnly" :referenced="referenced" :request="request" :headers="headers" :isShowEnable="isShowEnable"/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
@ -17,6 +17,10 @@
|
|||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
showScript: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
referenced: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
</el-card>
|
||||
|
||||
<!-- 加载用例 -->
|
||||
<ms-api-case-list @apiCaseClose="apiCaseClose" @selectTestCase="selectTestCase" :currentApi="api"
|
||||
<ms-api-case-list @apiCaseClose="apiCaseClose" @refresh="refresh" @selectTestCase="selectTestCase" :currentApi="api"
|
||||
:loaded="loaded" :refreshSign="refreshSign" :createCase="createCase"
|
||||
ref="caseList"/>
|
||||
|
||||
|
@ -104,6 +104,9 @@
|
|||
return this.runTest();
|
||||
}
|
||||
},
|
||||
refresh(){
|
||||
this.$emit('refresh');
|
||||
},
|
||||
runTest() {
|
||||
this.loading = true;
|
||||
this.api.request.name = this.api.id;
|
||||
|
|
|
@ -70,7 +70,7 @@
|
|||
</el-card>
|
||||
|
||||
<!-- 加载用例 -->
|
||||
<ms-api-case-list @selectTestCase="selectTestCase"
|
||||
<ms-api-case-list @selectTestCase="selectTestCase" @refresh="refresh"
|
||||
:loaded="loaded"
|
||||
:refreshSign="refreshSign"
|
||||
:createCase="createCase"
|
||||
|
@ -273,6 +273,9 @@
|
|||
environmentConfigClose() {
|
||||
this.getEnvironments();
|
||||
},
|
||||
refresh(){
|
||||
this.$emit('refresh');
|
||||
},
|
||||
getResult() {
|
||||
let url = "/api/definition/report/getReport/" + this.api.id;
|
||||
this.$get(url, response => {
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
</el-card>
|
||||
|
||||
<!-- 加载用例 -->
|
||||
<ms-api-case-list @apiCaseClose="apiCaseClose" @selectTestCase="selectTestCase" :currentApi="api" :refreshSign="refreshSign"
|
||||
<ms-api-case-list @apiCaseClose="apiCaseClose" @refresh="refresh" @selectTestCase="selectTestCase" :currentApi="api" :refreshSign="refreshSign"
|
||||
:loaded="loaded" :createCase="createCase"
|
||||
ref="caseList"/>
|
||||
|
||||
|
@ -103,6 +103,9 @@
|
|||
return this.$refs['requestForm'].validate();
|
||||
}
|
||||
},
|
||||
refresh(){
|
||||
this.$emit('refresh');
|
||||
},
|
||||
runTest() {
|
||||
this.loading = true;
|
||||
this.api.request.name = this.api.id;
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
</el-card>
|
||||
|
||||
<!-- 加载用例 -->
|
||||
<ms-api-case-list @apiCaseClose="apiCaseClose" @selectTestCase="selectTestCase" :currentApi="api" :refreshSign="refreshSign"
|
||||
<ms-api-case-list @apiCaseClose="apiCaseClose" @refresh="refresh" @selectTestCase="selectTestCase" :currentApi="api" :refreshSign="refreshSign"
|
||||
:loaded="loaded" :createCase="createCase"
|
||||
ref="caseList"/>
|
||||
<!-- 环境 -->
|
||||
|
@ -103,6 +103,9 @@
|
|||
return this.$refs['requestForm'].validate();
|
||||
}
|
||||
},
|
||||
refresh(){
|
||||
this.$emit('refresh');
|
||||
},
|
||||
runTest() {
|
||||
this.loading = true;
|
||||
this.api.request.name = this.api.id;
|
||||
|
|
Loading…
Reference in New Issue