Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
3a526d50
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看板
提交
3a526d50
编写于
7月 21, 2022
作者:
Z
zhouke
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
modify.Signed-off-by: <zhouke35@huawei.com>.
Signed-off-by:
N
zhouke
<
zhouke35@huawei.com
>
上级
85f992fe
变更
11
显示空白变更内容
内联
并排
Showing
11 changed file
with
502 addition
and
310 deletion
+502
-310
arkXtest/BUILD.gn
arkXtest/BUILD.gn
+1
-1
arkXtest/uitest/src/main/config.json
arkXtest/uitest/src/main/config.json
+1
-4
arkXtest/uitest/src/main/ets/MainAbility/app.ets
arkXtest/uitest/src/main/ets/MainAbility/app.ets
+12
-0
arkXtest/uitest/src/main/ets/MainAbility/pages/index.ets
arkXtest/uitest/src/main/ets/MainAbility/pages/index.ets
+91
-63
arkXtest/uitest/src/main/ets/TestAbility/app.ets
arkXtest/uitest/src/main/ets/TestAbility/app.ets
+0
-10
arkXtest/uitest/src/main/ets/TestAbility/pages/fourth.ets
arkXtest/uitest/src/main/ets/TestAbility/pages/fourth.ets
+0
-45
arkXtest/uitest/src/main/ets/TestAbility/pages/index.ets
arkXtest/uitest/src/main/ets/TestAbility/pages/index.ets
+77
-63
arkXtest/uitest/src/main/ets/TestAbility/pages/second.ets
arkXtest/uitest/src/main/ets/TestAbility/pages/second.ets
+0
-43
arkXtest/uitest/src/main/ets/TestAbility/pages/third.ets
arkXtest/uitest/src/main/ets/TestAbility/pages/third.ets
+0
-43
arkXtest/uitest/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
...t/uitest/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
+1
-1
arkXtest/uitest/src/main/ets/test/uitest.test.ets
arkXtest/uitest/src/main/ets/test/uitest.test.ets
+319
-37
未找到文件。
arkXtest/BUILD.gn
浏览文件 @
3a526d50
# Copyright (C) 202
1
Huawei Device Co., Ltd.
# Copyright (C) 202
2
Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# You may obtain a copy of the License at
...
...
arkXtest/uitest/src/main/config.json
浏览文件 @
3a526d50
...
@@ -89,10 +89,7 @@
...
@@ -89,10 +89,7 @@
"type"
:
"pageAbility"
"type"
:
"pageAbility"
},
},
"pages"
:
[
"pages"
:
[
"pages/index"
,
"pages/index"
"pages/second"
,
"pages/third"
,
"pages/fourth"
],
],
"name"
:
".TestAbility"
,
"name"
:
".TestAbility"
,
"window"
:
{
"window"
:
{
...
...
arkXtest/uitest/src/main/ets/MainAbility/app.ets
浏览文件 @
3a526d50
...
@@ -12,11 +12,23 @@
...
@@ -12,11 +12,23 @@
* See the License for the specific language governing permissions and
* See the License for the specific language governing permissions and
* limitations under the License.
* limitations under the License.
*/
*/
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from '@ohos/hypium'
import testsuite from '../test/List.test'
export default {
export default {
onCreate() {
onCreate() {
console.info('Application onCreate')
console.info('Application onCreate')
var abilityDelegator: any
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var abilityDelegatorArguments: any
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
console.info('start run testcase!!!')
abilityDelegatorArguments.parameters['-s timeout'] = 3000000
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
},
},
onDestroy() {
onDestroy() {
console.info('Application onDestroy')
console.info('Application onDestroy')
},
},
}
}
\ No newline at end of file
arkXtest/uitest/src/main/ets/MainAbility/pages/index.ets
浏览文件 @
3a526d50
/**
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import router from '@system.router';
import router from '@system.router';
import prompt from '@ohos.prompt';
import prompt from '@ohos.prompt';
...
@@ -8,6 +22,10 @@ struct ScrollExample {
...
@@ -8,6 +22,10 @@ struct ScrollExample {
private arr: number[] = [1,2,3,4]
private arr: number[] = [1,2,3,4]
build() {
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text('MainPage')
.fontSize(50)
.fontWeight(FontWeight.Bold)
Stack({ alignContent: Alignment.TopStart }) {
Stack({ alignContent: Alignment.TopStart }) {
Scroll(this.scroller) {
Scroll(this.scroller) {
Column() {
Column() {
...
@@ -15,34 +33,37 @@ struct ScrollExample {
...
@@ -15,34 +33,37 @@ struct ScrollExample {
Text('next page')
Text('next page')
.fontSize(25)
.fontSize(25)
.fontWeight(FontWeight.Bold)
.fontWeight(FontWeight.Bold)
}.key('my-key')
}
.key('my-key')
.type(ButtonType.Capsule)
.type(ButtonType.Capsule)
.margin({ top: 20 })
.margin({ top: 20 })
.onClick(() => {
.onClick(() => {
router.push({ uri: 'pages/second' })
router.push({ uri: 'pages/second' })
})
})
.gesture(
.gesture(
LongPressGesture({
repeat:false
})
LongPressGesture({
repeat: false
})
.onAction((event: GestureEvent)
=>
{
.onAction((event: GestureEvent)
=>
{
router.push({ uri: 'pages/fourth' })
router.push({ uri: 'pages/fourth' })
})
})
)
)
Button() {
Button() {
Text('Click twice')
Text('Click twice')
.fontSize(25)
.fontSize(25)
.fontWeight(FontWeight.Bold)
.fontWeight(FontWeight.Bold)
}
}
.type(ButtonType.Capsule)
.type(ButtonType.Capsule)
.margin({top:20
})
.margin({ top: 20
})
.gesture(
.gesture(
TapGesture({ count: 2
})
TapGesture({ count: 1
})
.onAction(() => {
.onAction(() => {
router.push({ uri: 'pages/third' })
router.push({ uri: 'pages/third' })
})
})
)
)
Checkbox({name:'hi'})
.size({width:30,height:30})
Checkbox({ name: 'hi' })
TextInput({ placeholder: 'welcome', text: 'Hello World'})
.size({ width: 30, height: 30 })
TextInput({ placeholder: 'welcome', text: 'Hello World' })
.type(InputType.Normal)
.type(InputType.Normal)
.width(300)
.width(300)
.height(50)
.height(50)
...
@@ -51,8 +72,12 @@ struct ScrollExample {
...
@@ -51,8 +72,12 @@ struct ScrollExample {
.margin({ top: 20 })
.margin({ top: 20 })
ForEach(this.arr, (item) => {
ForEach(this.arr, (item) => {
Text(item.toString())
Text(item.toString())
.width('100%').height('30%').backgroundColor(0xFFFFFF)
.width('100%')
.borderRadius(75).fontSize(80).textAlign(TextAlign.Center)
.height('30%')
.backgroundColor(0xFFFFFF)
.borderRadius(75)
.fontSize(80)
.textAlign(TextAlign.Center)
.margin({ top: 10 })
.margin({ top: 10 })
}, item => item)
}, item => item)
Button() {
Button() {
...
@@ -68,12 +93,15 @@ struct ScrollExample {
...
@@ -68,12 +93,15 @@ struct ScrollExample {
})
})
}.width('100%')
}.width('100%')
}
}
.scrollable(ScrollDirection.Vertical).scrollBar(BarState.On)
.scrollable(ScrollDirection.Vertical)
.scrollBarColor(Color.Gray).scrollBarWidth(30)
.scrollBar(BarState.On)
.scrollBarColor(Color.Gray)
.scrollBarWidth(30)
.onScroll((xOffset: number, yOffset: number) => {
.onScroll((xOffset: number, yOffset: number) => {
console.info(xOffset + ' ' + yOffset)
console.info(xOffset + ' ' + yOffset)
})
})
}.width('100%').height('100%').backgroundColor(0xDCDCDC)
}.width('100%').height('100%').backgroundColor(0xDCDCDC)
}
}
}
}
}
arkXtest/uitest/src/main/ets/TestAbility/app.ets
浏览文件 @
3a526d50
...
@@ -12,20 +12,10 @@
...
@@ -12,20 +12,10 @@
* See the License for the specific language governing permissions and
* See the License for the specific language governing permissions and
* limitations under the License.
* limitations under the License.
*/
*/
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from '@ohos/hypium'
import testsuite from '../test/List.test'
export default {
export default {
onCreate() {
onCreate() {
console.info('Application onCreate')
console.info('Application onCreate')
var abilityDelegator: any
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var abilityDelegatorArguments: any
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
console.info('start run testcase!!!')
abilityDelegatorArguments.parameters['timeout'] = 3000000
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
},
},
onDestroy() {
onDestroy() {
console.info('Application onDestroy')
console.info('Application onDestroy')
...
...
arkXtest/uitest/src/main/ets/TestAbility/pages/fourth.ets
已删除
100644 → 0
浏览文件 @
85f992fe
/**
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import router from '@system.router';
@Entry
@Component
struct Fourth
{
private content: string = "Fourth Page"
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text(`${this.content}`)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Button() {
Text('longClick')
.fontSize(20)
.fontWeight(FontWeight.Bold)
}.type(ButtonType.Capsule)
.margin({
top: 20
})
.backgroundColor('#0D9FFB')
.onClick(() => {
router.back()
})
}
.width('100%')
.height('100%')
}
}
\ No newline at end of file
arkXtest/uitest/src/main/ets/TestAbility/pages/index.ets
浏览文件 @
3a526d50
...
@@ -22,6 +22,10 @@ struct ScrollExample {
...
@@ -22,6 +22,10 @@ struct ScrollExample {
private arr: number[] = [1,2,3,4]
private arr: number[] = [1,2,3,4]
build() {
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text('MainPage')
.fontSize(50)
.fontWeight(FontWeight.Bold)
Stack({ alignContent: Alignment.TopStart }) {
Stack({ alignContent: Alignment.TopStart }) {
Scroll(this.scroller) {
Scroll(this.scroller) {
Column() {
Column() {
...
@@ -29,34 +33,37 @@ struct ScrollExample {
...
@@ -29,34 +33,37 @@ struct ScrollExample {
Text('next page')
Text('next page')
.fontSize(25)
.fontSize(25)
.fontWeight(FontWeight.Bold)
.fontWeight(FontWeight.Bold)
}.key('my-key')
}
.key('my-key')
.type(ButtonType.Capsule)
.type(ButtonType.Capsule)
.margin({ top: 20 })
.margin({ top: 20 })
.onClick(() => {
.onClick(() => {
router.push({ uri: 'pages/second' })
router.push({ uri: 'pages/second' })
})
})
.gesture(
.gesture(
LongPressGesture({
repeat:false
})
LongPressGesture({
repeat: false
})
.onAction((event: GestureEvent)
=>
{
.onAction((event: GestureEvent)
=>
{
router.push({ uri: 'pages/fourth' })
router.push({ uri: 'pages/fourth' })
})
})
)
)
Button() {
Button() {
Text('Click twice')
Text('Click twice')
.fontSize(25)
.fontSize(25)
.fontWeight(FontWeight.Bold)
.fontWeight(FontWeight.Bold)
}
}
.type(ButtonType.Capsule)
.type(ButtonType.Capsule)
.margin({top:20
})
.margin({ top: 20
})
.gesture(
.gesture(
TapGesture({ count: 2
})
TapGesture({ count: 1
})
.onAction(() => {
.onAction(() => {
router.push({ uri: 'pages/third' })
router.push({ uri: 'pages/third' })
})
})
)
)
Checkbox({name:'hi'})
.size({width:30,height:30})
Checkbox({ name: 'hi' })
TextInput({ placeholder: 'welcome', text: 'Hello World'})
.size({ width: 30, height: 30 })
TextInput({ placeholder: 'welcome', text: 'Hello World' })
.type(InputType.Normal)
.type(InputType.Normal)
.width(300)
.width(300)
.height(50)
.height(50)
...
@@ -65,8 +72,12 @@ struct ScrollExample {
...
@@ -65,8 +72,12 @@ struct ScrollExample {
.margin({ top: 20 })
.margin({ top: 20 })
ForEach(this.arr, (item) => {
ForEach(this.arr, (item) => {
Text(item.toString())
Text(item.toString())
.width('100%').height('30%').backgroundColor(0xFFFFFF)
.width('100%')
.borderRadius(75).fontSize(80).textAlign(TextAlign.Center)
.height('30%')
.backgroundColor(0xFFFFFF)
.borderRadius(75)
.fontSize(80)
.textAlign(TextAlign.Center)
.margin({ top: 10 })
.margin({ top: 10 })
}, item => item)
}, item => item)
Button() {
Button() {
...
@@ -82,12 +93,15 @@ struct ScrollExample {
...
@@ -82,12 +93,15 @@ struct ScrollExample {
})
})
}.width('100%')
}.width('100%')
}
}
.scrollable(ScrollDirection.Vertical).scrollBar(BarState.On)
.scrollable(ScrollDirection.Vertical)
.scrollBarColor(Color.Gray).scrollBarWidth(30)
.scrollBar(BarState.On)
.scrollBarColor(Color.Gray)
.scrollBarWidth(30)
.onScroll((xOffset: number, yOffset: number) => {
.onScroll((xOffset: number, yOffset: number) => {
console.info(xOffset + ' ' + yOffset)
console.info(xOffset + ' ' + yOffset)
})
})
}.width('100%').height('100%').backgroundColor(0xDCDCDC)
}.width('100%').height('100%').backgroundColor(0xDCDCDC)
}
}
}
}
}
arkXtest/uitest/src/main/ets/TestAbility/pages/second.ets
已删除
100644 → 0
浏览文件 @
85f992fe
/**
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import router from '@system.router';
@Entry
@Component
struct Second {
private content: string = "Second Page"
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text(`${this.content}`)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Button() {
Text('back to index')
.fontSize(20)
.fontWeight(FontWeight.Bold)
}.type(ButtonType.Capsule)
.margin({
top: 20
})
.backgroundColor('#0D9FFB')
.onClick(() => {
router.back()
})
}
.width('100%')
.height('100%')
}
}
\ No newline at end of file
arkXtest/uitest/src/main/ets/TestAbility/pages/third.ets
已删除
100644 → 0
浏览文件 @
85f992fe
/**
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import router from '@system.router';
@Entry
@Component
struct Third{
private content: string = "Third Page"
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text(`${this.content}`)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Button() {
Text('doubleClick')
.fontSize(20)
.fontWeight(FontWeight.Bold)
}.type(ButtonType.Capsule)
.margin({
top: 20
})
.backgroundColor('#0D9FFB')
.onClick(() => {
router.back()
})
}
.width('100%')
.height('100%')
}
}
\ No newline at end of file
arkXtest/uitest/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
浏览文件 @
3a526d50
...
@@ -58,7 +58,7 @@ export default class OpenHarmonyTestRunner implements TestRunner {
...
@@ -58,7 +58,7 @@ export default class OpenHarmonyTestRunner implements TestRunner {
abilityName
:
testAbilityName
,
abilityName
:
testAbilityName
,
onAbilityCreate
:
onAbilityCreateCallback
,
onAbilityCreate
:
onAbilityCreateCallback
,
};
};
var
testAbilityName
=
abilityDelegatorArguments
.
parameters
[
'
-p
'
]
+
'
.
Test
Ability
'
var
testAbilityName
=
abilityDelegatorArguments
.
parameters
[
'
-p
'
]
+
'
.
Main
Ability
'
abilityDelegator
.
addAbilityMonitor
(
lMonitor
,
addAbilityMonitorCallback
)
abilityDelegator
.
addAbilityMonitor
(
lMonitor
,
addAbilityMonitorCallback
)
var
cmd
=
'
aa start -d 0 -a
'
+
testAbilityName
+
'
-b
'
+
abilityDelegatorArguments
.
bundleName
var
cmd
=
'
aa start -d 0 -a
'
+
testAbilityName
+
'
-b
'
+
abilityDelegatorArguments
.
bundleName
cmd
+=
'
'
+
translateParamsToString
(
abilityDelegatorArguments
.
parameters
)
cmd
+=
'
'
+
translateParamsToString
(
abilityDelegatorArguments
.
parameters
)
...
...
arkXtest/uitest/src/main/ets/test/uitest.test.ets
浏览文件 @
3a526d50
...
@@ -37,9 +37,15 @@ async function stopApplication(bundleName: string) {
...
@@ -37,9 +37,15 @@ async function stopApplication(bundleName: string) {
})
})
}
}
export
default
function
ability
Test
()
{
export
default
function
ui
Test
()
{
describe
(
'UiTestCase'
,
function
()
{
describe
(
'UiTestCase'
,
function
()
{
it
(
'testInputNumber'
,
0
,
async
function
()
{
/*
* @tc.number: uiTest_0100
* @tc.name: testInputText
* @tc.desc: inject text to the target UiComponent
*/
it
(
'testInputText'
,
0
,
async
function
()
{
let
driver
=
UiDriver
.
create
()
let
driver
=
UiDriver
.
create
()
await
driver
.
delayMs
(
waitUiReadyMs
)
await
driver
.
delayMs
(
waitUiReadyMs
)
let
input
=
await
driver
.
findComponent
(
BY
.
type
(
'TextInput'
))
let
input
=
await
driver
.
findComponent
(
BY
.
type
(
'TextInput'
))
...
@@ -50,6 +56,11 @@ export default function abilityTest() {
...
@@ -50,6 +56,11 @@ export default function abilityTest() {
expect
(
text
==
'123'
)
.
assertTrue
()
expect
(
text
==
'123'
)
.
assertTrue
()
})
})
/*
* @tc.number: uiTest_0200
* @tc.name: testClearText
* @tc.desc: clear text of the target UiComponent
*/
it
(
'testClearText'
,
0
,
async
function
()
{
it
(
'testClearText'
,
0
,
async
function
()
{
let
driver
=
UiDriver
.
create
()
let
driver
=
UiDriver
.
create
()
await
driver
.
delayMs
(
waitUiReadyMs
)
await
driver
.
delayMs
(
waitUiReadyMs
)
...
@@ -63,6 +74,11 @@ export default function abilityTest() {
...
@@ -63,6 +74,11 @@ export default function abilityTest() {
expect
(
text
)
.
assertEqual
(
''
)
expect
(
text
)
.
assertEqual
(
''
)
})
})
/*
* @tc.number: uiTest_0300
* @tc.name: testCheckable
* @tc.desc: find UiComponent by checkable attribute and get it's checkable attribute.
*/
it
(
'testCheckable'
,
0
,
async
function
()
{
it
(
'testCheckable'
,
0
,
async
function
()
{
let
driver
=
UiDriver
.
create
()
let
driver
=
UiDriver
.
create
()
await
driver
.
delayMs
(
waitUiReadyMs
)
await
driver
.
delayMs
(
waitUiReadyMs
)
...
@@ -71,6 +87,11 @@ export default function abilityTest() {
...
@@ -71,6 +87,11 @@ export default function abilityTest() {
expect
(
checkable
==
true
)
.
assertTrue
()
expect
(
checkable
==
true
)
.
assertTrue
()
})
})
/*
* @tc.number: uiTest_0400
* @tc.name: testChecked
* @tc.desc: find UiComponent by checked attribute and get it's checked attribute.
*/
it
(
'testChecked'
,
0
,
async
function
()
{
it
(
'testChecked'
,
0
,
async
function
()
{
let
driver
=
UiDriver
.
create
()
let
driver
=
UiDriver
.
create
()
await
driver
.
delayMs
(
waitUiReadyMs
)
await
driver
.
delayMs
(
waitUiReadyMs
)
...
@@ -79,7 +100,12 @@ export default function abilityTest() {
...
@@ -79,7 +100,12 @@ export default function abilityTest() {
expect
(
checked
==
false
)
.
assertTrue
()
expect
(
checked
==
false
)
.
assertTrue
()
})
})
it
(
'testMatchPattren'
,
0
,
async
function
()
{
/*
* @tc.number: uiTest_0500
* @tc.name: testMatchPattern
* @tc.desc: specifies the string value match pattern.
*/
it
(
'testMatchPattern'
,
0
,
async
function
()
{
let
driver
=
UiDriver
.
create
()
let
driver
=
UiDriver
.
create
()
await
driver
.
delayMs
(
waitUiReadyMs
)
await
driver
.
delayMs
(
waitUiReadyMs
)
let
Button1
=
await
driver
.
findComponent
(
BY
.
text
(
'next page'
,
MatchPattern
.
EQUALS
))
let
Button1
=
await
driver
.
findComponent
(
BY
.
text
(
'next page'
,
MatchPattern
.
EQUALS
))
...
@@ -92,6 +118,11 @@ export default function abilityTest() {
...
@@ -92,6 +118,11 @@ export default function abilityTest() {
expect
(
await
Button4
.
getText
()
==
'next page'
)
.
assertTrue
()
expect
(
await
Button4
.
getText
()
==
'next page'
)
.
assertTrue
()
})
})
/*
* @tc.number: uiTest_0600
* @tc.name: testClick
* @tc.desc: click in the specified location on the screen.
*/
it
(
'testClick'
,
0
,
async
function
()
{
it
(
'testClick'
,
0
,
async
function
()
{
let
driver
=
UiDriver
.
create
()
let
driver
=
UiDriver
.
create
()
await
driver
.
delayMs
(
waitUiReadyMs
)
await
driver
.
delayMs
(
waitUiReadyMs
)
...
@@ -105,6 +136,11 @@ export default function abilityTest() {
...
@@ -105,6 +136,11 @@ export default function abilityTest() {
await
newButton
.
click
()
await
newButton
.
click
()
})
})
/*
* @tc.number: uiTest_0700
* @tc.name: testDoubleClick
* @tc.desc: doubleClick in the specified location on the screen.
*/
it
(
'testDoubleClick'
,
0
,
async
function
()
{
it
(
'testDoubleClick'
,
0
,
async
function
()
{
let
driver
=
UiDriver
.
create
()
let
driver
=
UiDriver
.
create
()
await
driver
.
delayMs
(
waitUiReadyMs
)
await
driver
.
delayMs
(
waitUiReadyMs
)
...
@@ -118,6 +154,11 @@ export default function abilityTest() {
...
@@ -118,6 +154,11 @@ export default function abilityTest() {
await
button
.
click
()
await
button
.
click
()
})
})
/*
* @tc.number: uiTest_0800
* @tc.name: testLongClick
* @tc.desc: longClick in the specified location on the screen.
*/
it
(
'testLongClick'
,
0
,
async
function
()
{
it
(
'testLongClick'
,
0
,
async
function
()
{
let
driver
=
UiDriver
.
create
()
let
driver
=
UiDriver
.
create
()
await
driver
.
delayMs
(
waitUiReadyMs
)
await
driver
.
delayMs
(
waitUiReadyMs
)
...
@@ -131,6 +172,11 @@ export default function abilityTest() {
...
@@ -131,6 +172,11 @@ export default function abilityTest() {
await
newButton
.
click
()
await
newButton
.
click
()
})
})
/*
* @tc.number: uiTest_0900
* @tc.name: testUiComponentClick
* @tc.desc: click this UiComponentClick.
*/
it
(
'testUiComponentClick'
,
0
,
async
function
()
{
it
(
'testUiComponentClick'
,
0
,
async
function
()
{
let
driver
=
UiDriver
.
create
()
let
driver
=
UiDriver
.
create
()
await
driver
.
delayMs
(
waitUiReadyMs
)
await
driver
.
delayMs
(
waitUiReadyMs
)
...
@@ -143,6 +189,11 @@ export default function abilityTest() {
...
@@ -143,6 +189,11 @@ export default function abilityTest() {
await
newButton
.
click
()
await
newButton
.
click
()
})
})
/*
* @tc.number: uiTest_1000
* @tc.name: testUiComponentDoubleClick
* @tc.desc: doubleClick this UiComponentClick.
*/
it
(
'testUiComponentDoubleClick'
,
0
,
async
function
()
{
it
(
'testUiComponentDoubleClick'
,
0
,
async
function
()
{
let
driver
=
UiDriver
.
create
()
let
driver
=
UiDriver
.
create
()
await
driver
.
delayMs
(
waitUiReadyMs
)
await
driver
.
delayMs
(
waitUiReadyMs
)
...
@@ -155,6 +206,11 @@ export default function abilityTest() {
...
@@ -155,6 +206,11 @@ export default function abilityTest() {
await
newButton
.
click
()
await
newButton
.
click
()
})
})
/*
* @tc.number: uiTest_1100
* @tc.name: testUiComponentLongClick
* @tc.desc: longClick this UiComponentClick.
*/
it
(
'testUiComponentLongClick'
,
0
,
async
function
()
{
it
(
'testUiComponentLongClick'
,
0
,
async
function
()
{
let
driver
=
UiDriver
.
create
()
let
driver
=
UiDriver
.
create
()
await
driver
.
delayMs
(
waitUiReadyMs
)
await
driver
.
delayMs
(
waitUiReadyMs
)
...
@@ -167,6 +223,11 @@ export default function abilityTest() {
...
@@ -167,6 +223,11 @@ export default function abilityTest() {
await
newButton
.
click
()
await
newButton
.
click
()
})
})
/*
* @tc.number: uiTest_1200
* @tc.name: testKey
* @tc.desc: find UiComponent by key attribute and get it's key attribute.
*/
it
(
'testKey'
,
0
,
async
function
()
{
it
(
'testKey'
,
0
,
async
function
()
{
let
driver
=
UiDriver
.
create
()
let
driver
=
UiDriver
.
create
()
await
driver
.
delayMs
(
waitUiReadyMs
)
await
driver
.
delayMs
(
waitUiReadyMs
)
...
@@ -174,16 +235,26 @@ export default function abilityTest() {
...
@@ -174,16 +235,26 @@ export default function abilityTest() {
expect
(
await
button
.
getKey
()
==
'my-key'
)
.
assertTrue
()
expect
(
await
button
.
getKey
()
==
'my-key'
)
.
assertTrue
()
})
})
/*
* @tc.number: uiTest_1300
* @tc.name: testId
* @tc.desc: find UiComponent by id attribute and get it's id attribute.
*/
it
(
'testId'
,
0
,
async
function
()
{
it
(
'testId'
,
0
,
async
function
()
{
let
driver
=
UiDriver
.
create
()
let
driver
=
UiDriver
.
create
()
await
driver
.
delayMs
(
waitUiReadyMs
)
await
driver
.
delayMs
(
waitUiReadyMs
)
let
button
=
await
driver
.
findComponent
(
BY
.
text
(
'next page'
))
let
button
=
await
driver
.
findComponent
(
BY
.
text
(
'next page'
))
let
id
=
await
button
.
getId
()
let
id
=
await
button
.
getId
()
let
button2
=
await
driver
.
findComponent
(
BY
.
id
(
id
))
let
button2
=
await
driver
.
findComponent
(
BY
.
id
(
id
))
expect
(
await
button
.
getText
()
==
'next page'
)
.
assertTrue
()
expect
(
await
button
2
.
getText
()
==
'next page'
)
.
assertTrue
()
})
})
it
(
'testGetType'
,
0
,
async
function
()
{
/*
* @tc.number: uiTest_1400
* @tc.name: testType
* @tc.desc: find UiComponent by type attribute and get it's type attribute.
*/
it
(
'testType'
,
0
,
async
function
()
{
let
driver
=
UiDriver
.
create
()
let
driver
=
UiDriver
.
create
()
await
driver
.
delayMs
(
waitUiReadyMs
)
await
driver
.
delayMs
(
waitUiReadyMs
)
let
text
=
await
driver
.
findComponent
(
BY
.
type
(
'Text'
))
let
text
=
await
driver
.
findComponent
(
BY
.
type
(
'Text'
))
...
@@ -191,6 +262,11 @@ export default function abilityTest() {
...
@@ -191,6 +262,11 @@ export default function abilityTest() {
expect
(
type
==
'Text'
)
.
assertTrue
()
expect
(
type
==
'Text'
)
.
assertTrue
()
})
})
/*
* @tc.number: uiTest_1500
* @tc.name: testClickable
* @tc.desc: find UiComponent by clickable attribute and get it's clickable attribute.
*/
it
(
'testClickable'
,
0
,
async
function
()
{
it
(
'testClickable'
,
0
,
async
function
()
{
let
driver
=
UiDriver
.
create
()
let
driver
=
UiDriver
.
create
()
await
driver
.
delayMs
(
waitUiReadyMs
)
await
driver
.
delayMs
(
waitUiReadyMs
)
...
@@ -199,6 +275,11 @@ export default function abilityTest() {
...
@@ -199,6 +275,11 @@ export default function abilityTest() {
expect
(
clickable
==
false
)
.
assertTrue
()
expect
(
clickable
==
false
)
.
assertTrue
()
})
})
/*
* @tc.number: uiTest_1600
* @tc.name: testLongClickable
* @tc.desc: find UiComponent by longClickable attribute and get it's longClickable attribute.
*/
it
(
'testLongClickable'
,
0
,
async
function
()
{
it
(
'testLongClickable'
,
0
,
async
function
()
{
let
driver
=
UiDriver
.
create
()
let
driver
=
UiDriver
.
create
()
await
driver
.
delayMs
(
waitUiReadyMs
)
await
driver
.
delayMs
(
waitUiReadyMs
)
...
@@ -207,6 +288,11 @@ export default function abilityTest() {
...
@@ -207,6 +288,11 @@ export default function abilityTest() {
expect
(
longClickable
==
false
)
.
assertTrue
()
expect
(
longClickable
==
false
)
.
assertTrue
()
})
})
/*
* @tc.number: uiTest_1700
* @tc.name: testScrollable
* @tc.desc: find UiComponent by scrollable attribute and get it's scrollable attribute.
*/
it
(
'testScrollable'
,
0
,
async
function
()
{
it
(
'testScrollable'
,
0
,
async
function
()
{
let
driver
=
UiDriver
.
create
()
let
driver
=
UiDriver
.
create
()
await
driver
.
delayMs
(
waitUiReadyMs
)
await
driver
.
delayMs
(
waitUiReadyMs
)
...
@@ -215,6 +301,11 @@ export default function abilityTest() {
...
@@ -215,6 +301,11 @@ export default function abilityTest() {
expect
(
scrollable
==
false
)
.
assertTrue
()
expect
(
scrollable
==
false
)
.
assertTrue
()
})
})
/*
* @tc.number: uiTest_1800
* @tc.name: testEnabled
* @tc.desc: find UiComponent by enabled attribute and get it's enabled attribute.
*/
it
(
'testEnabled'
,
0
,
async
function
()
{
it
(
'testEnabled'
,
0
,
async
function
()
{
let
driver
=
UiDriver
.
create
()
let
driver
=
UiDriver
.
create
()
await
driver
.
delayMs
(
waitUiReadyMs
)
await
driver
.
delayMs
(
waitUiReadyMs
)
...
@@ -223,6 +314,11 @@ export default function abilityTest() {
...
@@ -223,6 +314,11 @@ export default function abilityTest() {
expect
(
enable
==
true
)
.
assertTrue
()
expect
(
enable
==
true
)
.
assertTrue
()
})
})
/*
* @tc.number: uiTest_1900
* @tc.name: testFocused
* @tc.desc: find UiComponent by focused attribute and get it's focused attribute.
*/
it
(
'testFocused'
,
0
,
async
function
()
{
it
(
'testFocused'
,
0
,
async
function
()
{
let
driver
=
UiDriver
.
create
()
let
driver
=
UiDriver
.
create
()
await
driver
.
delayMs
(
waitUiReadyMs
)
await
driver
.
delayMs
(
waitUiReadyMs
)
...
@@ -231,6 +327,11 @@ export default function abilityTest() {
...
@@ -231,6 +327,11 @@ export default function abilityTest() {
expect
(
focused
==
false
)
.
assertTrue
()
expect
(
focused
==
false
)
.
assertTrue
()
})
})
/*
* @tc.number: uiTest_2000
* @tc.name: testSelected
* @tc.desc: find UiComponent by selected attribute and get it's selected attribute.
*/
it
(
'testSelected'
,
0
,
async
function
()
{
it
(
'testSelected'
,
0
,
async
function
()
{
let
driver
=
UiDriver
.
create
()
let
driver
=
UiDriver
.
create
()
await
driver
.
delayMs
(
waitUiReadyMs
)
await
driver
.
delayMs
(
waitUiReadyMs
)
...
@@ -239,33 +340,11 @@ export default function abilityTest() {
...
@@ -239,33 +340,11 @@ export default function abilityTest() {
expect
(
selected
==
false
)
.
assertTrue
()
expect
(
selected
==
false
)
.
assertTrue
()
})
})
it
(
'testScrollToBottom'
,
0
,
async
function
()
{
/*
let
driver
=
UiDriver
.
create
()
* @tc.number: uiTest_2100
await
driver
.
delayMs
(
waitUiReadyMs
)
* @tc.name: testPressBack
let
scrollBar
=
await
driver
.
findComponent
(
BY
.
type
(
'Scroll'
))
* @tc.desc: Press the BACK key.
expect
(
scrollBar
!=
null
)
.
assertTrue
()
*/
await
scrollBar
.
scrollToBottom
()
let
button
=
await
driver
.
findComponent
(
BY
.
text
(
'bottom'
))
expect
(
await
button
.
getText
()
==
'bottom'
)
.
assertTrue
()
})
it
(
'testScrollToTop'
,
0
,
async
function
()
{
let
driver
=
UiDriver
.
create
()
await
driver
.
delayMs
(
waitUiReadyMs
)
let
scrollBar
=
await
driver
.
findComponent
(
BY
.
type
(
'Scroll'
))
expect
(
scrollBar
!==
null
)
.
assertTrue
()
await
scrollBar
.
scrollToBottom
()
await
scrollBar
.
scrollToTop
()
let
button
=
await
driver
.
findComponent
(
BY
.
text
(
'next page'
))
expect
(
await
button
.
getText
()
==
'next page'
)
.
assertTrue
()
})
it
(
'testAssertComponentExist'
,
0
,
async
function
()
{
let
driver
=
UiDriver
.
create
()
await
driver
.
delayMs
(
waitUiReadyMs
)
await
driver
.
assertComponentExist
(
BY
.
text
(
'next page'
))
})
it
(
'testPressBack'
,
0
,
async
function
()
{
it
(
'testPressBack'
,
0
,
async
function
()
{
let
driver
=
UiDriver
.
create
()
let
driver
=
UiDriver
.
create
()
await
driver
.
delayMs
(
waitUiReadyMs
)
await
driver
.
delayMs
(
waitUiReadyMs
)
...
@@ -278,6 +357,11 @@ export default function abilityTest() {
...
@@ -278,6 +357,11 @@ export default function abilityTest() {
expect
(
await
button_ori
.
getText
()
==
'next page'
)
.
assertTrue
()
expect
(
await
button_ori
.
getText
()
==
'next page'
)
.
assertTrue
()
})
})
/*
* @tc.number: uiTest_2200
* @tc.name: testFindComponents
* @tc.desc: find all the matched UiComponents on current UI
*/
it
(
'testFindComponents'
,
0
,
async
function
()
{
it
(
'testFindComponents'
,
0
,
async
function
()
{
let
driver
=
UiDriver
.
create
()
let
driver
=
UiDriver
.
create
()
await
driver
.
delayMs
(
waitUiReadyMs
)
await
driver
.
delayMs
(
waitUiReadyMs
)
...
@@ -285,6 +369,11 @@ export default function abilityTest() {
...
@@ -285,6 +369,11 @@ export default function abilityTest() {
expect
(
await
buttons
[
0
]
.
getText
()
!=
null
)
.
assertTrue
()
expect
(
await
buttons
[
0
]
.
getText
()
!=
null
)
.
assertTrue
()
})
})
/*
* @tc.number: uiTest_2300
* @tc.name: testTriggerKey
* @tc.desc: press the specified key.
*/
it
(
'testTriggerKey'
,
0
,
async
function
()
{
it
(
'testTriggerKey'
,
0
,
async
function
()
{
let
driver
=
UiDriver
.
create
()
let
driver
=
UiDriver
.
create
()
await
driver
.
delayMs
(
waitUiReadyMs
)
await
driver
.
delayMs
(
waitUiReadyMs
)
...
@@ -298,6 +387,11 @@ export default function abilityTest() {
...
@@ -298,6 +387,11 @@ export default function abilityTest() {
expect
(
await
button_ori
.
getText
()
==
'next page'
)
.
assertTrue
()
expect
(
await
button_ori
.
getText
()
==
'next page'
)
.
assertTrue
()
})
})
/*
* @tc.number: uiTest_2400
* @tc.name: testGetUiComponentBounds
* @tc.desc: get the bounds of this UiComponent.
*/
it
(
'testGetUiComponentBounds'
,
0
,
async
function
()
{
it
(
'testGetUiComponentBounds'
,
0
,
async
function
()
{
let
driver
=
UiDriver
.
create
()
let
driver
=
UiDriver
.
create
()
await
driver
.
delayMs
(
waitUiReadyMs
)
await
driver
.
delayMs
(
waitUiReadyMs
)
...
@@ -309,6 +403,11 @@ export default function abilityTest() {
...
@@ -309,6 +403,11 @@ export default function abilityTest() {
expect
(
bounds
.
bottomY
)
.
assertLarger
(
bounds
.
topY
)
expect
(
bounds
.
bottomY
)
.
assertLarger
(
bounds
.
topY
)
})
})
/*
* @tc.number: uiTest_2500
* @tc.name: testGetUiComponentBoundsCenter
* @tc.desc: get the boundsCenter of this @link UiComponent.
*/
it
(
'testGetUiComponentBoundsCenter'
,
0
,
async
function
()
{
it
(
'testGetUiComponentBoundsCenter'
,
0
,
async
function
()
{
let
driver
=
UiDriver
.
create
()
let
driver
=
UiDriver
.
create
()
await
driver
.
delayMs
(
waitUiReadyMs
)
await
driver
.
delayMs
(
waitUiReadyMs
)
...
@@ -320,6 +419,11 @@ export default function abilityTest() {
...
@@ -320,6 +419,11 @@ export default function abilityTest() {
expect
(
point
.
X
==
(
bounds
.
rightX
+
bounds
.
leftX
)
/
2
)
.
assertTrue
()
expect
(
point
.
X
==
(
bounds
.
rightX
+
bounds
.
leftX
)
/
2
)
.
assertTrue
()
})
})
/*
* @tc.number: uiTest_2600
* @tc.name: testWaitForComponent
* @tc.desc: Find the first matched UiComponent on current UI during the time given.
*/
it
(
'testWaitForComponent'
,
0
,
async
function
()
{
it
(
'testWaitForComponent'
,
0
,
async
function
()
{
let
driver
=
UiDriver
.
create
()
let
driver
=
UiDriver
.
create
()
await
driver
.
delayMs
(
waitUiReadyMs
)
await
driver
.
delayMs
(
waitUiReadyMs
)
...
@@ -327,6 +431,11 @@ export default function abilityTest() {
...
@@ -327,6 +431,11 @@ export default function abilityTest() {
expect
(
button
!==
null
)
.
assertTrue
()
expect
(
button
!==
null
)
.
assertTrue
()
})
})
/*
* @tc.number: uiTest_2700
* @tc.name: testScreenCap
* @tc.desc: capture current screen.
*/
it
(
'testScreenCap'
,
0
,
async
function
()
{
it
(
'testScreenCap'
,
0
,
async
function
()
{
let
driver
=
UiDriver
.
create
()
let
driver
=
UiDriver
.
create
()
await
driver
.
delayMs
(
waitUiReadyMs
)
await
driver
.
delayMs
(
waitUiReadyMs
)
...
@@ -335,6 +444,22 @@ export default function abilityTest() {
...
@@ -335,6 +444,22 @@ export default function abilityTest() {
expect
(
success
==
true
)
.
assertTrue
()
expect
(
success
==
true
)
.
assertTrue
()
})
})
/*
* @tc.number: uiTest_2800
* @tc.name: testAssertComponentExist
* @tc.desc: Assert whether the matched UiComponent exists on current UI;.
*/
it
(
'testAssertComponentExist'
,
0
,
async
function
()
{
let
driver
=
UiDriver
.
create
()
await
driver
.
delayMs
(
waitUiReadyMs
)
await
driver
.
assertComponentExist
(
BY
.
text
(
'next page'
))
})
/*
* @tc.number: uiTest_2900
* @tc.name: testIsBefore
* @tc.desc: find uiComponent which is before another UiComponent that specified by given.
*/
it
(
'testIsBefore'
,
0
,
async
function
()
{
it
(
'testIsBefore'
,
0
,
async
function
()
{
let
driver
=
UiDriver
.
create
()
let
driver
=
UiDriver
.
create
()
await
driver
.
delayMs
(
waitUiReadyMs
)
await
driver
.
delayMs
(
waitUiReadyMs
)
...
@@ -342,6 +467,11 @@ export default function abilityTest() {
...
@@ -342,6 +467,11 @@ export default function abilityTest() {
expect
(
await
button
.
getType
()
==
'Button'
)
.
assertTrue
()
expect
(
await
button
.
getType
()
==
'Button'
)
.
assertTrue
()
})
})
/*
* @tc.number: uiTest_3000
* @tc.name: testIsAfter
* @tc.desc: find uiComponent which is after another UiComponent that specified by given.
*/
it
(
'testIsAfter'
,
0
,
async
function
()
{
it
(
'testIsAfter'
,
0
,
async
function
()
{
let
driver
=
UiDriver
.
create
()
let
driver
=
UiDriver
.
create
()
await
driver
.
delayMs
(
waitUiReadyMs
)
await
driver
.
delayMs
(
waitUiReadyMs
)
...
@@ -349,26 +479,121 @@ export default function abilityTest() {
...
@@ -349,26 +479,121 @@ export default function abilityTest() {
expect
(
await
button
.
getText
()
==
'Click twice'
)
.
assertTrue
()
expect
(
await
button
.
getText
()
==
'Click twice'
)
.
assertTrue
()
})
})
/*
* @tc.number: uiTest_3100
* @tc.name: testSwipe
* @tc.desc: swipe on the screen between the specified points.
*/
it
(
'testSwipe'
,
0
,
async
function
()
{
let
driver
=
UiDriver
.
create
()
await
driver
.
delayMs
(
waitUiReadyMs
)
await
driver
.
swipe
(
300
,
600
,
300
,
300
)
let
text
=
await
driver
.
findComponent
(
BY
.
text
(
'next page'
))
expect
(
text
==
null
)
.
assertTrue
()
await
driver
.
swipe
(
300
,
300
,
300
,
600
)
})
/*
* @tc.number: uiTest_3200
* @tc.name: testScrollSearch
* @tc.desc: scroll on this UiComponent to find matched UiComponent.
*/
it
(
'testScrollSearch'
,
0
,
async
function
()
{
it
(
'testScrollSearch'
,
0
,
async
function
()
{
let
driver
=
UiDriver
.
create
()
let
driver
=
UiDriver
.
create
()
await
driver
.
delayMs
(
waitUiReadyMs
)
await
driver
.
delayMs
(
waitUiReadyMs
)
let
scrollBar
=
await
driver
.
findComponent
(
BY
.
type
(
'Scroll'
))
let
scrollBar
=
await
driver
.
findComponent
(
BY
.
type
(
'Scroll'
))
let
text
=
await
scrollBar
.
scrollSearch
(
BY
.
text
(
'4'
))
let
text
=
await
scrollBar
.
scrollSearch
(
BY
.
text
(
'4'
))
await
driver
.
delayMs
(
waitUiReadyMs
)
await
driver
.
delayMs
(
waitUiReadyMs
)
expect
(
text
!
=
null
)
.
assertTrue
()
expect
(
text
=
=
null
)
.
assertTrue
()
await
scrollBar
.
scrollToTop
()
await
scrollBar
.
scrollToTop
()
})
})
/*
* @tc.number: uiTest_3300
* @tc.name: testScrollToBottom
* @tc.desc: scroll on this UiComponent to the bottom.
*/
it
(
'testScrollToBottom'
,
0
,
async
function
()
{
let
driver
=
UiDriver
.
create
()
await
driver
.
delayMs
(
waitUiReadyMs
)
let
scrollBar
=
await
driver
.
findComponent
(
BY
.
type
(
'Scroll'
))
expect
(
scrollBar
!=
null
)
.
assertTrue
()
await
scrollBar
.
scrollToBottom
()
let
button
=
await
driver
.
findComponent
(
BY
.
text
(
'bottom'
))
expect
(
await
button
.
getText
()
==
'bottom'
)
.
assertTrue
()
await
scrollBar
.
scrollToTop
()
})
/*
* @tc.number: uiTest_3400
* @tc.name: testScrollToTop
* @tc.desc: scroll on this UiComponent to the top.
*/
it
(
'testScrollToTop'
,
0
,
async
function
()
{
let
driver
=
UiDriver
.
create
()
await
driver
.
delayMs
(
waitUiReadyMs
)
let
scrollBar
=
await
driver
.
findComponent
(
BY
.
type
(
'Scroll'
))
expect
(
scrollBar
!==
null
)
.
assertTrue
()
await
scrollBar
.
scrollToBottom
()
await
scrollBar
.
scrollToTop
()
let
button
=
await
driver
.
findComponent
(
BY
.
text
(
'next page'
))
expect
(
await
button
.
getText
()
==
'next page'
)
.
assertTrue
()
})
/*
* @tc.number: uiTest_3500
* @tc.name: testGetWindowMode
* @tc.desc: get the window mode of this UiWindow.
*/
it
(
'testGetWindowMode'
,
0
,
async
function
()
{
it
(
'testGetWindowMode'
,
0
,
async
function
()
{
await
startAbility
(
'com.example.windows'
,
'MainAbility'
)
let
driver
=
UiDriver
.
create
()
await
driver
.
delayMs
(
waitUiReadyMs
)
let
window1
=
await
driver
.
findWindow
({
bundleName
:
'com.example.windows'
})
let
mode1
=
await
window1
.
getWindowMode
()
expect
(
mode1
==
WindowMode
.
FULLSCREEN
)
.
assertTrue
()
let
window2
=
await
driver
.
findWindow
({
bundleName
:
'com.example.windows'
})
await
window2
.
resume
()
let
mode2
=
await
window2
.
getWindowMode
()
expect
(
mode2
==
WindowMode
.
FLOATING
)
.
assertTrue
()
await
stopApplication
(
'com.example.windows'
)
})
/*
* @tc.number: uiTest_3600
* @tc.name: testGetBundleName
* @tc.desc: get the bundleName of this UiWindow.
*/
it
(
'testGetBundleName'
,
0
,
async
function
()
{
await
startAbility
(
'com.example.windows'
,
'MainAbility'
)
await
startAbility
(
'com.example.windows'
,
'MainAbility'
)
let
driver
=
UiDriver
.
create
()
let
driver
=
UiDriver
.
create
()
await
driver
.
delayMs
(
waitUiReadyMs
)
await
driver
.
delayMs
(
waitUiReadyMs
)
let
window
=
await
driver
.
findWindow
({
bundleName
:
'com.example.windows'
})
let
window
=
await
driver
.
findWindow
({
bundleName
:
'com.example.windows'
})
let
mode
=
await
window
.
getWindowMode
()
let
name
=
await
window
.
getBundleName
()
expect
(
mode
==
WindowMode
.
FULLSCREEN
)
.
assertTrue
()
expect
(
name
==
'com.example.windows'
)
.
assertTrue
()
await
stopApplication
(
'com.example.windows'
)
})
/*
* @tc.number: uiTest_3700
* @tc.name: testGetTitle
* @tc.desc: get the title of this UiWindow.
*/
it
(
'testGetTitle'
,
0
,
async
function
()
{
await
startAbility
(
'com.example.windows'
,
'MainAbility'
)
let
driver
=
UiDriver
.
create
()
await
driver
.
delayMs
(
waitUiReadyMs
)
let
window
=
await
driver
.
findWindow
({
bundleName
:
'com.example.windows'
})
let
title
=
await
window
.
getTitle
()
expect
(
title
==
''
)
.
assertTrue
()
await
stopApplication
(
'com.example.windows'
)
await
stopApplication
(
'com.example.windows'
)
})
})
/*
* @tc.number: uiTest_3800
* @tc.name: testWindowMoveTo
* @tc.desc: move this UiWindow to the specified points.
*/
it
(
'testWindowMoveTo'
,
0
,
async
function
()
{
it
(
'testWindowMoveTo'
,
0
,
async
function
()
{
await
startAbility
(
'com.example.windows'
,
'MainAbility'
)
await
startAbility
(
'com.example.windows'
,
'MainAbility'
)
let
driver
=
UiDriver
.
create
()
let
driver
=
UiDriver
.
create
()
...
@@ -386,6 +611,11 @@ export default function abilityTest() {
...
@@ -386,6 +611,11 @@ export default function abilityTest() {
await
stopApplication
(
'com.example.windows'
)
await
stopApplication
(
'com.example.windows'
)
})
})
/*
* @tc.number: uiTest_3900
* @tc.name: testWindowResize
* @tc.desc: resize this UiWindow to the specified size for the specified direction.
*/
it
(
'testWindowResize'
,
0
,
async
function
()
{
it
(
'testWindowResize'
,
0
,
async
function
()
{
await
startAbility
(
'com.example.windows'
,
'MainAbility'
)
await
startAbility
(
'com.example.windows'
,
'MainAbility'
)
let
driver
=
UiDriver
.
create
()
let
driver
=
UiDriver
.
create
()
...
@@ -399,10 +629,47 @@ export default function abilityTest() {
...
@@ -399,10 +629,47 @@ export default function abilityTest() {
await
driver
.
delayMs
(
waitUiReadyMs
)
await
driver
.
delayMs
(
waitUiReadyMs
)
let
window2
=
await
driver
.
findWindow
({
bundleName
:
'com.example.windows'
})
let
window2
=
await
driver
.
findWindow
({
bundleName
:
'com.example.windows'
})
let
bounds2
=
await
window2
.
getBounds
()
let
bounds2
=
await
window2
.
getBounds
()
expect
(
bounds1
!=
bounds2
)
.
assertTrue
()
expect
(
bounds2
!=
bounds1
)
.
assertTrue
()
await
window2
.
resize
(
500
,
500
,
ResizeDirection
.
RIGHT_UP
)
let
window3
=
await
driver
.
findWindow
({
bundleName
:
'com.example.windows'
})
let
bounds3
=
await
window2
.
getBounds
()
expect
(
bounds3
!=
bounds2
)
.
assertTrue
()
await
window3
.
resize
(
400
,
400
,
ResizeDirection
.
LEFT_DOWN
)
let
window4
=
await
driver
.
findWindow
({
bundleName
:
'com.example.windows'
})
let
bounds4
=
await
window2
.
getBounds
()
expect
(
bounds4
!=
bounds3
)
.
assertTrue
()
await
window4
.
resize
(
500
,
500
,
ResizeDirection
.
LEFT_DOWN
)
let
window5
=
await
driver
.
findWindow
({
bundleName
:
'com.example.windows'
})
let
bounds5
=
await
window2
.
getBounds
()
expect
(
bounds5
!=
bounds4
)
.
assertTrue
()
await
window5
.
resize
(
500
,
400
,
ResizeDirection
.
DOWN
)
let
window6
=
await
driver
.
findWindow
({
bundleName
:
'com.example.windows'
})
let
bounds6
=
await
window2
.
getBounds
()
expect
(
bounds6
!=
bounds5
)
.
assertTrue
()
await
window6
.
resize
(
500
,
500
,
ResizeDirection
.
UP
)
let
window7
=
await
driver
.
findWindow
({
bundleName
:
'com.example.windows'
})
let
bounds7
=
await
window2
.
getBounds
()
expect
(
bounds7
!=
bounds5
)
.
assertTrue
()
await
window7
.
resize
(
500
,
500
,
ResizeDirection
.
UP
)
let
window8
=
await
driver
.
findWindow
({
bundleName
:
'com.example.windows'
})
let
bounds8
=
await
window2
.
getBounds
()
expect
(
bounds8
!=
bounds7
)
.
assertTrue
()
await
window8
.
resize
(
400
,
500
,
ResizeDirection
.
LEFT
)
let
window9
=
await
driver
.
findWindow
({
bundleName
:
'com.example.windows'
})
let
bounds9
=
await
window2
.
getBounds
()
expect
(
bounds9
!=
bounds8
)
.
assertTrue
()
await
window9
.
resize
(
400
,
500
,
ResizeDirection
.
RIGHT
)
let
window10
=
await
driver
.
findWindow
({
bundleName
:
'com.example.windows'
})
let
bounds10
=
await
window2
.
getBounds
()
expect
(
bounds10
!=
bounds9
)
.
assertTrue
()
await
stopApplication
(
'com.example.windows'
)
await
stopApplication
(
'com.example.windows'
)
})
})
/*
* @tc.number: uiTest_4000
* @tc.name: testWindowFocus
* @tc.desc: set the focused status of this UiWindow.
*/
it
(
'testWindowFocus'
,
0
,
async
function
()
{
it
(
'testWindowFocus'
,
0
,
async
function
()
{
await
startAbility
(
'com.example.windows'
,
'MainAbility'
)
await
startAbility
(
'com.example.windows'
,
'MainAbility'
)
let
driver
=
UiDriver
.
create
()
let
driver
=
UiDriver
.
create
()
...
@@ -414,6 +681,11 @@ export default function abilityTest() {
...
@@ -414,6 +681,11 @@ export default function abilityTest() {
await
stopApplication
(
'com.example.windows'
)
await
stopApplication
(
'com.example.windows'
)
})
})
/*
* @tc.number: uiTest_4100
* @tc.name: testWindowMaximize
* @tc.desc: maximize this UiWindow.
*/
it
(
'testWindowMaximize'
,
0
,
async
function
()
{
it
(
'testWindowMaximize'
,
0
,
async
function
()
{
await
startAbility
(
'com.example.windows'
,
'MainAbility'
)
await
startAbility
(
'com.example.windows'
,
'MainAbility'
)
let
driver
=
UiDriver
.
create
()
let
driver
=
UiDriver
.
create
()
...
@@ -429,6 +701,11 @@ export default function abilityTest() {
...
@@ -429,6 +701,11 @@ export default function abilityTest() {
await
stopApplication
(
'com.example.windows'
)
await
stopApplication
(
'com.example.windows'
)
})
})
/*
* @tc.number: uiTest_4200
* @tc.name: testWindowMinimize
* @tc.desc: minimize this UiWindow.
*/
it
(
'testWindowMinimize'
,
0
,
async
function
()
{
it
(
'testWindowMinimize'
,
0
,
async
function
()
{
await
startAbility
(
'com.example.windows'
,
'MainAbility'
)
await
startAbility
(
'com.example.windows'
,
'MainAbility'
)
let
driver
=
UiDriver
.
create
()
let
driver
=
UiDriver
.
create
()
...
@@ -441,6 +718,11 @@ export default function abilityTest() {
...
@@ -441,6 +718,11 @@ export default function abilityTest() {
await
stopApplication
(
'com.example.windows'
)
await
stopApplication
(
'com.example.windows'
)
})
})
/*
* @tc.number: uiTest_4300
* @tc.name: testWindowClose
* @tc.desc: close this UiWindow.
*/
it
(
'testWindowClose'
,
0
,
async
function
()
{
it
(
'testWindowClose'
,
0
,
async
function
()
{
await
startAbility
(
'com.example.windows'
,
'MainAbility'
)
await
startAbility
(
'com.example.windows'
,
'MainAbility'
)
let
driver
=
UiDriver
.
create
()
let
driver
=
UiDriver
.
create
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录