feat(接口自动化): 查看引用场景变量
This commit is contained in:
parent
90adde0933
commit
d43f867e97
|
@ -39,7 +39,7 @@
|
||||||
:name="item.name"
|
:name="item.name"
|
||||||
closable>
|
closable>
|
||||||
<div class="ms-api-scenario-div">
|
<div class="ms-api-scenario-div">
|
||||||
<ms-edit-api-scenario @refresh="refresh" :currentScenario="item.currentScenario"
|
<ms-edit-api-scenario @refresh="refresh" @openScenario="editScenario" :currentScenario="item.currentScenario"
|
||||||
:moduleOptions="moduleOptions" ref="autoScenarioConfig"/>
|
:moduleOptions="moduleOptions" ref="autoScenarioConfig"/>
|
||||||
</div>
|
</div>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
|
|
|
@ -137,7 +137,7 @@
|
||||||
<!-- 步骤组件-->
|
<!-- 步骤组件-->
|
||||||
<ms-component-config :type="data.type" :scenario="data" :response="response" :currentScenario="currentScenario"
|
<ms-component-config :type="data.type" :scenario="data" :response="response" :currentScenario="currentScenario"
|
||||||
:currentEnvironmentId="currentEnvironmentId" :node="node" :project-list="projectList" :env-map="projectEnvMap"
|
:currentEnvironmentId="currentEnvironmentId" :node="node" :project-list="projectList" :env-map="projectEnvMap"
|
||||||
@remove="remove" @copyRow="copyRow" @suggestClick="suggestClick" @refReload="refReload"/>
|
@remove="remove" @copyRow="copyRow" @suggestClick="suggestClick" @refReload="refReload" @openScenario="openScenario"/>
|
||||||
</span>
|
</span>
|
||||||
</el-tree>
|
</el-tree>
|
||||||
</div>
|
</div>
|
||||||
|
@ -198,7 +198,7 @@
|
||||||
<ms-drawer :visible="drawer" :size="100" @close="close" direction="right" :show-full-screen="false" :is-show-close="false" style="overflow: hidden">
|
<ms-drawer :visible="drawer" :size="100" @close="close" direction="right" :show-full-screen="false" :is-show-close="false" style="overflow: hidden">
|
||||||
<template v-slot:header>
|
<template v-slot:header>
|
||||||
<scenario-header :currentScenario="currentScenario" :projectEnvMap="projectEnvMap" :projectIds="projectIds" :projectList="projectList" :scenarioDefinition="scenarioDefinition" :enableCookieShare="enableCookieShare"
|
<scenario-header :currentScenario="currentScenario" :projectEnvMap="projectEnvMap" :projectIds="projectIds" :projectList="projectList" :scenarioDefinition="scenarioDefinition" :enableCookieShare="enableCookieShare"
|
||||||
@closePage="close" @showAllBtn="showAllBtn" @runDebug="runDebug" @showScenarioParameters="showScenarioParameters" ref="maximizeHeader"/>
|
@closePage="close" @showAllBtn="showAllBtn" @runDebug="runDebug" @setProjectEnvMap="setProjectEnvMap" @showScenarioParameters="showScenarioParameters" ref="maximizeHeader"/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<maximize-scenario :scenario-definition="scenarioDefinition" :moduleOptions="moduleOptions" :currentScenario="currentScenario" :type="type" ref="maximizeScenario"/>
|
<maximize-scenario :scenario-definition="scenarioDefinition" :moduleOptions="moduleOptions" :currentScenario="currentScenario" :type="type" ref="maximizeScenario"/>
|
||||||
|
@ -222,7 +222,7 @@
|
||||||
import {parseEnvironment} from "../../definition/model/EnvironmentModel";
|
import {parseEnvironment} from "../../definition/model/EnvironmentModel";
|
||||||
import {ELEMENT_TYPE, ELEMENTS} from "./Setting";
|
import {ELEMENT_TYPE, ELEMENTS} from "./Setting";
|
||||||
import MsApiCustomize from "./ApiCustomize";
|
import MsApiCustomize from "./ApiCustomize";
|
||||||
import {getCurrentProjectID, getUUID, objToStrMap, strMapToObj} from "@/common/js/utils";
|
import {getCurrentProjectID, getUUID, objToStrMap, strMapToObj, handleCtrlSEvent} from "@/common/js/utils";
|
||||||
import ApiEnvironmentConfig from "../../definition/components/environment/ApiEnvironmentConfig";
|
import ApiEnvironmentConfig from "../../definition/components/environment/ApiEnvironmentConfig";
|
||||||
import MsInputTag from "./MsInputTag";
|
import MsInputTag from "./MsInputTag";
|
||||||
import MsRun from "./DebugRun";
|
import MsRun from "./DebugRun";
|
||||||
|
@ -234,7 +234,6 @@
|
||||||
import ScenarioApiRelevance from "./api/ApiRelevance";
|
import ScenarioApiRelevance from "./api/ApiRelevance";
|
||||||
import ScenarioRelevance from "./api/ScenarioRelevance";
|
import ScenarioRelevance from "./api/ScenarioRelevance";
|
||||||
import MsComponentConfig from "./component/ComponentConfig";
|
import MsComponentConfig from "./component/ComponentConfig";
|
||||||
import {handleCtrlSEvent} from "../../../../../common/js/utils";
|
|
||||||
import EnvPopover from "@/business/components/api/automation/scenario/EnvPopover";
|
import EnvPopover from "@/business/components/api/automation/scenario/EnvPopover";
|
||||||
import MaximizeScenario from "./maximize/MaximizeScenario";
|
import MaximizeScenario from "./maximize/MaximizeScenario";
|
||||||
import ScenarioHeader from "./maximize/ScenarioHeader";
|
import ScenarioHeader from "./maximize/ScenarioHeader";
|
||||||
|
@ -442,6 +441,10 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
// 打开引用的场景
|
||||||
|
openScenario(data) {
|
||||||
|
this.$emit('openScenario', data);
|
||||||
|
},
|
||||||
showAllBtn() {
|
showAllBtn() {
|
||||||
this.$refs.maximizeScenario.showAll();
|
this.$refs.maximizeScenario.showAll();
|
||||||
},
|
},
|
||||||
|
@ -465,7 +468,9 @@
|
||||||
// 直接更新场景防止编辑内容丢失
|
// 直接更新场景防止编辑内容丢失
|
||||||
this.editScenario();
|
this.editScenario();
|
||||||
}
|
}
|
||||||
this.$refs.maximizeHeader.getVariableSize();
|
if (this.$refs.maximizeHeader) {
|
||||||
|
this.$refs.maximizeHeader.getVariableSize();
|
||||||
|
}
|
||||||
this.reload();
|
this.reload();
|
||||||
},
|
},
|
||||||
showButton(...names) {
|
showButton(...names) {
|
||||||
|
@ -727,6 +732,9 @@
|
||||||
this.loading = false
|
this.loading = false
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
runDebugMax() {
|
||||||
|
this.$refs.maximizeScenario.runDebug();
|
||||||
|
},
|
||||||
runDebug() {
|
runDebug() {
|
||||||
/*触发执行操作*/
|
/*触发执行操作*/
|
||||||
let sign = this.$refs.envPopover.checkEnv();
|
let sign = this.$refs.envPopover.checkEnv();
|
||||||
|
|
|
@ -90,7 +90,8 @@
|
||||||
response.data.forEach(item => {
|
response.data.forEach(item => {
|
||||||
let scenarioDefinition = JSON.parse(item.scenarioDefinition);
|
let scenarioDefinition = JSON.parse(item.scenarioDefinition);
|
||||||
if (scenarioDefinition && scenarioDefinition.hashTree) {
|
if (scenarioDefinition && scenarioDefinition.hashTree) {
|
||||||
let obj = {id: item.id, name: item.name, type: "scenario", referenced: 'Copy', resourceId: getUUID(), hashTree: scenarioDefinition.hashTree, projectId: item.projectId};
|
let obj = {id: item.id, name: item.name, type: "scenario", headers: scenarioDefinition.headers, variables: scenarioDefinition.variables, environmentMap: scenarioDefinition.environmentMap,
|
||||||
|
referenced: 'Copy', resourceId: getUUID(), hashTree: scenarioDefinition.hashTree, projectId: item.projectId};
|
||||||
scenarios.push(obj);
|
scenarios.push(obj);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
@click="active(data)" v-if="data.type!='scenario' && !isMax "/>
|
@click="active(data)" v-if="data.type!='scenario' && !isMax "/>
|
||||||
<el-input :draggable="draggable" v-if="isShowInput && isShowNameInput" size="mini" v-model="data.name" class="name-input"
|
<el-input :draggable="draggable" v-if="isShowInput && isShowNameInput" size="mini" v-model="data.name" class="name-input"
|
||||||
@blur="isShowInput = false" :placeholder="$t('commons.input_name')" ref="nameEdit" :disabled="data.disabled"/>
|
@blur="isShowInput = false" :placeholder="$t('commons.input_name')" ref="nameEdit" :disabled="data.disabled"/>
|
||||||
|
<!--最大化显示-->
|
||||||
<span v-else-if="isMax">
|
<span v-else-if="isMax">
|
||||||
<el-tooltip :content="data.name" placement="top">
|
<el-tooltip :content="data.name" placement="top">
|
||||||
<span>{{data.name}}</span>
|
<span>{{data.name}}</span>
|
||||||
|
@ -34,13 +35,14 @@
|
||||||
<el-switch v-model="data.enable" class="enable-switch"/>
|
<el-switch v-model="data.enable" class="enable-switch"/>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
<slot name="button"></slot>
|
<slot name="button"></slot>
|
||||||
<step-extend-btns style="display: contents" @copy="copyRow" @remove="remove" v-if="showBtn"/>
|
<step-extend-btns style="display: contents" :data="data" @copy="copyRow" @remove="remove" @openScenario="openScenario" v-if="showBtn"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
<!--最大化不显示具体内容-->
|
||||||
<div class="header" v-if="!isMax">
|
<div class="header" v-if="!isMax">
|
||||||
<fieldset :disabled="data.disabled" class="ms-fieldset">
|
<fieldset :disabled="data.disabled" class="ms-fieldset">
|
||||||
<el-collapse-transition>6.
|
<el-collapse-transition>
|
||||||
<div v-if="data.active && showCollapse" :draggable="draggable">
|
<div v-if="data.active && showCollapse" :draggable="draggable">
|
||||||
<el-divider></el-divider>
|
<el-divider></el-divider>
|
||||||
<slot></slot>
|
<slot></slot>
|
||||||
|
@ -130,6 +132,9 @@
|
||||||
remove() {
|
remove() {
|
||||||
this.$emit('remove');
|
this.$emit('remove');
|
||||||
},
|
},
|
||||||
|
openScenario(data) {
|
||||||
|
this.$emit('openScenario', data);
|
||||||
|
},
|
||||||
editName() {
|
editName() {
|
||||||
this.isShowInput = true;
|
this.isShowInput = true;
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
|
@ -159,7 +164,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.header-right {
|
.header-right {
|
||||||
margin-top: 5px;
|
margin-top: 0px;
|
||||||
float: right;
|
float: right;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
@copy="copyRow"
|
@copy="copyRow"
|
||||||
@remove="remove"
|
@remove="remove"
|
||||||
@active="active"
|
@active="active"
|
||||||
|
@openScenario="openScenario"
|
||||||
:data="scenario"
|
:data="scenario"
|
||||||
:show-collapse="false"
|
:show-collapse="false"
|
||||||
:is-show-name-input="!isDeletedOrRef"
|
:is-show-name-input="!isDeletedOrRef"
|
||||||
|
@ -62,8 +63,10 @@
|
||||||
this.result = this.$get("/api/automation/getApiScenario/" + this.scenario.id, response => {
|
this.result = this.$get("/api/automation/getApiScenario/" + this.scenario.id, response => {
|
||||||
if (response.data) {
|
if (response.data) {
|
||||||
this.scenario.loaded = true;
|
this.scenario.loaded = true;
|
||||||
|
let obj = {};
|
||||||
if (response.data.scenarioDefinition) {
|
if (response.data.scenarioDefinition) {
|
||||||
this.scenario.hashTree = JSON.parse(response.data.scenarioDefinition).hashTree;
|
obj = JSON.parse(response.data.scenarioDefinition);
|
||||||
|
this.scenario.hashTree = obj.hashTree;
|
||||||
}
|
}
|
||||||
if (this.scenario.hashTree) {
|
if (this.scenario.hashTree) {
|
||||||
this.setDisabled(this.scenario.hashTree);
|
this.setDisabled(this.scenario.hashTree);
|
||||||
|
@ -73,7 +76,9 @@
|
||||||
if (!this.scenario.projectId) {
|
if (!this.scenario.projectId) {
|
||||||
this.scenario.projectId = response.data.projectId;
|
this.scenario.projectId = response.data.projectId;
|
||||||
}
|
}
|
||||||
|
this.scenario.headers = obj.headers;
|
||||||
|
this.scenario.variables = obj.variables;
|
||||||
|
this.scenario.environmentMap = obj.environmentMap;
|
||||||
this.$emit('refReload');
|
this.$emit('refReload');
|
||||||
} else {
|
} else {
|
||||||
this.scenario.referenced = "Deleted";
|
this.scenario.referenced = "Deleted";
|
||||||
|
@ -109,6 +114,9 @@
|
||||||
copyRow() {
|
copyRow() {
|
||||||
this.$emit('copyRow', this.scenario, this.node);
|
this.$emit('copyRow', this.scenario, this.node);
|
||||||
},
|
},
|
||||||
|
openScenario(data){
|
||||||
|
this.$emit('openScenario', data);
|
||||||
|
},
|
||||||
reload() {
|
reload() {
|
||||||
this.loading = true
|
this.loading = true
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<component :is="component" :isMax="isMax" :show-btn="showBtn"
|
<component :is="component" :isMax="isMax" :show-btn="showBtn"
|
||||||
:scenario="scenario" :controller="scenario" :timer="scenario" :assertions="scenario" :extract="scenario" :jsr223-processor="scenario" :request="scenario" :currentScenario="currentScenario" :currentEnvironmentId="currentEnvironmentId" :node="node"
|
:scenario="scenario" :controller="scenario" :timer="scenario" :assertions="scenario" :extract="scenario" :jsr223-processor="scenario" :request="scenario" :currentScenario="currentScenario" :currentEnvironmentId="currentEnvironmentId" :node="node"
|
||||||
:draggable="true" :title="title" :color="titleColor" :background-color="backgroundColor" @suggestClick="suggestClick(node)" :response="response"
|
:draggable="true" :title="title" :color="titleColor" :background-color="backgroundColor" @suggestClick="suggestClick(node)" :response="response"
|
||||||
@remove="remove" @copyRow="copyRow" @refReload="refReload" :project-list="projectList" :env-map="envMap"/>
|
@remove="remove" @copyRow="copyRow" @refReload="refReload" @openScenario="openScenario" :project-list="projectList" :env-map="envMap"/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -120,6 +120,9 @@
|
||||||
this.$emit('copyRow', row, node);
|
this.$emit('copyRow', row, node);
|
||||||
|
|
||||||
},
|
},
|
||||||
|
openScenario(data){
|
||||||
|
this.$emit('openScenario', data);
|
||||||
|
},
|
||||||
suggestClick(node) {
|
suggestClick(node) {
|
||||||
this.$emit('suggestClick', node);
|
this.$emit('suggestClick', node);
|
||||||
},
|
},
|
||||||
|
|
|
@ -7,34 +7,31 @@
|
||||||
<el-dropdown-menu slot="dropdown">
|
<el-dropdown-menu slot="dropdown">
|
||||||
<el-dropdown-item command="copy">复制步骤</el-dropdown-item>
|
<el-dropdown-item command="copy">复制步骤</el-dropdown-item>
|
||||||
<el-dropdown-item command="remove" v-tester>删除步骤</el-dropdown-item>
|
<el-dropdown-item command="remove" v-tester>删除步骤</el-dropdown-item>
|
||||||
<el-dropdown-item command="scenarioVar" v-tester>查看场景变量</el-dropdown-item>
|
<el-dropdown-item command="scenarioVar" v-tester v-if="data.type==='scenario'">查看场景变量</el-dropdown-item>
|
||||||
<el-dropdown-item command="openScenario" v-tester>打开场景</el-dropdown-item>
|
<el-dropdown-item command="openScenario" v-tester v-if="data.type==='scenario' && data.referenced==='REF'">打开场景</el-dropdown-item>
|
||||||
<el-dropdown-item command="saveAs" v-tester>另存为接口定义</el-dropdown-item>
|
<el-dropdown-item command="saveAs" v-tester v-if="allSamplers.indexOf(data.type)!=-1">另存为接口定义</el-dropdown-item>
|
||||||
<!--<el-tooltip content="Copy" placement="top">-->
|
|
||||||
<!--<el-button size="mini" icon="el-icon-copy-document" circle @click="copyRow" :disabled="data && data.disabled"/>-->
|
|
||||||
<!--</el-tooltip>-->
|
|
||||||
<!--<el-tooltip :content="$t('commons.remove')" placement="top">-->
|
|
||||||
<!--<el-button size="mini" icon="el-icon-delete" type="danger" circle @click="remove" :disabled="data && data.disabled"/>-->
|
|
||||||
<!--</el-tooltip>-->
|
|
||||||
|
|
||||||
</el-dropdown-menu>
|
</el-dropdown-menu>
|
||||||
</el-dropdown>
|
</el-dropdown>
|
||||||
<ms-reference-view @openScenario="openScenario" ref="viewRef"/>
|
<ms-variable-list ref="scenarioParameters"/>
|
||||||
<ms-schedule-maintain ref="scheduleMaintain" @refreshTable="refreshTable"/>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import MsReferenceView from "@/business/components/api/automation/scenario/ReferenceView";
|
|
||||||
import MsScheduleMaintain from "@/business/components/api/automation/schedule/ScheduleMaintain"
|
|
||||||
import {getCurrentProjectID, getUUID} from "@/common/js/utils";
|
import {getCurrentProjectID, getUUID} from "@/common/js/utils";
|
||||||
|
import {ELEMENTS} from "../Setting";
|
||||||
|
import MsVariableList from "../variable/VariableList";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "StepExtendBtns",
|
name: "StepExtendBtns",
|
||||||
components: {MsReferenceView, MsScheduleMaintain},
|
components: {ELEMENTS, MsVariableList},
|
||||||
props: {
|
props: {
|
||||||
row: Object
|
data: Object,
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
allSamplers: ELEMENTS.get('AllSamplerProxy'),
|
||||||
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
handleCommand(cmd) {
|
handleCommand(cmd) {
|
||||||
|
@ -46,47 +43,16 @@
|
||||||
this.$emit('remove');
|
this.$emit('remove');
|
||||||
break;
|
break;
|
||||||
case "scenarioVar":
|
case "scenarioVar":
|
||||||
this.$emit('copy');
|
this.$refs.scenarioParameters.open(this.data.variables, this.data.headers, true);
|
||||||
break;
|
break;
|
||||||
case "openScenario":
|
case "openScenario":
|
||||||
this.$emit('copy');
|
this.$emit('openScenario', this.data);
|
||||||
break;
|
break;
|
||||||
case "saveAs":
|
case "saveAs":
|
||||||
this.$emit('copy');
|
this.$emit('copy');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
createPerformance(row) {
|
|
||||||
this.infoDb = false;
|
|
||||||
let url = "/api/automation/genPerformanceTestJmx";
|
|
||||||
let run = {};
|
|
||||||
let scenarioIds = [];
|
|
||||||
scenarioIds.push(row.id);
|
|
||||||
run.projectId = getCurrentProjectID();
|
|
||||||
run.ids = scenarioIds;
|
|
||||||
run.id = getUUID();
|
|
||||||
run.name = row.name;
|
|
||||||
this.$post(url, run, response => {
|
|
||||||
let jmxObj = {};
|
|
||||||
jmxObj.name = response.data.name;
|
|
||||||
jmxObj.xml = response.data.xml;
|
|
||||||
jmxObj.attachFiles = response.data.attachFiles;
|
|
||||||
jmxObj.attachByteFiles = response.data.attachByteFiles;
|
|
||||||
this.$store.commit('setTest', {
|
|
||||||
name: row.name,
|
|
||||||
jmx: jmxObj
|
|
||||||
})
|
|
||||||
this.$router.push({
|
|
||||||
path: "/performance/test/create"
|
|
||||||
})
|
|
||||||
});
|
|
||||||
},
|
|
||||||
openScenario(item) {
|
|
||||||
this.$emit('openScenario', item)
|
|
||||||
},
|
|
||||||
refreshTable() {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -1,31 +1,28 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="ms-header" @click="showAll">
|
<div class="ms-header">
|
||||||
<el-row>
|
<div class="ms-div" v-loading="loading" @click="showAll">
|
||||||
<div class="ms-div" v-loading="loading">
|
<!-- 调试部分 -->
|
||||||
<!-- 调试部分 -->
|
<el-row class="ms-header-margin">
|
||||||
<el-row style="margin: 5px">
|
<el-col :span="8">
|
||||||
<el-col :span="6" class="ms-col-one ms-font">
|
{{currentScenario.name}}
|
||||||
{{$t('api_test.automation.step_total')}}:{{scenarioDefinition.length}}
|
</el-col>
|
||||||
</el-col>
|
<el-col :span="8">
|
||||||
<el-col :span="6" class="ms-col-one ms-font">
|
{{$t('api_test.automation.step_total')}}:{{scenarioDefinition.length}}
|
||||||
<el-link class="head" @click="showScenarioParameters">{{$t('api_test.automation.scenario_total')}}</el-link>
|
</el-col>
|
||||||
:{{varSize }}
|
<el-col :span="8">
|
||||||
</el-col>
|
<el-link class="head" @click="showScenarioParameters">{{$t('api_test.automation.scenario_total')}}</el-link>
|
||||||
<el-col :span="5" class="ms-col-one ms-font">
|
:{{varSize }}
|
||||||
<el-checkbox v-model="enableCookieShare">共享cookie</el-checkbox>
|
</el-col>
|
||||||
</el-col>
|
</el-row>
|
||||||
<el-col :span="7">
|
</div>
|
||||||
<env-popover :env-map="envMap" :project-ids="projectIds" @setProjectEnvMap="setProjectEnvMap"
|
<div class="ms-header-right">
|
||||||
:project-list="projectList" ref="envPopover" style="margin-top: 0px"/>
|
<el-checkbox v-model="cookieShare" class="ms-right">共享cookie</el-checkbox>
|
||||||
</el-col>
|
<env-popover :env-map="envMap" :project-ids="projectIds" @setProjectEnvMap="setProjectEnvMap"
|
||||||
</el-row>
|
:project-list="projectList" ref="envPopover" class="ms-right"/>
|
||||||
</div>
|
<el-button :disabled="scenarioDefinition.length < 1" size="mini" type="primary" v-prevent-re-click @click="runDebug">{{$t('api_test.request.debug')}}</el-button>
|
||||||
<div class="ms-header-right">
|
|
|
||||||
<el-button :disabled="scenarioDefinition.length < 1" size="small" type="primary" v-prevent-re-click @click="runDebug">{{$t('api_test.request.debug')}}</el-button>
|
<i class="el-icon-close alt-ico" @click="close"/>
|
||||||
|
|
</div>
|
||||||
<i class="el-icon-close alt-ico" @click="close"/>
|
|
||||||
</div>
|
|
||||||
</el-row>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -43,11 +40,13 @@
|
||||||
envMap: new Map,
|
envMap: new Map,
|
||||||
loading: false,
|
loading: false,
|
||||||
varSize: 0,
|
varSize: 0,
|
||||||
|
cookieShare: false,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.envMap = this.projectEnvMap;
|
this.envMap = this.projectEnvMap;
|
||||||
this.getVariableSize();
|
this.getVariableSize();
|
||||||
|
this.cookieShare = this.enableCookieShare;
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
handleExport() {
|
handleExport() {
|
||||||
|
@ -92,6 +91,7 @@
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
setProjectEnvMap(projectEnvMap) {
|
setProjectEnvMap(projectEnvMap) {
|
||||||
|
this.$emit('setProjectEnvMap',projectEnvMap);
|
||||||
this.envMap = projectEnvMap;
|
this.envMap = projectEnvMap;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -101,7 +101,7 @@
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.ms-header {
|
.ms-header {
|
||||||
border-bottom: 1px solid #E6E6E6;
|
border-bottom: 1px solid #E6E6E6;
|
||||||
height: 65px;
|
height: 50px;
|
||||||
background-color: #FFF;
|
background-color: #FFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,15 +112,13 @@
|
||||||
margin-top: 12px;
|
margin-top: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ms-span {
|
|
||||||
margin: 0px 10px 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ms-header-right {
|
.ms-header-right {
|
||||||
float: right;
|
float: right;
|
||||||
margin-bottom: 10px;
|
margin-top: 2px;
|
||||||
margin-top: 10px;
|
position: fixed;
|
||||||
margin-right: 20px;
|
right: 40px;
|
||||||
|
z-index: 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.alt-ico {
|
.alt-ico {
|
||||||
|
@ -134,13 +132,11 @@
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ms-font {
|
.ms-header-margin {
|
||||||
color: #303133;
|
margin-top: 3px;
|
||||||
font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", Arial, sans-serif;
|
|
||||||
font-size: 13px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.ms-col-one {
|
.ms-right {
|
||||||
margin-top: 5px;
|
margin-right: 40px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -1,96 +1,101 @@
|
||||||
<template>
|
<template>
|
||||||
<el-dialog title="场景变量" :close-on-click-modal="false"
|
<el-dialog title="场景变量" :close-on-click-modal="false"
|
||||||
:visible.sync="visible" class="visible-dialog" width="60%"
|
:visible.sync="visible" class="visible-dialog" width="60%"
|
||||||
@close="close" v-loading="loading">
|
@close="close" v-loading="loading" append-to-body>
|
||||||
<el-tabs v-model="activeName">
|
<fieldset :disabled="disabled" class="ms-fieldset">
|
||||||
<el-tab-pane :label="$t('api_test.scenario.variables')" name="variable">
|
<el-collapse-transition>
|
||||||
<div style="margin-top: 10px">
|
|
||||||
<el-row style="margin-bottom: 10px">
|
|
||||||
<el-col :span="8">
|
|
||||||
<el-input placeholder="变量名称搜索" v-model="selectVariable" size="small" @change="filter"
|
|
||||||
@keyup.enter="filter">
|
|
||||||
<el-select v-model="searchType" slot="prepend" placeholder="类型" style="width: 90px" @change="filter">
|
|
||||||
<el-option value="CONSTANT" label="常量"></el-option>
|
|
||||||
<el-option value="LIST" label="列表"></el-option>
|
|
||||||
<el-option value="CSV" label="CSV"></el-option>
|
|
||||||
<el-option value="COUNTER" label="计数器"></el-option>
|
|
||||||
<el-option value="RANDOM" label="随机数"></el-option>
|
|
||||||
</el-select>
|
|
||||||
</el-input>
|
|
||||||
</el-col>
|
|
||||||
|
|
||||||
<el-col :span="6">
|
<el-tabs v-model="activeName">
|
||||||
<el-dropdown split-button type="primary" @command="handleClick" @click="handleClick('CONSTANT')"
|
<el-tab-pane :label="$t('api_test.scenario.variables')" name="variable">
|
||||||
size="small" style="margin-left: 10px">
|
<div style="margin-top: 10px">
|
||||||
{{ $t('commons.add') }}
|
<el-row style="margin-bottom: 10px">
|
||||||
<el-dropdown-menu slot="dropdown">
|
<el-col :span="8">
|
||||||
<el-dropdown-item command="CONSTANT">常量</el-dropdown-item>
|
<el-input placeholder="变量名称搜索" v-model="selectVariable" size="small" @change="filter"
|
||||||
<el-dropdown-item command="LIST">列表</el-dropdown-item>
|
@keyup.enter="filter">
|
||||||
<el-dropdown-item command="CSV">CSV</el-dropdown-item>
|
<el-select v-model="searchType" slot="prepend" placeholder="类型" style="width: 90px" @change="filter">
|
||||||
<el-dropdown-item command="COUNTER">计数器</el-dropdown-item>
|
<el-option value="CONSTANT" label="常量"></el-option>
|
||||||
<el-dropdown-item command="RANDOM">随机数</el-dropdown-item>
|
<el-option value="LIST" label="列表"></el-option>
|
||||||
</el-dropdown-menu>
|
<el-option value="CSV" label="CSV"></el-option>
|
||||||
</el-dropdown>
|
<el-option value="COUNTER" label="计数器"></el-option>
|
||||||
<el-button size="small" style="margin-left: 10px" @click="deleteVariable">{{ $t('commons.delete') }}
|
<el-option value="RANDOM" label="随机数"></el-option>
|
||||||
</el-button>
|
</el-select>
|
||||||
|
</el-input>
|
||||||
|
</el-col>
|
||||||
|
|
||||||
</el-col>
|
<el-col :span="6">
|
||||||
</el-row>
|
<el-dropdown split-button type="primary" @command="handleClick" @click="handleClick('CONSTANT')"
|
||||||
<el-row>
|
size="small" style="margin-left: 10px">
|
||||||
<el-col :span="12">
|
{{ $t('commons.add') }}
|
||||||
<div style="border:1px #DCDFE6 solid; min-height: 400px;border-radius: 4px ;width: 100% ;">
|
<el-dropdown-menu slot="dropdown">
|
||||||
<el-table ref="table" border :data="variables" class="adjust-table" @select-all="select"
|
<el-dropdown-item command="CONSTANT">常量</el-dropdown-item>
|
||||||
@select="select"
|
<el-dropdown-item command="LIST">列表</el-dropdown-item>
|
||||||
v-loading="loading" @row-click="edit" height="400px" :row-class-name="tableRowClassName">
|
<el-dropdown-item command="CSV">CSV</el-dropdown-item>
|
||||||
<el-table-column type="selection" width="38"/>
|
<el-dropdown-item command="COUNTER">计数器</el-dropdown-item>
|
||||||
<el-table-column prop="num" label="ID" sortable/>
|
<el-dropdown-item command="RANDOM">随机数</el-dropdown-item>
|
||||||
<el-table-column prop="name" :label="$t('api_test.variable_name')" sortable show-overflow-tooltip/>
|
</el-dropdown-menu>
|
||||||
<el-table-column prop="type" :label="$t('test_track.case.type')">
|
</el-dropdown>
|
||||||
<template v-slot:default="scope">
|
<el-button size="small" style="margin-left: 10px" @click="deleteVariable">{{ $t('commons.delete') }}
|
||||||
<span>{{ types.get(scope.row.type) }}</span>
|
</el-button>
|
||||||
</template>
|
|
||||||
</el-table-column>
|
</el-col>
|
||||||
<el-table-column prop="value" :label="$t('api_test.value')" show-overflow-tooltip/>
|
</el-row>
|
||||||
</el-table>
|
<el-row>
|
||||||
</div>
|
<el-col :span="12">
|
||||||
</el-col>
|
<div style="border:1px #DCDFE6 solid; min-height: 400px;border-radius: 4px ;width: 100% ;">
|
||||||
<el-col :span="12">
|
<el-table ref="table" border :data="variables" class="adjust-table" @select-all="select"
|
||||||
<ms-edit-constant v-if="editData.type=='CONSTANT'" ref="parameters" :editData.sync="editData"/>
|
@select="select"
|
||||||
<ms-edit-counter v-if="editData.type=='COUNTER'" ref="counter" :editData.sync="editData"/>
|
v-loading="loading" @row-click="edit" height="400px" :row-class-name="tableRowClassName">
|
||||||
<ms-edit-random v-if="editData.type=='RANDOM'" ref="random" :editData.sync="editData"/>
|
<el-table-column type="selection" width="38"/>
|
||||||
<ms-edit-list-value v-if="editData.type=='LIST'" ref="listValue" :editData="editData"/>
|
<el-table-column prop="num" label="ID" sortable/>
|
||||||
<ms-edit-csv v-if="editData.type=='CSV'" ref="csv" :editData.sync="editData"/>
|
<el-table-column prop="name" :label="$t('api_test.variable_name')" sortable show-overflow-tooltip/>
|
||||||
</el-col>
|
<el-table-column prop="type" :label="$t('test_track.case.type')">
|
||||||
</el-row>
|
<template v-slot:default="scope">
|
||||||
</div>
|
<span>{{ types.get(scope.row.type) }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="value" :label="$t('api_test.value')" show-overflow-tooltip/>
|
||||||
|
</el-table>
|
||||||
|
</div>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<ms-edit-constant v-if="editData.type=='CONSTANT'" ref="parameters" :editData.sync="editData"/>
|
||||||
|
<ms-edit-counter v-if="editData.type=='COUNTER'" ref="counter" :editData.sync="editData"/>
|
||||||
|
<ms-edit-random v-if="editData.type=='RANDOM'" ref="random" :editData.sync="editData"/>
|
||||||
|
<ms-edit-list-value v-if="editData.type=='LIST'" ref="listValue" :editData="editData"/>
|
||||||
|
<ms-edit-csv v-if="editData.type=='CSV'" ref="csv" :editData.sync="editData"/>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane :label="$t('api_test.scenario.headers')" name="headers">
|
<el-tab-pane :label="$t('api_test.scenario.headers')" name="headers">
|
||||||
<!-- 请求头-->
|
<!-- 请求头-->
|
||||||
<el-tooltip class="item-tabs" effect="dark" :content="$t('api_test.request.headers')" placement="top-start"
|
<el-tooltip class="item-tabs" effect="dark" :content="$t('api_test.request.headers')" placement="top-start"
|
||||||
slot="label">
|
slot="label">
|
||||||
<span>{{ $t('api_test.request.headers') }}
|
<span>{{ $t('api_test.request.headers') }}
|
||||||
<div class="el-step__icon is-text ms-api-col ms-variable-header" v-if="headers.length>1">
|
<div class="el-step__icon is-text ms-api-col ms-variable-header" v-if="headers.length>1">
|
||||||
<div class="el-step__icon-inner">{{ headers.length - 1 }}</div>
|
<div class="el-step__icon-inner">{{ headers.length - 1 }}</div>
|
||||||
</div>
|
</div>
|
||||||
</span>
|
</span>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-link class="ms-variable-link" @click="batchAdd" style="color: #783887"> {{ $t("commons.batch_add") }}
|
<el-link class="ms-variable-link" @click="batchAdd" style="color: #783887"> {{ $t("commons.batch_add") }}
|
||||||
</el-link>
|
</el-link>
|
||||||
</el-row>
|
</el-row>
|
||||||
<div style="min-height: 400px">
|
<div style="min-height: 400px">
|
||||||
<ms-api-key-value :items="headers" :suggestions="headerSuggestions"/>
|
<ms-api-key-value :items="headers" :suggestions="headerSuggestions"/>
|
||||||
<batch-add-parameter @batchSave="batchSave" ref="batchAddParameter"/>
|
<batch-add-parameter @batchSave="batchSave" ref="batchAddParameter"/>
|
||||||
</div>
|
</div>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
<template v-slot:footer>
|
<template v-slot:footer>
|
||||||
<div>
|
<div>
|
||||||
<el-button type="primary" @click="save">{{ $t('commons.confirm') }}</el-button>
|
<el-button type="primary" @click="save">{{ $t('commons.confirm') }}</el-button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
</el-collapse-transition>
|
||||||
|
</fieldset>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -146,6 +151,7 @@
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
total: 0,
|
total: 0,
|
||||||
headerSuggestions: REQUEST_HEADERS,
|
headerSuggestions: REQUEST_HEADERS,
|
||||||
|
disabled: false,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -212,12 +218,13 @@
|
||||||
isSelect(row) {
|
isSelect(row) {
|
||||||
return this.selection.includes(row.id)
|
return this.selection.includes(row.id)
|
||||||
},
|
},
|
||||||
open: function (variables, headers) {
|
open: function (variables, headers, disabled) {
|
||||||
this.variables = variables;
|
this.variables = variables;
|
||||||
this.headers = headers;
|
this.headers = headers;
|
||||||
this.visible = true;
|
this.visible = true;
|
||||||
this.editData = {type: "CONSTANT"};
|
this.editData = {type: "CONSTANT"};
|
||||||
this.addParameters(this.editData);
|
this.addParameters(this.editData);
|
||||||
|
this.disabled = disabled;
|
||||||
},
|
},
|
||||||
save() {
|
save() {
|
||||||
this.visible = false;
|
this.visible = false;
|
||||||
|
@ -302,4 +309,11 @@
|
||||||
float: right;
|
float: right;
|
||||||
margin-right: 45px;
|
margin-right: 45px;
|
||||||
}
|
}
|
||||||
|
fieldset {
|
||||||
|
padding: 0px;
|
||||||
|
margin: 0px;
|
||||||
|
min-width: 100%;
|
||||||
|
min-inline-size: 0px;
|
||||||
|
border: 0px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit b2571e06e8b211821409115cc2c4a7c52cbac1db
|
Subproject commit 4c33b9c3b12a83da6d9bd2740262c6c8baaab819
|
Loading…
Reference in New Issue