Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
f4e729a2
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
1 年多 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
f4e729a2
编写于
7月 15, 2022
作者:
Z
zhouke
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
MODIFY.Signed-off-by: <zhouke35@huawei.com>.
Signed-off-by:
N
zhouke
<
zhouke35@huawei.com
>
上级
b0657533
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
14 addition
and
51 deletion
+14
-51
arkXtest/uitest/src/main/ets/test/Ability.test.ets
arkXtest/uitest/src/main/ets/test/Ability.test.ets
+14
-51
未找到文件。
arkXtest/uitest/src/main/ets/test/Ability.test.ets
浏览文件 @
f4e729a2
...
...
@@ -41,7 +41,6 @@ export default function abilityTest() {
describe
(
'UiTestCase'
,
function
()
{
it
(
'UiComponent.InputText'
,
0
,
async
function
()
{
let
driver
=
UiDriver
.
create
()
//await startAbility('com.example.myapplication', 'com.example.entry.MainAbility')
await
driver
.
delayMs
(
waitUiReadyMs
)
let
input
=
await
driver
.
findComponent
(
BY
.
type
(
'TextInput'
))
await
input
.
inputText
(
'123'
)
...
...
@@ -255,30 +254,10 @@ export default function abilityTest() {
expect
(
await
button_ori
.
getText
()
==
'next page'
)
.
assertTrue
()
})
it
(
'UiDriver.swipe'
,
0
,
async
function
()
{
let
driver
=
UiDriver
.
create
()
await
driver
.
delayMs
(
waitUiReadyMs
)
await
driver
.
swipe
(
100
,
500
,
100
,
100
)
await
driver
.
delayMs
(
waitUiReadyMs
)
let
button
=
await
driver
.
findComponent
(
BY
.
text
(
'bottom'
))
let
text
=
await
button
.
getText
()
expect
(
text
==
'bottom'
)
.
assertTrue
()
await
driver
.
swipe
(
100
,
100
,
100
,
600
)
})
it
(
'UiDriver.screenCap'
,
0
,
async
function
()
{
let
driver
=
UiDriver
.
create
()
await
driver
.
delayMs
(
waitUiReadyMs
)
let
path
=
'/data/local/tmp/1.png'
let
success
=
await
driver
.
screenCap
(
path
)
expect
(
typeof
(
success
)
==
'boolean'
)
.
assertTrue
()
})
it
(
'getUiComponentBounds'
,
0
,
async
function
()
{
let
driver
=
UiDriver
.
create
()
await
driver
.
delayMs
(
waitUiReadyMs
)
let
text
=
await
driver
.
findComponent
(
BY
.
text
(
'
Hello World
'
))
let
text
=
await
driver
.
findComponent
(
BY
.
text
(
'
next page
'
))
expect
(
text
!==
null
)
.
assertTrue
()
let
bounds
=
await
text
.
getBounds
();
console
.
info
(
`UiTestCase, bounds=${bounds}, type=${typeof (bounds)}`
)
...
...
@@ -306,6 +285,14 @@ export default function abilityTest() {
expect
(
button
!==
null
)
.
assertTrue
()
})
it
(
'UiDriver.screenCap'
,
0
,
async
function
()
{
let
driver
=
UiDriver
.
create
()
await
driver
.
delayMs
(
waitUiReadyMs
)
let
path
=
'/data/local/tmp/1.png'
let
success
=
await
driver
.
screenCap
(
path
)
expect
(
typeof
(
success
)
==
'boolean'
)
.
assertTrue
()
})
it
(
'By.isBefore'
,
0
,
async
function
()
{
await
startAbility
(
'com.ohos.settings'
,
'com.ohos.settings.MainAbility'
)
let
driver
=
UiDriver
.
create
()
...
...
@@ -322,34 +309,6 @@ export default function abilityTest() {
expect
(
await
button
.
getText
()
==
'声音'
)
.
assertTrue
()
})
it
(
'window.test'
,
0
,
async
function
()
{
await
startAbility
(
'com.example.windows'
,
'MainAbility'
)
let
driver
=
UiDriver
.
create
()
await
driver
.
delayMs
(
200
)
let
window
=
await
driver
.
findWindow
({
bundleName
:
'com.example.windows'
})
await
window
.
resume
()
await
driver
.
delayMs
(
200
)
let
window2
=
await
driver
.
findWindow
({
bundleName
:
'com.example.windows'
})
await
window2
.
moveTo
(
300
,
300
)
await
driver
.
delayMs
(
200
)
let
button2
=
await
driver
.
findComponent
(
BY
.
text
(
'Clock'
))
await
button2
.
click
()
})
it
(
'window.test_2'
,
0
,
async
function
()
{
await
startAbility
(
'com.example.windows'
,
'MainAbility'
)
let
driver
=
UiDriver
.
create
()
await
driver
.
delayMs
(
waitUiReadyMs
)
let
button
=
await
driver
.
findComponent
(
BY
.
text
(
'自由窗口创建'
))
await
button
.
click
()
await
driver
.
delayMs
(
waitUiReadyMs
)
let
window_2
=
await
driver
.
findWindow
({
bundleName
:
'com.example.windows'
})
await
window_2
.
resize
(
400
,
400
,
7
)
let
window
=
await
driver
.
findWindow
({
bundleName
:
'com.example.windows'
})
await
window
.
resize
(
600
,
600
,
7
)
await
stopApplication
(
'com.example.windows'
)
})
it
(
'window.resize'
,
0
,
async
function
()
{
await
startAbility
(
'com.example.windows'
,
'MainAbility'
)
let
driver
=
UiDriver
.
create
()
...
...
@@ -362,7 +321,7 @@ export default function abilityTest() {
await
driver
.
delayMs
(
waitUiReadyMs
)
let
window2
=
await
driver
.
findWindow
({
bundleName
:
'com.example.windows'
})
await
window2
.
resize
(
600
,
600
,
7
)
await
driver
.
delayMs
(
waitUiReadyMs
)
await
stopApplication
(
'com.example.windows'
)
})
it
(
'window.maximize'
,
0
,
async
function
()
{
...
...
@@ -370,7 +329,9 @@ export default function abilityTest() {
let
driver
=
UiDriver
.
create
()
await
driver
.
delayMs
(
waitUiReadyMs
)
let
window
=
await
driver
.
findWindow
({
bundleName
:
'com.example.windows'
})
await
window
.
resume
()
await
window
.
maximize
()
await
stopApplication
(
'com.example.windows'
)
})
it
(
'window.minimize'
,
0
,
async
function
()
{
...
...
@@ -379,6 +340,7 @@ export default function abilityTest() {
await
driver
.
delayMs
(
waitUiReadyMs
)
let
window
=
await
driver
.
findWindow
({
bundleName
:
'com.example.windows'
})
await
window
.
minimize
()
await
stopApplication
(
'com.example.windows'
)
})
it
(
'window.close'
,
0
,
async
function
()
{
...
...
@@ -395,6 +357,7 @@ export default function abilityTest() {
await
driver
.
delayMs
(
waitUiReadyMs
)
let
window
=
await
driver
.
findWindow
({
bundleName
:
'com.example.windows'
})
await
window
.
split
()
await
stopApplication
(
'com.example.windows'
)
})
})
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录