Merge branch 'v1.8'

This commit is contained in:
Captain.B 2021-03-30 19:15:04 +08:00
commit 6d8873ca5c
10 changed files with 69 additions and 77 deletions

View File

@ -163,7 +163,11 @@ public class MsHTTPSamplerProxy extends MsTestElement {
sampler.setProtocol(urlObject.getProtocol());
sampler.setPath(urlObject.getPath());
} else {
sampler.setDomain(config.getConfig().get(this.getProjectId()).getHttpConfig().getDomain());
String configStr = config.getConfig().get(this.getProjectId()).getHttpConfig().getSocket();
sampler.setDomain(configStr);
if (config.getConfig().get(this.getProjectId()).getHttpConfig().getPort() > 0) {
sampler.setDomain(config.getConfig().get(this.getProjectId()).getHttpConfig().getDomain());
}
sampler.setPort(config.getConfig().get(this.getProjectId()).getHttpConfig().getPort());
sampler.setProtocol(config.getConfig().get(this.getProjectId()).getHttpConfig().getProtocol());
sampler.setPath(this.getPath());

View File

@ -241,7 +241,7 @@ public class ApiAutomationService {
} else {
scenario.setUserId(request.getUserId());
}
if (StringUtils.isEmpty(request.getApiScenarioModuleId()) || StringUtils.isEmpty(request.getModulePath()) || "default-module".equals(request.getApiScenarioModuleId())) {
if (StringUtils.isEmpty(request.getApiScenarioModuleId()) || "default-module".equals(request.getApiScenarioModuleId())) {
ApiScenarioModuleExample example = new ApiScenarioModuleExample();
example.createCriteria().andProjectIdEqualTo(request.getProjectId()).andNameEqualTo("默认模块");
List<ApiScenarioModule> modules = apiScenarioModuleMapper.selectByExample(example);

View File

@ -264,15 +264,7 @@ public class ApiDefinitionService {
test.setEnvironmentId(request.getEnvironmentId());
test.setUserId(request.getUserId());
test.setTags(request.getTags());
if (StringUtils.isEmpty(request.getModulePath()) || StringUtils.isEmpty(request.getModuleId()) || "default-module".equals(request.getModuleId())) {
ApiModuleExample example = new ApiModuleExample();
example.createCriteria().andProjectIdEqualTo(test.getProjectId()).andProtocolEqualTo(test.getProtocol()).andNameEqualTo("默认模块");
List<ApiModule> modules = apiModuleMapper.selectByExample(example);
if (CollectionUtils.isNotEmpty(modules)) {
test.setModuleId(modules.get(0).getId());
test.setModulePath(modules.get(0).getName());
}
}
this.setModule(test);
apiDefinitionMapper.updateByPrimaryKeySelective(test);
return test;
}
@ -297,7 +289,7 @@ public class ApiDefinitionService {
test.setStatus(APITestStatus.Underway.name());
test.setModulePath(request.getModulePath());
test.setModuleId(request.getModuleId());
if (StringUtils.isEmpty(request.getModulePath()) || StringUtils.isEmpty(request.getModuleId()) || "default-module".equals(request.getModuleId())) {
if (StringUtils.isEmpty(request.getModuleId()) || "default-module".equals(request.getModuleId())) {
ApiModuleExample example = new ApiModuleExample();
example.createCriteria().andProjectIdEqualTo(test.getProjectId()).andProtocolEqualTo(test.getProtocol()).andNameEqualTo("默认模块");
List<ApiModule> modules = apiModuleMapper.selectByExample(example);
@ -591,6 +583,17 @@ public class ApiDefinitionService {
return apiTestCaseMapper.selectByPrimaryKey(apiCaseId);
}
private void setModule(ApiDefinitionWithBLOBs item) {
if (item != null && StringUtils.isEmpty(item.getModuleId()) || "default-module".equals(item.getModuleId())) {
ApiModuleExample example = new ApiModuleExample();
example.createCriteria().andProjectIdEqualTo(item.getProjectId()).andProtocolEqualTo(item.getProtocol()).andNameEqualTo("默认模块");
List<ApiModule> modules = apiModuleMapper.selectByExample(example);
if (CollectionUtils.isNotEmpty(modules)) {
item.setModuleId(modules.get(0).getId());
item.setModulePath(modules.get(0).getName());
}
}
}
public ApiDefinitionImport apiTestImport(MultipartFile file, ApiTestImportRequest request) {
ApiImportParser apiImportParser = ApiDefinitionImportParserFactory.getApiImportParser(request.getPlatform());
@ -616,15 +619,7 @@ public class ApiDefinitionService {
}
for (int i = 0; i < data.size(); i++) {
ApiDefinitionWithBLOBs item = data.get(i);
if (StringUtils.isEmpty(item.getModuleId()) || StringUtils.isEmpty(item.getModulePath()) || "default-module".equals(item.getModuleId())) {
ApiModuleExample example = new ApiModuleExample();
example.createCriteria().andProjectIdEqualTo(item.getProjectId()).andProtocolEqualTo(item.getProtocol()).andNameEqualTo("默认模块");
List<ApiModule> modules = apiModuleMapper.selectByExample(example);
if (CollectionUtils.isNotEmpty(modules)) {
item.setModuleId(modules.get(0).getId());
item.setModulePath(modules.get(0).getName());
}
}
this.setModule(item);
if (item.getName().length() > 255) {
item.setName(item.getName().substring(0, 255));
}

View File

@ -93,7 +93,7 @@ public class TestCaseService {
TestCaseTestMapper testCaseTestMapper;
private void setNode(TestCaseWithBLOBs testCase){
if (StringUtils.isEmpty(testCase.getNodeId()) || StringUtils.isEmpty(testCase.getNodePath()) || "default-module".equals(testCase.getNodeId())) {
if (StringUtils.isEmpty(testCase.getNodeId()) || "default-module".equals(testCase.getNodeId())) {
TestCaseNodeExample example = new TestCaseNodeExample();
example.createCriteria().andProjectIdEqualTo(testCase.getProjectId()).andNameEqualTo("默认模块");
List<TestCaseNode> nodes = testCaseNodeMapper.selectByExample(example);

View File

@ -441,18 +441,12 @@ export default {
}
});
if (this.$refs.scenarioTable) {
setTimeout(() => {
this.$refs.scenarioTable.doLayout();
this.result.loading = false;
}, 500)
}
if (!this.condition.selectAll) {
this.condition.unSelectIds = response.data.listObject.map(s => s.id);
}
this.$nextTick(function () {
this.$refs.scenarioTable.doLayout();
this.checkTableRowIsSelect();
})
});
@ -838,4 +832,8 @@ export default {
/deep/ .el-card__header {
padding: 10px;
}
/deep/ .el-table__fixed-body-wrapper {
top: 60px !important;
}
</style>

View File

@ -351,13 +351,9 @@ export default {
item.tags = JSON.parse(item.tags);
}
})
if (this.$refs.caseTable) {
setTimeout(() => {
this.$refs.caseTable.doLayout();
this.result.loading = false;
}, 500)
}
this.$nextTick(function(){
this.$refs.caseTable.doLayout();
this.checkTableRowIsSelect();
})
});
@ -694,4 +690,8 @@ export default {
/deep/ .el-table__fixed {
height: 100% !important;
}
/deep/ .el-table__fixed-body-wrapper {
top: 60px !important;
}
</style>

View File

@ -454,18 +454,10 @@
item.tags = JSON.parse(item.tags);
}
})
if (this.$refs.apiDefinitionTable) {
setTimeout(() => {
this.$refs.apiDefinitionTable.doLayout();
this.result.loading = false;
}, 500)
}
// nexttick:
this.$nextTick(function(){
// if (this.$refs.apiDefinitionTable) {
// this.$refs.apiDefinitionTable.doLayout();
// this.result.loading = false;
// }
this.$refs.apiDefinitionTable.doLayout();
this.checkTableRowIsSelect();
})
});
@ -838,4 +830,8 @@
top: -2px;
}
/deep/ .el-table__fixed-body-wrapper {
top: 60px !important;
}
</style>

