feat(接口自动化): 查看引用场景变量
This commit is contained in:
parent
90adde0933
commit
d43f867e97
|
@ -39,7 +39,7 @@
|
|||
:name="item.name"
|
||||
closable>
|
||||
<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"/>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
|
|
|
@ -137,7 +137,7 @@
|
|||
<!-- 步骤组件-->
|
||||
<ms-component-config :type="data.type" :scenario="data" :response="response" :currentScenario="currentScenario"
|
||||
: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>
|
||||
</el-tree>
|
||||
</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">
|
||||
<template v-slot:header>
|
||||
<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>
|
||||
|
||||
<maximize-scenario :scenario-definition="scenarioDefinition" :moduleOptions="moduleOptions" :currentScenario="currentScenario" :type="type" ref="maximizeScenario"/>
|
||||
|
@ -222,7 +222,7 @@
|
|||
import {parseEnvironment} from "../../definition/model/EnvironmentModel";
|
||||
import {ELEMENT_TYPE, ELEMENTS} from "./Setting";
|
||||
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 MsInputTag from "./MsInputTag";
|
||||
import MsRun from "./DebugRun";
|
||||
|
@ -234,7 +234,6 @@
|
|||
import ScenarioApiRelevance from "./api/ApiRelevance";
|
||||
import ScenarioRelevance from "./api/ScenarioRelevance";
|
||||
import MsComponentConfig from "./component/ComponentConfig";
|
||||
import {handleCtrlSEvent} from "../../../../../common/js/utils";
|
||||
import EnvPopover from "@/business/components/api/automation/scenario/EnvPopover";
|
||||
import MaximizeScenario from "./maximize/MaximizeScenario";
|
||||
import ScenarioHeader from "./maximize/ScenarioHeader";
|
||||
|
@ -442,6 +441,10 @@
|
|||
}
|
||||
},
|
||||
methods: {
|
||||
// 打开引用的场景
|
||||
openScenario(data) {
|
||||
this.$emit('openScenario', data);
|
||||
},
|
||||
showAllBtn() {
|
||||
this.$refs.maximizeScenario.showAll();
|
||||
},
|
||||
|
@ -465,7 +468,9 @@
|
|||
// 直接更新场景防止编辑内容丢失
|
||||
this.editScenario();
|
||||
}
|
||||
if (this.$refs.maximizeHeader) {
|
||||
this.$refs.maximizeHeader.getVariableSize();
|
||||
}
|
||||
this.reload();
|
||||
},
|
||||
showButton(...names) {
|
||||
|
@ -727,6 +732,9 @@
|
|||
this.loading = false
|
||||
})
|
||||
},
|
||||
runDebugMax() {
|
||||
this.$refs.maximizeScenario.runDebug();
|
||||
},
|
||||
runDebug() {
|
||||
/*触发执行操作*/
|
||||
let sign = this.$refs.envPopover.checkEnv();
|
||||
|
|
|
@ -90,7 +90,8 @@
|
|||
response.data.forEach(item => {
|
||||
let scenarioDefinition = JSON.parse(item.scenarioDefinition);
|
||||
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);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
@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"
|
||||
@blur="isShowInput = false" :placeholder="$t('commons.input_name')" ref="nameEdit" :disabled="data.disabled"/>
|
||||
<!--最大化显示-->
|
||||
<span v-else-if="isMax">
|
||||
<el-tooltip :content="data.name" placement="top">
|
||||
<span>{{data.name}}</span>
|
||||
|
@ -34,13 +35,14 @@
|
|||
<el-switch v-model="data.enable" class="enable-switch"/>
|
||||
</el-tooltip>
|
||||
<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 class="header" v-if="!isMax">
|
||||
<fieldset :disabled="data.disabled" class="ms-fieldset">
|
||||
<el-collapse-transition>6.
|
||||
<el-collapse-transition>
|
||||
<div v-if="data.active && showCollapse" :draggable="draggable">
|
||||
<el-divider></el-divider>
|
||||
<slot></slot>
|
||||
|
@ -130,6 +132,9 @@
|
|||
remove() {
|
||||
this.$emit('remove');
|
||||
},
|
||||
openScenario(data) {
|
||||
this.$emit('openScenario', data);
|
||||
},
|
||||
editName() {
|
||||
this.isShowInput = true;
|
||||
this.$nextTick(() => {
|
||||
|
@ -159,7 +164,7 @@
|
|||
}
|
||||
|
||||
.header-right {
|
||||
margin-top: 5px;
|
||||
margin-top: 0px;
|
||||
float: right;
|
||||
z-index: 1;
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
@copy="copyRow"
|
||||
@remove="remove"
|
||||
@active="active"
|
||||
@openScenario="openScenario"
|
||||
:data="scenario"
|
||||
:show-collapse="false"
|
||||
:is-show-name-input="!isDeletedOrRef"
|
||||
|
@ -62,8 +63,10 @@
|
|||
this.result = this.$get("/api/automation/getApiScenario/" + this.scenario.id, response => {
|
||||
if (response.data) {
|
||||
this.scenario.loaded = true;
|
||||
let obj = {};
|
||||
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) {
|
||||
this.setDisabled(this.scenario.hashTree);
|
||||
|
@ -73,7 +76,9 @@
|
|||
if (!this.scenario.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');
|
||||
} else {
|
||||
this.scenario.referenced = "Deleted";
|
||||
|
@ -109,6 +114,9 @@
|
|||
copyRow() {
|
||||
this.$emit('copyRow', this.scenario, this.node);
|
||||
},
|
||||
openScenario(data){
|
||||
this.$emit('openScenario', data);
|
||||
},
|
||||
reload() {
|
||||
this.loading = true
|
||||
this.$nextTick(() => {
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<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"
|
||||
: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>
|
||||
</template>
|
||||
|
||||
|
@ -120,6 +120,9 @@
|
|||
this.$emit('copyRow', row, node);
|
||||
|
||||
},
|
||||
openScenario(data){
|
||||
this.$emit('openScenario', data);
|
||||
},
|
||||
suggestClick(node) {
|
||||
this.$emit('suggestClick', node);
|
||||
},
|
||||
|
|
|
@ -7,34 +7,31 @@
|
|||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item command="copy">复制步骤</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="openScenario" v-tester>打开场景</el-dropdown-item>
|
||||
<el-dropdown-item command="saveAs" v-tester>另存为接口定义</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-item command="scenarioVar" v-tester v-if="data.type==='scenario'">查看场景变量</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 v-if="allSamplers.indexOf(data.type)!=-1">另存为接口定义</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
<ms-reference-view @openScenario="openScenario" ref="viewRef"/>
|
||||
<ms-schedule-maintain ref="scheduleMaintain" @refreshTable="refreshTable"/>
|
||||
<ms-variable-list ref="scenarioParameters"/>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<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 {ELEMENTS} from "../Setting";
|
||||
import MsVariableList from "../variable/VariableList";
|
||||
|
||||
export default {
|
||||
name: "StepExtendBtns",
|
||||
components: {MsReferenceView, MsScheduleMaintain},
|
||||
components: {ELEMENTS, MsVariableList},
|
||||
props: {
|
||||
row: Object
|
||||
data: Object,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
allSamplers: ELEMENTS.get('AllSamplerProxy'),
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleCommand(cmd) {
|
||||
|
@ -46,47 +43,16 @@
|
|||
this.$emit('remove');
|
||||
break;
|
||||
case "scenarioVar":
|
||||
this.$emit('copy');
|
||||
this.$refs.scenarioParameters.open(this.data.variables, this.data.headers, true);
|
||||
break;
|
||||
case "openScenario":
|
||||
this.$emit('copy');
|
||||
this.$emit('openScenario', this.data);
|
||||
break;
|
||||
case "saveAs":
|
||||
this.$emit('copy');
|
||||
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>
|
||||
|
|
|
@ -1,31 +1,28 @@
|
|||
<template>
|
||||
<div class="ms-header" @click="showAll">
|
||||
<el-row>
|
||||
<div class="ms-div" v-loading="loading">
|
||||
<div class="ms-header">
|
||||
<div class="ms-div" v-loading="loading" @click="showAll">
|
||||
<!-- 调试部分 -->
|
||||
<el-row style="margin: 5px">
|
||||
<el-col :span="6" class="ms-col-one ms-font">
|
||||
<el-row class="ms-header-margin">
|
||||
<el-col :span="8">
|
||||
{{currentScenario.name}}
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
{{$t('api_test.automation.step_total')}}:{{scenarioDefinition.length}}
|
||||
</el-col>
|
||||
<el-col :span="6" class="ms-col-one ms-font">
|
||||
<el-col :span="8">
|
||||
<el-link class="head" @click="showScenarioParameters">{{$t('api_test.automation.scenario_total')}}</el-link>
|
||||
:{{varSize }}
|
||||
</el-col>
|
||||
<el-col :span="5" class="ms-col-one ms-font">
|
||||
<el-checkbox v-model="enableCookieShare">共享cookie</el-checkbox>
|
||||
</el-col>
|
||||
<el-col :span="7">
|
||||
<env-popover :env-map="envMap" :project-ids="projectIds" @setProjectEnvMap="setProjectEnvMap"
|
||||
:project-list="projectList" ref="envPopover" style="margin-top: 0px"/>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
<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>
|
||||
<el-checkbox v-model="cookieShare" class="ms-right">共享cookie</el-checkbox>
|
||||
<env-popover :env-map="envMap" :project-ids="projectIds" @setProjectEnvMap="setProjectEnvMap"
|
||||
:project-list="projectList" ref="envPopover" class="ms-right"/>
|
||||
<el-button :disabled="scenarioDefinition.length < 1" size="mini" 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>
|
||||
</el-row>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
@ -43,11 +40,13 @@
|
|||
envMap: new Map,
|
||||
loading: false,
|
||||
varSize: 0,
|
||||
cookieShare: false,
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.envMap = this.projectEnvMap;
|
||||
this.getVariableSize();
|
||||
this.cookieShare = this.enableCookieShare;
|
||||
},
|
||||
methods: {
|
||||
handleExport() {
|
||||
|
@ -92,6 +91,7 @@
|
|||
})
|
||||
},
|
||||
setProjectEnvMap(projectEnvMap) {
|
||||
this.$emit('setProjectEnvMap',projectEnvMap);
|
||||
this.envMap = projectEnvMap;
|
||||
}
|
||||
},
|
||||
|
@ -101,7 +101,7 @@
|
|||
<style scoped>
|
||||
.ms-header {
|
||||
border-bottom: 1px solid #E6E6E6;
|
||||
height: 65px;
|
||||
height: 50px;
|
||||
background-color: #FFF;
|
||||
}
|
||||
|
||||
|
@ -112,15 +112,13 @@
|
|||
margin-top: 12px;
|
||||
}
|
||||
|
||||
.ms-span {
|
||||
margin: 0px 10px 10px;
|
||||
}
|
||||
|
||||
.ms-header-right {
|
||||
float: right;
|
||||
margin-bottom: 10px;
|
||||
margin-top: 10px;
|
||||
margin-right: 20px;
|
||||
margin-top: 2px;
|
||||
position: fixed;
|
||||
right: 40px;
|
||||
z-index: 1;
|
||||
|
||||
}
|
||||
|
||||
.alt-ico {
|
||||
|
@ -134,13 +132,11 @@
|
|||
font-size: 18px;
|
||||
}
|
||||
|
||||
.ms-font {
|
||||
color: #303133;
|
||||
font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", Arial, sans-serif;
|
||||
font-size: 13px;
|
||||
.ms-header-margin {
|
||||
margin-top: 3px;
|
||||
}
|
||||
|
||||
.ms-col-one {
|
||||
margin-top: 5px;
|
||||
.ms-right {
|
||||
margin-right: 40px;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
<template>
|
||||
<el-dialog title="场景变量" :close-on-click-modal="false"
|
||||
:visible.sync="visible" class="visible-dialog" width="60%"
|
||||
@close="close" v-loading="loading">
|
||||
@close="close" v-loading="loading" append-to-body>
|
||||
<fieldset :disabled="disabled" class="ms-fieldset">
|
||||
<el-collapse-transition>
|
||||
|
||||
<el-tabs v-model="activeName">
|
||||
<el-tab-pane :label="$t('api_test.scenario.variables')" name="variable">
|
||||
<div style="margin-top: 10px">
|
||||
|
@ -91,6 +94,8 @@
|
|||
<el-button type="primary" @click="save">{{ $t('commons.confirm') }}</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-collapse-transition>
|
||||
</fieldset>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
|
@ -146,6 +151,7 @@
|
|||
pageSize: 10,
|
||||
total: 0,
|
||||
headerSuggestions: REQUEST_HEADERS,
|
||||
disabled: false,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
@ -212,12 +218,13 @@
|
|||
isSelect(row) {
|
||||
return this.selection.includes(row.id)
|
||||
},
|
||||
open: function (variables, headers) {
|
||||
open: function (variables, headers, disabled) {
|
||||
this.variables = variables;
|
||||
this.headers = headers;
|
||||
this.visible = true;
|
||||
this.editData = {type: "CONSTANT"};
|
||||
this.addParameters(this.editData);
|
||||
this.disabled = disabled;
|
||||
},
|
||||
save() {
|
||||
this.visible = false;
|
||||
|
@ -302,4 +309,11 @@
|
|||
float: right;
|
||||
margin-right: 45px;
|
||||
}
|
||||
fieldset {
|
||||
padding: 0px;
|
||||
margin: 0px;
|
||||
min-width: 100%;
|
||||
min-inline-size: 0px;
|
||||
border: 0px;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit b2571e06e8b211821409115cc2c4a7c52cbac1db
|
||||
Subproject commit 4c33b9c3b12a83da6d9bd2740262c6c8baaab819
|
Loading…
Reference in New Issue