Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello uni-app x
提交
6c34dbce
H
hello uni-app x
项目概览
DCloud
/
hello uni-app x
通知
6005
Star
91
Fork
164
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
18
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
hello uni-app x
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
18
Issue
18
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
6c34dbce
编写于
2月 02, 2024
作者:
DCloud-yyl
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'dev' into alpha
上级
aaf52a3b
7484d3a8
变更
24
隐藏空白更改
内联
并排
Showing
24 changed file
with
1604 addition
and
67 deletion
+1604
-67
AndroidManifest.xml
AndroidManifest.xml
+2
-0
pages/API/action-sheet/action-sheet.test.js
pages/API/action-sheet/action-sheet.test.js
+540
-0
pages/API/action-sheet/action-sheet.uvue
pages/API/action-sheet/action-sheet.uvue
+15
-8
pages/API/choose-image/choose-image.uvue
pages/API/choose-image/choose-image.uvue
+8
-9
pages/API/get-app-authorize-setting/get-app-authorize-setting.uvue
.../get-app-authorize-setting/get-app-authorize-setting.uvue
+5
-5
pages/API/get-app-base-info/get-app-base-info.uvue
pages/API/get-app-base-info/get-app-base-info.uvue
+1
-1
pages/API/get-device-info/get-device-info.uvue
pages/API/get-device-info/get-device-info.uvue
+1
-1
pages/API/get-system-info/get-system-info.uvue
pages/API/get-system-info/get-system-info.uvue
+1
-1
pages/API/get-system-setting/get-system-setting.uvue
pages/API/get-system-setting/get-system-setting.uvue
+13
-5
pages/API/get-window-info/get-window-info.uvue
pages/API/get-window-info/get-window-info.uvue
+1
-1
pages/API/loading/loading.uvue
pages/API/loading/loading.uvue
+4
-0
pages/API/modal/modal.test.js
pages/API/modal/modal.test.js
+702
-0
pages/API/modal/modal.uvue
pages/API/modal/modal.uvue
+5
-1
pages/API/nodes-info/nodes-info.test.js
pages/API/nodes-info/nodes-info.test.js
+26
-1
pages/API/nodes-info/nodes-info.uvue
pages/API/nodes-info/nodes-info.uvue
+20
-1
pages/API/storage/storage.test.js
pages/API/storage/storage.test.js
+36
-0
pages/API/storage/storage.uvue
pages/API/storage/storage.uvue
+26
-3
pages/API/toast/toast.test.js
pages/API/toast/toast.test.js
+161
-0
pages/API/toast/toast.uvue
pages/API/toast/toast.uvue
+12
-12
pages/component/input/input.uvue
pages/component/input/input.uvue
+18
-12
pages/component/textarea/textarea.uvue
pages/component/textarea/textarea.uvue
+1
-1
pages/template/custom-tab-bar/custom-tab-bar.uvue
pages/template/custom-tab-bar/custom-tab-bar.uvue
+3
-2
pages/template/drop-card/drop-card.uvue
pages/template/drop-card/drop-card.uvue
+2
-2
pages/webview-screenshot-comparison/webview-screenshot-comparison.test.js
...reenshot-comparison/webview-screenshot-comparison.test.js
+1
-1
未找到文件。
AndroidManifest.xml
浏览文件 @
6c34dbce
...
...
@@ -3,6 +3,8 @@
<!-- 读取日历权限,用于演示权限申请监听API:uni.createRequestPermissionListener -->
<uses-permission
android:name=
"android.permission.READ_CALENDAR"
/>
<!-- 录音权限,用于演示获取录音权限API:uni.getAppAuthorizeSetting 返回的microphoneAuthorized属性值 -->
<uses-permission
android:name=
"android.permission.RECORD_AUDIO"
/>
<application>
...
...
pages/API/action-sheet/action-sheet.test.js
0 → 100644
浏览文件 @
6c34dbce
// uni-app自动化测试教程: uni-app自动化测试教程: https://uniapp.dcloud.net.cn/worktile/auto/hbuilderx-extension/
describe
(
'
API-loading
'
,
()
=>
{
let
page
;
const
isAndroid
=
process
.
env
.
UNI_OS_NAME
===
"
android
"
;
beforeAll
(
async
()
=>
{
page
=
await
program
.
reLaunch
(
'
/pages/API/action-sheet/action-sheet
'
)
await
page
.
waitFor
(
200
);
});
it
(
"
onload-action-sheet-test
"
,
async
()
=>
{
if
(
isAndroid
)
{
const
res
=
await
page
.
callMethod
(
'
jest_getWindowInfo
'
)
const
windowHeight
=
res
.
windowHeight
*
res
.
pixelRatio
;
const
windowWidth
=
res
.
windowWidth
*
res
.
pixelRatio
;
const
image
=
await
program
.
screenshot
({
adb
:
true
,
area
:
{
x
:
0
,
y
:
200
,
height
:
windowHeight
,
width
:
windowWidth
},
});
expect
(
image
).
toMatchImageSnapshot
();
}
else
{
const
image
=
await
program
.
screenshot
({
adb
:
true
,
fullPage
:
true
});
expect
(
image
).
toMatchImageSnapshot
()
}
})
it
(
"
action-sheet-test-current-0
"
,
async
()
=>
{
const
res
=
await
page
.
callMethod
(
'
jest_getWindowInfo
'
)
const
windowHeight
=
res
.
windowHeight
*
res
.
pixelRatio
;
const
windowWidth
=
res
.
windowWidth
*
res
.
pixelRatio
;
await
page
.
setData
({
showErrorToast
:
false
,
current
:
0
,
itemContentLarge
:
false
,
itemNumLargeSelect
:
false
,
itemColorCustom
:
false
,
})
const
btnToastDurationButton
=
await
page
.
$
(
'
#btn-action-sheet-show
'
)
await
btnToastDurationButton
.
tap
()
await
page
.
waitFor
(
500
);
if
(
isAndroid
)
{
const
image
=
await
program
.
screenshot
({
adb
:
true
,
area
:
{
x
:
0
,
y
:
200
,
height
:
windowHeight
,
width
:
windowWidth
},
});
expect
(
image
).
toMatchImageSnapshot
();
}
else
{
const
image
=
await
program
.
screenshot
({
adb
:
true
,
fullPage
:
true
});
expect
(
image
).
toMatchImageSnapshot
()
}
})
it
(
"
action-sheet-test-current-0-largeContent
"
,
async
()
=>
{
const
res
=
await
page
.
callMethod
(
'
jest_getWindowInfo
'
)
const
windowHeight
=
res
.
windowHeight
*
res
.
pixelRatio
;
const
windowWidth
=
res
.
windowWidth
*
res
.
pixelRatio
;
await
page
.
setData
({
showErrorToast
:
false
,
current
:
0
,
itemContentLarge
:
true
,
itemNumLargeSelect
:
false
,
itemColorCustom
:
false
,
})
const
btnToastDurationButton
=
await
page
.
$
(
'
#btn-action-sheet-show
'
)
await
btnToastDurationButton
.
tap
()
await
page
.
waitFor
(
500
);
if
(
isAndroid
)
{
const
image
=
await
program
.
screenshot
({
adb
:
true
,
area
:
{
x
:
0
,
y
:
200
,
height
:
windowHeight
,
width
:
windowWidth
},
});
expect
(
image
).
toMatchImageSnapshot
();
}
else
{
const
image
=
await
program
.
screenshot
({
adb
:
true
,
fullPage
:
true
});
expect
(
image
).
toMatchImageSnapshot
()
}
})
it
(
"
action-sheet-test-current-0-largeContent-largeNum
"
,
async
()
=>
{
const
res
=
await
page
.
callMethod
(
'
jest_getWindowInfo
'
)
const
windowHeight
=
res
.
windowHeight
*
res
.
pixelRatio
;
const
windowWidth
=
res
.
windowWidth
*
res
.
pixelRatio
;
await
page
.
setData
({
showErrorToast
:
false
,
current
:
0
,
itemContentLarge
:
true
,
itemNumLargeSelect
:
true
,
itemColorCustom
:
false
,
})
const
btnToastDurationButton
=
await
page
.
$
(
'
#btn-action-sheet-show
'
)
await
btnToastDurationButton
.
tap
()
await
page
.
waitFor
(
500
);
if
(
isAndroid
)
{
const
image
=
await
program
.
screenshot
({
adb
:
true
,
area
:
{
x
:
0
,
y
:
200
,
height
:
windowHeight
,
width
:
windowWidth
},
});
expect
(
image
).
toMatchImageSnapshot
();
}
else
{
const
image
=
await
program
.
screenshot
({
adb
:
true
,
fullPage
:
true
});
expect
(
image
).
toMatchImageSnapshot
()
}
})
it
(
"
action-sheet-test-current-0-largeContent-largeNum-customColor
"
,
async
()
=>
{
const
res
=
await
page
.
callMethod
(
'
jest_getWindowInfo
'
)
const
windowHeight
=
res
.
windowHeight
*
res
.
pixelRatio
;
const
windowWidth
=
res
.
windowWidth
*
res
.
pixelRatio
;
await
page
.
setData
({
showErrorToast
:
false
,
current
:
0
,
itemContentLarge
:
true
,
itemNumLargeSelect
:
true
,
itemColorCustom
:
true
,
})
const
btnToastDurationButton
=
await
page
.
$
(
'
#btn-action-sheet-show
'
)
await
btnToastDurationButton
.
tap
()
await
page
.
waitFor
(
500
);
if
(
isAndroid
)
{
const
image
=
await
program
.
screenshot
({
adb
:
true
,
area
:
{
x
:
0
,
y
:
200
,
height
:
windowHeight
,
width
:
windowWidth
},
});
expect
(
image
).
toMatchImageSnapshot
();
}
else
{
const
image
=
await
program
.
screenshot
({
adb
:
true
,
fullPage
:
true
});
expect
(
image
).
toMatchImageSnapshot
()
}
})
it
(
"
action-sheet-test-current-1
"
,
async
()
=>
{
const
res
=
await
page
.
callMethod
(
'
jest_getWindowInfo
'
)
const
windowHeight
=
res
.
windowHeight
*
res
.
pixelRatio
;
const
windowWidth
=
res
.
windowWidth
*
res
.
pixelRatio
;
await
page
.
setData
({
current
:
1
,
itemContentLarge
:
false
,
itemNumLargeSelect
:
false
,
itemColorCustom
:
false
,
})
const
btnToastDurationButton
=
await
page
.
$
(
'
#btn-action-sheet-show
'
)
await
btnToastDurationButton
.
tap
()
await
page
.
waitFor
(
500
);
if
(
isAndroid
)
{
const
image
=
await
program
.
screenshot
({
adb
:
true
,
area
:
{
x
:
0
,
y
:
200
,
height
:
windowHeight
,
width
:
windowWidth
},
});
expect
(
image
).
toMatchImageSnapshot
();
}
else
{
const
image
=
await
program
.
screenshot
({
adb
:
true
,
fullPage
:
true
});
expect
(
image
).
toMatchImageSnapshot
()
}
})
it
(
"
action-sheet-test-current-1-largeContent
"
,
async
()
=>
{
const
res
=
await
page
.
callMethod
(
'
jest_getWindowInfo
'
)
const
windowHeight
=
res
.
windowHeight
*
res
.
pixelRatio
;
const
windowWidth
=
res
.
windowWidth
*
res
.
pixelRatio
;
await
page
.
setData
({
showErrorToast
:
false
,
current
:
1
,
itemContentLarge
:
true
,
itemNumLargeSelect
:
false
,
itemColorCustom
:
false
,
})
const
btnToastDurationButton
=
await
page
.
$
(
'
#btn-action-sheet-show
'
)
await
btnToastDurationButton
.
tap
()
await
page
.
waitFor
(
500
);
if
(
isAndroid
)
{
const
image
=
await
program
.
screenshot
({
adb
:
true
,
area
:
{
x
:
0
,
y
:
200
,
height
:
windowHeight
,
width
:
windowWidth
},
});
expect
(
image
).
toMatchImageSnapshot
();
}
else
{
const
image
=
await
program
.
screenshot
({
adb
:
true
,
fullPage
:
true
});
expect
(
image
).
toMatchImageSnapshot
()
}
})
it
(
"
action-sheet-test-current-1-largeContent-largeNum
"
,
async
()
=>
{
const
res
=
await
page
.
callMethod
(
'
jest_getWindowInfo
'
)
const
windowHeight
=
res
.
windowHeight
*
res
.
pixelRatio
;
const
windowWidth
=
res
.
windowWidth
*
res
.
pixelRatio
;
await
page
.
setData
({
showErrorToast
:
false
,
current
:
1
,
itemContentLarge
:
true
,
itemNumLargeSelect
:
true
,
itemColorCustom
:
false
,
})
const
btnToastDurationButton
=
await
page
.
$
(
'
#btn-action-sheet-show
'
)
await
btnToastDurationButton
.
tap
()
await
page
.
waitFor
(
500
);
if
(
isAndroid
)
{
const
image
=
await
program
.
screenshot
({
adb
:
true
,
area
:
{
x
:
0
,
y
:
200
,
height
:
windowHeight
,
width
:
windowWidth
},
});
expect
(
image
).
toMatchImageSnapshot
();
}
else
{
const
image
=
await
program
.
screenshot
({
adb
:
true
,
fullPage
:
true
});
expect
(
image
).
toMatchImageSnapshot
()
}
})
it
(
"
action-sheet-test-current-1-largeContent-largeNum-customColor
"
,
async
()
=>
{
const
res
=
await
page
.
callMethod
(
'
jest_getWindowInfo
'
)
const
windowHeight
=
res
.
windowHeight
*
res
.
pixelRatio
;
const
windowWidth
=
res
.
windowWidth
*
res
.
pixelRatio
;
await
page
.
setData
({
showErrorToast
:
false
,
current
:
1
,
itemContentLarge
:
true
,
itemNumLargeSelect
:
true
,
itemColorCustom
:
true
,
})
const
btnToastDurationButton
=
await
page
.
$
(
'
#btn-action-sheet-show
'
)
await
btnToastDurationButton
.
tap
()
await
page
.
waitFor
(
500
);
if
(
isAndroid
)
{
const
image
=
await
program
.
screenshot
({
adb
:
true
,
area
:
{
x
:
0
,
y
:
200
,
height
:
windowHeight
,
width
:
windowWidth
},
});
expect
(
image
).
toMatchImageSnapshot
();
}
else
{
const
image
=
await
program
.
screenshot
({
adb
:
true
,
fullPage
:
true
});
expect
(
image
).
toMatchImageSnapshot
()
}
})
it
(
"
action-sheet-test-current-2
"
,
async
()
=>
{
const
res
=
await
page
.
callMethod
(
'
jest_getWindowInfo
'
)
const
windowHeight
=
res
.
windowHeight
*
res
.
pixelRatio
;
const
windowWidth
=
res
.
windowWidth
*
res
.
pixelRatio
;
await
page
.
setData
({
current
:
2
,
itemContentLarge
:
false
,
itemNumLargeSelect
:
false
,
itemColorCustom
:
false
,
})
const
btnToastDurationButton
=
await
page
.
$
(
'
#btn-action-sheet-show
'
)
await
btnToastDurationButton
.
tap
()
await
page
.
waitFor
(
500
);
if
(
isAndroid
)
{
const
image
=
await
program
.
screenshot
({
adb
:
true
,
area
:
{
x
:
0
,
y
:
200
,
height
:
windowHeight
,
width
:
windowWidth
},
});
expect
(
image
).
toMatchImageSnapshot
();
}
else
{
const
image
=
await
program
.
screenshot
({
adb
:
true
,
fullPage
:
true
});
expect
(
image
).
toMatchImageSnapshot
()
}
})
it
(
"
action-sheet-test-current-2-largeContent
"
,
async
()
=>
{
const
res
=
await
page
.
callMethod
(
'
jest_getWindowInfo
'
)
const
windowHeight
=
res
.
windowHeight
*
res
.
pixelRatio
;
const
windowWidth
=
res
.
windowWidth
*
res
.
pixelRatio
;
await
page
.
setData
({
showErrorToast
:
false
,
current
:
2
,
itemContentLarge
:
true
,
itemNumLargeSelect
:
false
,
itemColorCustom
:
false
,
})
const
btnToastDurationButton
=
await
page
.
$
(
'
#btn-action-sheet-show
'
)
await
btnToastDurationButton
.
tap
()
await
page
.
waitFor
(
500
);
if
(
isAndroid
)
{
const
image
=
await
program
.
screenshot
({
adb
:
true
,
area
:
{
x
:
0
,
y
:
200
,
height
:
windowHeight
,
width
:
windowWidth
},
});
expect
(
image
).
toMatchImageSnapshot
();
}
else
{
const
image
=
await
program
.
screenshot
({
adb
:
true
,
fullPage
:
true
});
expect
(
image
).
toMatchImageSnapshot
()
}
})
it
(
"
action-sheet-test-current-2-largeContent-largeNum
"
,
async
()
=>
{
const
res
=
await
page
.
callMethod
(
'
jest_getWindowInfo
'
)
const
windowHeight
=
res
.
windowHeight
*
res
.
pixelRatio
;
const
windowWidth
=
res
.
windowWidth
*
res
.
pixelRatio
;
await
page
.
setData
({
showErrorToast
:
false
,
current
:
2
,
itemContentLarge
:
true
,
itemNumLargeSelect
:
true
,
itemColorCustom
:
false
,
})
const
btnToastDurationButton
=
await
page
.
$
(
'
#btn-action-sheet-show
'
)
await
btnToastDurationButton
.
tap
()
await
page
.
waitFor
(
500
);
if
(
isAndroid
)
{
const
image
=
await
program
.
screenshot
({
adb
:
true
,
area
:
{
x
:
0
,
y
:
200
,
height
:
windowHeight
,
width
:
windowWidth
},
});
expect
(
image
).
toMatchImageSnapshot
();
}
else
{
const
image
=
await
program
.
screenshot
({
adb
:
true
,
fullPage
:
true
});
expect
(
image
).
toMatchImageSnapshot
()
}
})
it
(
"
action-sheet-test-current-2-largeContent-largeNum-customColor
"
,
async
()
=>
{
const
res
=
await
page
.
callMethod
(
'
jest_getWindowInfo
'
)
const
windowHeight
=
res
.
windowHeight
*
res
.
pixelRatio
;
const
windowWidth
=
res
.
windowWidth
*
res
.
pixelRatio
;
await
page
.
setData
({
showErrorToast
:
false
,
current
:
2
,
itemContentLarge
:
true
,
itemNumLargeSelect
:
true
,
itemColorCustom
:
true
,
})
const
btnToastDurationButton
=
await
page
.
$
(
'
#btn-action-sheet-show
'
)
await
btnToastDurationButton
.
tap
()
await
page
.
waitFor
(
500
);
if
(
isAndroid
)
{
const
image
=
await
program
.
screenshot
({
adb
:
true
,
area
:
{
x
:
0
,
y
:
200
,
height
:
windowHeight
,
width
:
windowWidth
},
});
expect
(
image
).
toMatchImageSnapshot
();
}
else
{
const
image
=
await
program
.
screenshot
({
adb
:
true
,
fullPage
:
true
});
expect
(
image
).
toMatchImageSnapshot
()
}
})
});
pages/API/action-sheet/action-sheet.uvue
浏览文件 @
6c34dbce
...
...
@@ -25,7 +25,7 @@
</view>
<view class="uni-padding-wrap">
<view class="uni-btn-v">
<button class="uni-btn-v" type="default" @tap="actionSheetTap">弹出action sheet</button>
<button class="uni-btn-v" type="default" @tap="actionSheetTap"
id="btn-action-sheet-show"
>弹出action sheet</button>
</view>
</view>
</view>
...
...
@@ -41,7 +41,8 @@
title: 'action-sheet',
itemColorCustom: false,
itemContentLarge: false,
itemNumLargeSelect: false,
itemNumLargeSelect: false,
showErrorToast:true,
items: [{
value: '标题',
name: '有标题'
...
...
@@ -64,7 +65,11 @@
itemList:['item1', 'item2'],
})
},
methods: {
methods: {
//自动化测试例专用
jest_getWindowInfo() : GetWindowInfoResult {
return uni.getWindowInfo();
},
radioChange(e : UniRadioGroupChangeEvent) {
for (let i = 0; i < this.items.length; i++) {
if (this.items[i].value === e.detail.value) {
...
...
@@ -127,11 +132,13 @@
})
},
fail: (e) => {
console.log(e);
uni.showToast({
title: e.errMsg,
icon: "none"
})
console.log(e);
if(this.showErrorToast){
uni.showToast({
title: e.errMsg,
icon: "none"
})
}
}
})
}
...
...
pages/API/choose-image/choose-image.uvue
浏览文件 @
6c34dbce
...
...
@@ -29,8 +29,7 @@
数量限制
</view>
<view class="uni-list-cell-right">
<input class="click-t" :value="countIndex+1" type="number" :maxlength="1" @confirm="chooseImageCount"
confirm-type="done" />
<input class="click-t" :value="countIndex+1" type="number" :maxlength="1" @confirm="chooseImageCount" confirm-type="done" />
</view>
</view>
<view class="uni-list-cell cell-pd">
...
...
@@ -41,7 +40,7 @@
<switch :checked="isCrop" @change="switchCrop"></switch>
</view>
</view>
<view ref="cropOptionNode" class="crop-option" :style="{'height':isCrop?'200px':'0px'}">
<view ref="cropOptionNode" class="crop-option" :style="{'height':isCrop?'200px':'0px'
,'margin-bottom':isCrop?'11px':'0px'
}">
<view class="uni-list-cell cell-pd">
<view class="uni-list-cell-left item_width">
图片质量(%)
...
...
@@ -285,11 +284,11 @@
}
.crop-option {
border-top-color: lightgray
;
border-width:
1px;
border-
style: solid
;
padding: 10px
;
transition
: height
;
transition-duration:
3
00ms;
margin-left: 11px
;
margin-right: 1
1px;
border-
radius: 11px
;
background-color: #eee
;
transition
-property: height, margin-bottom
;
transition-duration:
2
00ms;
}
</style>
pages/API/get-app-authorize-setting/get-app-authorize-setting.uvue
浏览文件 @
6c34dbce
...
...
@@ -7,7 +7,7 @@
<view class="uni-label" style="width:180px;">是否授权使用摄像头</view>
</view>
<view class="uni-list-cell-db">
<input
class="uni-input"
type="text" :disabled="true" placeholder="未获取" :value="cameraAuthorized" />
<input type="text" :disabled="true" placeholder="未获取" :value="cameraAuthorized" />
</view>
</view>
<view class="uni-list-cell">
...
...
@@ -15,7 +15,7 @@
<view class="uni-label" style="width:180px;">是否授权使用定位</view>
</view>
<view class="uni-list-cell-db">
<input
class="uni-input"
type="text" :disabled="true" placeholder="未获取" :value="locationAuthorized" />
<input type="text" :disabled="true" placeholder="未获取" :value="locationAuthorized" />
</view>
</view>
<view class="uni-list-cell">
...
...
@@ -23,7 +23,7 @@
<view class="uni-label" style="width:180px;">定位准确度</view>
</view>
<view class="uni-list-cell-db">
<input
class="uni-input"
type="text" :disabled="true" placeholder="未获取" :value="locationAccuracy" />
<input type="text" :disabled="true" placeholder="未获取" :value="locationAccuracy" />
</view>
</view>
<view class="uni-list-cell">
...
...
@@ -31,7 +31,7 @@
<view class="uni-label" style="width:180px;">是否授权使用麦克风</view>
</view>
<view class="uni-list-cell-db">
<input
class="uni-input"
type="text" :disabled="true" placeholder="未获取" :value="microphoneAuthorized" />
<input type="text" :disabled="true" placeholder="未获取" :value="microphoneAuthorized" />
</view>
</view>
<view class="uni-list-cell">
...
...
@@ -39,7 +39,7 @@
<view class="uni-label" style="width:180px;">是否授权通知</view>
</view>
<view class="uni-list-cell-db">
<input
class="uni-input"
type="text" :disabled="true" placeholder="未获取" :value="notificationAuthorized" />
<input type="text" :disabled="true" placeholder="未获取" :value="notificationAuthorized" />
</view>
</view>
</view>
...
...
pages/API/get-app-base-info/get-app-base-info.uvue
浏览文件 @
6c34dbce
...
...
@@ -7,7 +7,7 @@
<view class="uni-label" style="width:180px;">{{item.label}}</view>
</view>
<view class="uni-list-cell-db">
<text
area style="width: 100%;" :auto-height="true" :disabled="true" placeholder="未获取" :value="item.value
" />
<text
style="width: 100%;" :value="item.value == '' ? '未获取' : item.value
" />
</view>
</view>
</view>
...
...
pages/API/get-device-info/get-device-info.uvue
浏览文件 @
6c34dbce
...
...
@@ -14,7 +14,7 @@
}}</view>
</view>
<view class="uni-list-cell-db">
<text
area style="width: 100%;" :auto-height="true" :disabled="true" placeholder="未获取" :value="item.value
" />
<text
style="width: 100%;" :value="item.value == '' ? '未获取' : item.value
" />
</view>
</view>
</view>
...
...
pages/API/get-system-info/get-system-info.uvue
浏览文件 @
6c34dbce
...
...
@@ -13,7 +13,7 @@
}}</view>
</view>
<view class="uni-list-cell-db">
<text
area style="width: 100%;" :auto-height="true" :disabled="true" placeholder="未获取" :value="item.value
" />
<text
style="width: 100%;" :value="item.value == '' ? '未获取' : item.value
" />
</view>
</view>
</view>
...
...
pages/API/get-system-setting/get-system-setting.uvue
浏览文件 @
6c34dbce
...
...
@@ -7,7 +7,7 @@
<view class="uni-label" style="width:180px;">蓝牙的系统开关</view>
</view>
<view class="uni-list-cell-db">
<input
class="uni-input"
type="text" :disabled="true" placeholder="未获取" :value="bluetoothEnabled" />
<input type="text" :disabled="true" placeholder="未获取" :value="bluetoothEnabled" />
</view>
</view>
<view class="uni-list-cell">
...
...
@@ -15,7 +15,7 @@
<view class="uni-label" style="width:180px;">地理位置的系统开关</view>
</view>
<view class="uni-list-cell-db">
<input
class="uni-input"
type="text" :disabled="true" placeholder="未获取" :value="locationEnabled" />
<input type="text" :disabled="true" placeholder="未获取" :value="locationEnabled" />
</view>
</view>
<view class="uni-list-cell">
...
...
@@ -23,7 +23,7 @@
<view class="uni-label" style="width:180px;">Wi-Fi 的系统开关</view>
</view>
<view class="uni-list-cell-db">
<input
class="uni-input"
type="text" :disabled="true" placeholder="未获取" :value="wifiEnabled" />
<input type="text" :disabled="true" placeholder="未获取" :value="wifiEnabled" />
</view>
</view>
<view class="uni-list-cell">
...
...
@@ -31,7 +31,7 @@
<view class="uni-label" style="width:180px;">设备方向</view>
</view>
<view class="uni-list-cell-db">
<input
class="uni-input"
type="text" :disabled="true" placeholder="未获取" :value="deviceOrientation" />
<input type="text" :disabled="true" placeholder="未获取" :value="deviceOrientation" />
</view>
</view>
</view>
...
...
@@ -62,7 +62,15 @@
this.bluetoothEnabled = (res.bluetoothEnabled ?? false) ? "开启" : "关闭";
this.locationEnabled = res.locationEnabled ? "开启" : "关闭";
this.wifiEnabled = (res.wifiEnabled ?? false) ? "开启" : "关闭";
this.deviceOrientation = res.deviceOrientation
this.deviceOrientation = res.deviceOrientation
if(res.bluetoothError != null){
this.bluetoothEnabled = "无蓝牙权限"
}
if(res.wifiError != null){
this.wifiEnabled = "无WiFi权限"
}
}
}
}
...
...
pages/API/get-window-info/get-window-info.uvue
浏览文件 @
6c34dbce
...
...
@@ -7,7 +7,7 @@
<view class="uni-label" style="width: 180px">{{ item.label }}</view>
</view>
<view class="uni-list-cell-db">
<text
area style="width: 100%;" :auto-height="true" :disabled="true" placeholder="未获取" :value="item.value
" />
<text
style="width: 100%;" :value="item.value == '' ? '未获取' : item.value
" />
</view>
</view>
</view>
...
...
pages/API/loading/loading.uvue
浏览文件 @
6c34dbce
...
...
@@ -67,6 +67,10 @@
}, 2000);
},
methods: {
//自动化测试例专用
jest_getWindowInfo() : GetWindowInfoResult {
return uni.getWindowInfo();
},
radioChange(e : UniRadioGroupChangeEvent) {
const selected = this.items.find((item) : boolean => {
...
...
pages/API/modal/modal.test.js
0 → 100644
浏览文件 @
6c34dbce
// uni-app自动化测试教程: uni-app自动化测试教程: https://uniapp.dcloud.net.cn/worktile/auto/hbuilderx-extension/
describe
(
'
API-loading
'
,
()
=>
{
let
page
;
const
isAndroid
=
process
.
env
.
UNI_OS_NAME
===
"
android
"
;
beforeAll
(
async
()
=>
{
page
=
await
program
.
reLaunch
(
'
/pages/API/modal/modal
'
)
await
page
.
waitFor
(
200
);
});
it
(
"
onload-modal-test
"
,
async
()
=>
{
if
(
isAndroid
)
{
const
res
=
await
page
.
callMethod
(
'
jest_getWindowInfo
'
)
const
windowHeight
=
res
.
windowHeight
*
res
.
pixelRatio
;
const
image
=
await
program
.
screenshot
({
adb
:
true
,
area
:
{
x
:
0
,
y
:
200
,
height
:
windowHeight
,
},
});
expect
(
image
).
toMatchImageSnapshot
();
}
else
{
const
image
=
await
program
.
screenshot
({
adb
:
true
,
fullPage
:
true
});
expect
(
image
).
toMatchImageSnapshot
()
}
})
it
(
"
modal-test-current-0
"
,
async
()
=>
{
await
page
.
setData
({
current
:
0
,
showCancelSelect
:
false
,
cancelTextSelect
:
false
,
confirmTextSelect
:
false
,
editableSelect
:
false
,
placeholderTextSelect
:
false
,
})
const
btnModalButton
=
await
page
.
$
(
'
#btn-modal-show
'
)
await
btnModalButton
.
tap
()
await
page
.
waitFor
(
500
);
if
(
isAndroid
)
{
const
res
=
await
page
.
callMethod
(
'
jest_getWindowInfo
'
)
const
windowHeight
=
res
.
windowHeight
*
res
.
pixelRatio
;
const
image
=
await
program
.
screenshot
({
adb
:
true
,
area
:
{
x
:
0
,
y
:
200
,
height
:
windowHeight
,
},
});
expect
(
image
).
toMatchImageSnapshot
();
}
else
{
const
image
=
await
program
.
screenshot
({
adb
:
true
,
fullPage
:
true
});
expect
(
image
).
toMatchImageSnapshot
()
}
})
it
(
"
modal-test-current-1
"
,
async
()
=>
{
await
page
.
setData
({
current
:
1
,
showCancelSelect
:
false
,
cancelTextSelect
:
false
,
confirmTextSelect
:
false
,
editableSelect
:
false
,
placeholderTextSelect
:
false
,
})
const
btnModalButton
=
await
page
.
$
(
'
#btn-modal-show
'
)
await
btnModalButton
.
tap
()
await
page
.
waitFor
(
500
);
if
(
isAndroid
)
{
const
res
=
await
page
.
callMethod
(
'
jest_getWindowInfo
'
)
const
windowHeight
=
res
.
windowHeight
*
res
.
pixelRatio
;
const
image
=
await
program
.
screenshot
({
adb
:
true
,
area
:
{
x
:
0
,
y
:
200
,
height
:
windowHeight
,
},
});
expect
(
image
).
toMatchImageSnapshot
();
}
else
{
const
image
=
await
program
.
screenshot
({
adb
:
true
,
fullPage
:
true
});
expect
(
image
).
toMatchImageSnapshot
()
}
})
it
(
"
modal-test-current-2
"
,
async
()
=>
{
await
page
.
setData
({
current
:
2
,
showCancelSelect
:
false
,
cancelTextSelect
:
false
,
confirmTextSelect
:
false
,
editableSelect
:
false
,
placeholderTextSelect
:
false
,
})
const
btnModalButton
=
await
page
.
$
(
'
#btn-modal-show
'
)
await
btnModalButton
.
tap
()
await
page
.
waitFor
(
500
);
if
(
isAndroid
)
{
const
res
=
await
page
.
callMethod
(
'
jest_getWindowInfo
'
)
const
windowHeight
=
res
.
windowHeight
*
res
.
pixelRatio
;
const
image
=
await
program
.
screenshot
({
adb
:
true
,
area
:
{
x
:
0
,
y
:
200
,
height
:
windowHeight
,
},
});
expect
(
image
).
toMatchImageSnapshot
();
}
else
{
const
image
=
await
program
.
screenshot
({
adb
:
true
,
fullPage
:
true
});
expect
(
image
).
toMatchImageSnapshot
()
}
})
it
(
"
modal-test-current-2-showCancel
"
,
async
()
=>
{
await
page
.
setData
({
current
:
2
,
showCancelSelect
:
true
,
cancelTextSelect
:
false
,
confirmTextSelect
:
false
,
editableSelect
:
false
,
placeholderTextSelect
:
false
,
})
const
btnModalButton
=
await
page
.
$
(
'
#btn-modal-show
'
)
await
btnModalButton
.
tap
()
await
page
.
waitFor
(
500
);
if
(
isAndroid
)
{
const
res
=
await
page
.
callMethod
(
'
jest_getWindowInfo
'
)
const
windowHeight
=
res
.
windowHeight
*
res
.
pixelRatio
;
const
image
=
await
program
.
screenshot
({
adb
:
true
,
area
:
{
x
:
0
,
y
:
200
,
height
:
windowHeight
,
},
});
expect
(
image
).
toMatchImageSnapshot
();
}
else
{
const
image
=
await
program
.
screenshot
({
adb
:
true
,
fullPage
:
true
});
expect
(
image
).
toMatchImageSnapshot
()
}
})
it
(
"
modal-test-current-2-showCancel-cancelText
"
,
async
()
=>
{
await
page
.
setData
({
current
:
2
,
showCancelSelect
:
true
,
cancelTextSelect
:
true
,
confirmTextSelect
:
false
,
editableSelect
:
false
,
placeholderTextSelect
:
false
,
})
const
btnModalButton
=
await
page
.
$
(
'
#btn-modal-show
'
)
await
btnModalButton
.
tap
()
await
page
.
waitFor
(
500
);
if
(
isAndroid
)
{
const
res
=
await
page
.
callMethod
(
'
jest_getWindowInfo
'
)
const
windowHeight
=
res
.
windowHeight
*
res
.
pixelRatio
;
const
image
=
await
program
.
screenshot
({
adb
:
true
,
area
:
{
x
:
0
,
y
:
200
,
height
:
windowHeight
,
},
});
expect
(
image
).
toMatchImageSnapshot
();
}
else
{
const
image
=
await
program
.
screenshot
({
adb
:
true
,
fullPage
:
true
});
expect
(
image
).
toMatchImageSnapshot
()
}
})
it
(
"
modal-test-current-2-showCancel-cancelText-confirmText
"
,
async
()
=>
{
await
page
.
setData
({
current
:
2
,
showCancelSelect
:
true
,
cancelTextSelect
:
true
,
confirmTextSelect
:
true
,
editableSelect
:
false
,
placeholderTextSelect
:
false
,
})
const
btnModalButton
=
await
page
.
$
(
'
#btn-modal-show
'
)
await
btnModalButton
.
tap
()
await
page
.
waitFor
(
500
);
if
(
isAndroid
)
{
const
res
=
await
page
.
callMethod
(
'
jest_getWindowInfo
'
)
const
windowHeight
=
res
.
windowHeight
*
res
.
pixelRatio
;
const
image
=
await
program
.
screenshot
({
adb
:
true
,
area
:
{
x
:
0
,
y
:
200
,
height
:
windowHeight
,
},
});
expect
(
image
).
toMatchImageSnapshot
();
}
else
{
const
image
=
await
program
.
screenshot
({
adb
:
true
,
fullPage
:
true
});
expect
(
image
).
toMatchImageSnapshot
()
}
})
it
(
"
modal-test-current-2-showCancel-cancelText-confirmText-editable-placeholder
"
,
async
()
=>
{
await
page
.
setData
({
current
:
2
,
showCancelSelect
:
true
,
cancelTextSelect
:
true
,
confirmTextSelect
:
true
,
editableSelect
:
true
,
placeholderTextSelect
:
true
,
})
const
btnModalButton
=
await
page
.
$
(
'
#btn-modal-show
'
)
await
btnModalButton
.
tap
()
await
page
.
waitFor
(
500
);
if
(
isAndroid
)
{
const
res
=
await
page
.
callMethod
(
'
jest_getWindowInfo
'
)
const
windowHeight
=
res
.
windowHeight
*
res
.
pixelRatio
;
const
image
=
await
program
.
screenshot
({
adb
:
true
,
area
:
{
x
:
0
,
y
:
200
,
height
:
windowHeight
,
},
});
expect
(
image
).
toMatchImageSnapshot
();
}
else
{
const
image
=
await
program
.
screenshot
({
adb
:
true
,
fullPage
:
true
});
expect
(
image
).
toMatchImageSnapshot
()
}
})
it
(
"
modal-test-current-2-showCancel-confirmText-editable-placeholder
"
,
async
()
=>
{
await
page
.
setData
({
current
:
2
,
showCancelSelect
:
true
,
cancelTextSelect
:
false
,
confirmTextSelect
:
true
,
editableSelect
:
true
,
placeholderTextSelect
:
true
,
})
const
btnModalButton
=
await
page
.
$
(
'
#btn-modal-show
'
)
await
btnModalButton
.
tap
()
await
page
.
waitFor
(
500
);
if
(
isAndroid
)
{
const
res
=
await
page
.
callMethod
(
'
jest_getWindowInfo
'
)
const
windowHeight
=
res
.
windowHeight
*
res
.
pixelRatio
;
const
image
=
await
program
.
screenshot
({
adb
:
true
,
area
:
{
x
:
0
,
y
:
200
,
height
:
windowHeight
,
},
});
expect
(
image
).
toMatchImageSnapshot
();
}
else
{
const
image
=
await
program
.
screenshot
({
adb
:
true
,
fullPage
:
true
});
expect
(
image
).
toMatchImageSnapshot
()
}
})
it
(
"
modal-test-current-2-showCancel-editable-placeholder
"
,
async
()
=>
{
await
page
.
setData
({
current
:
2
,
showCancelSelect
:
true
,
cancelTextSelect
:
false
,
confirmTextSelect
:
false
,
editableSelect
:
true
,
placeholderTextSelect
:
true
,
})
const
btnModalButton
=
await
page
.
$
(
'
#btn-modal-show
'
)
await
btnModalButton
.
tap
()
await
page
.
waitFor
(
500
);
if
(
isAndroid
)
{
const
res
=
await
page
.
callMethod
(
'
jest_getWindowInfo
'
)
const
windowHeight
=
res
.
windowHeight
*
res
.
pixelRatio
;
const
image
=
await
program
.
screenshot
({
adb
:
true
,
area
:
{
x
:
0
,
y
:
200
,
height
:
windowHeight
,
},
});
expect
(
image
).
toMatchImageSnapshot
();
}
else
{
const
image
=
await
program
.
screenshot
({
adb
:
true
,
fullPage
:
true
});
expect
(
image
).
toMatchImageSnapshot
()
}
})
it
(
"
modal-test-current-2-showCancel-placeholder
"
,
async
()
=>
{
await
page
.
setData
({
current
:
2
,
showCancelSelect
:
true
,
cancelTextSelect
:
false
,
confirmTextSelect
:
false
,
editableSelect
:
false
,
placeholderTextSelect
:
true
,
})
const
btnModalButton
=
await
page
.
$
(
'
#btn-modal-show
'
)
await
btnModalButton
.
tap
()
await
page
.
waitFor
(
500
);
if
(
isAndroid
)
{
const
res
=
await
page
.
callMethod
(
'
jest_getWindowInfo
'
)
const
windowHeight
=
res
.
windowHeight
*
res
.
pixelRatio
;
const
image
=
await
program
.
screenshot
({
adb
:
true
,
area
:
{
x
:
0
,
y
:
200
,
height
:
windowHeight
,
},
});
expect
(
image
).
toMatchImageSnapshot
();
}
else
{
const
image
=
await
program
.
screenshot
({
adb
:
true
,
fullPage
:
true
});
expect
(
image
).
toMatchImageSnapshot
()
}
})
it
(
"
modal-test-current-2-showCancel
"
,
async
()
=>
{
await
page
.
setData
({
current
:
2
,
showCancelSelect
:
true
,
cancelTextSelect
:
false
,
confirmTextSelect
:
false
,
editableSelect
:
false
,
placeholderTextSelect
:
false
,
})
const
btnModalButton
=
await
page
.
$
(
'
#btn-modal-show
'
)
await
btnModalButton
.
tap
()
await
page
.
waitFor
(
500
);
if
(
isAndroid
)
{
const
res
=
await
page
.
callMethod
(
'
jest_getWindowInfo
'
)
const
windowHeight
=
res
.
windowHeight
*
res
.
pixelRatio
;
const
image
=
await
program
.
screenshot
({
adb
:
true
,
area
:
{
x
:
0
,
y
:
200
,
height
:
windowHeight
,
},
});
expect
(
image
).
toMatchImageSnapshot
();
}
else
{
const
image
=
await
program
.
screenshot
({
adb
:
true
,
fullPage
:
true
});
expect
(
image
).
toMatchImageSnapshot
()
}
})
it
(
"
modal-test-current-2-showCancel-cancelText-editable-placeholder
"
,
async
()
=>
{
await
page
.
setData
({
current
:
2
,
showCancelSelect
:
true
,
cancelTextSelect
:
true
,
confirmTextSelect
:
false
,
editableSelect
:
true
,
placeholderTextSelect
:
true
,
})
const
btnModalButton
=
await
page
.
$
(
'
#btn-modal-show
'
)
await
btnModalButton
.
tap
()
await
page
.
waitFor
(
500
);
if
(
isAndroid
)
{
const
res
=
await
page
.
callMethod
(
'
jest_getWindowInfo
'
)
const
windowHeight
=
res
.
windowHeight
*
res
.
pixelRatio
;
const
image
=
await
program
.
screenshot
({
adb
:
true
,
area
:
{
x
:
0
,
y
:
200
,
height
:
windowHeight
,
},
});
expect
(
image
).
toMatchImageSnapshot
();
}
else
{
const
image
=
await
program
.
screenshot
({
adb
:
true
,
fullPage
:
true
});
expect
(
image
).
toMatchImageSnapshot
()
}
})
it
(
"
modal-test-current-2-showCancel-cancelText-placeholder
"
,
async
()
=>
{
await
page
.
setData
({
current
:
2
,
showCancelSelect
:
true
,
cancelTextSelect
:
true
,
confirmTextSelect
:
false
,
editableSelect
:
false
,
placeholderTextSelect
:
true
,
})
const
btnModalButton
=
await
page
.
$
(
'
#btn-modal-show
'
)
await
btnModalButton
.
tap
()
await
page
.
waitFor
(
500
);
if
(
isAndroid
)
{
const
res
=
await
page
.
callMethod
(
'
jest_getWindowInfo
'
)
const
windowHeight
=
res
.
windowHeight
*
res
.
pixelRatio
;
const
image
=
await
program
.
screenshot
({
adb
:
true
,
area
:
{
x
:
0
,
y
:
200
,
height
:
windowHeight
,
},
});
expect
(
image
).
toMatchImageSnapshot
();
}
else
{
const
image
=
await
program
.
screenshot
({
adb
:
true
,
fullPage
:
true
});
expect
(
image
).
toMatchImageSnapshot
()
}
})
it
(
"
modal-test-current-2-showCancel-cancelText
"
,
async
()
=>
{
await
page
.
setData
({
current
:
2
,
showCancelSelect
:
true
,
cancelTextSelect
:
true
,
confirmTextSelect
:
false
,
editableSelect
:
false
,
placeholderTextSelect
:
false
,
})
const
btnModalButton
=
await
page
.
$
(
'
#btn-modal-show
'
)
await
btnModalButton
.
tap
()
await
page
.
waitFor
(
500
);
if
(
isAndroid
)
{
const
res
=
await
page
.
callMethod
(
'
jest_getWindowInfo
'
)
const
windowHeight
=
res
.
windowHeight
*
res
.
pixelRatio
;
const
image
=
await
program
.
screenshot
({
adb
:
true
,
area
:
{
x
:
0
,
y
:
200
,
height
:
windowHeight
,
},
});
expect
(
image
).
toMatchImageSnapshot
();
}
else
{
const
image
=
await
program
.
screenshot
({
adb
:
true
,
fullPage
:
true
});
expect
(
image
).
toMatchImageSnapshot
()
}
})
it
(
"
modal-test-current-2-showCancel-cancelText-confirmText-placeholder
"
,
async
()
=>
{
await
page
.
setData
({
current
:
2
,
showCancelSelect
:
true
,
cancelTextSelect
:
true
,
confirmTextSelect
:
true
,
editableSelect
:
false
,
placeholderTextSelect
:
true
,
})
const
btnModalButton
=
await
page
.
$
(
'
#btn-modal-show
'
)
await
btnModalButton
.
tap
()
await
page
.
waitFor
(
500
);
if
(
isAndroid
)
{
const
res
=
await
page
.
callMethod
(
'
jest_getWindowInfo
'
)
const
windowHeight
=
res
.
windowHeight
*
res
.
pixelRatio
;
const
image
=
await
program
.
screenshot
({
adb
:
true
,
area
:
{
x
:
0
,
y
:
200
,
height
:
windowHeight
,
},
});
expect
(
image
).
toMatchImageSnapshot
();
}
else
{
const
image
=
await
program
.
screenshot
({
adb
:
true
,
fullPage
:
true
});
expect
(
image
).
toMatchImageSnapshot
()
}
})
it
(
"
modal-test-current-2-showCancel-cancelText-confirmText
"
,
async
()
=>
{
await
page
.
setData
({
current
:
2
,
showCancelSelect
:
true
,
cancelTextSelect
:
true
,
confirmTextSelect
:
true
,
editableSelect
:
false
,
placeholderTextSelect
:
false
,
})
const
btnModalButton
=
await
page
.
$
(
'
#btn-modal-show
'
)
await
btnModalButton
.
tap
()
await
page
.
waitFor
(
500
);
if
(
isAndroid
)
{
const
res
=
await
page
.
callMethod
(
'
jest_getWindowInfo
'
)
const
windowHeight
=
res
.
windowHeight
*
res
.
pixelRatio
;
const
image
=
await
program
.
screenshot
({
adb
:
true
,
area
:
{
x
:
0
,
y
:
200
,
height
:
windowHeight
,
},
});
expect
(
image
).
toMatchImageSnapshot
();
}
else
{
const
image
=
await
program
.
screenshot
({
adb
:
true
,
fullPage
:
true
});
expect
(
image
).
toMatchImageSnapshot
()
}
})
it
(
"
modal-test-current-2-showCancel-cancelText-confirmText-editable
"
,
async
()
=>
{
await
page
.
setData
({
current
:
2
,
showCancelSelect
:
true
,
cancelTextSelect
:
true
,
confirmTextSelect
:
true
,
editableSelect
:
true
,
placeholderTextSelect
:
false
,
})
const
btnModalButton
=
await
page
.
$
(
'
#btn-modal-show
'
)
await
btnModalButton
.
tap
()
await
page
.
waitFor
(
500
);
if
(
isAndroid
)
{
const
res
=
await
page
.
callMethod
(
'
jest_getWindowInfo
'
)
const
windowHeight
=
res
.
windowHeight
*
res
.
pixelRatio
;
const
image
=
await
program
.
screenshot
({
adb
:
true
,
area
:
{
x
:
0
,
y
:
200
,
height
:
windowHeight
,
},
});
expect
(
image
).
toMatchImageSnapshot
();
}
else
{
const
image
=
await
program
.
screenshot
({
adb
:
true
,
fullPage
:
true
});
expect
(
image
).
toMatchImageSnapshot
()
}
})
});
pages/API/modal/modal.uvue
浏览文件 @
6c34dbce
...
...
@@ -37,7 +37,7 @@
</view>
<view class="uni-padding-wrap uni-common-mt">
<view class="uni-btn-v">
<button class="uni-btn-v" type="default" @tap="modalTap">
<button class="uni-btn-v" type="default" @tap="modalTap"
id="btn-modal-show"
>
modal测试
</button>
</view>
...
...
@@ -87,6 +87,10 @@
})
},
methods: {
//自动化测试例专用
jest_getWindowInfo() : GetWindowInfoResult {
return uni.getWindowInfo();
},
showCancelChange: function (e : UniSwitchChangeEvent) {
this.showCancelSelect = e.detail.value
},
...
...
pages/API/nodes-info/nodes-info.test.js
浏览文件 @
6c34dbce
...
...
@@ -10,6 +10,16 @@ describe('nodes-info', () => {
page
=
await
program
.
reLaunch
(
PAGE_PATH
)
await
page
.
waitFor
(
500
)
})
it
(
'
get-root-node-info
'
,
async
()
=>
{
// 测试 class 选择器
await
getRootNode
(
'
.page
'
)
// 测试 id 选择器
await
getRootNode
(
'
#page
'
)
// 测试 标签 选择器
// await getRootNode('page')
})
it
(
'
get-node-info
'
,
async
()
=>
{
const
btnGetNodeInfo
=
await
page
.
$
(
'
.btn-get-node-info
'
)
...
...
@@ -53,4 +63,19 @@ describe('nodes-info', () => {
}) */
// #endif
})
})
async
function
getRootNode
(
selector
)
{
const
page
=
await
program
.
currentPage
()
await
page
.
setData
({
rootNodeInfo
:
null
,
})
await
page
.
waitFor
(
100
)
await
page
.
callMethod
(
'
getRootNodeInfo
'
,
selector
)
await
page
.
waitFor
(
100
)
const
data
=
await
page
.
data
()
expect
(
data
.
rootNodeInfo
!=
null
).
toBe
(
true
)
}
pages/API/nodes-info/nodes-info.uvue
浏览文件 @
6c34dbce
<template>
<view class="page">
<view class="page"
id="page"
>
<page-head :title="title"></page-head>
<button class="btn btn-get-node-info" @click="getNodeInfo">getNodeInfo</button>
<button class="btn btn-get-all-node-info" @click="getAllNodeInfo">getAllNodeInfo</button>
...
...
@@ -53,6 +53,8 @@
return {
title: 'createSelectorQuery',
nodeInfoList: [] as NodeInfoType[],
// 仅用于自动化测试
rootNodeInfo: null as NodeInfoType | null,
//供自动化测试使用
// resizeRectValid: false
}
...
...
@@ -68,6 +70,23 @@
} */
},
methods: {
// 仅用于自动化测试
getRootNodeInfo(selector: string) {
uni.createSelectorQuery().select(selector).boundingClientRect().exec((ret) => {
if (ret.length == 1) {
const nodeInfo = ret[0] as NodeInfo;
const nodeType = {
left: nodeInfo.left,
top: nodeInfo.top,
right: nodeInfo.right,
bottom: nodeInfo.bottom,
width: nodeInfo.width,
height: nodeInfo.height,
} as NodeInfoType;
this.rootNodeInfo = nodeType
}
})
},
getNodeInfo() {
uni.createSelectorQuery().select('.rect1').boundingClientRect().exec((ret) => {
this.nodeInfoList.length = 0
...
...
pages/API/storage/storage.test.js
浏览文件 @
6c34dbce
...
...
@@ -241,6 +241,42 @@ describe('ExtApi-StorageInfoTest', () => {
expect
(
parseObj
[
'
name
'
]).
toEqual
(
'
james
'
)
await
page
.
setData
({
key
:
"
autotest_key_mock
"
,
data
:
"
1234567890
"
})
await
page
.
waitFor
(
600
)
btnSetStorageButtonInfo
=
await
page
.
$
(
'
.btn-setstorageSync
'
)
await
btnSetStorageButtonInfo
.
tap
()
await
page
.
waitFor
(
600
)
btnGetStorageButtonInfo
=
await
page
.
$
(
'
.btn-getstorageSync
'
)
await
btnGetStorageButtonInfo
.
tap
()
await
page
.
waitFor
(
600
)
let
strRet
=
await
getData
(
'
apiGetData
'
)
// 顺序不能保证,验证长度和各个属性来区分
expect
(
typeof
strRet
).
toEqual
(
"
string
"
)
expect
(
strRet
).
toEqual
(
"
1234567890
"
)
await
page
.
setData
({
key
:
"
autotest_key_mock
"
,
data
:
"
1234567.890
"
})
await
page
.
waitFor
(
600
)
btnSetStorageButtonInfo
=
await
page
.
$
(
'
.btn-setstorageSync
'
)
await
btnSetStorageButtonInfo
.
tap
()
await
page
.
waitFor
(
600
)
btnGetStorageButtonInfo
=
await
page
.
$
(
'
.btn-getstorageSync
'
)
await
btnGetStorageButtonInfo
.
tap
()
await
page
.
waitFor
(
600
)
let
strRet2
=
await
getData
(
'
apiGetData
'
)
// 顺序不能保证,验证长度和各个属性来区分
expect
(
typeof
strRet2
).
toEqual
(
"
string
"
)
expect
(
strRet2
).
toEqual
(
"
1234567.890
"
)
});
});
pages/API/storage/storage.uvue
浏览文件 @
6c34dbce
...
...
@@ -49,11 +49,21 @@
<button type="default" style="width:50%" @tap="floatMock">
填充浮点型
</button>
</view>
<view class="uni-flex uni-row">
<button type="default" style="width:100%" @tap="jsonLikeMock">
填充符合json格式的字符串
<button type="default" style="width:50%" @tap="jsonLikeMock">
填充json字符串
</button>
<button type="default" style="width:50%" @tap="longLikeMock">
填充整数字符串
</button>
</view>
<view class="uni-flex uni-row">
<button type="default" style="width:50%" @tap="floatLikeMock">
填充浮点字符串
</button>
<button type="default" style="width:50%" @tap="negativeLikeMock">
填充负数字符串
</button>
</view>
</view>
...
...
@@ -124,6 +134,19 @@
age: 12,
from: "american"
});
},
longLikeMock() {
this.key = 'key_' + Math.random()
this.data = "1234567890"
},
floatLikeMock() {
this.key = 'key_' + Math.random()
this.data = "321456.1234567890"
},
negativeLikeMock() {
this.key = 'key_' + Math.random()
this.data = "-321456"
},
strMock() {
this.key = 'key_' + Math.random()
...
...
pages/API/toast/toast.test.js
0 → 100644
浏览文件 @
6c34dbce
// uni-app自动化测试教程: uni-app自动化测试教程: https://uniapp.dcloud.net.cn/worktile/auto/hbuilderx-extension/
describe
(
'
API-toast
'
,
()
=>
{
let
page
;
const
isAndroid
=
process
.
env
.
UNI_OS_NAME
===
"
android
"
;
beforeAll
(
async
()
=>
{
page
=
await
program
.
reLaunch
(
'
/pages/API/toast/toast
'
)
await
page
.
waitFor
(
600
);
});
it
(
"
onload-toast-test
"
,
async
()
=>
{
if
(
isAndroid
)
{
const
image
=
await
program
.
screenshot
({
adb
:
true
,
area
:
{
x
:
0
,
y
:
200
,
},
});
expect
(
image
).
toMatchImageSnapshot
();
}
else
{
const
image
=
await
program
.
screenshot
({
adb
:
true
,
fullPage
:
true
});
expect
(
image
).
toMatchImageSnapshot
()
}
})
it
(
"
btn-toast-default-1
"
,
async
()
=>
{
const
btnToastDefaultButton
=
await
page
.
$
(
'
#btn-toast-default
'
)
await
btnToastDefaultButton
.
tap
()
await
page
.
waitFor
(
200
)
if
(
isAndroid
)
{
const
image
=
await
program
.
screenshot
({
adb
:
true
,
area
:
{
x
:
0
,
y
:
200
,
},
});
expect
(
image
).
toMatchImageSnapshot
();
}
else
{
const
image
=
await
program
.
screenshot
({
adb
:
true
,
fullPage
:
true
});
expect
(
image
).
toMatchImageSnapshot
()
}
})
it
(
"
btn-toast-duration-1
"
,
async
()
=>
{
const
btnToastDurationButton
=
await
page
.
$
(
'
#btn-toast-duration
'
)
await
btnToastDurationButton
.
tap
()
await
page
.
waitFor
(
2000
)
if
(
isAndroid
)
{
const
image
=
await
program
.
screenshot
({
adb
:
true
,
area
:
{
x
:
0
,
y
:
200
,
},
});
expect
(
image
).
toMatchImageSnapshot
();
}
else
{
const
image
=
await
program
.
screenshot
({
adb
:
true
,
fullPage
:
true
});
expect
(
image
).
toMatchImageSnapshot
()
}
})
it
(
"
btn-toast-errorIcon-1
"
,
async
()
=>
{
const
btnToastErrorIconButton
=
await
page
.
$
(
'
#btn-toast-errorIcon
'
)
await
btnToastErrorIconButton
.
tap
()
await
page
.
waitFor
(
200
)
if
(
isAndroid
)
{
const
image
=
await
program
.
screenshot
({
adb
:
true
,
area
:
{
x
:
0
,
y
:
200
,
},
});
expect
(
image
).
toMatchImageSnapshot
();
}
else
{
const
image
=
await
program
.
screenshot
({
adb
:
true
,
fullPage
:
true
});
expect
(
image
).
toMatchImageSnapshot
()
}
})
it
(
"
btn-toast-loading-1
"
,
async
()
=>
{
const
btnToastLoadingButton
=
await
page
.
$
(
'
#btn-toast-loading
'
)
await
btnToastLoadingButton
.
tap
()
await
page
.
waitFor
(
200
)
const
btnToastHideButton
=
await
page
.
$
(
'
#btn-toast-hide
'
)
await
btnToastHideButton
.
tap
()
await
page
.
waitFor
(
200
)
if
(
isAndroid
)
{
const
image
=
await
program
.
screenshot
({
adb
:
true
,
area
:
{
x
:
0
,
y
:
200
,
},
});
expect
(
image
).
toMatchImageSnapshot
();
}
else
{
const
image
=
await
program
.
screenshot
({
adb
:
true
,
fullPage
:
true
});
expect
(
image
).
toMatchImageSnapshot
()
}
})
// it("btn-toast-postion-bottom-1", async () => {
// const btnToastButton = await page.$('#btn-toast-postion-bottom')
// await btnToastButton.tap()
// await page.waitFor(200)
// if (isAndroid) {
// const windowHeight = uni.getWindowInfo().windowHeight;
// const windowWidth = uni.getWindowInfo().windowWidth;
// const image = await program.screenshot({
// adb: true,
// area: {
// x: 0,
// y: 200,
// height: windowHeight,
// width:windowWidth
// },
// });
// expect(image).toMatchImageSnapshot();
// }else{
// const image = await program.screenshot({
// adb: true,
// fullPage: true
// });
// expect(image).toMatchImageSnapshot()
// }
// })
});
pages/API/toast/toast.uvue
浏览文件 @
6c34dbce
...
...
@@ -3,17 +3,17 @@
<page-head :title="title"></page-head>
<view class="uni-padding-wrap">
<view class="uni-btn-v">
<button class="uni-btn-v" type="default" @tap="toast1Tap">点击弹出默认toast</button>
<button class="uni-btn-v" type="default" @tap="toastTapIconError">点击弹出设置icon的toast</button>
<button class="uni-btn-v" type="default" @tap="toast2Tap">点击弹出设置duration的toast</button>
<button class="uni-btn-v" type="default" @tap="toast3Tap">点击弹出显示loading的toast</button>
<button class="uni-btn-v" type="default" @tap="toast1Tap"
id="btn-toast-default"
>点击弹出默认toast</button>
<button class="uni-btn-v" type="default" @tap="toastTapIconError"
id="btn-toast-errorIcon"
>点击弹出设置icon的toast</button>
<button class="uni-btn-v" type="default" @tap="toast2Tap"
id="btn-toast-duration"
>点击弹出设置duration的toast</button>
<button class="uni-btn-v" type="default" @tap="toast3Tap"
id="btn-toast-loading"
>点击弹出显示loading的toast</button>
<!-- #ifndef MP-ALIPAY -->
<button class="uni-btn-v" type="default" @tap="toast4Tap">点击弹出显示自定义图片的toast</button>
<!-- #endif -->
<!-- #ifdef APP-PLUS -->
<button class="uni-btn-v" type="default" @tap="toast5Tap">点击显示无图标的居底toast</button>
<button class="uni-btn-v" type="default" @tap="toast5Tap"
id="btn-toast-postion-bottom"
>点击显示无图标的居底toast</button>
<!-- #endif -->
<button class="uni-btn-v" type="default" @tap="hideToast">点击隐藏toast</button>
<button class="uni-btn-v" type="default" @tap="hideToast"
id="btn-toast-hide"
>点击隐藏toast</button>
</view>
<text>{{exeRet}}</text>
</view>
...
...
@@ -41,7 +41,7 @@
uni.showToast({
title: "默认",
success: (res) => {
this.exeRet = "success:" + JSON.stringify(res)
+ new Date()
this.exeRet = "success:" + JSON.stringify(res)
},
fail: (res) => {
this.exeRet = "fail:" + JSON.stringify(res)
...
...
@@ -53,7 +53,7 @@
title: "默认",
icon: 'error',
success: (res) => {
this.exeRet = "success:" + JSON.stringify(res)
+ new Date()
this.exeRet = "success:" + JSON.stringify(res)
},
fail: (res) => {
this.exeRet = "fail:" + JSON.stringify(res)
...
...
@@ -65,7 +65,7 @@
title: "duration 3000",
duration: 3000,
success: (res) => {
this.exeRet = "success:" + JSON.stringify(res)
+ new Date()
this.exeRet = "success:" + JSON.stringify(res)
},
fail: (res) => {
this.exeRet = "fail:" + JSON.stringify(res)
...
...
@@ -78,7 +78,7 @@
icon: "loading",
duration: 5000,
success: (res) => {
this.exeRet = "success:" + JSON.stringify(res)
+ new Date()
this.exeRet = "success:" + JSON.stringify(res)
},
fail: (res) => {
this.exeRet = "fail:" + JSON.stringify(res)
...
...
@@ -90,7 +90,7 @@
title: "logo",
image: "/static/uni.png",
success: (res) => {
this.exeRet = "success:" + JSON.stringify(res)
+ new Date()
this.exeRet = "success:" + JSON.stringify(res)
},
fail: (res) => {
this.exeRet = "fail:" + JSON.stringify(res)
...
...
@@ -103,7 +103,7 @@
title: "显示一段轻提示",
position: 'bottom',
success: (res) => {
this.exeRet = "success:" + JSON.stringify(res)
+ new Date()
this.exeRet = "success:" + JSON.stringify(res)
},
fail: (res) => {
this.exeRet = "fail:" + JSON.stringify(res)
...
...
pages/component/input/input.uvue
浏览文件 @
6c34dbce
...
...
@@ -127,7 +127,7 @@
<text class="uni-title-text">设置输入框聚焦时光标的位置(点击生效)</text>
</view>
<view class="input-wrapper">
<input ref="input" class="uni-input" value="0123456789" :cursor="cursor" />
<input ref="input" class="uni-input" value="0123456789" :cursor="cursor"
@blur="onCursorBlurChange"
/>
</view>
</view>
...
...
@@ -137,7 +137,7 @@
</view>
<view class="input-wrapper">
<input ref="input2" class="uni-input" value="0123456789" :selection-start="selectionStart"
:selection-end="selectionEnd" />
:selection-end="selectionEnd"
@blur="onSelectionBlurChange"
/>
</view>
</view>
...
...
@@ -269,22 +269,28 @@
}
},
methods: {
inputFocusKeyBoardChange(e : InputKeyboardHeightChangeEvent) {
inputFocusKeyBoardChange(e :
Uni
InputKeyboardHeightChangeEvent) {
this.inputFocusKeyBoardChangeValue = e.detail.height > 50
},
onMaxLengthInput(event : InputEvent) {
onMaxLengthInput(event :
Uni
InputEvent) {
this.onMaxLengthInputValue = event.detail.value
},
setCursor: function (cursor : number) {
(this.$refs['input'] as UniInputElement).focus();
this.cursor = cursor;
this.cursor = cursor;
},
onCursorBlurChange(){
this.cursor = 0
},
setSelection: function (selectionStart : number, selectionEnd : number) {
(this.$refs['input2'] as UniInputElement).focus();
this.selectionStart = selectionStart;
this.selectionEnd = selectionEnd;
this.selectionEnd = selectionEnd;
},
onSelectionBlurChange(){
this.selectionEnd = 0;
},
clearInput: function (event : InputEvent) {
clearInput: function (event :
Uni
InputEvent) {
this.inputClearValue = event.detail.value
if (event.detail.value.length > 0) {
this.showClearIcon = true
...
...
@@ -299,23 +305,23 @@
changePassword: function () {
this.showPassword = !this.showPassword
},
onInput: function (event : InputEvent) {
onInput: function (event :
Uni
InputEvent) {
console.log("键盘输入", JSON.stringify(event.detail));
this.inputEventDetail = JSON.stringify(event.detail)
},
onFocus: function (event : InputFocusEvent) {
onFocus: function (event :
Uni
InputFocusEvent) {
console.log("输入框聚焦", JSON.stringify(event.detail));
this.focusAndBlurEventDetail = JSON.stringify(event.detail);
},
onBlur: function (event : InputBlurEvent) {
onBlur: function (event :
Uni
InputBlurEvent) {
console.log("输入框失去焦点", JSON.stringify(event.detail));
this.focusAndBlurEventDetail = JSON.stringify(event.detail);
},
onConfirm: function (event : InputConfirmEvent) {
onConfirm: function (event :
Uni
InputConfirmEvent) {
console.log("点击完成按钮", JSON.stringify(event.detail));
this.confirmEventDetail = JSON.stringify(event.detail);
},
onKeyborardHeightChange: function (event : InputKeyboardHeightChangeEvent) {
onKeyborardHeightChange: function (event :
Uni
InputKeyboardHeightChangeEvent) {
console.log("键盘高度发生变化", JSON.stringify(event.detail));
this.keyboardHeightChangeEventDetail = JSON.stringify(event.detail);
},
...
...
pages/component/textarea/textarea.uvue
浏览文件 @
6c34dbce
...
...
@@ -10,7 +10,7 @@ export default {
confirm_hold_boolean: false,
focus_boolean: true,
auto_focus_boolean: false,
default_value:"",
default_value:"
1\n2\n3\n4\n5\n6
",
maxlength:-1,
inputmode_enum: [{"value":1,"name":"text"},{"value":2,"name":"decimal"},{"value":3,"name":"numeric"},{"value":4,"name":"tel"},{"value":5,"name":"search"},{"value":6,"name":"email"},{"value":7,"name":"url"},{"value":0,"name":"none"}] as ItemType[],
cursor_color: "#3393E2",
...
...
pages/template/custom-tab-bar/custom-tab-bar.uvue
浏览文件 @
6c34dbce
...
...
@@ -80,10 +80,11 @@
},
methods: {
onTabClick(index : number) {
this.setSelectedIndex(index);
if (index == 0) {
if (this.selectedIndex == index && index == 0) {
this.displayArrow = false;
(this.$refs["tab1"]! as ComponentPublicInstance).$callMethod('scrollTop', 0)
}
this.setSelectedIndex(index);
},
onTabPageEvent(top : number) {
this.displayArrow = top > this.tabViewHeight
...
...
pages/template/drop-card/drop-card.uvue
浏览文件 @
6c34dbce
...
...
@@ -17,12 +17,12 @@
'/static/template/drop-card/1.jpg',
'/static/template/drop-card/2.jpg',
'/static/template/drop-card/3.jpg'
] as string[]
] as string
.ImageURIString
[]
}
}
}
</script>
<style>
<style>
.root {
flex: 1;
position: relative;
...
...
pages/webview-screenshot-comparison/webview-screenshot-comparison.test.js
浏览文件 @
6c34dbce
...
...
@@ -21,7 +21,7 @@ const pages = [
"
pages/component/swiper/swiper
"
,
"
pages/component/image/image
"
,
"
pages/component/image/image-format
"
,
"
pages/component/image/image-mode
"
,
...(
process
.
env
.
android_cpu_type
!==
'
x86_64
'
?
[
"
pages/component/image/image-mode
"
]
:
[]),
// x86_64 模拟器 image-model 截图崩溃
"
pages/component/video/video-format
"
,
"
pages/component/navigator/navigator
"
,
"
pages/component/navigator/navigate
"
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录