View File

@ -71,27 +71,27 @@
</template>
<script>
import MsApiRequestForm from "../request/http/ApiHttpRequestForm";
import {getUUID} from "@/common/js/utils";
import MsApiCaseList from "../case/ApiCaseList";
import MsContainer from "../../../../common/components/MsContainer";
import MsRequestResultTail from "../response/RequestResultTail";
import MsRun from "../Run";
import {REQ_METHOD} from "../../model/JsonData";
import EnvironmentSelect from "../environment/EnvironmentSelect";
import MsJmxStep from "../step/JmxStep";
import MsApiRequestForm from "../request/http/ApiHttpRequestForm";
import {getUUID} from "@/common/js/utils";
import MsApiCaseList from "../case/ApiCaseList";
import MsContainer from "../../../../common/components/MsContainer";
import MsRequestResultTail from "../response/RequestResultTail";
import MsRun from "../Run";
import {REQ_METHOD} from "../../model/JsonData";
import EnvironmentSelect from "../environment/EnvironmentSelect";
import MsJmxStep from "../step/JmxStep";
export default {
name: "RunTestHTTPPage",
components: {
EnvironmentSelect,
MsApiRequestForm,
MsApiCaseList,
MsContainer,
MsRequestResultTail,
MsRun,
MsJmxStep
},
export default {
name: "RunTestHTTPPage",
components: {
EnvironmentSelect,
MsApiRequestForm,
MsApiCaseList,
MsContainer,
MsRequestResultTail,
MsRun,
MsJmxStep
},
data() {
return {
visible: false,
@ -134,6 +134,7 @@ export default {
if (valid) {
this.loading = true;
this.api.request.name = this.api.id;
this.api.request.url = undefined;
this.api.request.useEnvironment = this.api.environmentId;
this.api.protocol = this.currentProtocol;
this.runData = [];

View File

@ -392,14 +392,9 @@ export default {
this.tableData.forEach((item) => {
item.tags = JSON.parse(item.tags);
})
if (this.$refs.table) {
setTimeout(() => {
this.$refs.table.doLayout();
this.result.loading = false;
}, 500)
}
this.$nextTick(function(){
this.$refs.table.doLayout();
this.checkTableRowIsSelect();
})
});
@ -662,4 +657,8 @@ export default {
.el-tag {
margin-left: 10px;
}
/deep/ .el-table__fixed-body-wrapper {
top: 60px !important;
}
</style>

View File

@ -472,12 +472,7 @@ export default {
}
}
this.selectRows.clear();
if (this.$refs.table) {
setTimeout(() => {
this.$refs.table.doLayout();
this.result.loading = false;
}, 500)
}
this.$refs.table.doLayout();
});
}
getLabel(this, TEST_PLAN_FUNCTION_TEST_CASE);
@ -718,4 +713,8 @@ export default {
.ms-table-header >>> .table-title {
height: 0px;
}
/deep/ .el-table__fixed-body-wrapper {
top: 60px !important;
}
</style>