From 713c7942cd7b5221811f3df63230c1655de2a266 Mon Sep 17 00:00:00 2001 From: zhouke Date: Fri, 1 Jul 2022 16:18:33 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=87=E6=A1=A3=E6=8E=A5=E5=8F=A3=E5=AE=8C?= =?UTF-8?q?=E6=95=B4=E6=80=A7=E6=8A=A5=E9=94=99=E4=BF=AE=E6=94=B9,?= =?UTF-8?q?=E8=A7=84=E8=8C=83=E4=BF=AE=E6=94=B9.Signed-off-by:=20.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhouke --- .../reference/apis/js-apis-uitest.md | 104 +++++++++--------- 1 file changed, 51 insertions(+), 53 deletions(-) diff --git a/zh-cn/application-dev/reference/apis/js-apis-uitest.md b/zh-cn/application-dev/reference/apis/js-apis-uitest.md index 15ffef5fa4..9589d22569 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-uitest.md +++ b/zh-cn/application-dev/reference/apis/js-apis-uitest.md @@ -28,7 +28,7 @@ By提供的API能力具有以下几个特点:
1、支持单属性匹配和多 BY.text('123').type('button') ``` -### By.text +### text text(txt: string, pattern?: MatchPattern): By @@ -56,7 +56,7 @@ let by = BY.text('123') //使用静态构造器BY创建by对象,指定目标 ``` -### By.key +### key key(key: string): By @@ -83,7 +83,7 @@ let by = BY.key('123') //使用静态构造器BY创建by对象,指定目标控 ``` -### By.id +### id id(id: number): By @@ -110,7 +110,7 @@ let by = BY.id(123) //使用静态构造器BY创建by对象,指定目标控件 ``` -### By.type +### type type(tp: string): By @@ -137,7 +137,7 @@ let by = BY.type('button') //使用静态构造器BY创建by对象,指定目 ``` -### By.clickable +### clickable clickable(b?: bool): By @@ -163,7 +163,7 @@ clickable(b?: bool): By let by = BY.clickable(true) //使用静态构造器BY创建by对象,指定目标控件的可点击状态属性。 ``` -### By.longClickable9+ +### longClickable9+ longClickable(b?: bool): By @@ -190,7 +190,7 @@ let by = BY.longClickable(true) //使用静态构造器BY创建by对象,指定 ``` -### By.scrollable +### scrollable scrollable(b?: bool): By @@ -216,7 +216,7 @@ scrollable(b?: bool): By let by = BY.scrollable(true) //使用静态构造器BY创建by对象,指定目标控件的可滑动状态属性。 ``` -### By.enabled +### enabled enabled(b?: bool): By @@ -242,7 +242,7 @@ enabled(b?: bool): By let by = BY.enabled(true) //使用静态构造器BY创建by对象,指定目标控件的使能状态属性。 ``` -### By.focused +### focused focused(b?: bool): By @@ -268,7 +268,7 @@ focused(b?: bool): By let by = BY.focused(true) //使用静态构造器BY创建by对象,指定目标控件的获焦状态属性。 ``` -### By.selected +### selected selected(b?: bool): By @@ -294,7 +294,7 @@ selected(b?: bool): By let by = BY.selected(true) //使用静态构造器BY创建by对象,指定目标控件的被选中状态属性。 ``` -### By.checked9+ +### checked9+ checked(b?: bool): By @@ -320,7 +320,7 @@ checked(b?: bool): By let by = BY.checked(true) //使用静态构造器BY创建by对象,指定目标控件的被勾选状态属性 ``` -### By.checkable9+ +### checkable9+ checkable(b?: bool): By @@ -346,7 +346,7 @@ checkable(b?: bool): By let by = BY.checkable(true) //使用静态构造器BY创建by对象,指定目标控件的能否被勾选状态属性。 ``` -### By.isBefore +### isBefore isBefore(by: By): By @@ -372,7 +372,7 @@ isBefore(by: By): By let by = BY.isBefore(BY.text('123')) //使用静态构造器BY创建by对象,指定目标控件位于给出的特征属性控件之前。 ``` -### By.isAfter +### isAfter isAfter(by: By): By @@ -407,8 +407,6 @@ UiTest中,UiComponent类代表了UI界面上的一个控件,提供控件属 控件的边框信息。 -**系统能力**:SystemCapability.Test.UiTest - | 名称 | 参数类型 | 可读 | 可写 | 描述 | | ------- | -------- | ---- | ---- | ------------------------- | | leftX | number | 是 | 否 | 控件边框的左上角的X坐标。 | @@ -416,7 +414,7 @@ UiTest中,UiComponent类代表了UI界面上的一个控件,提供控件属 | rightX | number | 是 | 否 | 控件边框的右下角的X坐标。 | | bottomY | number | 是 | 否 | 控件边框的右下角的Y坐标。 | -### UiComponent.click +### click click(): Promise\ @@ -434,7 +432,7 @@ async function demo() { } ``` -### UiComponent.doubleClick +### doubleClick doubleClick(): Promise\ @@ -452,7 +450,7 @@ async function demo() { } ``` -### UiComponent.longClick +### longClick longClick(): Promise\ @@ -470,7 +468,7 @@ async function demo() { } ``` -### UiComponent.getId +### getId getId(): Promise\ @@ -494,7 +492,7 @@ async function demo() { } ``` -### UiComponent.getKey +### getKey getKey(): Promise\ @@ -518,7 +516,7 @@ async function demo() { } ``` -### UiComponent.getText +### getText getText(): Promise\ @@ -542,7 +540,7 @@ async function demo() { } ``` -### UiComponent.getType +### getType getType(): Promise\ @@ -566,7 +564,7 @@ async function demo() { } ``` -### UiComponent.getBounds9+ +### getBounds9+ getBounds(): Promise\ @@ -590,7 +588,7 @@ async function demo() { } ``` -### UiComponent.isClickable +### isClickable isClickable(): Promise\ @@ -619,7 +617,7 @@ async function demo() { } ``` -### UiComponent.isLongClickable9+ +### isLongClickable9+ isLongClickable(): Promise\ @@ -648,9 +646,9 @@ async function demo() { } ``` -### UiComponent.isChecked9+ +### isChecked9+ -isLongClickable(): Promise\ +isChecked(): Promise\ 获取控件对象被勾选状态。 @@ -677,7 +675,7 @@ async function demo() { } ``` -### UiComponent.isCheckable9+ +### isCheckable9+ isCheckable(): Promise\ @@ -706,7 +704,7 @@ async function demo() { } ``` -### UiComponent.isScrollable +### isScrollable isScrollable(): Promise\ @@ -736,7 +734,7 @@ async function demo() { ``` -### UiComponent.isEnabled +### isEnabled isEnabled(): Promise\ @@ -766,7 +764,7 @@ async function demo() { ``` -### UiComponent.isFocused +### isFocused isFocused(): Promise\ @@ -795,7 +793,7 @@ async function demo() { } ``` -### UiComponent.isSelected +### isSelected isSelected(): Promise\ @@ -824,7 +822,7 @@ async function demo() { } ``` -### UiComponent.inputText +### inputText inputText(text: string): Promise\ @@ -848,7 +846,7 @@ async function demo() { } ``` -### UiComponent.clearText9+ +### clearText9+ clearText(): Promise\ @@ -866,7 +864,7 @@ async function demo() { } ``` -### UiComponent.scrollSearch +### scrollSearch scrollSearch(by: By): Promise\ @@ -896,7 +894,7 @@ async function demo() { } ``` -### UiComponent.scrollToTop9+ +### scrollToTop9+ scrollToTop(): Promise\ @@ -914,7 +912,7 @@ async function demo() { } ``` -### UiComponent.scrollToBottom9+ +### scrollToBottom9+ scrollToBottom(): Promise\ @@ -932,7 +930,7 @@ async function demo() { } ``` -### UiComponent.dragTo9+ +### dragTo9+ dragTo(target: UiComponent): Promise\ @@ -962,7 +960,7 @@ async function demo() { UiDriver类为uitest测试框架的总入口,提供控件匹配/查找,按键注入,坐标点击/滑动,截图等API。 该类提供的方法除UiDriver.create()以外的所有方法都使用Promise方式作为异步方法,需使用await调用。 -### UiDriver.create +### create static create(): UiDriver @@ -984,7 +982,7 @@ async function demo() { } ``` -### UiDriver.delayMs +### delayMs delayMs(duration: number): Promise\ @@ -1007,7 +1005,7 @@ async function demo() { } ``` -### UiDriver.findComponent +### findComponent findComponent(by: By): Promise\ @@ -1036,7 +1034,7 @@ async function demo() { } ``` -### UiDriver.findComponents +### findComponents findComponents(by: By): Promise\> @@ -1065,7 +1063,7 @@ async function demo() { } ``` -### UiDriver.waitForComponent9+ +### waitForComponent9+ waitForComponent(by: By, time: number): Promise\ @@ -1095,7 +1093,7 @@ async function demo() { } ``` -### UiDriver.assertComponentExist +### assertComponentExist assertComponentExist(by: By): Promise\ @@ -1118,7 +1116,7 @@ async function demo() { } ``` -### UiDriver.pressBack +### pressBack pressBack(): Promise\ @@ -1135,7 +1133,7 @@ async function demo() { } ``` -### UiDriver.triggerKey +### triggerKey triggerKey(keyCode: number): Promise\ @@ -1158,7 +1156,7 @@ async function demo() { } ``` -### UiDriver.click +### click click(x: number, y: number): Promise\ @@ -1182,7 +1180,7 @@ async function demo() { } ``` -### UiDriver.doubleClick +### doubleClick doubleClick(x: number, y: number): Promise\ @@ -1206,7 +1204,7 @@ async function demo() { } ``` -### UiDriver.longClick +### longClick longClick(x: number, y: number): Promise\ @@ -1230,7 +1228,7 @@ async function demo() { } ``` -### UiDriver.swipe +### swipe swipe(startx: number, starty: number, endx: number, endy: number): Promise\ @@ -1256,7 +1254,7 @@ async function demo() { } ``` -### UiDriver.drag9+ +### drag9+ drag(startx: number, starty: number, endx: number, endy: number): Promise\ @@ -1282,7 +1280,7 @@ async function demo() { } ``` -### UiDriver.screenCap +### screenCap screenCap(savePath: string): Promise\ -- GitLab