feat(测试计划): 测试计划内批量执行用例时增加默认环境的展示方式

--story=1012486
--user=宋天阳
【货车之家】接口场景包含跨项目步骤时取消跨项目环境必选&测试计划关联接口、UI测试时取消运行环境必选
https://www.tapd.cn/55049933/s/1402102
This commit is contained in:
song-tianyang 2023-08-10 18:08:02 +08:00 committed by fit2-zhao
parent 87dd88209d
commit 2265199e37
7 changed files with 229 additions and 220 deletions

View File

@ -413,10 +413,10 @@ export default {
});
},
getLoadConfig() {
this.loadIsOver = false;
getLoadConfig(this.testId, this.reportId, this.isShare)
.then(response => {
let data = JSON.parse(response.data);
this.loadIsOver = false;
for (let i = 0; i < this.threadGroups.length; i++) {
data[i].forEach(item => {
switch (item.key) {
@ -511,9 +511,10 @@ export default {
tg.durationMinutes = Math.floor((tg.duration / 60 % 60));
tg.durationSeconds = Math.floor((tg.duration % 60));
}
this.loadIsOver = true;
this.resourcePoolChange();
this.calculateTotalChart();
}).finally(() => {
this.loadIsOver = true;
});
},
getJmxContent() {

View File

@ -267,6 +267,7 @@ export default {
methods: {
open(testType, runModeConfig) {
this.defaultEnvMap = {};
if (this.type === 'plan') {
if (runModeConfig) {
this.runConfig = JSON.parse(runModeConfig);
if (!this.runConfig.envMap || JSON.stringify(this.runConfig.envMap) === "{}") {
@ -282,6 +283,7 @@ export default {
} else {
this.isEnvSaved = false;
}
}
this.runConfig.environmentType = ENV_TYPE.JSON;
this.runModeVisible = true;
this.testType = testType;
@ -401,11 +403,7 @@ export default {
let data = res.data;
if (data) {
this.projectEnvListMap = data;
for (let d in data) {
this.projectIds.add(d);
}
}
if (this.projectIds.size === 0) {
param = {id: this.planId};
getPlanCaseProjectIds(param).then((res) => {
let data = res.data;
@ -416,9 +414,6 @@ export default {
}
this.$refs.envSelectPopover.open();
});
} else {
this.$refs.envSelectPopover.open();
}
});
}
},

View File

@ -1,6 +1,5 @@
<template>
<div>
<!-- {{ JSON.stringify(eventData) }}-->
<el-radio-group
v-model="radio"
style="width: 100%"

View File

@ -24,13 +24,17 @@
@refreshTable="initTable"
ref="apitable">
<template v-slot:header>
<ms-environment-select :project-id="projectId" :is-read-only="isReadOnly"
@setEnvironment="setEnvironment" ref="msEnvironmentSelect"/>
</template>
</api-table-list>
<div>
<el-radio-group v-model="envType" style="float: left;margin-top: 8px;">
<el-radio label="default">{{ $t("api_test.environment.default_environment") }}</el-radio>
<el-radio label="newEnv">{{ $t("api_test.environment.choose_new_environment") }}</el-radio>
</el-radio-group>
<ms-environment-select v-if="envType==='newEnv'" :project-id="projectId" :is-read-only="isReadOnly"
@setEnvironment="setEnvironment" ref="msEnvironmentSelect"
style="float: left;margin-left: 16px"
/>
</div>
</api-list-container>
</div>
@ -60,6 +64,7 @@ export default {
condition: {
components: TEST_PLAN_RELEVANCE_API_DEFINITION_CONFIGS
},
envType: 'default',
result: {},
screenHeight: 'calc(100vh - 400px)',//,
tableData: [],
@ -94,6 +99,7 @@ export default {
},
created() {
this.condition.versionId = this.currentVersion;
},
watch: {
selectNodeIds() {
@ -112,7 +118,7 @@ export default {
currentVersion() {
this.condition.versionId = this.currentVersion;
this.initTable();
}
},
},
methods: {
setSelectRow(setSelectRow) {

View File

@ -7,13 +7,6 @@
<template>
<slot name="version"></slot>
</template>
<ms-environment-select
:project-id="projectId"
:is-read-only="isReadOnly"
@setEnvironment="setEnvironment"
ref="msEnvironmentSelect"
/>
<ms-search
:condition.sync="condition"
v-if="clearOver"
@ -132,6 +125,20 @@
:page-size.sync="pageSize"
:total="total"
/>
<div>
<el-radio-group v-model="envType" style="float: left;margin-top: 8px;">
<el-radio label="default">{{ $t("api_test.environment.default_environment") }}</el-radio>
<el-radio label="newEnv">{{ $t("api_test.environment.choose_new_environment") }}</el-radio>
</el-radio-group>
<ms-environment-select
:project-id="projectId"
:is-read-only="isReadOnly"
@setEnvironment="setEnvironment"
ref="msEnvironmentSelect"
v-if="envType==='newEnv'"
style="float: left;margin-left: 16px"
/>
</div>
</api-list-container>
</div>
</template>
@ -141,20 +148,13 @@ import MsTable from "metersphere-frontend/src/components/table/MsTable";
import MsTableColumn from "metersphere-frontend/src/components/table/MsTableColumn";
import MsTablePagination from "metersphere-frontend/src/components/pagination/TablePagination";
import MsTag from "metersphere-frontend/src/components/MsTag";
import {
API_METHOD_COLOUR,
CASE_PRIORITY,
} from "metersphere-frontend/src/model/JsonData";
import {API_METHOD_COLOUR, CASE_PRIORITY,} from "metersphere-frontend/src/model/JsonData";
import MsEnvironmentSelect from "metersphere-frontend/src/components/environment/snippet/ext/MsEnvironmentSelect";
import MsTableAdvSearchBar from "metersphere-frontend/src/components/search/MsTableAdvSearchBar";
import {TEST_PLAN_RELEVANCE_API_CASE_CONFIGS} from "metersphere-frontend/src/components/search/search-components";
import MsSearch from "metersphere-frontend/src/components/search/MsSearch";
import ApiListContainer from "@/business/plan/view/comonents/api/ApiListContainer";
import {
buildBatchParam,
hasLicense,
isProjectVersionEnable,
} from "@/business/utils/sdk-utils";
import {buildBatchParam, hasLicense, isProjectVersionEnable,} from "@/business/utils/sdk-utils";
import PriorityTableItem from "@/business/common/tableItems/planview/PriorityTableItem";
import {apiDefinitionGet} from "@/api/remote/api/api-definition";
import {testPlanApiCaseRelevanceList} from "@/api/remote/plan/test-plan-api-case";
@ -177,6 +177,7 @@ export default {
condition: {
components: TEST_PLAN_RELEVANCE_API_CASE_CONFIGS,
},
envType: 'default',
selectCase: {},
loading: false,
moduleId: "",

View File

@ -1,21 +1,5 @@
<template>
<div v-loading="result.loading">
<env-group-popover
:env-map="projectEnvMap"
:project-ids="projectIds"
@setProjectEnvMap="setProjectEnvMap"
:environment-type.sync="environmentType"
:group-id="envGroupId"
:is-scenario="false"
@setEnvGroup="setEnvGroup"
:show-config-button-with-out-permission="
showConfigButtonWithOutPermission
"
:project-list="projectList"
ref="envPopover"
class="env-popover"
/>
<mx-version-select
v-xpack
:project-id="projectId"
@ -162,6 +146,27 @@
:page-size.sync="pageSize"
:total="total"
/>
<div>
<el-radio-group v-model="envType" style="float: left;margin-top: 18px;">
<el-radio label="default">{{ $t("api_test.environment.default_environment") }}</el-radio>
<el-radio label="newEnv">{{ $t("api_test.environment.choose_new_environment") }}</el-radio>
</el-radio-group>
<env-group-popover
:env-map="projectEnvMap"
:project-ids="projectIds"
@setProjectEnvMap="setProjectEnvMap"
:environment-type.sync="environmentType"
:group-id="envGroupId"
:is-scenario="false"
@setEnvGroup="setEnvGroup"
:show-config-button-with-out-permission="showConfigButtonWithOutPermission"
:project-list="projectList"
ref="envPopover"
class="env-popover"
v-if="envType==='newEnv'"
style="float: left;margin-left: 16px"
/>
</div>
</div>
</template>
@ -176,17 +181,11 @@ import { TEST_PLAN_RELEVANCE_API_SCENARIO_CONFIGS } from "metersphere-frontend/s
import {ENV_TYPE} from "metersphere-frontend/src/utils/constants";
import MsTable from "metersphere-frontend/src/components/table/MsTable";
import MsSearch from "metersphere-frontend/src/components/search/MsSearch";
import {
getOwnerProjects,
getVersionFilters,
} from "@/business/utils/sdk-utils";
import {getOwnerProjects, getVersionFilters,} from "@/business/utils/sdk-utils";
import MxVersionSelect from "metersphere-frontend/src/components/version/MxVersionSelect";
import {getProjectApplicationConfig} from "@/api/project-application";
import {getApiScenarioEnvByProjectId} from "@/api/remote/api/api-automation";
import {
scenarioRelevanceList,
scenarioRelevanceProjectIds,
} from "@/api/remote/plan/test-plan-scenario";
import {scenarioRelevanceList, scenarioRelevanceProjectIds,} from "@/api/remote/plan/test-plan-scenario";
import EnvGroupPopover from "@/business/plan/env/EnvGroupPopover";
import ApiReportStatus from "@/business/plan/view/comonents/report/detail/api/ApiReportStatus";
import MsApiReportStatus from "@/business/plan/view/comonents/report/detail/api/ApiReportStatus";
@ -225,6 +224,7 @@ export default {
condition: {
components: TEST_PLAN_RELEVANCE_API_SCENARIO_CONFIGS,
},
envType: 'default',
currentScenario: {},
schedule: {},
tableData: [],

View File

@ -123,6 +123,13 @@ export default {
projectId() {
this.getVersionOptions();
},
isApiListEnable() {
if (this.isApiListEnable) {
this.$nextTick(() => {
this.refresh();
});
}
}
},
mounted() {
this.getVersionOptions();