fix(接口测试): 修复文档结构断言,导入了一个比较长的json卡住的缺陷

--bug=1013770 --user=王孝刚 【接口测试】文档结构断言导入JSON文件页面卡住 https://www.tapd.cn/55049933/s/1180117
This commit is contained in:
wxg0103 2022-06-13 16:55:54 +08:00 committed by fit2-zhao
parent ab70ca487d
commit f58e53c128
18 changed files with 537 additions and 354 deletions

View File

@ -402,7 +402,7 @@ import {
} from "@/business/components/api/automation/api-automation";
import MsComponentConfig from "./component/ComponentConfig";
import {ENV_TYPE} from "@/common/js/constants";
import {hisDataProcessing} from "@/business/components/api/definition/api-definition";
import {hisDataProcessing, mergeRequestDocumentData} from "@/business/components/api/definition/api-definition";
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
const versionHistory = requireComponent.keys().length > 0 ? requireComponent("./version/VersionHistory.vue") : {};
@ -1019,6 +1019,7 @@ export default {
this.debug = false;
this.saved = true;
this.executeType = "Saved";
this.mergeScenario(this.scenarioDefinition);
this.validatePluginData(this.scenarioDefinition);
if (this.pluginDelStep) {
this.$error("场景包含插件步骤,对应场景已经删除不能执行!");
@ -1436,7 +1437,16 @@ export default {
run() {
this.reportId = this.debugReportId;
},
mergeScenario(data) {
data.forEach(item => {
mergeRequestDocumentData(item);
if (item.hashTree && item.hashTree > 0) {
this.mergeScenario(item.hashTree);
}
})
},
runDebug(runScenario) {
this.mergeScenario(this.scenarioDefinition);
if (this.debugLoading) {
return;
}
@ -1457,6 +1467,7 @@ export default {
this.debugLoading = false;
return;
}
this.stopDebug = "";
this.clearDebug();
this.validatePluginData(this.scenarioDefinition);
@ -1569,6 +1580,7 @@ export default {
}
},
editScenario() {
this.mergeScenario(this.scenarioDefinition);
if (!document.getElementById("inputDelay")) {
return;
}

View File

@ -125,7 +125,7 @@ export function hisDataProcessing(array, request) {
}
}
assertionsIndex.forEach(item => {
const rmIndex = request.hashTree.findIndex((d) => d.id === item.id&&d.resourceId===item.resourceId);
const rmIndex = request.hashTree.findIndex((d) => d.id === item.id && d.resourceId === item.resourceId);
request.hashTree.splice(rmIndex, 1);
})
@ -157,3 +157,36 @@ export function stepCompute(array, request) {
request.ruleSize = ruleSize;
}
export function mergeDocumentData(originalData, childMap) {
originalData.forEach(item => {
if (childMap && childMap.has(item.id)) {
let sourceData = JSON.parse(JSON.stringify(item.children));
item.children = JSON.parse(JSON.stringify(childMap.get(item.id)));
item.children.forEach(target => {
let index = sourceData.findIndex(source => source.id === target.id);
if (index !== -1) {
target.children = sourceData[index].children
}
})
if (item.children && item.children.length > 0) {
mergeDocumentData(item.children, childMap);
}
}
})
}
export function mergeRequestDocumentData(request) {
if (request && request.hashTree && request.hashTree.length > 0) {
let index = request.hashTree.findIndex(item => item.type === 'Assertions');
if (index !== -1) {
if (request.hashTree[index].document.originalData && request.hashTree[index].document.tableData.size && request.hashTree[index].document.tableData.size !== 0) {
mergeDocumentData(request.hashTree[index].document.originalData, request.hashTree[index].document.tableData);
request.hashTree[index].document.data.json = request.hashTree[index].document.originalData;
}
}
}
}

View File

@ -81,13 +81,13 @@
</div>
<div v-if="showMock && (currentProtocol === 'HTTP' || currentProtocol === 'TCP')">
<mock-tab :base-mock-config-data="baseMockConfigData" @redirectToTest="redirectToTest" :version-name="currentApi.versionName"
<mock-tab :base-mock-config-data="baseMockConfigData" @redirectToTest="redirectToTest"
:version-name="currentApi.versionName"
:is-tcp="currentProtocol === 'TCP'"/>
</div>
<div v-if="showTestCaseList">
<!--测试用例列表-->
<api-case-simple-list
class="api-case-simple-list"
:apiDefinitionId="currentApi.id"
:apiDefinition="currentApi"
:current-version="currentApi.versionId"
@ -283,7 +283,7 @@ export default {
this.beforeChangeTab();
this.refreshButtonActiveClass(tabType);
},
beforeChangeTab(){
beforeChangeTab() {
//
this.$refs.caseList.close();
},
@ -295,9 +295,9 @@ export default {
if (param.params) {
requestParam = param.params;
}
this.$refs.httpTestPage.setRequestParam(requestParam,true);
this.$refs.httpTestPage.setRequestParam(requestParam, true);
} else if (this.currentProtocol === "TCP" && this.$refs.tcpTestPage) {
this.$refs.tcpTestPage.setRequestParam(param,true);
this.$refs.tcpTestPage.setRequestParam(param, true);
}
});
},
@ -405,11 +405,6 @@ export default {
border: solid 1px var(--primary_color);
}
.api-case-simple-list >>> .el-table {
height: calc(100vh - 262px) !important;
}
/deep/ .ms-opt-btn {
position: fixed;
right: 50px;

View File

@ -5,10 +5,10 @@
{{ assertion.desc }}
</div>
<div class="assertion-item btn">
<el-button :disabled="isReadOnly" type="success" size="small" @click="detail">
<el-button :disabled="isReadOnly" type="success" size="mini" @click="detail">
{{ $t('commons.edit') }}
</el-button>
<el-button :disabled="isReadOnly" type="primary" size="small" @click="add">
<el-button :disabled="isReadOnly" type="primary" size="mini" @click="add">
{{ $t('api_test.request.assertions.add') }}
</el-button>
</div>
@ -21,7 +21,8 @@
<i class="el-icon-view el-button el-button--primary el-button--mini is-circle" circle @click="showPage"/>
<el-button :disabled="isReadOnly" type="success" size="mini" icon="el-icon-edit" circle @click="detail"/>
<el-tooltip :content="$t('test_resource_pool.enable_disable')" placement="top">
<el-switch v-model="assertion.enable" class="enable-switch" size="mini" :disabled="isReadOnly" style="width: 30px;margin:0px 10px 0px 10px"/>
<el-switch v-model="assertion.enable" class="enable-switch" size="mini" :disabled="isReadOnly"
style="width: 30px;margin:0px 10px 0px 10px"/>
</el-tooltip>
<el-button :disabled="isReadOnly" type="danger" size="mini" icon="el-icon-delete" circle @click="remove"/>
</div>
@ -61,279 +62,279 @@
</template>
<script>
import {AssertionJSR223} from "../../model/ApiTestModel";
import MsDialogFooter from "@/business/components/common/components/MsDialogFooter";
import MsJsr233Processor from "../../../automation/scenario/common/Jsr233ProcessorContent";
import {AssertionJSR223} from "../../model/ApiTestModel";
import MsDialogFooter from "@/business/components/common/components/MsDialogFooter";
import MsJsr233Processor from "../../../automation/scenario/common/Jsr233ProcessorContent";
export default {
name: "MsApiAssertionJsr223",
components: {MsJsr233Processor, MsDialogFooter},
props: {
assertion: {
default: () => {
return new AssertionJSR223();
}
},
edit: {
type: Boolean,
default: false
},
index: Number,
list: Array,
callback: Function,
isReadOnly: {
type: Boolean,
default: false
export default {
name: "MsApiAssertionJsr223",
components: {MsJsr233Processor, MsDialogFooter},
props: {
assertion: {
default: () => {
return new AssertionJSR223();
}
},
edit: {
type: Boolean,
default: false
},
index: Number,
list: Array,
callback: Function,
isReadOnly: {
type: Boolean,
default: false
}
},
data() {
return {
visible: false,
disabled: false,
operators: {
EQ: {
label: "commons.adv_search.operators.equals",
value: "=="
},
NE: {
label: "commons.adv_search.operators.not_equals",
value: "!="
},
CONTAINS: {
label: "commons.adv_search.operators.like",
value: "contains"
},
NOT_CONTAINS: {
label: "commons.adv_search.operators.not_like",
value: "not contains"
},
GT: {
label: "commons.adv_search.operators.gt",
value: ">"
},
LT: {
label: "commons.adv_search.operators.lt",
value: "<"
},
IS_EMPTY: {
label: "commons.adv_search.operators.is_empty",
value: "is empty"
},
IS_NOT_EMPTY: {
label: "commons.adv_search.operators.is_not_empty",
value: "is not empty"
}
data() {
return {
visible: false,
disabled: false,
operators: {
EQ: {
label: "commons.adv_search.operators.equals",
value: "=="
},
templates: [
{
title: this.$t('api_test.request.assertions.set_failure_status'),
value: 'AssertionResult.setFailure(true)',
},
{
title: this.$t('api_test.request.assertions.set_failure_msg'),
value: 'AssertionResult.setFailureMessage("msg")',
}
],
NE: {
label: "commons.adv_search.operators.not_equals",
value: "!="
},
CONTAINS: {
label: "commons.adv_search.operators.like",
value: "contains"
},
NOT_CONTAINS: {
label: "commons.adv_search.operators.not_like",
value: "not contains"
},
GT: {
label: "commons.adv_search.operators.gt",
value: ">"
},
LT: {
label: "commons.adv_search.operators.lt",
value: "<"
},
IS_EMPTY: {
label: "commons.adv_search.operators.is_empty",
value: "is empty"
},
IS_NOT_EMPTY: {
label: "commons.adv_search.operators.is_not_empty",
value: "is not empty"
}
},
templates: [
{
title: this.$t('api_test.request.assertions.set_failure_status'),
value: 'AssertionResult.setFailure(true)',
},
{
title: this.$t('api_test.request.assertions.set_failure_msg'),
value: 'AssertionResult.setFailureMessage("msg")',
}
],
}
},
methods: {
add() {
this.list.push(new AssertionJSR223(this.assertion));
this.callback();
},
remove() {
this.list.splice(this.index, 1);
},
changeOperator(value) {
if (value.indexOf("empty") > 0 && !!this.assertion.value) {
this.assertion.value = "";
}
this.quickScript();
},
beanShellOrGroovyScript() {
if (this.assertion.variable && this.assertion.operator) {
let variable = this.assertion.variable;
let operator = this.assertion.operator;
let value = this.assertion.value || "";
let desc = "${" + variable + "} " + operator + " '" + value + "'";
let msgScript = "\" + value + \" " + operator + " '" + value + "'";
let script = "value = vars.get(\"" + variable + "\");\n"
switch (this.assertion.operator) {
case "==":
script += "result = \"" + value + "\".equals(value);\n";
break;
case "!=":
script += "result = !\"" + value + "\".equals(value);\n";
break;
case "contains":
script += "result = value.contains(\"" + value + "\");\n";
break;
case "not contains":
script += "result = !value.contains(\"" + value + "\");\n";
break;
case ">":
desc = "${" + variable + "} " + operator + " " + value;
msgScript = "\" + value + \" " + operator + " " + value;
script += "number = Integer.parseInt(value);\n" +
"result = number > " + value + ";\n";
break;
case "<":
desc = "${" + variable + "} " + operator + " " + value;
msgScript = "\" + value + \" " + operator + " " + value;
script += "number = Integer.parseInt(value);\n" +
"result = number < " + value + ";\n";
break;
case "is empty":
desc = "${" + variable + "} " + operator;
msgScript = "\" + value + \" " + operator;
script += "result = value == void || value.length() == 0;\n";
break;
case "is not empty":
desc = "${" + variable + "} " + operator;
msgScript = "\" + value + \" " + operator;
script += "result = value != void && value.length() > 0;\n";
break;
}
let msg = (operator !== "is empty" && operator !== "is not empty") ? "assertion [" + msgScript + "]: false;" : "value " + operator
script += "if (!result){\n" +
"\tmsg = \"" + msg + "\";\n" +
"\tAssertionResult.setFailureMessage(msg);\n" +
"\tAssertionResult.setFailure(true);\n" +
"}";
this.assertion.desc = desc;
this.assertion.script = script;
this.$refs.jsr233.reload();
}
},
pythonScript() {
if (this.assertion.variable && this.assertion.operator) {
let variable = this.assertion.variable;
let operator = this.assertion.operator;
let value = this.assertion.value || "";
let desc = "${" + variable + "} " + operator + " '" + value + "'";
let msg = "";
let script = "value = vars.get(\"" + variable + "\");\n"
switch (this.assertion.operator) {
case "==":
script += "if value != \"" + value + "\" :\n";
break;
case "!=":
script += "if value == \"" + value + "\" :\n";
break;
case "contains":
script += "if value.find(\"" + value + "\") == -1:\n";
msg = "value " + operator + " " + value + ": false;";
break;
case "not contains":
script += "if value.find(\"" + value + "\") != -1:\n";
msg = "value " + operator + " " + ": false;";
break;
case ">":
desc = "${" + variable + "} " + operator + " " + value;
script += "if value is None or int(value) < " + value + ":\n";
msg = "value " + operator + " " + value + ": false;";
break;
case "<":
desc = "${" + variable + "} " + operator + " " + value;
script += "if value is None or int(value) > " + value + ":\n";
msg = "value " + operator + " " + value + ": false;";
break;
case "is empty":
desc = "${" + variable + "} " + operator
script += "if value is not None:\n";
msg = "value " + operator + ": false;";
break;
case "is not empty":
desc = "${" + variable + "} " + operator
script += "if value is None:\n";
msg = "value " + operator + ": false;";
break;
}
script +=
"\tmsg = \" " + msg + "\"\n" +
"\tAssertionResult.setFailureMessage(msg)" + "\n" +
"\tAssertionResult.setFailure(True)";
this.assertion.desc = desc;
this.assertion.script = script;
this.$refs.jsr233.reload();
}
},
quickScript() {
if (this.assertion.scriptLanguage == 'beanshell' || this.assertion.scriptLanguage == 'groovy' || this.assertion.scriptLanguage == 'javascript') {
this.beanShellOrGroovyScript();
} else {
this.pythonScript();
}
},
methods: {
add() {
this.list.push(new AssertionJSR223(this.assertion));
this.callback();
},
remove() {
this.list.splice(this.index, 1);
},
changeOperator(value) {
if (value.indexOf("empty") > 0 && !!this.assertion.value) {
this.assertion.value = "";
}
this.quickScript();
},
beanShellOrGroovyScript() {
if (this.assertion.variable && this.assertion.operator) {
let variable = this.assertion.variable;
let operator = this.assertion.operator;
let value = this.assertion.value || "";
let desc = "${" + variable + "} " + operator + " '" + value + "'";
let msgScript = "\" + value + \" " + operator + " '" + value + "'";
let script = "value = vars.get(\"" + variable + "\");\n"
switch (this.assertion.operator) {
case "==":
script += "result = \"" + value + "\".equals(value);\n";
break;
case "!=":
script += "result = !\"" + value + "\".equals(value);\n";
break;
case "contains":
script += "result = value.contains(\"" + value + "\");\n";
break;
case "not contains":
script += "result = !value.contains(\"" + value + "\");\n";
break;
case ">":
desc = "${" + variable + "} " + operator + " " + value;
msgScript = "\" + value + \" " + operator + " " + value;
script += "number = Integer.parseInt(value);\n" +
"result = number > " + value + ";\n";
break;
case "<":
desc = "${" + variable + "} " + operator + " " + value;
msgScript = "\" + value + \" " + operator + " " + value;
script += "number = Integer.parseInt(value);\n" +
"result = number < " + value + ";\n";
break;
case "is empty":
desc = "${" + variable + "} " + operator;
msgScript = "\" + value + \" " + operator;
script += "result = value == void || value.length() == 0;\n";
break;
case "is not empty":
desc = "${" + variable + "} " + operator;
msgScript = "\" + value + \" " + operator;
script += "result = value != void && value.length() > 0;\n";
break;
}
let msg = (operator !== "is empty" && operator !== "is not empty") ? "assertion [" + msgScript + "]: false;" : "value " + operator
script += "if (!result){\n" +
"\tmsg = \"" + msg + "\";\n" +
"\tAssertionResult.setFailureMessage(msg);\n" +
"\tAssertionResult.setFailure(true);\n" +
"}";
this.assertion.desc = desc;
this.assertion.script = script;
this.$refs.jsr233.reload();
}
},
pythonScript() {
if (this.assertion.variable && this.assertion.operator) {
let variable = this.assertion.variable;
let operator = this.assertion.operator;
let value = this.assertion.value || "";
let desc = "${" + variable + "} " + operator + " '" + value + "'";
let msg = "";
let script = "value = vars.get(\"" + variable + "\");\n"
switch (this.assertion.operator) {
case "==":
script += "if value != \"" + value + "\" :\n";
break;
case "!=":
script += "if value == \"" + value + "\" :\n";
break;
case "contains":
script += "if value.find(\"" + value + "\") == -1:\n";
msg = "value " + operator + " " + value + ": false;";
break;
case "not contains":
script += "if value.find(\"" + value + "\") != -1:\n";
msg = "value " + operator + " " + ": false;";
break;
case ">":
desc = "${" + variable + "} " + operator + " " + value;
script += "if value is None or int(value) < " + value + ":\n";
msg = "value " + operator + " " + value + ": false;";
break;
case "<":
desc = "${" + variable + "} " + operator + " " + value;
script += "if value is None or int(value) > " + value + ":\n";
msg = "value " + operator + " " + value + ": false;";
break;
case "is empty":
desc = "${" + variable + "} " + operator
script += "if value is not None:\n";
msg = "value " + operator + ": false;";
break;
case "is not empty":
desc = "${" + variable + "} " + operator
script += "if value is None:\n";
msg = "value " + operator + ": false;";
break;
}
script +=
"\tmsg = \" " + msg + "\"\n" +
"\tAssertionResult.setFailureMessage(msg)" +"\n"+
"\tAssertionResult.setFailure(True)";
this.assertion.desc = desc;
this.assertion.script = script;
this.$refs.jsr233.reload();
}
},
quickScript() {
if (this.assertion.scriptLanguage == 'beanshell' || this.assertion.scriptLanguage == 'groovy' || this.assertion.scriptLanguage == 'javascript') {
this.beanShellOrGroovyScript();
} else {
this.pythonScript();
}
},
detail() {
this.disabled = false;
this.visible = true;
},
showPage() {
this.disabled = true;
this.visible = true;
},
close() {
this.visible = false;
},
confirm() {
if (!this.edit) {
this.add();
}
if (!this.assertion.desc) {
this.assertion.desc = this.assertion.script;
}
this.close();
}
detail() {
this.disabled = false;
this.visible = true;
},
computed: {
hasEmptyOperator() {
return !!this.assertion.operator && this.assertion.operator.indexOf("empty") > 0;
showPage() {
this.disabled = true;
this.visible = true;
},
close() {
this.visible = false;
},
confirm() {
if (!this.edit) {
this.add();
}
if (!this.assertion.desc) {
this.assertion.desc = this.assertion.script;
}
this.close();
}
},
computed: {
hasEmptyOperator() {
return !!this.assertion.operator && this.assertion.operator.indexOf("empty") > 0;
}
}
}
</script>
<style scoped>
.assertion-item {
display: inline-block;
}
.assertion-item {
display: inline-block;
}
.assertion-item + .assertion-item {
margin-left: 10px;
}
.assertion-item + .assertion-item {
margin-left: 10px;
}
.assertion-item.input {
width: 100%;
}
.assertion-item.input {
width: 100%;
}
.assertion-item.select {
min-width: 150px;
}
.assertion-item.select {
min-width: 150px;
}
.assertion-item.label {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.assertion-item.label {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.assertion-item.btn {
min-width: 130px;
}
.assertion-item.btn {
min-width: 130px;
}
.assertion-item.btn.circle {
text-align: right;
min-width: 80px;
}
.assertion-item.btn.circle {
text-align: right;
min-width: 80px;
}
.quick-script-block {
margin-bottom: 10px;
}
.quick-script-block {
margin-bottom: 10px;
}
</style>

View File

@ -129,7 +129,11 @@ export default {
},
methods: {
remove() {
this.assertions.document = {type: "JSON", data: {xmlFollowAPI: false, jsonFollowAPI: false, json: [], xml: []}};
this.assertions.document = {
type: "JSON",
data: {xmlFollowAPI: false, jsonFollowAPI: false, json: [], xml: []},
enable: true
};
},
reload() {
this.loading = true

View File

@ -21,13 +21,18 @@
@cell-mouse-leave="editLeave"
row-key="id"
border
default-expand-all
lazy
:load="loadChild"
:height="300"
v-loading="loading">
v-loading="loading"
ref="table">
<el-table-column prop="name" :label="$t('api_test.definition.request.esb_table.name')" width="230">
<template slot-scope="scope">
<el-input v-if="(scope.row.status && scope.column.fixed && scope.row.id!=='root') || (scope.row.type !=='object' && !scope.row.name)" v-model="scope.row.name" style="width: 140px" size="mini" :placeholder="$t('api_test.definition.request.esb_table.name')"/>
<el-input
v-if="(scope.row.status && scope.column.fixed && scope.row.id!=='root') || (scope.row.type !=='object' && !scope.row.name)"
v-model="scope.row.name" style="width: 140px" size="mini"
:placeholder="$t('api_test.definition.request.esb_table.name')"/>
<span v-else>{{ scope.row.name }}</span>
</template>
</el-table-column>
@ -35,7 +40,8 @@
<el-table-column prop="include" width="78" :label="$t('api_test.request.assertions.must_contain')"
:scoped-slot="renderHeader">
<template slot-scope="scope">
<el-checkbox v-model="scope.row.include" @change="handleCheckOneChange" :disabled="checked || scope.row.type==='array'"/>
<el-checkbox v-model="scope.row.include" @change="handleCheckOneChange"
:disabled="checked || scope.row.type==='array'"/>
</template>
</el-table-column>
@ -48,7 +54,8 @@
<el-table-column prop="type" :label="$t('api_test.definition.request.esb_table.type')" width="120">
<template slot-scope="scope">
<el-select v-model="scope.row.type" :placeholder="$t('commons.please_select')" size="mini" @change="changeType(scope.row)" :disabled="checked">
<el-select v-model="scope.row.type" :placeholder="$t('commons.please_select')" size="mini"
@change="changeType(scope.row)" :disabled="checked">
<el-option v-for="item in typeSelectOptions " :key="item.value" :label="item.label" :value="item.value"/>
</el-select>
</template>
@ -93,7 +100,8 @@
:disabled="(scope.row.type !=='object' && scope.row.type !=='array') || checked"/>
</el-tooltip>
<el-tooltip effect="dark" :content="$t('commons.remove')" placement="top-start">
<el-button icon="el-icon-delete" type="primary" circle size="mini" style="margin-left: 10px" @click="remove(scope.row)" :disabled="checked || scope.row.id==='root'"/>
<el-button icon="el-icon-delete" type="primary" circle size="mini" style="margin-left: 10px"
@click="remove(scope.row)" :disabled="checked || scope.row.id==='root'"/>
</el-tooltip>
</span>
</template>
@ -149,8 +157,11 @@ export default {
],
checked: false,
tableData: Array,
originalData: Array,
mapData: new Map(),
}
},
created() {
if (this.document.type === "JSON") {
this.checked = this.document.data.jsonFollowAPI && this.document.data.jsonFollowAPI !== "false" ? true : false;
@ -167,7 +178,7 @@ export default {
this.checked = this.document.data.xmlFollowAPI && this.document.data.xmlFollowAPI !== "false" ? true : false;
}
this.changeData();
}
},
},
methods: {
removeDoc() {
@ -177,13 +188,60 @@ export default {
this.checked = false;
this.document.data.jsonFollowAPI = "";
this.document.data.xmlFollowAPI = "";
this.tableData = data;
//childrennull
this.tableDataList(data);
if (this.document.type === "JSON") {
this.document.data.json = this.tableData;
this.document.data.json = this.originalData;
} else if (this.document.type === "XML") {
this.document.data.xml = this.tableData;
}
},
tableDataList(data) {
this.$set(this.document, 'originalData', data);
this.$set(this.document, 'tableData', this.mapData);
this.originalData = data;
this.tableData = JSON.parse(JSON.stringify(data)).map(item => {
// hasChildren
item.hasChildren = item.children && item.children.length > 0
item.idList = [item.id];
item.children = [];
return item;
});
},
loadChild(tree, treeNode, resolve) {
//
const idCopy = JSON.parse(JSON.stringify(tree.idList))
//
let resolveArr;
if (tree.children.length === 0) {
resolveArr = this.originalData;
//children
const tarItem = resolveArr.find(item => item.id === tree.idList.shift())
tarItem.loadedChildren = true
resolveArr = tarItem.children
} else {
resolveArr = tree;
resolveArr = tree.children;
}
//
resolveArr = JSON.parse(JSON.stringify(resolveArr))
resolveArr.forEach(item => {
item.hasChildren = item.children && item.children.length > 0
item.children = [];
// itemidList
item.idList = JSON.parse(JSON.stringify(idCopy));
item.parentId = item.idList[item.idList.length - 1];
item.idList.push(item.id);
})
//
tree.loadedChildren = true
//
resolve(resolveArr);
this.mapData.set(tree.id, resolveArr);
},
checkedAPI() {
this.document.data.jsonFollowAPI = "";
this.document.data.xmlFollowAPI = "";
@ -212,7 +270,7 @@ export default {
let url = "/api/definition/getDocument/" + (id ? id : this.apiId) + "/" + this.document.type;
this.$get(url, response => {
if (response.data) {
this.tableData = response.data;
this.tableDataList(response.data);
}
});
},
@ -239,8 +297,9 @@ export default {
if (this.document.data.jsonFollowAPI) {
this.getDocument();
} else {
this.tableData = this.document.data.json;
this.tableDataList(this.document.data.json);
}
} else if (this.document.type === "XML") {
this.document.data.xmlFollowAPI = this.checked ? this.apiId : "";
if (this.document.data.xmlFollowAPI) {
@ -251,13 +310,6 @@ export default {
}
this.reload();
}
if (this.tableData && this.tableData.length > 0) {
this.tableData.forEach(row => {
if (row.name == null || row.name === "") {
this.remove(row);
}
})
}
},
objectSpanMethod({row, column, rowIndex, columnIndex}) {
if (columnIndex === 0 || columnIndex === 1 || columnIndex === 2 || columnIndex === 3) {
@ -268,7 +320,30 @@ export default {
}
},
changeType(row) {
row.children = [];
if (this.mapData && this.mapData.has(row.id)) {
this.clearChild(this.mapData.get(row.id))
row.hasChildren = false;
row.idList = [row.parentId, row.id];
}
this.changeChild(this.originalData, row);
},
clearChild(data) {
data.forEach(item => {
this.remove(item)
})
if (data && data.length > 0) {
this.clearChild(data);
}
},
changeChild(data, row) {
data.forEach(item => {
if (item.id === row.id) {
item.children = [];
row.hasChildren = false;
} else {
this.changeChild(item.children, row)
}
})
},
getValue(key) {
let value = "";
@ -308,6 +383,7 @@ export default {
)
},
renderHeaderArray(h, {column}) {
return h(
'span', [
h('el-checkbox', {
@ -358,19 +434,21 @@ export default {
if (this.checked) {
return;
}
this.tableData.forEach(item => {
this.originalData.forEach(item => {
item.typeVerification = val;
this.childrenChecked(item.children, 2, val);
})
this.tableDataList(this.originalData)
},
handleArray(val) {
if (this.checked) {
return;
}
this.tableData.forEach(item => {
this.originalData.forEach(item => {
item.arrayVerification = val;
this.childrenChecked(item.children, 3, val);
})
this.tableDataList(this.originalData)
},
handleCheckOneChange(val) {
},
@ -381,15 +459,44 @@ export default {
this.removeTableRow(row);
},
addRow(row) {
if (!row.idList && row.idList.length === 0) {
row.idList.push(row.id);
}
//
if (row.type !== "array") {
row.type = "object";
}
let newRow = this.getNewRow();
row.children.push(newRow);
newRow.idList = [row.id, newRow.id];
newRow.parentId = row.id;
if (this.mapData.has(row.id) && this.mapData.get(row.id).length > 0) {
this.mapData.get(row.id).push(newRow);
} else {
this.getChild(this.originalData, row);
row.children.push(newRow);
row.hasChildren = true;
if (row.parentId) {
let brotherRow = this.getNewRow();
brotherRow.idList = [row.parentId, brotherRow.id];
brotherRow.parentId = row.parentId;
this.mapData.get(row.parentId).push(brotherRow);
this.remove(brotherRow)
}
}
},
getChild(data, row) {
data.forEach(item => {
if (item.id === row.id) {
row.children = item.children
} else {
this.getChild(item.children, row)
}
})
},
verSet(arr, row) {
//
arr = this.mapData.get(row.idList[row.idList.length - 2]);
if (row.groupId) {
const index = arr.findIndex(d => d.id === row.groupId);
if (index !== -1) {
@ -398,7 +505,7 @@ export default {
} else if (row.rowspan > 0) {
const index = arr.findIndex(d => d.id === row.id);
if (index !== -1) {
arr[index].rowspan = arr[index].rowspan + 1;
arr[index].rowspan = arr[index].rowspan + 1;//
}
} else {
row.rowspan = 2;
@ -410,6 +517,7 @@ export default {
newRow.id = getUUID();
newRow.groupId = !row.groupId ? row.id : row.groupId;
newRow.rowspan = 0;
newRow.idList.splice(row.idList.length - 1, 0, newRow.id);
if (row.type !== "object" || row.type !== "array") {
newRow.children = [];
}
@ -420,9 +528,6 @@ export default {
arr.push(newRow);
}
}
if (item.children && item.children.length > 0) {
this.verSet(item.children, row);
}
})
},
addVerification(row) {
@ -508,15 +613,11 @@ export default {
} else {
row.rowspan = 1;
}
arr.forEach(item => {
if (item.children && item.children.length > 0) {
this.removeVerSet(item.children, row);
}
})
},
removeTableRow(row) {
this.removeVerSet(this.tableData, row);
this.removeFromDataStruct(this.tableData, row);
this.removeVerSet(this.mapData.get(row.parentId), row);
this.removeFromDataStruct(this.mapData.get(row.parentId), row);
},
removeFromDataStruct(dataStruct, row) {
if (dataStruct == null || dataStruct.length === 0) {
@ -525,12 +626,6 @@ export default {
let rowIndex = dataStruct.indexOf(row);
if (rowIndex >= 0) {
dataStruct.splice(rowIndex, 1);
} else {
dataStruct.forEach(itemData => {
if (itemData.children != null && itemData.children.length > 0) {
this.removeFromDataStruct(itemData.children, row);
}
});
}
},
}

View File

@ -8,7 +8,7 @@
</el-select>
</el-col>
<el-col class="assertion-btn">
<el-button :disabled="isReadOnly" type="primary" size="small" @click="add">
<el-button :disabled="isReadOnly" type="primary" size="mini" @click="add">
{{ $t('api_test.request.assertions.add') }}
</el-button>
</el-col>

View File

@ -182,8 +182,8 @@
</template>
<script>
import {_getBodyUploadFiles, getCurrentProjectID, getCurrentUser, getUUID} from "@/common/js/utils";
import {API_STATUS, PRIORITY} from "../../model/JsonData";
import {_getBodyUploadFiles, getCurrentProjectID, getCurrentUser, getUUID, hasPermission} from "@/common/js/utils";
import {API_METHOD_COLOUR, API_STATUS, PRIORITY} from "../../model/JsonData";
import MsTag from "../../../../common/components/MsTag";
import MsTipButton from "../../../../common/components/MsTipButton";
import MsApiRequestForm from "../request/http/ApiHttpRequestForm";
@ -197,15 +197,14 @@ import MsInputTag from "@/business/components/api/automation/scenario/MsInputTag
import MsRequestResultTail from "../response/RequestResultTail";
import ApiResponseComponent from "../../../automation/scenario/component/ApiResponseComponent";
import ShowMoreBtn from "../../../../track/case/components/ShowMoreBtn";
import MsChangeHistory from "../../../../history/ChangeHistory";
import {TYPE_TO_C} from "@/business/components/api/automation/scenario/Setting";
import ApiCaseHeader from "./ApiCaseHeader";
import {mergeRequestDocumentData} from "@/business/components/api/definition/api-definition";
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
const esbDefinition = (requireComponent != null && requireComponent.keys().length) > 0 ? requireComponent("./apidefinition/EsbDefinition.vue") : {};
const esbDefinitionResponse = (requireComponent != null && requireComponent.keys().length) > 0 ? requireComponent("./apidefinition/EsbDefinitionResponse.vue") : {};
import {API_METHOD_COLOUR} from "../../model/JsonData";
import MsChangeHistory from "../../../../history/ChangeHistory";
import {TYPE_TO_C} from "@/business/components/api/automation/scenario/Setting";
import {hasPermission} from '@/common/js/utils';
import ApiCaseHeader from "./ApiCaseHeader";
export default {
name: "ApiCaseItem",
@ -312,12 +311,11 @@ export default {
this.isXpack = true;
}
if (this.apiCase.request && this.apiCase.request.hashTree && this.apiCase.request.hashTree.length > 0) {
this.apiCase.request.hashTree.forEach(item => {
if (item.type === 'Assertions') {
item.document.nodeType = 'Case';
item.document.apiDefinitionId = this.apiCase.apiDefinitionId;
}
})
let index = this.apiCase.request.hashTree.findIndex(item => item.type === 'Assertions');
if (index !== -1) {
this.apiCase.request.hashTree[index].document.nodeType = 'Case';
this.apiCase.request.hashTree[index].document.apiDefinitionId = this.apiCase.apiDefinitionId;
}
}
this.readonly = !hasPermission('PROJECT_API_DEFINITION:READ+EDIT_CASE');
if (this.apiCase && this.apiCase.id) {
@ -431,11 +429,12 @@ export default {
});
},
singleRun(data) {
let methods =["SQL","DUBBO","dubbo://","TCP" ];
let methods = ["SQL", "DUBBO", "dubbo://", "TCP"];
if (data.apiMethod && methods.indexOf(data.apiMethod) === -1 && !this.environment) {
this.$warning(this.$t('api_test.environment.select_environment'));
return;
}
mergeRequestDocumentData(data.request);
if (data.apiMethod !== "SQL" && data.apiMethod !== "DUBBO" && data.apiMethod !== "dubbo://" && data.apiMethod !== "TCP") {
data.request.useEnvironment = this.environment;
} else {
@ -614,6 +613,7 @@ export default {
if (this.validate(row)) {
return;
}
mergeRequestDocumentData(this.apiCase.request);
this.compare = [];
if (this.compare.indexOf(row.id) === -1) {
this.compare.push(row.id);

View File

@ -2,7 +2,8 @@
<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">
<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>
@ -23,13 +24,17 @@
<ms-basis-parameters :request="request" ref="requestForm"/>
<!-- 请求返回数据 -->
<p class="tip">{{ $t('api_test.definition.request.res_param') }} </p>
<ms-request-result-tail v-if="!loading" :response="responseData" :currentProtocol="currentProtocol" ref="debugResult"/>
<ms-request-result-tail v-if="!loading" :response="responseData" :currentProtocol="currentProtocol"
ref="debugResult"/>
</div>
<!-- 执行组件 -->
<ms-run :debug="true" :reportId="reportId" :isStop="isStop" :run-data="runData" @runRefresh="runRefresh" ref="runTest"/>
<ms-run :debug="true" :reportId="reportId" :isStop="isStop" :run-data="runData" @runRefresh="runRefresh"
ref="runTest"/>
</el-card>
<div v-if="scenario">
<el-button style="float: right;margin: 20px" type="primary" @click="handleCommand('save_as_api')"> {{ $t('commons.save') }}</el-button>
<el-button style="float: right;margin: 20px" type="primary" @click="handleCommand('save_as_api')">
{{ $t('commons.save') }}
</el-button>
</div>
<!-- 加载用例 -->
<ms-api-case-list @refreshModule="refreshModule" :loaded="false" ref="caseList"/>
@ -49,6 +54,7 @@ import MsRequestResultTail from "../response/RequestResultTail";
import MsBasisParameters from "../request/dubbo/BasisParameters";
import MsApiCaseList from "../case/ApiCaseList";
import {TYPE_TO_C} from "@/business/components/api/automation/scenario/Setting";
import {mergeRequestDocumentData} from "@/business/components/api/definition/api-definition";
export default {
name: "ApiConfig",
@ -117,6 +123,7 @@ export default {
},
methods: {
handleCommand(e) {
mergeRequestDocumentData(this.request);
if (e === "save_as") {
this.saveAs();
} else if (e === 'save_as_api') {

View File

@ -23,7 +23,10 @@
@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-item command="save_as">{{
$t('api_test.definition.request.save_as_case')
}}
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<el-button v-if="scenario" size="small" type="primary" @click="handleCommand">
@ -41,18 +44,22 @@
<div v-loading="loading">
<p class="tip">{{ $t('api_test.definition.request.req_param') }} </p>
<!-- HTTP 请求参数 -->
<ms-api-request-form :isShowEnable="true" :definition-test="true" :headers="request.headers" :request="request" :response="responseData" ref="apiRequestForm"/>
<ms-api-request-form :isShowEnable="true" :definition-test="true" :headers="request.headers" :request="request"
:response="responseData" ref="apiRequestForm"/>
<!-- HTTP 请求返回数据 -->
<p class="tip">{{ $t('api_test.definition.request.res_param') }} </p>
<ms-request-result-tail v-if="!loading" :response="responseData" ref="debugResult"/>
<!-- 执行组件 -->
<ms-run :debug="true" :reportId="reportId" :isStop="isStop" :run-data="runData" @runRefresh="runRefresh" ref="runTest"/>
<ms-run :debug="true" :reportId="reportId" :isStop="isStop" :run-data="runData" @runRefresh="runRefresh"
ref="runTest"/>
</div>
</el-card>
<div v-if="scenario">
<el-button style="float: right;margin: 20px" type="primary" @click="handleCommand('save_as_api')"> {{ $t('commons.save') }}</el-button>
<el-button style="float: right;margin: 20px" type="primary" @click="handleCommand('save_as_api')">
{{ $t('commons.save') }}
</el-button>
</div>
<!-- 加载用例 -->
<ms-api-case-list :currentApi="debugForm" @refreshModule="refreshModule" :loaded="false" ref="caseList"/>
@ -72,6 +79,7 @@ import MsRequestResultTail from "../response/RequestResultTail";
import {KeyValue} from "../../model/ApiTestModel";
import MsApiCaseList from "../case/ApiCaseList";
import {TYPE_TO_C} from "@/business/components/api/automation/scenario/Setting";
import {mergeRequestDocumentData} from "@/business/components/api/definition/api-definition";
export default {
name: "ApiConfig",
@ -157,6 +165,7 @@ export default {
this.$refs.apiRequestForm.generate();
},
handleCommand(e) {
mergeRequestDocumentData(this.request);
if (e === "save_as") {
this.saveAs();
} else if (e === 'save_as_api') {
@ -198,7 +207,7 @@ export default {
this.responseData = data;
this.loading = false;
this.isStop = false;
if(this.$refs.debugResult) {
if (this.$refs.debugResult) {
this.$refs.debugResult.reload();
}
},

View File

@ -2,7 +2,8 @@
<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">
<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>
@ -23,14 +24,18 @@
<ms-basis-parameters :request="request" @callback="runDebug" ref="requestForm"/>
<!-- JDBC 请求返回数据 -->
<p class="tip">{{ $t('api_test.definition.request.res_param') }} </p>
<ms-request-result-tail v-if="!loading" :response="responseData" :currentProtocol="currentProtocol" ref="debugResult"/>
<ms-request-result-tail v-if="!loading" :response="responseData" :currentProtocol="currentProtocol"
ref="debugResult"/>
</div>
<!-- 执行组件 -->
<ms-run :debug="true" :reportId="reportId" :isStop="isStop" :run-data="runData" @runRefresh="runRefresh" ref="runTest"/>
<ms-run :debug="true" :reportId="reportId" :isStop="isStop" :run-data="runData" @runRefresh="runRefresh"
ref="runTest"/>
</el-card>
<div v-if="scenario">
<el-button style="float: right;margin: 20px" type="primary" @click="handleCommand('save_as_api')"> {{ $t('commons.save') }}</el-button>
<el-button style="float: right;margin: 20px" type="primary" @click="handleCommand('save_as_api')">
{{ $t('commons.save') }}
</el-button>
</div>
<!-- 加载用例 -->
<ms-api-case-list @refreshModule="refreshModule" :loaded="false" ref="caseList"/>
@ -51,6 +56,7 @@ import MsRequestResultTail from "../response/RequestResultTail";
import MsBasisParameters from "../request/database/BasisParameters";
import MsApiCaseList from "../case/ApiCaseList";
import {TYPE_TO_C} from "@/business/components/api/automation/scenario/Setting";
import {mergeRequestDocumentData} from "@/business/components/api/definition/api-definition";
export default {
name: "ApiConfig",
@ -111,8 +117,8 @@ export default {
} else {
this.request = createComponent("JDBCSampler");
}
if(!this.request.environmentId){
this.request.environmentId = this.$store.state.useEnvironment;
if (!this.request.environmentId) {
this.request.environmentId = this.$store.state.useEnvironment;
}
},
watch: {
@ -122,6 +128,7 @@ export default {
},
methods: {
handleCommand(e) {
mergeRequestDocumentData(this.request);
if (e === "save_as") {
this.saveAs();
} else if (e === 'save_as_api') {

View File

@ -8,7 +8,7 @@
<el-input v-model="request.server" maxlength="300" show-word-limit size="small"/>
</el-form-item>
<el-form-item :label="$t('api_test.request.tcp.port')" prop="port" label-width="60px">
<el-input v-model="request.port" size="small"/>
<el-input v-model="request.port" size="small"/>
</el-form-item>
<el-form-item>
<el-button size="small" type="primary" @click="stop" v-if="isStop">
@ -35,13 +35,17 @@
<ms-tcp-format-parameters :request="request" @callback="runDebug" ref="requestForm"/>
<!-- TCP 请求返回数据 -->
<p class="tip">{{ $t('api_test.definition.request.res_param') }} </p>
<ms-request-result-tail v-if="!loading" :response="responseData" :currentProtocol="currentProtocol" ref="debugResult"/>
<ms-request-result-tail v-if="!loading" :response="responseData" :currentProtocol="currentProtocol"
ref="debugResult"/>
</div>
<!-- 执行组件 -->
<ms-run :debug="true" :reportId="reportId" :isStop="isStop" :run-data="runData" @runRefresh="runRefresh" ref="runTest"/>
<ms-run :debug="true" :reportId="reportId" :isStop="isStop" :run-data="runData" @runRefresh="runRefresh"
ref="runTest"/>
</el-card>
<div v-if="scenario">
<el-button style="float: right;margin: 20px" type="primary" @click="handleCommand('save_as_api')"> {{ $t('commons.save') }}</el-button>
<el-button style="float: right;margin: 20px" type="primary" @click="handleCommand('save_as_api')">
{{ $t('commons.save') }}
</el-button>
</div>
<!-- 加载用例 -->
<ms-api-case-list @refreshModule="refreshModule" :loaded="false" ref="caseList"/>
@ -63,6 +67,7 @@ import MsRequestResultTail from "../response/RequestResultTail";
import MsTcpFormatParameters from "@/business/components/api/definition/components/request/tcp/TcpFormatParameters";
import MsApiCaseList from "../case/ApiCaseList";
import {TYPE_TO_C} from "@/business/components/api/automation/scenario/Setting";
import {mergeRequestDocumentData} from "@/business/components/api/definition/api-definition";
export default {
name: "ApiConfig",
@ -126,6 +131,7 @@ export default {
},
methods: {
handleCommand(e) {
mergeRequestDocumentData(this.request);
if (e === "save_as") {
this.saveAs();
} else if (e === 'save_as_api') {

View File

@ -31,6 +31,7 @@
operator-width="190px"
@refresh="initTable"
ref="caseTable"
class="api-case-simple-list"
>
<ms-table-column
prop="deleteTime"
@ -1342,4 +1343,9 @@ export default {
.ms-unexecute {
}
.api-case-simple-list >>> .el-table {
height: calc(100vh - 262px) !important;
}
</style>

View File

@ -61,6 +61,7 @@ import MsRun from "../Run";
import MsBasisParameters from "../request/dubbo/BasisParameters";
import {REQ_METHOD} from "../../model/JsonData";
import {TYPE_TO_C} from "@/business/components/api/automation/scenario/Setting";
import {mergeRequestDocumentData} from "@/business/components/api/definition/api-definition";
export default {
name: "RunTestDubboPage",
@ -100,6 +101,7 @@ export default {
props: {apiData: {}, currentProtocol: String, syncTabs: Array, projectId: String},
methods: {
handleCommand(e) {
mergeRequestDocumentData(this.request);
switch (e) {
case "load_case":
return this.loadCase();

View File

@ -61,7 +61,8 @@
<div v-loading="loading">
<p class="tip">{{ $t('api_test.definition.request.req_param') }} </p>
<!-- HTTP 请求参数 -->
<ms-api-request-form :isShowEnable="true" :definition-test="true" :headers="api.request.headers" :response="responseData"
<ms-api-request-form :isShowEnable="true" :definition-test="true" :headers="api.request.headers"
:response="responseData"
v-if="loadRequest"
:request="api.request" ref="apiRequestForm"/>
<!--返回结果-->
@ -98,6 +99,7 @@ import MsRun from "../Run";
import {REQ_METHOD} from "../../model/JsonData";
import EnvironmentSelect from "../environment/EnvironmentSelect";
import {TYPE_TO_C} from "@/business/components/api/automation/scenario/Setting";
import {mergeRequestDocumentData} from "@/business/components/api/definition/api-definition";
export default {
name: "RunTestHTTPPage",
@ -119,7 +121,7 @@ export default {
createCase: "",
currentRequest: {},
refreshSign: "",
loadCaseConfirmButton:this.$t("commons.confirm"),
loadCaseConfirmButton: this.$t("commons.confirm"),
responseData: {type: 'HTTP', responseResult: {}, subRequestResults: []},
reqOptions: REQ_METHOD,
rules: {
@ -201,6 +203,7 @@ export default {
})
},
handleCommand(e) {
mergeRequestDocumentData(this.api.request);
switch (e) {
case "load_case":
return this.loadCase();

View File

@ -61,6 +61,7 @@ import MsRun from "../Run";
import MsBasisParameters from "../request/database/BasisParameters";
import {REQ_METHOD} from "../../model/JsonData";
import {TYPE_TO_C} from "@/business/components/api/automation/scenario/Setting";
import {mergeRequestDocumentData} from "@/business/components/api/definition/api-definition";
export default {
name: "RunTestSQLPage",
@ -100,6 +101,7 @@ export default {
props: {apiData: {}, currentProtocol: String, syncTabs: Array, projectId: String},
methods: {
handleCommand(e) {
mergeRequestDocumentData(this.api.request);
switch (e) {
case "load_case":
return this.loadCase();
@ -290,13 +292,13 @@ export default {
created() {
//
this.api = JSON.parse(JSON.stringify(this.apiData));
if(!this.api.environmentId){
this.api.environmentId = this.$store.state.useEnvironment;
if (!this.api.environmentId) {
this.api.environmentId = this.$store.state.useEnvironment;
}
this.api.protocol = this.currentProtocol;
this.currentRequest = this.api.request;
if(!this.currentRequest.environmentId){
this.currentRequest.environmentId = this.$store.state.useEnvironment;
if (!this.currentRequest.environmentId) {
this.currentRequest.environmentId = this.$store.state.useEnvironment;
}
this.runLoading = false;
this.getEnvironments();

View File

@ -84,6 +84,7 @@ import MsTcpFormatParameters from "@/business/components/api/definition/componen
import {REQ_METHOD} from "../../model/JsonData";
import EnvironmentSelect from "../environment/EnvironmentSelect";
import {TYPE_TO_C} from "@/business/components/api/automation/scenario/Setting";
import {mergeRequestDocumentData} from "@/business/components/api/definition/api-definition";
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
const esbDefinition = (requireComponent != null && requireComponent.keys().length) > 0 ? requireComponent("./apidefinition/EsbDefinition.vue") : {};
@ -128,7 +129,7 @@ export default {
props: {apiData: {}, currentProtocol: String, syncTabs: Array, projectId: String},
watch: {
'$store.state.useEnvironment': function () {
if(this.api && this.api.request) {
if (this.api && this.api.request) {
this.api.request.useEnvironment = this.$store.state.useEnvironment;
}
this.api.environmentId = this.$store.state.useEnvironment;
@ -168,6 +169,7 @@ export default {
}
},
handleCommand(e) {
mergeRequestDocumentData(this.api.request);
switch (e) {
case "load_case":
return this.loadCase();
@ -339,7 +341,7 @@ export default {
if (requireComponent != null && JSON.stringify(esbDefinition) !== '{}') {
this.showXpackCompnent = true;
}
if(this.api.environmentId) {
if (this.api.environmentId) {
this.api.request.useEnvironment = this.api.environmentId;
}
this.checkVersionEnable();

View File

@ -12,7 +12,6 @@ import {
HTTPsamplerFiles,
HTTPSamplerProxy,
IfController as JMXIfController,
TransactionController as JMXTransactionController,
JDBCDataSource,
JDBCSampler,
JSONPathAssertion,
@ -782,7 +781,7 @@ export class Assertions extends BaseConfig {
this.xpath2 = [];
this.duration = undefined;
this.enable = true;
this.document = {type: "JSON", data: {xmlFollowAPI: false, jsonFollowAPI: false, json: [], xml: []}};
this.document = {type: "JSON", data: {xmlFollowAPI: false, jsonFollowAPI: false, json: [], xml: []}, enable: true};
this.set(options);
this.sets({text: Text, regex: Regex, jsonPath: JSONPath, jsr223: AssertionJSR223, xpath2: XPath2}, options);
}
@ -1131,7 +1130,7 @@ export class TransactionController extends Controller {
this.type = "TransactionController";
this.name;
this.hashTree = [];
this.generateParentSample =true;
this.generateParentSample = true;
this.includeTimers = true;
this.set(options);