Skip to content

Commit

Permalink
feat: set snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhouYixun committed May 25, 2023
1 parent c3fb0ed commit a559c02
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 10 deletions.
6 changes: 5 additions & 1 deletion src/components/StepShow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ const getNotes = (text, type) => {
size="small"
style="margin-left: 10px; margin-right: 10px"
>{{ step.elements[0]['eleName'] }}</el-tag
> 期望:
> 期望:
<el-tag size="small" style="margin-left: 10px; margin-right: 10px">{{ getAssertTextOpe(step.content) }}</el-tag>{{ step.text }}
</span>
<span v-if="step.stepType === 'getTitle'">
Expand Down Expand Up @@ -620,6 +620,10 @@ const getNotes = (text, type) => {
<el-tag size="small" style="margin-right: 5px">强制等待</el-tag>
等待 {{ step.content }} ms
</span>
<span v-if="step.stepType === 'setSnapshotMaxDepth'">
<el-tag size="small" style="margin-right: 5px">设置控件获取最大遍历深度</el-tag>
最大 {{ step.content }} 层
</span>
<span>
<el-tag
v-if="step.conditionType !== 3 && step.conditionType !== 0"
Expand Down
31 changes: 23 additions & 8 deletions src/components/StepUpdate.vue
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,8 @@ const getStepInfo = (id) => {
step.value.stepType === 'setDefaultFindPocoElementInterval' ||
step.value.stepType === 'setDefaultFindWebViewElementInterval' ||
step.value.stepType === 'longPress' ||
step.value.stepType === 'checkImage'
step.value.stepType === 'checkImage' ||
step.value.stepType === 'setSnapshotMaxDepth'
) {
step.value.content = parseInt(step.value.content);
}
Expand Down Expand Up @@ -358,7 +359,7 @@ const getStepInfo = (id) => {
}
if (
step.value.stepType === 'assertText' ||
step.value.stepType === 'assertWebViewText' ||
step.value.stepType === 'assertWebViewText' ||
step.value.stepType === 'assertPocoText'
) {
step.value.content = JSON.parse(step.value.content);
Expand Down Expand Up @@ -955,6 +956,10 @@ const iOSOptions = ref([
value: 'iteratorIOSElement',
label: '迭代控件列表',
},
{
value: 'setSnapshotMaxDepth',
label: '设置控件获取最大遍历深度',
},
],
},
{
Expand Down Expand Up @@ -1508,7 +1513,7 @@ onMounted(() => {
placeholder="输入数量"
:min="0"
style="width: 150px; margin-left: 10px;"
prop="text"
prop="text"
></el-input-number>
</el-form-item>
</div>
Expand Down Expand Up @@ -1763,7 +1768,7 @@ onMounted(() => {
<div
v-if="
step.stepType === 'isExistEleNum' ||
step.stepType === 'isExistWebViewEleNum'
step.stepType === 'isExistWebViewEleNum'
"
>
<element-select
Expand Down Expand Up @@ -1792,7 +1797,7 @@ onMounted(() => {
placeholder="输入数量"
:min="0"
style="width: 150px; margin-left: 10px;"
prop="text"
prop="text"
></el-input-number>
</el-form-item>
</div>
Expand Down Expand Up @@ -1983,6 +1988,16 @@ onMounted(() => {
/>
</div>

<div v-if="step.stepType === 'setSnapshotMaxDepth'">
<el-form-item label="最大深度">
<el-input-number
v-model="step.content"
:min="1"
:max="60"
></el-input-number>
</el-form-item>
</div>

<div v-if="step.stepType === 'longPress'">
<element-select
label="控件元素"
Expand Down Expand Up @@ -2109,7 +2124,7 @@ onMounted(() => {

<!--这里UI上还需要保留,用于在老版本升级上来之后,可以编辑用-->
<div
v-if="step.stepType === 'getText' || step.stepType === 'getWebViewText' || step.stepType === 'getPocoText'"
v-if="step.stepType === 'getText' || step.stepType === 'getWebViewText' || step.stepType === 'getPocoText'"
>
<element-select
label="控件元素"
Expand All @@ -2129,7 +2144,7 @@ onMounted(() => {

<!-- >2.5版本之后,增强类型的文本断言 -->
<div
v-if="step.stepType === 'assertText' || step.stepType === 'assertWebViewText' || step.stepType === 'assertPocoText'"
v-if="step.stepType === 'assertText' || step.stepType === 'assertWebViewText' || step.stepType === 'assertPocoText'"
>
<element-select
label="控件元素"
Expand All @@ -2151,7 +2166,7 @@ onMounted(() => {
<el-option label="不包含" value="notContain"></el-option>
</el-select>
</el-form-item>
<el-form-item
<el-form-item
label="期望值"
prop="text"
:rules="{required: true, message: '期望值不能为空', trigger: 'change'}">
Expand Down
1 change: 1 addition & 0 deletions src/locales/lang/en_US.js
Original file line number Diff line number Diff line change
Expand Up @@ -963,6 +963,7 @@ const usersTS = {
},
};
const IOSRemote = {
depth: "Snapshot Max Depth",
driverStatus: {
success: 'Init WebDriverAgent successful!',
fail: 'Init WebDriverAgent failed!',
Expand Down
1 change: 1 addition & 0 deletions src/locales/lang/ja_JP.js
Original file line number Diff line number Diff line change
Expand Up @@ -940,6 +940,7 @@ const usersTS = {
},
};
const IOSRemote = {
depth: "最大遍历深度",
driverStatus: {
success: '初始化 WebDriverAgent 完成!',
fail: '初始化 WebDriverAgent 失败!',
Expand Down
1 change: 1 addition & 0 deletions src/locales/lang/zh_CN.js
Original file line number Diff line number Diff line change
Expand Up @@ -938,6 +938,7 @@ const usersTS = {
},
};
const IOSRemote = {
depth: "最大遍历深度",
driverStatus: {
success: '初始化 WebDriverAgent 完成!',
fail: '初始化 WebDriverAgent 失败!',
Expand Down
1 change: 1 addition & 0 deletions src/locales/lang/zh_TW.js
Original file line number Diff line number Diff line change
Expand Up @@ -938,6 +938,7 @@ const usersTS = {
},
};
const IOSRemote = {
depth: "最大遍历深度",
driverStatus: {
success: '初始化 WebDriverAgent 完成!',
fail: '初始化 WebDriverAgent 失败!',
Expand Down
13 changes: 12 additions & 1 deletion src/views/RemoteEmulator/IOSRemote.vue
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ const directionStatus = {
};
let moveX = 0;
let moveY = 0;
const depth = ref(50);
const isFixTouch = false;
const isPress = false;
let loop = null;
Expand Down Expand Up @@ -1181,6 +1182,7 @@ const getElement = () => {
type: 'debug',
detail: 'tree',
needImg: oldBlob == null,
depth: depth.value
})
);
};
Expand Down Expand Up @@ -2558,15 +2560,24 @@ const checkAlive = () => {
margin-bottom: 15px;
display: flex;
align-items: center;
justify-content: space-between;
"
>
<span
style="
margin-right: 10px;
color: #909399;
font-size: 14px;
"
>{{ $t('IOSRemote.depth') }}: </span
>
<el-input-number size="mini" v-model="depth" :min="1" :max="60"/>
<el-button
type="primary"
size="mini"
:loading="elementLoading"
:disabled="isDriverFinish === false"
@click="getElement"
style="margin-left: 10px"
>
<el-icon :size="12" style="vertical-align: middle">
<Search />
Expand Down

0 comments on commit a559c02

Please sign in to comment.