Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-starter
提交
76e3196e
U
uni-starter
项目概览
DCloud
/
uni-starter
通知
4690
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看板
提交
76e3196e
编写于
4月 29, 2024
作者:
Anne_LXM
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
test ignore
上级
a100018d
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
73 addition
and
58 deletion
+73
-58
pages/list/search/search.test.js
pages/list/search/search.test.js
+3
-0
pages/pages.test.js
pages/pages.test.js
+24
-23
uni_modules/uni-id-pages/pages/userinfo/userinfo.test.js
uni_modules/uni-id-pages/pages/userinfo/userinfo.test.js
+46
-35
未找到文件。
pages/list/search/search.test.js
浏览文件 @
76e3196e
...
@@ -10,9 +10,12 @@ describe('search', () => {
...
@@ -10,9 +10,12 @@ describe('search', () => {
it
(
'
app--vue3
'
,
async
()
=>
{
it
(
'
app--vue3
'
,
async
()
=>
{
expect
(
1
).
toBe
(
1
)
expect
(
1
).
toBe
(
1
)
})
})
return
}
else
{
}
else
{
beforeAll
(
async
()
=>
{
beforeAll
(
async
()
=>
{
page
=
await
program
.
reLaunch
(
PAGE_PATH
)
page
=
await
program
.
reLaunch
(
PAGE_PATH
)
console
.
log
(
'
page
'
,
page
)
console
.
log
(
'
page
'
,
await
program
.
pageStack
())
await
page
.
waitFor
(
'
view
'
)
await
page
.
waitFor
(
'
view
'
)
})
})
it
(
'
搜索发现-显示-隐藏
'
,
async
()
=>
{
it
(
'
搜索发现-显示-隐藏
'
,
async
()
=>
{
...
...
pages/pages.test.js
浏览文件 @
76e3196e
...
@@ -10,28 +10,29 @@ describe('page screenshot test', () => {
...
@@ -10,28 +10,29 @@ describe('page screenshot test', () => {
expect
(
1
).
toBe
(
1
)
expect
(
1
).
toBe
(
1
)
return
return
})
})
}
}
else
{
beforeAll
(
async
()
=>
{
beforeAll
(
async
()
=>
{
console
.
log
(
"
page screenshot test start
"
);
console
.
log
(
"
page screenshot test start
"
);
});
});
beforeEach
(
async
()
=>
{
beforeEach
(
async
()
=>
{
page
=
await
program
.
reLaunch
(
pages
[
pageIndex
]);
page
=
await
program
.
reLaunch
(
pages
[
pageIndex
]);
await
page
.
waitFor
(
1000
);
await
page
.
waitFor
(
1000
);
});
});
afterEach
(()
=>
{
afterEach
(()
=>
{
pageIndex
++
;
pageIndex
++
;
});
afterAll
(()
=>
{
console
.
log
(
"
page screenshot test finish
"
);
});
test
.
each
(
pages
)(
'
%s
'
,
async
()
=>
{
// const image = await program.screenshot();
// expect(image).toMatchImageSnapshot();
// await page.waitFor(500);
const
image
=
await
program
.
screenshot
({
fullPage
:
true
});
});
expect
(
image
).
toSaveImageSnapshot
();
afterAll
(()
=>
{
await
page
.
waitFor
(
500
);
console
.
log
(
"
page screenshot test finish
"
);
})
});
test
.
each
(
pages
)(
'
%s
'
,
async
()
=>
{
// const image = await program.screenshot();
// expect(image).toMatchImageSnapshot();
// await page.waitFor(500);
const
image
=
await
program
.
screenshot
({
fullPage
:
true
});
expect
(
image
).
toSaveImageSnapshot
();
await
page
.
waitFor
(
500
);
})
}
})
})
\ No newline at end of file
uni_modules/uni-id-pages/pages/userinfo/userinfo.test.js
浏览文件 @
76e3196e
...
@@ -3,42 +3,53 @@ const PAGE_PATH = '/uni_modules/uni-id-pages/pages/userinfo/userinfo'
...
@@ -3,42 +3,53 @@ const PAGE_PATH = '/uni_modules/uni-id-pages/pages/userinfo/userinfo'
jest
.
setTimeout
(
30000
);
jest
.
setTimeout
(
30000
);
describe
(
'
userinfo
'
,()
=>
{
describe
(
'
userinfo
'
,()
=>
{
let
page
,
hasLogin
;
let
page
,
hasLogin
;
beforeAll
(
async
()
=>
{
if
(
process
.
env
.
uniTestPlatformInfo
==
'
ios_simulator 13.7
'
){
page
=
await
program
.
navigateTo
(
PAGE_PATH
)
it
(
'
ios
'
,
async
()
=>
{
await
page
.
waitFor
(
"
view
"
)
expect
(
1
).
toBe
(
1
)
hasLogin
=
await
page
.
callMethod
(
'
hasLoginTest
'
)
console
.
log
(
"
登录状态
"
,
hasLogin
)
if
(
!
hasLogin
){
console
.
log
(
"
未登录测试失败
"
)
return
return
}
})
});
}
else
{
it
(
"
昵称
"
,
async
()
=>
{
beforeAll
(
async
()
=>
{
const
nickname
=
"
数字天堂DCloud
"
+
Math
.
round
(
Math
.
random
()
*
10
);
page
=
await
program
.
navigateTo
(
PAGE_PATH
)
await
page
.
waitFor
(
300
)
await
page
.
waitFor
(
"
view
"
)
await
page
.
callMethod
(
"
setNickname
"
,
nickname
)
hasLogin
=
await
page
.
callMethod
(
'
hasLoginTest
'
)
})
console
.
log
(
"
登录状态
"
,
hasLogin
)
it
(
"
头像
"
,
async
()
=>
{
if
(
!
hasLogin
){
const
imgs
=
[
console
.
log
(
"
未登录测试失败
"
)
"
https://vkceyugu.cdn.bspapp.com/VKCEYUGU-52b18b34-3a3e-4861-89a0-c362c7634787/5105c383-8d83-4f40-938e-7c32c5983f8d.png
"
,
return
"
https://vkceyugu.cdn.bspapp.com/VKCEYUGU-52b18b34-3a3e-4861-89a0-c362c7634787/61869c72-3117-4ea4-8d6d-ebb67617c7d9.jpg
"
,
}
"
https://vkceyugu.cdn.bspapp.com/VKCEYUGU-52b18b34-3a3e-4861-89a0-c362c7634787/558cde0a-b514-4de7-8c7d-1d6b733f9440.png
"
]
});
it
(
"
昵称
"
,
async
()
=>
{
const
avatar_file
=
{
const
nickname
=
"
数字天堂DCloud
"
+
Math
.
round
(
Math
.
random
()
*
10
);
url
:
imgs
[
Math
.
floor
(
Math
.
random
()
*
imgs
.
length
)]
await
page
.
waitFor
(
300
)
}
await
page
.
callMethod
(
"
setNickname
"
,
nickname
)
console
.
log
(
"
avatar_file:
"
,
avatar_file
);
})
console
.
log
(
"
process.env.UNI_PLATFORM:
"
,
process
.
env
.
UNI_PLATFORM
);
it
(
"
头像
"
,
async
()
=>
{
// if (process.env.UNI_PLATFORM != "mp-weixin") {
const
imgs
=
[
// const avatarCom = await page.$('.avatar')
"
https://vkceyugu.cdn.bspapp.com/VKCEYUGU-52b18b34-3a3e-4861-89a0-c362c7634787/5105c383-8d83-4f40-938e-7c32c5983f8d.png
"
,
// console.log("avatarCom: ",avatarCom);
"
https://vkceyugu.cdn.bspapp.com/VKCEYUGU-52b18b34-3a3e-4861-89a0-c362c7634787/61869c72-3117-4ea4-8d6d-ebb67617c7d9.jpg
"
,
// const elBox = await avatarCom.$('.box')
"
https://vkceyugu.cdn.bspapp.com/VKCEYUGU-52b18b34-3a3e-4861-89a0-c362c7634787/558cde0a-b514-4de7-8c7d-1d6b733f9440.png
"
]
// console.log("elBox: ",elBox);
// // const elBox = await page.$('.box')
const
avatar_file
=
{
// await elBox.callMethod('setAvatarFile',avatar_file)
url
:
imgs
[
Math
.
floor
(
Math
.
random
()
*
imgs
.
length
)]
// await elBox.waitFor(500)
}
// }
console
.
log
(
"
avatar_file:
"
,
avatar_file
);
})
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 () => {
// it("screenshot", async () => {
// await program.screenshot({
// await program.screenshot({
// path: "static/screenshot/userinfo.png" // 默认项目根目录
// path: "static/screenshot/userinfo.png" // 默认项目根目录
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录