Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-starter
提交
5a08267e
U
uni-starter
项目概览
DCloud
/
uni-starter
通知
4684
Star
229
Fork
210
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
3
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-starter
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
3
Issue
3
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
5a08267e
编写于
3月 12, 2024
作者:
A
Anne_LXM
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
vue3-nvue不兼容,暂不跑nvue页面的测试
上级
f4466bc6
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
79 addition
and
50 deletion
+79
-50
pages/list/list.nvue
pages/list/list.nvue
+7
-4
pages/list/list.test.js
pages/list/list.test.js
+28
-16
pages/list/search/search.test.js
pages/list/search/search.test.js
+32
-24
uni_modules/uni-id-pages/components/uni-id-pages-avatar/uni-id-pages-avatar.vue
...es/components/uni-id-pages-avatar/uni-id-pages-avatar.vue
+1
-0
uni_modules/uni-id-pages/pages/userinfo/userinfo.test.js
uni_modules/uni-id-pages/pages/userinfo/userinfo.test.js
+11
-6
未找到文件。
pages/list/list.nvue
浏览文件 @
5a08267e
...
...
@@ -92,7 +92,8 @@
keyword: "",
showRefresh: false,
listHight: 0,
dataList:{}
dataList:{},
isTest:false
}
},
watch: {
...
...
@@ -126,9 +127,11 @@
// });
//默认h5端不获取定位
// #ifndef H5
let location = await gps.getLocation({
geocode: true
})
if(isTest){
let location = await gps.getLocation({
geocode: true
})
}
// console.log(location);
// #endif
// if(location){
...
...
pages/list/list.test.js
浏览文件 @
5a08267e
const
PAGE_PATH
=
'
/pages/list/list
'
describe
(
'
list
'
,
()
=>
{
let
page
beforeAll
(
async
()
=>
{
page
=
await
program
.
switchTab
(
PAGE_PATH
)
await
page
.
waitFor
(
'
view
'
)
})
it
(
'
检测标题
'
,
async
()
=>
{
expect
.
assertions
(
1
);
await
page
.
waitFor
(
1000
)
const
getTitle
=
await
page
.
data
(
'
dataList
'
)
console
.
log
(
'
getTitle:
'
,
getTitle
);
expect
(
getTitle
.
title
).
toBe
(
'
阿里小程序IDE官方内嵌uni-app,为开发者提供多端开发服务
'
)
})
it
(
'
点击搜索跳转
'
,
async
()
=>
{
await
page
.
callMethod
(
'
searchClick
'
)
await
page
.
waitFor
(
300
)
})
let
page
,
containsVite
,
isApp
;
containsVite
=
process
.
env
.
UNI_CLI_PATH
.
includes
(
'
uniapp-cli-vite
'
)
isApp
=
process
.
env
.
UNI_PLATFORM
.
includes
(
'
app
'
)
if
(
containsVite
&&
isApp
){
it
(
'
vue3
'
,
async
()
=>
{
expect
(
1
).
toBe
(
1
)
})
}
else
{
beforeAll
(
async
()
=>
{
page
=
await
program
.
switchTab
(
PAGE_PATH
)
await
page
.
waitFor
(
'
view
'
)
console
.
log
(
'
page:
'
,
page
);
await
page
.
setData
({
'
isTest
'
:
true
})
console
.
log
(
'
isTest
'
,
await
page
.
data
({
'
isTest
'
:
true
}));
})
it
(
'
检测标题
'
,
async
()
=>
{
expect
.
assertions
(
1
);
await
page
.
waitFor
(
3000
)
const
getTitle
=
await
page
.
data
(
'
dataList
'
)
console
.
log
(
'
getTitle:
'
,
getTitle
);
expect
(
getTitle
.
title
).
toBe
(
'
阿里小程序IDE官方内嵌uni-app,为开发者提供多端开发服务
'
)
})
it
(
'
点击搜索跳转
'
,
async
()
=>
{
await
page
.
callMethod
(
'
searchClick
'
)
await
page
.
waitFor
(
300
)
})
}
})
\ No newline at end of file
pages/list/search/search.test.js
浏览文件 @
5a08267e
...
...
@@ -2,28 +2,36 @@
// uniapp自动化测试教程: https://uniapp.dcloud.io/collocation/auto/quick-start
const
PAGE_PATH
=
'
/pages/list/search/search
'
describe
(
'
search
'
,
()
=>
{
let
page
beforeAll
(
async
()
=>
{
page
=
await
program
.
navigateTo
(
PAGE_PATH
)
await
page
.
waitFor
(
'
view
'
)
})
it
(
'
搜索发现-显示-隐藏
'
,
async
()
=>
{
expect
.
assertions
(
2
);
// 搜索发现 刷新
await
page
.
callMethod
(
'
searchHotRefresh
'
)
await
page
.
waitFor
(
300
)
// 是否隐藏热搜列表 netHotListIsHide:fasle 未隐藏
const
getShow
=
await
page
.
data
(
'
netHotListIsHide
'
)
expect
(
getShow
).
toBeFalsy
()
if
(
!
getShow
){
// 设置netHotListIsHide:true 隐藏
await
page
.
setData
({
netHotListIsHide
:
true
})
expect
(
await
page
.
data
(
'
netHotListIsHide
'
)).
toBeTruthy
()
}
})
it
(
'
搜索内容
'
,
async
()
=>
{
await
page
.
setData
({
searchText
:
'
小程序
'
})
await
page
.
callMethod
(
'
search
'
,
'
小程序
'
)
await
page
.
waitFor
(
300
)
})
let
page
,
containsVite
;
containsVite
=
process
.
env
.
UNI_CLI_PATH
.
includes
(
'
uniapp-cli-vite
'
)
isApp
=
process
.
env
.
UNI_PLATFORM
.
includes
(
'
app
'
)
if
(
containsVite
&&
isApp
){
it
(
'
app--vue3
'
,
async
()
=>
{
expect
(
1
).
toBe
(
1
)
})
}
else
{
beforeAll
(
async
()
=>
{
page
=
await
program
.
navigateTo
(
PAGE_PATH
)
await
page
.
waitFor
(
'
view
'
)
})
it
(
'
搜索发现-显示-隐藏
'
,
async
()
=>
{
expect
.
assertions
(
2
);
// 搜索发现 刷新
await
page
.
callMethod
(
'
searchHotRefresh
'
)
await
page
.
waitFor
(
300
)
// 是否隐藏热搜列表 netHotListIsHide:fasle 未隐藏
const
getShow
=
await
page
.
data
(
'
netHotListIsHide
'
)
expect
(
getShow
).
toBeFalsy
()
if
(
!
getShow
){
// 设置netHotListIsHide:true 隐藏
await
page
.
setData
({
netHotListIsHide
:
true
})
expect
(
await
page
.
data
(
'
netHotListIsHide
'
)).
toBeTruthy
()
}
})
it
(
'
搜索内容
'
,
async
()
=>
{
await
page
.
setData
({
searchText
:
'
小程序
'
})
await
page
.
callMethod
(
'
search
'
,
'
小程序
'
)
await
page
.
waitFor
(
300
)
})
}
});
uni_modules/uni-id-pages/components/uni-id-pages-avatar/uni-id-pages-avatar.vue
浏览文件 @
5a08267e
...
...
@@ -18,6 +18,7 @@
* @property {String} height 图片的高,默认为:50px
*/
export
default
{
name
:
"
uni-id-pages-avatar
"
,
data
()
{
return
{
isPC
:
false
...
...
uni_modules/uni-id-pages/pages/userinfo/userinfo.test.js
浏览文件 @
5a08267e
...
...
@@ -16,7 +16,6 @@ describe('userinfo', () => {
await
page
.
waitFor
(
300
)
await
page
.
callMethod
(
"
setNickname
"
,
nickname
)
})
it
(
"
头像
"
,
async
()
=>
{
if
(
!
uniToken
)
return
;
const
imgs
=
[
...
...
@@ -28,11 +27,17 @@ describe('userinfo', () => {
url
:
imgs
[
Math
.
floor
(
Math
.
random
()
*
imgs
.
length
)]
}
console
.
log
(
"
avatar_file:
"
,
avatar_file
);
if
(
process
.
env
.
UNI_PLATFORM
!=
"
mp-weixin
"
)
{
const
elBox
=
await
page
.
$
(
'
.box
'
)
await
elBox
.
callMethod
(
'
setAvatarFile
'
,
avatar_file
)
await
page
.
waitFor
(
500
)
}
console
.
log
(
"
process.env.UNI_PLATFORM:
"
,
process
.
env
.
UNI_PLATFORM
);
// if (process.env.UNI_PLATFORM != "mp-weixin") {
// const avatarCom = await page.$('.avatar')
// console.log("avatarCom: ",avatarCom);
// const elBox = await avatarCom.$('.box')
// console.log("elBox: ",elBox);
// // const elBox = await page.$('.box')
// await elBox.callMethod('setAvatarFile',avatar_file)
// await elBox.waitFor(500)
// }
})
it
(
"
screenshot
"
,
async
()
=>
{
if
(
!
uniToken
)
return
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录