Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello uni-app x
提交
1d27aea9
H
hello uni-app x
项目概览
DCloud
/
hello uni-app x
通知
5995
Star
90
Fork
162
代码
文件
提交
分支
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看板
提交
1d27aea9
编写于
7月 07, 2024
作者:
DCloud-WZF
💬
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
test: 更新页面路径
上级
79bef35a
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
14 addition
and
278 deletion
+14
-278
pages/API/create-selector-query/create-selector-query.test.js
...s/API/create-selector-query/create-selector-query.test.js
+7
-7
pages/component/input/input.test copy.js
pages/component/input/input.test copy.js
+0
-264
pages/component/unicloud-db/unicloud-db/mixin-datacom/mixin-datacom.test.js
...icloud-db/unicloud-db/mixin-datacom/mixin-datacom.test.js
+1
-1
pages/pages.test.js
pages/pages.test.js
+6
-6
未找到文件。
pages/API/create-selector-query/
nodes-info
.test.js
→
pages/API/create-selector-query/
create-selector-query
.test.js
浏览文件 @
1d27aea9
const
PAGE_PATH
=
'
/pages/API/
nodes-info/nodes-info
'
const
PAGE_PATH
=
'
/pages/API/
create-selector-query/create-selector-query
'
const
RECT_LEFT
=
15
;
const
RECT_LEFT
=
15
;
const
RECT_WIDTH
=
150
;
const
RECT_WIDTH
=
150
;
...
@@ -53,11 +53,11 @@ describe('nodes-info', () => {
...
@@ -53,11 +53,11 @@ describe('nodes-info', () => {
expect
(
nodeInfo2
.
top
>
220
).
toBe
(
true
)
expect
(
nodeInfo2
.
top
>
220
).
toBe
(
true
)
expect
(
Math
.
round
(
nodeInfo2
.
width
)).
toBe
(
RECT_WIDTH
)
expect
(
Math
.
round
(
nodeInfo2
.
width
)).
toBe
(
RECT_WIDTH
)
expect
(
Math
.
round
(
nodeInfo2
.
height
)).
toBe
(
RECT_HEIGHT
)
expect
(
Math
.
round
(
nodeInfo2
.
height
)).
toBe
(
RECT_HEIGHT
)
})
})
it
(
'
get-node-info-child
'
,
async
()
=>
{
it
(
'
get-node-info-child
'
,
async
()
=>
{
const
child
=
await
page
.
$
(
'
.node-child
'
)
const
child
=
await
page
.
$
(
'
.node-child
'
)
const
childData
=
await
child
.
data
()
const
childData
=
await
child
.
data
()
expect
(
childData
.
top
>
100
).
toBe
(
true
)
expect
(
childData
.
top
>
100
).
toBe
(
true
)
})
})
// #ifdef APP
// #ifdef APP
...
@@ -83,4 +83,4 @@ async function getRootNode(selector) {
...
@@ -83,4 +83,4 @@ async function getRootNode(selector) {
const
data
=
await
page
.
data
()
const
data
=
await
page
.
data
()
expect
(
data
.
rootNodeInfo
!=
null
).
toBe
(
true
)
expect
(
data
.
rootNodeInfo
!=
null
).
toBe
(
true
)
}
}
pages/component/input/input.test copy.js
已删除
100644 → 0
浏览文件 @
79bef35a
describe
(
'
component-native-input
'
,
()
=>
{
const
platformInfo
=
process
.
env
.
uniTestPlatformInfo
.
toLocaleLowerCase
()
const
isAndroid
=
platformInfo
.
startsWith
(
'
android
'
)
const
isIos
=
platformInfo
.
startsWith
(
'
ios
'
)
let
page
;
beforeAll
(
async
()
=>
{
page
=
await
program
.
reLaunch
(
'
/pages/component/input/input
'
)
await
page
.
waitFor
(
'
view
'
);
});
// it("beforeAllTestScreenshot", async () => {
// const image = await program.screenshot({
// fullPage: true
// })
// expect(image).toSaveImageSnapshot()
// })
// 测试焦点及键盘弹起
it
(
'
focus
'
,
async
()
=>
{
const
input
=
await
page
.
$
(
'
#uni-input-focus
'
);
expect
(
await
input
.
attribute
(
'
focus
'
)).
toBe
(
"
true
"
)
// expect(await page.data("inputFocusKeyBoardChangeValue")).toBe(true)
await
page
.
setData
({
focus
:
false
,
})
expect
(
await
input
.
attribute
(
'
focus
'
)).
toBe
(
"
false
"
)
// await page.waitFor(1000)
// expect(await page.data("inputFocusKeyBoardChangeValue")).toBe(false)
// await page.setData({
// focus: true,
// })
// expect(await input.attribute('focus')).toBe(true)
// await page.waitFor(1000)
// expect(await page.data("inputFocusKeyBoardChangeValue")).toBe(true)
// await page.setData({
// focus: false,
// })
// expect(await input.attribute('focus')).toBe(false)
// await page.waitFor(1000)
// expect(await page.data("inputFocusKeyBoardChangeValue")).toBe(false)
// await page.waitFor(1000)
});
// 测试修改value属性
it
(
"
value
"
,
async
()
=>
{
const
input
=
await
page
.
$
(
'
#uni-input-default
'
);
expect
(
await
input
.
property
(
'
value
'
)).
toEqual
(
"
hello uni-app x
"
)
})
//测试input的类型
it
(
"
type
"
,
async
()
=>
{
const
text
=
await
page
.
$
(
'
#uni-input-type-text
'
);
const
number
=
await
page
.
$
(
'
#uni-input-type-number
'
);
const
digit
=
await
page
.
$
(
'
#uni-input-type-digit
'
);
const
tel
=
await
page
.
$
(
'
#uni-input-type-tel
'
);
expect
(
await
text
.
attribute
(
'
type
'
)).
toEqual
(
"
text
"
)
expect
(
await
number
.
attribute
(
'
type
'
)).
toEqual
(
"
number
"
)
expect
(
await
digit
.
attribute
(
'
type
'
)).
toEqual
(
"
digit
"
)
expect
(
await
tel
.
attribute
(
'
type
'
)).
toEqual
(
"
tel
"
)
})
// 测试密码属性
// it("password", async () => {
// const input = await page.$('.uni-input-password');
// expect(await input.attribute('password')).toBe(true)
// await page.setData({
// inputPassword: false,
// inputPasswordValue: "inputPasswordValue"
// })
// expect(await input.attribute('password')).toBe(false)
// await page.waitFor(500)
// await page.setData({
// inputPassword: true
// })
// })
// 测试placeholder
// it("placeholder", async () => {
// const placeholder1 = await page.$('.uni-input-placeholder1');
// expect(await placeholder1.attribute("placeholder-style")).toMatchObject({
// "color": "red"
// })
// expect(await placeholder1.attribute("placeholder")).toEqual("占位符文字颜色为红色")
// await page.setData({
// inputPlaceHolderStyle: "color:#CC00CC",
// })
// expect(await placeholder1.attribute("placeholder-style")).toMatchObject({
// "color": "#CC00CC"
// })
// await page.setData({
// inputPlaceHolderStyle: "color:#CC19CC;background-color:#00b1c0",
// })
// expect(await placeholder1.attribute("placeholder-style")).toMatchObject({
// "color": "#CC19CC",
// "backgroundColor": "#00b1c0"
// })
// await page.setData({
// inputPlaceHolderStyle: "color:#CC19CC;background-color:#00b1c0;text-align:center;font-size:44px;font-weight:900",
// })
// expect(await placeholder1.attribute("placeholder-style")).toEqual({
// "backgroundColor": "#00b1c0",
// "color": "#CC19CC",
// "fontSize": "44px",
// "fontWeight": "900",
// "textAlign": "center"
// })
// const placeholder2 = await page.$('.uni-input-placeholder2');
// expect(await placeholder2.attribute("placeholder-class")).toMatchObject({
// "backgroundColor": "#008000"
// })
// await page.setData({
// inputPlaceHolderClass: "uni-input-placeholder-class-ts",
// })
// expect(await placeholder2.attribute("placeholder-class")).toMatchObject({
// "backgroundColor": "#FFA500"
// })
// expect(await placeholder2.attribute("placeholder")).toEqual("占位符背景色为绿色")
// })
it
(
"
disable
"
,
async
()
=>
{
const
input
=
await
page
.
$
(
'
#uni-input-disable
'
);
expect
(
await
input
.
attribute
(
"
disabled
"
)).
toBe
(
"
true
"
)
})
it
(
"
confirm-type
"
,
async
()
=>
{
expect
(
await
(
await
page
.
$
(
'
#uni-input-confirm-send
'
)).
attribute
(
"
confirmType
"
)).
toEqual
(
"
send
"
)
expect
(
await
(
await
page
.
$
(
'
#uni-input-confirm-search
'
)).
attribute
(
"
confirmType
"
)).
toEqual
(
"
search
"
)
expect
(
await
(
await
page
.
$
(
'
#uni-input-confirm-next
'
)).
attribute
(
"
confirmType
"
)).
toEqual
(
"
next
"
)
expect
(
await
(
await
page
.
$
(
'
#uni-input-confirm-go
'
)).
attribute
(
"
confirmType
"
)).
toEqual
(
"
go
"
)
expect
(
await
(
await
page
.
$
(
'
#uni-input-confirm-done
'
)).
attribute
(
"
confirmType
"
)).
toEqual
(
"
done
"
)
})
// it("maxlength", async () => {
// const input = await page.$('.uni-input-maxlength');
// await page.setData({
// inputMaxLengthValue: "uni-input-maxlength"
// })
// await page.waitFor(500)
// })
it
(
"
cursor-color
"
,
async
()
=>
{
await
page
.
setData
({
cursor_color
:
"
red
"
,
})
await
page
.
waitFor
(
500
)
expect
(
await
(
await
page
.
$
(
'
#uni-input-cursor-color
'
)).
attribute
(
"
cursor-color
"
)).
toBe
(
"
red
"
)
})
it
(
"
maxlength
"
,
async
()
=>
{
const
input
=
await
page
.
$
(
'
#uni-input-maxlength
'
);
let
str
=
""
;
for
(
let
i
=
0
;
i
<
200
;
i
++
)
{
str
+=
`
${
i
}
`
}
await
page
.
setData
({
inputMaxLengthValue
:
str
})
let
length
=
(
await
input
.
value
()).
length
expect
(
length
).
toBe
(
10
)
await
page
.
setData
({
inputMaxLengthValue
:
""
})
})
it
(
"
password and value order
"
,
async
()
=>
{
const
input
=
await
page
.
$
(
'
#uni-input-password
'
);
let
length
=
(
await
input
.
value
()).
length
expect
(
length
).
toBe
(
6
)
await
page
.
setData
({
inputPasswordValue
:
""
})
})
it
(
"
keyboard height changed after page back
"
,
async
()
=>
{
if
(
process
.
env
.
uniTestPlatformInfo
.
toLocaleLowerCase
().
startsWith
(
'
web
'
))
{
expect
(
1
).
toBe
(
1
)
return
}
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
ios
'
))
{
expect
(
1
).
toBe
(
1
)
return
}
await
program
.
navigateTo
(
"
/pages/API/navigator/new-page/new-page-3
"
)
await
page
.
waitFor
(
2000
);
await
program
.
navigateBack
()
await
page
.
waitFor
(
1000
);
await
page
.
setData
({
focusedForKeyboardHeightChangeTest
:
true
})
await
page
.
waitFor
(
2000
);
const
keyboardHeight
=
await
page
.
data
(
'
keyboardHeight
'
);
console
.
log
(
"
keyboardHeight :
"
,
keyboardHeight
);
expect
(
keyboardHeight
).
toBeGreaterThan
(
25
)
//reset
await
page
.
setData
({
focusedForKeyboardHeightChangeTest
:
false
,
keyboardHeight
:
0
})
})
it
(
"
afterAllTestScreenshot
"
,
async
()
=>
{
const
image
=
await
program
.
screenshot
({
fullPage
:
true
})
expect
(
image
).
toSaveImageSnapshot
()
})
it
(
'
both set modelValue and value
'
,
async
()
=>
{
const
input2
=
await
page
.
$
(
'
#both-model-value
'
);
expect
(
await
input2
.
value
()).
toEqual
(
"
123
"
)
})
it
(
'
digit input .
'
,
async
()
=>
{
// ios 非 webview 模式规避该测试
// ios input type='digit' 输入 . 实际得到 。,只有系统软键盘才可以输入 .
if
(
isIos
&&
!
process
.
env
.
UNI_AUTOMATOR_APP_WEBVIEW
){
return
}
await
page
.
setData
({
focus
:
false
,
digitValue
:
'
1
'
})
await
program
.
pageScrollTo
(
0
)
const
digitInput
=
await
page
.
$
(
'
#uni-input-type-digit
'
)
expect
(
await
digitInput
.
value
()).
toEqual
(
'
1
'
)
if
(
isAndroid
)
{
if
(
platformInfo
.
indexOf
(
'
6
'
)
!=
-
1
&&
platformInfo
.
indexOf
(
'
x86
'
)
==
-
1
)
{
await
program
.
tap
({
x
:
200
,
y
:
850
,
})
}
else
if
(
platformInfo
.
indexOf
(
'
12
'
)
!=
-
1
)
{
await
program
.
tap
({
x
:
200
,
y
:
1500
,
})
}
else
{
await
program
.
tap
({
x
:
200
,
y
:
1200
,
})
}
}
else
if
(
isIos
)
{
await
program
.
tap
({
x
:
200
,
y
:
450
,
})
}
else
{
await
program
.
tap
({
x
:
200
,
y
:
400
,
})
}
await
page
.
waitFor
(
1000
)
await
program
.
keyboardInput
(
'
.2
'
)
await
page
.
waitFor
(
500
)
await
program
.
tap
({
x
:
0
,
y
:
0
,
})
await
page
.
waitFor
(
500
)
expect
(
await
digitInput
.
value
()).
toEqual
(
'
1.2
'
);
})
});
pages/component/unicloud-db/unicloud-db/mixin-datacom/mixin-datacom.test.js
浏览文件 @
1d27aea9
const
PAGE_PATH
=
'
/pages/component/mixin-datacom/mixin-datacom
'
const
PAGE_PATH
=
'
/pages/component/
unicloud-db/unicloud-db/
mixin-datacom/mixin-datacom
'
describe
(
'
mixin-datacom
'
,
()
=>
{
describe
(
'
mixin-datacom
'
,
()
=>
{
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
web
'
))
{
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
web
'
))
{
...
...
pages/pages.test.js
浏览文件 @
1d27aea9
...
@@ -120,7 +120,7 @@ const pages = [
...
@@ -120,7 +120,7 @@ const pages = [
// '/pages/API/get-element-by-id/get-element-by-id',
// '/pages/API/get-element-by-id/get-element-by-id',
// 单独测试例截图
// 单独测试例截图
// '/pages/API/get-element-by-id/get-element-by-id-multiple-root-node',
// '/pages/API/get-element-by-id/get-element-by-id-multiple-root-node',
'
/pages/API/
nodes-info/nodes-info
'
,
'
/pages/API/
create-selector-query/create-selector-query
'
,
'
/pages/API/storage/storage
'
,
'
/pages/API/storage/storage
'
,
// 单独测试例截图
// 单独测试例截图
// '/pages/API/show-action-sheet/show-action-sheet',
// '/pages/API/show-action-sheet/show-action-sheet',
...
@@ -315,13 +315,13 @@ if (isWeb) {
...
@@ -315,13 +315,13 @@ if (isWeb) {
'
/pages/API/get-image-info/get-image-info
'
,
'
/pages/API/get-image-info/get-image-info
'
,
'
/pages/API/get-video-info/get-video-info
'
,
'
/pages/API/get-video-info/get-video-info
'
,
'
/pages/API/make-phone-call/make-phone-call
'
,
'
/pages/API/make-phone-call/make-phone-call
'
,
'
/pages/API/
inner-audio/inner-audio
'
,
'
/pages/API/
create-inner-audio-context/create-inner-audio-context
'
,
'
/pages/API/
inner-audio
/inner-audio-format
'
,
'
/pages/API/
create-inner-audio-context
/inner-audio-format
'
,
'
/pages/API/
inner-audio
/inner-audio-path
'
,
'
/pages/API/
create-inner-audio-context
/inner-audio-path
'
,
'
/pages/API/clipboard/clipboard
'
,
'
/pages/API/clipboard/clipboard
'
,
'
/pages/API/
on-compass-change/on-compass-change
'
,
'
/pages/API/
compass/compass
'
,
'
/pages/component/canvas/canvas
'
,
'
/pages/component/canvas/canvas
'
,
'
/pages/component/canvas/ball
'
,
'
/pages/component/canvas/
canvas/
ball
'
,
'
/pages/template/browser-element/browser-element
'
,
'
/pages/template/browser-element/browser-element
'
,
)
)
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录