feat(接口自动化): 全屏设置
This commit is contained in:
parent
170d811c14
commit
0255bcb598
|
@ -215,7 +215,6 @@ public class ApiDefinitionService {
|
|||
ApiDefinitionExample example = new ApiDefinitionExample();
|
||||
if (request.getProtocol().equals(RequestType.HTTP)) {
|
||||
example.createCriteria().andMethodEqualTo(request.getMethod()).andStatusNotEqualTo("Trash")
|
||||
.andProtocolEqualTo(request.getProtocol()).andPathEqualTo(request.getPath())
|
||||
.andProjectIdEqualTo(request.getProjectId()).andIdNotEqualTo(request.getId());
|
||||
return apiDefinitionMapper.selectByExample(example);
|
||||
} else {
|
||||
|
|
|
@ -114,12 +114,13 @@
|
|||
<el-col :span="3" class="ms-col-one ms-font">
|
||||
<el-checkbox v-model="enableCookieShare">共享cookie</el-checkbox>
|
||||
</el-col>
|
||||
<el-col :span="7">
|
||||
<el-col :span="6">
|
||||
<env-popover :env-map="projectEnvMap" :project-ids="projectIds" @setProjectEnvMap="setProjectEnvMap"
|
||||
:project-list="projectList" ref="envPopover"/>
|
||||
</el-col>
|
||||
<el-col :span="2">
|
||||
<el-col :span="3">
|
||||
<el-button :disabled="scenarioDefinition.length < 1" size="small" type="primary" v-prevent-re-click @click="runDebug">{{$t('api_test.request.debug')}}</el-button>
|
||||
<font-awesome-icon class="alt-ico" :icon="['fa', 'expand-alt']" size="lg" @click="fullScreen"/>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
|
@ -192,6 +193,17 @@
|
|||
class="ms-sc-variable-header"/>
|
||||
<!--外部导入-->
|
||||
<api-import v-if="type!=='detail'" ref="apiImport" :saved="false" @refresh="apiImport"/>
|
||||
|
||||
<!--步骤最大化-->
|
||||
<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"/>
|
||||
</template>
|
||||
|
||||
<maximize-scenario :scenario-definition="scenarioDefinition" :moduleOptions="moduleOptions" :currentScenario="currentScenario" :type="type" ref="maximizeScenario"/>
|
||||
</ms-drawer>
|
||||
|
||||
</div>
|
||||
</el-card>
|
||||
</template>
|
||||
|
@ -224,6 +236,9 @@
|
|||
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";
|
||||
import MsDrawer from "../../../common/components/MsDrawer";
|
||||
|
||||
let jsonPath = require('jsonpath');
|
||||
export default {
|
||||
|
@ -243,7 +258,10 @@
|
|||
MsApiCustomize,
|
||||
ApiImport,
|
||||
MsComponentConfig,
|
||||
EnvPopover
|
||||
EnvPopover,
|
||||
MaximizeScenario,
|
||||
ScenarioHeader,
|
||||
MsDrawer
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
@ -293,6 +311,7 @@
|
|||
projectEnvMap: new Map,
|
||||
projectList: [],
|
||||
debugResult: new Map,
|
||||
drawer: false,
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
@ -423,6 +442,9 @@
|
|||
}
|
||||
},
|
||||
methods: {
|
||||
showAllBtn() {
|
||||
this.$refs.maximizeScenario.showAll();
|
||||
},
|
||||
addListener() {
|
||||
document.addEventListener("keydown", this.createCtrlSHandle);
|
||||
// document.addEventListener("keydown", (even => handleCtrlSEvent(even, this.$refs.httpApi.saveApi)));
|
||||
|
@ -443,6 +465,7 @@
|
|||
// 直接更新场景防止编辑内容丢失
|
||||
this.editScenario();
|
||||
}
|
||||
this.$refs.maximizeHeader.getVariableSize();
|
||||
this.reload();
|
||||
},
|
||||
showButton(...names) {
|
||||
|
@ -697,8 +720,7 @@
|
|||
}
|
||||
this.sort();
|
||||
this.reload();
|
||||
}
|
||||
,
|
||||
},
|
||||
reload() {
|
||||
this.loading = true
|
||||
this.$nextTick(() => {
|
||||
|
@ -1046,7 +1068,14 @@
|
|||
// 把执行结果分发给各个请求
|
||||
this.debugResult = result;
|
||||
this.sort()
|
||||
},
|
||||
fullScreen() {
|
||||
this.drawer = true;
|
||||
},
|
||||
close() {
|
||||
this.drawer = false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
@ -1112,7 +1141,7 @@
|
|||
}
|
||||
|
||||
/deep/ .el-card__body {
|
||||
padding: 15px;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
/deep/ .el-drawer__body {
|
||||
|
@ -1182,4 +1211,17 @@
|
|||
.ms-sc-variable-header >>> .el-dialog__body {
|
||||
padding: 0px 20px;
|
||||
}
|
||||
|
||||
.alt-ico {
|
||||
font-size: 15px;
|
||||
margin: 0px 10px 0px;
|
||||
color: #8c939d;
|
||||
}
|
||||
|
||||
.alt-ico:hover {
|
||||
color: black;
|
||||
cursor: pointer;
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
|
|
@ -16,6 +16,9 @@ export const ELEMENTS = new Map([
|
|||
['Extract', []],
|
||||
['JmeterElement', []],
|
||||
['CustomizeReq', ["ConstantTimer", "JSR223PreProcessor", "JSR223PostProcessor", "Assertions", "Extract"]],
|
||||
['MaxSamplerProxy', ["JSR223PreProcessor", "JSR223PostProcessor", "Assertions", "Extract"]],
|
||||
['AllSamplerProxy', ["HTTPSamplerProxy", "DubboSampler", "JDBCSampler", "TCPSampler"]],
|
||||
|
||||
])
|
||||
|
||||
export const ELEMENT_TYPE = {
|
||||
|
|
|
@ -1,47 +1,46 @@
|
|||
<template>
|
||||
<el-card class="api-component">
|
||||
|
||||
<div class="header" @click="active(data)">
|
||||
|
||||
<slot name="beforeHeaderLeft">
|
||||
<div v-if="data.index" class="el-step__icon is-text" style="margin-right: 10px;" :style="{'color': color, 'background-color': backgroundColor}">
|
||||
<div class="el-step__icon-inner">{{data.index}}</div>
|
||||
</div>
|
||||
<el-button class="ms-left-buttion" size="small" :style="{'color': color, 'background-color': backgroundColor}">{{title}}</el-button>
|
||||
<el-button class="ms-left-buttion" size="mini" :style="{'color': color, 'background-color': backgroundColor}">{{title}}</el-button>
|
||||
<el-tag size="mini" v-if="data.method">{{data.method}}</el-tag>
|
||||
</slot>
|
||||
|
||||
<span @click.stop>
|
||||
<slot name="headerLeft">
|
||||
<i class="icon el-icon-arrow-right" :class="{'is-active': data.active}"
|
||||
@click="active(data)" v-if="data.type!='scenario'"/>
|
||||
<el-input :draggable="draggable" v-if="isShowInput && isShowNameInput" size="small" v-model="data.name" class="name-input"
|
||||
@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>
|
||||
</el-tooltip>
|
||||
</span>
|
||||
<span v-else>
|
||||
{{data.name}}
|
||||
<i class="el-icon-edit" style="cursor:pointer" @click="editName" v-tester v-if="data.referenced!='REF' && !data.disabled"/>
|
||||
</span>
|
||||
</slot>
|
||||
<slot name="behindHeaderLeft"></slot>
|
||||
<slot name="behindHeaderLeft" v-if="!isMax"></slot>
|
||||
</span>
|
||||
|
||||
<div class="header-right" @click.stop>
|
||||
<slot name="message"></slot>
|
||||
<el-tooltip :content="$t('test_resource_pool.enable_disable')" placement="top">
|
||||
<el-tooltip :content="$t('test_resource_pool.enable_disable')" placement="top" v-if="showBtn">
|
||||
<el-switch v-model="data.enable" class="enable-switch"/>
|
||||
</el-tooltip>
|
||||
<slot name="button"></slot>
|
||||
<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>
|
||||
<step-extend-btns style="display: contents" @copy="copyRow" @remove="remove" v-if="showBtn"/>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="header">
|
||||
<div class="header" v-if="!isMax">
|
||||
<fieldset :disabled="data.disabled" class="ms-fieldset">
|
||||
<el-collapse-transition>
|
||||
<el-collapse-transition>6.
|
||||
<div v-if="data.active && showCollapse" :draggable="draggable">
|
||||
<el-divider></el-divider>
|
||||
<slot></slot>
|
||||
|
@ -54,8 +53,11 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import StepExtendBtns from "../component/StepExtendBtns";
|
||||
|
||||
export default {
|
||||
name: "ApiBaseComponent",
|
||||
components: {StepExtendBtns},
|
||||
data() {
|
||||
return {
|
||||
isShowInput: false
|
||||
|
@ -63,6 +65,14 @@
|
|||
},
|
||||
props: {
|
||||
draggable: Boolean,
|
||||
isMax: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
showBtn: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
data: {
|
||||
type: Object,
|
||||
default() {
|
||||
|
@ -104,6 +114,9 @@
|
|||
this.$refs.nameEdit.focus();
|
||||
});
|
||||
}
|
||||
if (this.data && this.data.type === "JmeterElement") {
|
||||
this.data.active = false;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
active() {
|
||||
|
@ -146,14 +159,26 @@
|
|||
}
|
||||
|
||||
.header-right {
|
||||
margin-right: 20px;
|
||||
margin-top: 5px;
|
||||
float: right;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.enable-switch {
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.node-title {
|
||||
display: inline-block;
|
||||
margin: 0px;
|
||||
overflow-x: hidden;
|
||||
padding-bottom: 0;
|
||||
text-overflow: ellipsis;
|
||||
vertical-align: middle;
|
||||
white-space: nowrap;
|
||||
width: 100px;
|
||||
}
|
||||
|
||||
fieldset {
|
||||
padding: 0px;
|
||||
margin: 0px;
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
:draggable="true"
|
||||
:color="displayColor.color"
|
||||
:background-color="displayColor.backgroundColor"
|
||||
:is-max="isMax"
|
||||
:show-btn="showBtn"
|
||||
:title="displayTitle">
|
||||
|
||||
<template v-slot:behindHeaderLeft>
|
||||
|
@ -71,6 +73,7 @@
|
|||
import ApiBaseComponent from "../common/ApiBaseComponent";
|
||||
import ApiResponseComponent from "./ApiResponseComponent";
|
||||
import CustomizeReqInfo from "@/business/components/api/automation/scenario/common/CustomizeReqInfo";
|
||||
import {ELEMENTS} from "../Setting";
|
||||
|
||||
export default {
|
||||
name: "MsApiComponent",
|
||||
|
@ -82,6 +85,14 @@
|
|||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
isMax: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
showBtn: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
currentEnvironmentId: String,
|
||||
projectList: Array,
|
||||
envMap: Map
|
||||
|
@ -122,6 +133,11 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
// if (this.isMax && this.request && ELEMENTS.get("AllSamplerProxy").indexOf(this.request.type) != -1
|
||||
// && this.request.hashTree && this.request.hashTree != null && this.request.hashTree.length > 0) {
|
||||
// this.request.hashTrees = JSON.parse(JSON.stringify(this.request.hashTree));
|
||||
// this.request.hashTree = undefined;
|
||||
// }
|
||||
},
|
||||
computed: {
|
||||
displayColor() {
|
||||
|
@ -220,6 +236,12 @@
|
|||
if (!this.request.projectId) {
|
||||
this.request.projectId = response.data.projectId;
|
||||
}
|
||||
// if (this.isMax && this.request && ELEMENTS.get("AllSamplerProxy").indexOf(this.request.type) != -1) {
|
||||
// this.request.hashTrees = [];
|
||||
// Object.assign(this.request.hashTrees, this.request.hashTree);
|
||||
// this.request.hashTree = [];
|
||||
// }
|
||||
|
||||
this.reload();
|
||||
this.sort();
|
||||
} else {
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
:show-collapse="false"
|
||||
:is-show-name-input="!isDeletedOrRef"
|
||||
:is-disabled="true"
|
||||
:is-max="isMax"
|
||||
:show-btn="showBtn"
|
||||
color="#606266"
|
||||
background-color="#F4F4F5"
|
||||
:title="$t('api_test.automation.scenario_import')">
|
||||
|
@ -36,6 +38,14 @@
|
|||
props: {
|
||||
scenario: {},
|
||||
node: {},
|
||||
isMax: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
showBtn: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
draggable: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<template>
|
||||
<div class="request-form">
|
||||
<component :is="component" :scenario="scenario" :controller="scenario" :timer="scenario" :assertions="scenario" :extract="scenario" :jsr223-processor="scenario" :request="scenario" :currentScenario="currentScenario" :currentEnvironmentId="currentEnvironmentId" :node="node"
|
||||
<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"/>
|
||||
</div>
|
||||
|
@ -24,6 +25,14 @@
|
|||
props: {
|
||||
type: String,
|
||||
scenario: {},
|
||||
isMax: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
showBtn: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
currentScenario: {},
|
||||
currentEnvironmentId: String,
|
||||
response: {},
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
:data="timer"
|
||||
:draggable="true"
|
||||
:show-collapse="false"
|
||||
:is-max="isMax"
|
||||
color="#67C23A"
|
||||
background-color="#F2F9EE"
|
||||
:title="$t('api_test.automation.wait_controller')">
|
||||
|
@ -26,6 +27,14 @@
|
|||
props: {
|
||||
timer: {},
|
||||
node: {},
|
||||
isMax: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
showBtn: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
draggable: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
:data="controller"
|
||||
:show-collapse="false"
|
||||
:draggable="true"
|
||||
:is-max="isMax"
|
||||
:show-btn="showBtn"
|
||||
color="#E6A23C"
|
||||
background-color="#FCF6EE"
|
||||
:title="$t('api_test.automation.if_controller')">
|
||||
|
@ -33,6 +35,14 @@
|
|||
props: {
|
||||
controller: {},
|
||||
node: {},
|
||||
isMax: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
showBtn: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
index: Object,
|
||||
draggable: {
|
||||
type: Boolean,
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
:data="request"
|
||||
:draggable="draggable"
|
||||
:color="defColor"
|
||||
:is-max="isMax"
|
||||
:show-btn="showBtn"
|
||||
:background-color="defBackgroundColor"
|
||||
:title="request.elementType">
|
||||
|
||||
|
@ -31,6 +33,14 @@
|
|||
default:
|
||||
false
|
||||
},
|
||||
isMax: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
showBtn: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
request: {
|
||||
type: Object,
|
||||
},
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
:data="jsr223Processor"
|
||||
:draggable="draggable"
|
||||
:color="color"
|
||||
:is-max="isMax"
|
||||
:show-btn="showBtn"
|
||||
:background-color="backgroundColor"
|
||||
:title="title" v-loading="loading">
|
||||
|
||||
|
@ -33,6 +35,14 @@ export default {
|
|||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
isMax: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
showBtn: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
isReadOnly: {
|
||||
type: Boolean,
|
||||
default:
|
||||
|
|
|
@ -7,12 +7,14 @@
|
|||
@remove="remove"
|
||||
:data="controller"
|
||||
:draggable="true"
|
||||
:is-max="isMax"
|
||||
:show-btn="showBtn"
|
||||
color="#02A7F0"
|
||||
background-color="#F4F4F5"
|
||||
:title="$t('api_test.automation.loop_controller')" v-loading="loading">
|
||||
|
||||
<template v-slot:headerLeft>
|
||||
<i class="icon el-icon-arrow-right" :class="{'is-active': controller.active}" @click="active(controller)" style="margin-right: 10px"/>
|
||||
<i class="icon el-icon-arrow-right" :class="{'is-active': controller.active}" @click="active(controller)" style="margin-right: 10px" v-if="!isMax"/>
|
||||
<el-radio @change="changeRadio" class="ms-radio" v-model="controller.loopType" label="LOOP_COUNT">{{$t('loop.loops_title')}}</el-radio>
|
||||
<el-radio @change="changeRadio" class="ms-radio" v-model="controller.loopType" label="FOREACH">{{$t('loop.foreach')}}</el-radio>
|
||||
<el-radio @change="changeRadio" class="ms-radio" v-model="controller.loopType" label="WHILE">{{$t('loop.while')}}</el-radio>
|
||||
|
@ -97,6 +99,14 @@ export default {
|
|||
currentEnvironmentId: String,
|
||||
currentScenario: {},
|
||||
node: {},
|
||||
isMax: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
showBtn: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
index: Object,
|
||||
draggable: {
|
||||
type: Boolean,
|
||||
|
|
|
@ -0,0 +1,98 @@
|
|||
<template>
|
||||
<div>
|
||||
<el-dropdown @command="handleCommand" class="scenario-ext-btn">
|
||||
<el-link type="primary" :underline="false">
|
||||
<el-icon class="el-icon-more"></el-icon>
|
||||
</el-link>
|
||||
<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-menu>
|
||||
</el-dropdown>
|
||||
<ms-reference-view @openScenario="openScenario" ref="viewRef"/>
|
||||
<ms-schedule-maintain ref="scheduleMaintain" @refreshTable="refreshTable"/>
|
||||
|
||||
</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";
|
||||
|
||||
export default {
|
||||
name: "StepExtendBtns",
|
||||
components: {MsReferenceView, MsScheduleMaintain},
|
||||
props: {
|
||||
row: Object
|
||||
},
|
||||
methods: {
|
||||
handleCommand(cmd) {
|
||||
switch (cmd) {
|
||||
case "copy":
|
||||
this.$emit('copy');
|
||||
break;
|
||||
case "remove":
|
||||
this.$emit('remove');
|
||||
break;
|
||||
case "scenarioVar":
|
||||
this.$emit('copy');
|
||||
break;
|
||||
case "openScenario":
|
||||
this.$emit('copy');
|
||||
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>
|
||||
|
||||
<style scoped>
|
||||
.scenario-ext-btn {
|
||||
margin-left: 10px;
|
||||
}
|
||||
</style>
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,146 @@
|
|||
<template>
|
||||
<div class="ms-header" @click="showAll">
|
||||
<el-row>
|
||||
<div class="ms-div" v-loading="loading">
|
||||
<!-- 调试部分 -->
|
||||
<el-row style="margin: 5px">
|
||||
<el-col :span="6" class="ms-col-one ms-font">
|
||||
{{$t('api_test.automation.step_total')}}:{{scenarioDefinition.length}}
|
||||
</el-col>
|
||||
<el-col :span="6" class="ms-col-one ms-font">
|
||||
<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>
|
||||
|
|
||||
<i class="el-icon-close alt-ico" @click="close"/>
|
||||
</div>
|
||||
</el-row>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {checkoutTestManagerOrTestUser, exportPdf} from "@/common/js/utils";
|
||||
import html2canvas from 'html2canvas';
|
||||
import EnvPopover from "../../scenario/EnvPopover";
|
||||
|
||||
export default {
|
||||
name: "ScenarioHeader",
|
||||
components: {EnvPopover},
|
||||
props: {currentScenario: {}, scenarioDefinition: Array, enableCookieShare: Boolean, projectEnvMap: Map, projectIds: Set, projectList: Array},
|
||||
data() {
|
||||
return {
|
||||
envMap: new Map,
|
||||
loading: false,
|
||||
varSize: 0,
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.envMap = this.projectEnvMap;
|
||||
this.getVariableSize();
|
||||
},
|
||||
methods: {
|
||||
handleExport() {
|
||||
let name = this.$t('commons.report_statistics.test_case_analysis');
|
||||
this.$nextTick(function () {
|
||||
setTimeout(() => {
|
||||
html2canvas(document.getElementById('reportAnalysis'), {
|
||||
scale: 2
|
||||
}).then(function (canvas) {
|
||||
exportPdf(name, [canvas]);
|
||||
});
|
||||
}, 1000);
|
||||
});
|
||||
},
|
||||
showAll() {
|
||||
this.$emit('showAllBtn');
|
||||
},
|
||||
close() {
|
||||
this.$emit('closePage');
|
||||
},
|
||||
runDebug() {
|
||||
this.$emit('runDebug');
|
||||
},
|
||||
showScenarioParameters() {
|
||||
this.$emit('showScenarioParameters');
|
||||
},
|
||||
getVariableSize() {
|
||||
let size = 0;
|
||||
if (this.currentScenario.variables) {
|
||||
size += this.currentScenario.variables.length;
|
||||
}
|
||||
if (this.currentScenario.headers && this.currentScenario.headers.length > 1) {
|
||||
size += this.currentScenario.headers.length - 1;
|
||||
}
|
||||
this.varSize = size;
|
||||
this.reload();
|
||||
},
|
||||
reload() {
|
||||
this.loading = true
|
||||
this.$nextTick(() => {
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
setProjectEnvMap(projectEnvMap) {
|
||||
this.envMap = projectEnvMap;
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.ms-header {
|
||||
border-bottom: 1px solid #E6E6E6;
|
||||
height: 65px;
|
||||
background-color: #FFF;
|
||||
}
|
||||
|
||||
.ms-div {
|
||||
float: left;
|
||||
width: 80%;
|
||||
margin-left: 20px;
|
||||
margin-top: 12px;
|
||||
}
|
||||
|
||||
.ms-span {
|
||||
margin: 0px 10px 10px;
|
||||
}
|
||||
|
||||
.ms-header-right {
|
||||
float: right;
|
||||
margin-bottom: 10px;
|
||||
margin-top: 10px;
|
||||
margin-right: 20px;
|
||||
}
|
||||
|
||||
.alt-ico {
|
||||
font-size: 18px;
|
||||
margin: 10px 0px 0px;
|
||||
}
|
||||
|
||||
.alt-ico:hover {
|
||||
color: black;
|
||||
cursor: pointer;
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.ms-font {
|
||||
color: #303133;
|
||||
font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", Arial, sans-serif;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.ms-col-one {
|
||||
margin-top: 5px;
|
||||
}
|
||||
</style>
|
|
@ -6,6 +6,8 @@
|
|||
@active="active"
|
||||
:data="assertions"
|
||||
:draggable="draggable"
|
||||
:is-max="isMax"
|
||||
:show-btn="showBtn"
|
||||
color="#A30014"
|
||||
background-color="#F7E6E9"
|
||||
:title="$t('api_test.definition.request.assertions_rule')">
|
||||
|
@ -87,6 +89,14 @@
|
|||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
isMax: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
showBtn: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
assertions: {},
|
||||
node: {},
|
||||
request: {},
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
@active="active"
|
||||
:data="extract"
|
||||
:draggable="draggable"
|
||||
:is-max="isMax"
|
||||
:show-btn="showBtn"
|
||||
color="#015478"
|
||||
background-color="#E6EEF2"
|
||||
:title="$t('api_test.definition.request.extract_param')">
|
||||
|
@ -41,26 +43,26 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import {EXTRACT_TYPE} from "../../model/ApiTestModel";
|
||||
import MsApiExtractEdit from "./ApiExtractEdit";
|
||||
import MsApiExtractCommon from "./ApiExtractCommon";
|
||||
import {getUUID} from "@/common/js/utils";
|
||||
import ApiJsonPathSuggestButton from "../assertion/ApiJsonPathSuggestButton";
|
||||
import MsApiJsonpathSuggest from "../assertion/ApiJsonpathSuggest";
|
||||
import {ExtractJSONPath} from "../../../test/model/ScenarioModel";
|
||||
import ApiBaseComponent from "../../../automation/scenario/common/ApiBaseComponent";
|
||||
import {EXTRACT_TYPE} from "../../model/ApiTestModel";
|
||||
import MsApiExtractEdit from "./ApiExtractEdit";
|
||||
import MsApiExtractCommon from "./ApiExtractCommon";
|
||||
import {getUUID} from "@/common/js/utils";
|
||||
import ApiJsonPathSuggestButton from "../assertion/ApiJsonPathSuggestButton";
|
||||
import MsApiJsonpathSuggest from "../assertion/ApiJsonpathSuggest";
|
||||
import {ExtractJSONPath} from "../../../test/model/ScenarioModel";
|
||||
import ApiBaseComponent from "../../../automation/scenario/common/ApiBaseComponent";
|
||||
|
||||
export default {
|
||||
name: "MsApiExtract",
|
||||
components: {
|
||||
ApiBaseComponent,
|
||||
MsApiJsonpathSuggest,
|
||||
ApiJsonPathSuggestButton,
|
||||
MsApiExtractCommon,
|
||||
MsApiExtractEdit,
|
||||
},
|
||||
props: {
|
||||
extract: {},
|
||||
export default {
|
||||
name: "MsApiExtract",
|
||||
components: {
|
||||
ApiBaseComponent,
|
||||
MsApiJsonpathSuggest,
|
||||
ApiJsonPathSuggestButton,
|
||||
MsApiExtractCommon,
|
||||
MsApiExtractEdit,
|
||||
},
|
||||
props: {
|
||||
extract: {},
|
||||
response: {},
|
||||
node: {},
|
||||
customizeStyle: {
|
||||
|
@ -74,7 +76,15 @@ export default {
|
|||
draggable: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
}
|
||||
},
|
||||
isMax: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
showBtn: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
|
Loading…
Reference in New Issue