ui测试前后端问题修复

This commit is contained in:
2025-05-27 14:32:09 +08:00
parent 2965095148
commit 64b57fc3ec
5 changed files with 133 additions and 62 deletions

View File

@@ -2,6 +2,7 @@ package com.test.test.controller;
import java.util.List;
import com.test.common.utils.StringUtils;
import com.test.test.domain.PerformanceTest;
import com.test.test.domain.TestCase;
import com.test.test.domain.qo.PerformanceTestQO;
@@ -157,7 +158,8 @@ public class PerformanceTestController extends BaseController {
Long l = performanceTestService.updatePerformanceTest(performanceTestQO);
PerformanceTestVO updatedTask = performanceTestService.selectPerformanceTestById(performanceTestQO.getId());
// 如果crontab或crontab_status被修改了则更新定时任务
if (!updatedTask.getCrontab().equals(originalTask.getCrontab())
if ((!StringUtils.isEmpty(updatedTask.getCrontab()) &&
!StringUtils.isEmpty(originalTask.getCrontab()) && !updatedTask.getCrontab().equals(originalTask.getCrontab()))
|| updatedTask.getCrontabStatus() != originalTask.getCrontabStatus()) {
PerformanceTest entity = new PerformanceTest();
entity.setId(updatedTask.getId());

View File

@@ -466,7 +466,7 @@ public class UiSceneStepsServiceImpl implements IUiSceneStepsService {
*/
private List<UiHighSettingVO> extractbeforeSetting(List<UiHighSettingVO> settings) {
return settings.stream()
.filter(e -> "1".equals(e.getSettingType()) && 0 == e.getIsDisabled() )
.filter(e -> "1".equals(e.getSettingType()) && 1 == e.getIsDisabled() )
.collect(Collectors.toList()); // 返回默认设置
}
@@ -485,7 +485,7 @@ public class UiSceneStepsServiceImpl implements IUiSceneStepsService {
result.put("continueExecution", continueExecution);
result.put("assertionReportVOS", assertionReports);
List<UiHighSettingVO> uiHighSettingVOS = settingList.stream()
.filter(setting -> setting.getOperateType().equals("2") && 0 == setting.getIsDisabled())
.filter(setting -> setting.getOperateType().equals("2") && 1 == setting.getIsDisabled())
.toList();
if (CollectionUtils.isEmpty(uiHighSettingVOS)) {
@@ -500,7 +500,7 @@ public class UiSceneStepsServiceImpl implements IUiSceneStepsService {
assertionQOList.addAll(assertion.getWebTitles());
if (!CollectionUtils.isEmpty(assertionQOList)) {
for (AssertionQO assertionQO : assertionQOList) {
if ("1".equals(assertionQO.getIsDisabled())) {
if ("0".equals(assertionQO.getIsDisabled())) {
continue;
}
AssertionReportVO report = new AssertionReportVO();
@@ -905,7 +905,7 @@ public class UiSceneStepsServiceImpl implements IUiSceneStepsService {
dataExtractionQOList.addAll(dataExtractionQO.getWindowExtractions());
if (!CollectionUtils.isEmpty(dataExtractionQOList)) {
for (DataExtractionQO extraction : dataExtractionQOList) {
if ("1".equals(extraction.getIsDisabled())) {
if ("0".equals(extraction.getIsDisabled())) {
continue;
}
try {

View File

@@ -73,7 +73,7 @@ export function editAndExecuteTest(data) {
// 测试-编辑-立即执行
export function executeTest(query) {
return request({
url: '/test/performanceTest/executeNow?' + query,
url: '/test/performanceTest/executeNow?id=' + query,
method: 'get',
})
}

View File

@@ -925,40 +925,54 @@ export default {
if (newVal === null) {
return
}
this.saveForm.beforeList = []
this.saveForm.afterList = []
// 重置所有数据
this.saveForm = {
errorHandling: '1', // 错误处理
waitElementTime: 15000, // 等待元素超时时间
screenshotConfiguration: 1, // 截图配置
beforeList: [], // 前置数组
afterList: [], // 后置数组
before: '1',
after: '1',
informationType: '1',
windowType: null,
elementType: null,
assertionType: null,
}
if (newVal.operateType != '1' && newVal.operateType != '2') {
this.activeName = 'first'
} else {
this.activeName = 'second'
}
// 如果有已存在的设置,则加载它们
if (newVal.uiHighSettingVOList != null) {
this.uiHighSettingVOList = newVal.uiHighSettingVOList
this.uiHighSettingVOList.forEach(item => {
switch (item.settingType) {
// 前置操作
case '1':
this.saveForm.beforeList.push({...item}) // 使用解构复制,避免引用
break
// 后置操作
case '2':
this.saveForm.afterList.push({...item}) // 使用解构复制,避免引用
break
// 错误处理
case '3':
this.saveForm.errorHandling = item.errorHandling
break
// 其他设置
case '4':
if (item.otherSettingsQO != null) {
this.saveForm.waitElementTime = item.otherSettingsQO.waitElementTime || 15000
this.saveForm.screenshotConfiguration = item.otherSettingsQO.screenshotConfiguration || 2
}
break
}
})
}
this.uiHighSettingVOList.forEach(item => {
switch (item.settingType) {
// 前置操作
case '1':
this.saveForm.beforeList.push(item)
break
// 后置操作
case '2':
this.saveForm.afterList.push(item)
break
// 错误处理
case '3':
this.saveForm.errorHandling = item.errorHandling
break
// 其他设置
case '4':
if (item.otherSettingsQO != null) {
this.saveForm.waitElementTime = item.otherSettingsQO.waitElementTime || 15000
this.saveForm.screenshotConfiguration = item.otherSettingsQO.screenshotConfiguration || 2
}
break
}
})
},
saveForm: {
handler(newVal, oldVal) {

View File

@@ -22,7 +22,7 @@
</el-tooltip>
</el-form-item>
<el-form-item v-show="saveForm.stepType === '1'">
<el-checkbox v-model="saveForm.isAppendPage">追加页面</el-checkbox>
<el-checkbox v-model="appendPageValue">追加页面</el-checkbox>
<el-tooltip class="item" effect="dark" content="追加页面在新的页面打开url不勾选覆盖当前url" placement="right">
<i class="el-icon-info"></i>
</el-tooltip>
@@ -91,11 +91,11 @@
<el-option key="2" label="元素定位" value="2"></el-option>
</el-select>
<!-- 元素对象 -->
<div v-show="saveForm.operateObject != '2'" class="operateObject-wrap">
<el-select v-model="saveForm.operateGroupId" class="select" @change="getOperateGroup">
<div v-show="saveForm.operateObject === '1'" class="operateObject-wrap">
<el-select v-model="saveForm.operateGroupId" class="select" @change="handleOperateGroupChange" placeholder="请选择元素组">
<el-option v-for="item in groupList" :key="item.id" :label="item.name" :value="item.id"></el-option>
</el-select>
<el-select v-model="saveForm.operateElementId" class="select">
<el-select v-model="saveForm.operateElementId" class="select" placeholder="请选择元素">
<el-option v-for="item in elementList" :key="item.id" :label="item.name" :value="item.id"></el-option>
</el-select>
</div>
@@ -153,11 +153,11 @@
<el-option key="2" label="元素定位" value="2"></el-option>
</el-select>
<!-- 元素对象 -->
<div v-show="saveForm.operateObject != '2'" class="operateObject-wrap">
<el-select v-model="saveForm.operateGroupId" class="select" @change="getOperateGroup">
<div v-show="saveForm.operateObject === '1'" class="operateObject-wrap">
<el-select v-model="saveForm.operateGroupId" class="select" @change="handleOperateGroupChange" placeholder="请选择元素组">
<el-option v-for="item in groupList" :key="item.id" :label="item.name" :value="item.id"></el-option>
</el-select>
<el-select v-model="saveForm.operateElementId" class="select">
<el-select v-model="saveForm.operateElementId" class="select" placeholder="请选择元素">
<el-option v-for="item in elementList" :key="item.id" :label="item.name" :value="item.id"></el-option>
</el-select>
</div>
@@ -222,11 +222,11 @@
<el-option key="2" label="元素定位" value="2"></el-option>
</el-select>
<!-- 元素对象 -->
<div v-show="saveForm.operateObject != '2'" class="operateObject-wrap">
<el-select v-model="saveForm.operateGroupId" class="select" @change="getOperateGroup">
<div v-show="saveForm.operateObject === '1'" class="operateObject-wrap">
<el-select v-model="saveForm.operateGroupId" class="select" @change="handleOperateGroupChange" placeholder="请选择元素组">
<el-option v-for="item in groupList" :key="item.id" :label="item.name" :value="item.id"></el-option>
</el-select>
<el-select v-model="saveForm.operateElementId" class="select">
<el-select v-model="saveForm.operateElementId" class="select" placeholder="请选择元素">
<el-option v-for="item in elementList" :key="item.id" :label="item.name" :value="item.id"></el-option>
</el-select>
</div>
@@ -263,11 +263,11 @@
<el-option key="2" label="元素定位" value="2"></el-option>
</el-select>
<!-- 元素对象 -->
<div v-show="saveForm.operateObject != '2'" class="operateObject-wrap">
<el-select v-model="saveForm.operateGroupId" class="select" @change="getOperateGroup">
<div v-show="saveForm.operateObject === '1'" class="operateObject-wrap">
<el-select v-model="saveForm.operateGroupId" class="select" @change="handleOperateGroupChange" placeholder="请选择元素组">
<el-option v-for="item in groupList" :key="item.id" :label="item.name" :value="item.id"></el-option>
</el-select>
<el-select v-model="saveForm.operateElementId" class="select">
<el-select v-model="saveForm.operateElementId" class="select" placeholder="请选择元素">
<el-option v-for="item in elementList" :key="item.id" :label="item.name" :value="item.id"></el-option>
</el-select>
</div>
@@ -311,11 +311,11 @@
<el-option key="2" label="元素定位" value="2"></el-option>
</el-select>
<!-- 元素对象 -->
<div v-show="saveForm.operateObject != '2'" class="operateObject-wrap">
<el-select v-model="saveForm.operateGroupId" class="select" @change="getOperateGroup">
<div v-show="saveForm.operateObject === '1'" class="operateObject-wrap">
<el-select v-model="saveForm.operateGroupId" class="select" @change="handleOperateGroupChange" placeholder="请选择元素组">
<el-option v-for="item in groupList" :key="item.id" :label="item.name" :value="item.id"></el-option>
</el-select>
<el-select v-model="saveForm.operateElementId" class="select">
<el-select v-model="saveForm.operateElementId" class="select" placeholder="请选择元素">
<el-option v-for="item in elementList" :key="item.id" :label="item.name" :value="item.id"></el-option>
</el-select>
</div>
@@ -368,7 +368,7 @@ export default {
operateType: null, // 操作类型
stepType: null, // 步骤类型
url: null, // url
isAppendPage: 0, // 追加页面
isAppendPage: 0, // 追加页面 - 使用0而不是false作为默认值
operate: null, // 操作
handleId: null, // 句柄ID
pageIndex: 1, // 网页索引号
@@ -386,6 +386,11 @@ export default {
awaitValue: null, // 等待文本
clickMethod: null, // 点击方式
inputValue: null, // 输入内容
beforeList: [], // 初始化前置操作列表
afterList: [], // 初始化后置操作列表
errorHandling: null, // 错误处理
waitElementTime: null, // 等待元素时间
screenshotConfiguration: null // 截图配置
},
rules: {
name: [{ required: true, message: '请输入元素名称', trigger: 'blur' }],
@@ -412,7 +417,7 @@ export default {
typeName: '', // 步骤类型
actionList: [], // 操作列表
groupList: [], // 操作对象分组
elementList: [], // 操作对象分组
elementList: [], // 元素列表
}
},
mounted() {
@@ -436,26 +441,40 @@ export default {
}
})
},
// 元素对象
getOperateGroup() {
this.getElementListData(this.saveForm.operateGroupId)
},
// 元素定位
getOperateLoc() {
this.getElementListData(this.saveForm.operateLocType)
},
// 获取元素列表
getElementListData(id) {
getElementList({ groupId: id }).then(res => {
getElementListData(groupId) {
getElementList({ groupId: groupId }).then(res => {
if (res.code === 200) {
this.elementList = res.rows
this.elementList = res.rows;
// 检查当前选中的operateElementId是否在新的列表中存在
if (this.saveForm.operateElementId) {
const elementExists = this.elementList.some(item => item.id === this.saveForm.operateElementId);
if (!elementExists) {
// 如果不存在,清空选择
this.saveForm.operateElementId = null;
}
}
}
})
},
// 元素组变化时触发
handleOperateGroupChange() {
if (this.saveForm.operateGroupId) {
this.getElementListData(this.saveForm.operateGroupId);
} else {
this.elementList = [];
this.saveForm.operateElementId = null;
}
},
},
watch: {
detail(newVal, oldVal) {
this.saveForm = newVal
// 如果是元素对象且有元素组ID获取元素列表
if (this.saveForm.operateObject === '1' && this.saveForm.operateGroupId) {
this.getElementListData(this.saveForm.operateGroupId)
}
},
saveForm: {
handler(newVal, oldVal) {
@@ -544,18 +563,54 @@ export default {
}
break
}
// 尺寸
if (newVal.windowSize != null) {
let result = newVal.windowSize.split(/\*/);
if (result.length > 0) {
this.winSize.width = result[0]
this.winSize.width = result[1]
this.winSize.height = result[1]
}
}
// 确保数组已初始化
const beforeList = this.saveForm.beforeList || [];
const afterList = this.saveForm.afterList || [];
var newList = [...beforeList, ...afterList];
// 错误处理
var param3 = {
settingType: '3',
errorHandling: this.saveForm.errorHandling,
}
newList.push(param3)
// 其他设置
var param4 = {
settingType: '4',
otherSettingsQO: {
waitElementTime: this.saveForm.waitElementTime,
screenshotConfiguration: this.saveForm.screenshotConfiguration
}
}
newList.push(param4)
this.$emit('changeSetting', newList)
},
deep: true
},
}
},
computed: {
appendPageValue: {
get() {
// 将数字转换为布尔值用于显示
return this.saveForm.isAppendPage === 1;
},
set(value) {
// 将布尔值转换为数字存储
this.saveForm.isAppendPage = value ? 1 : 0;
}
}
},
}
</script>