From 6b1b2a099455712cb8ba4c5c5ed0566a41307b7e Mon Sep 17 00:00:00 2001 From: zhouke Date: Mon, 16 May 2022 14:21:48 +0800 Subject: [PATCH] =?UTF-8?q?=20=E4=BF=AE=E6=94=B9uitest.d.ts,=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E6=8E=A5=E5=8F=A3=E6=8F=8F=E8=BF=B0.=20Signed-off-by:?= =?UTF-8?q?=20.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhouke --- api/@ohos.uitest.d.ts | 158 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 157 insertions(+), 1 deletion(-) diff --git a/api/@ohos.uitest.d.ts b/api/@ohos.uitest.d.ts index e24e756824..75e8f7ff67 100755 --- a/api/@ohos.uitest.d.ts +++ b/api/@ohos.uitest.d.ts @@ -49,6 +49,28 @@ ENDS_WITH = 3 } +/** + * Represents the point on the device screen. + * + * @since 9 + */ +declare interface Point { + readonly X: number; + readonly Y: number; +} + +/** + * Represents the rectangle area on the device screen. + * + * @since 9 + */ +declare interface Rect { + readonly leftX: number; + readonly topY: number; + readonly rightX: number; + readonly bottomY: number; +} + /** * Describes the attribute requirements for the target UiComponents. * @@ -108,6 +130,16 @@ clickable(b?:bool):By; /** + * Specifies the longClickable status of the target UiComponent. + * @syscap SystemCapability.Test.UiTest + * @param b the clickable status,default to true. + * @return Returns this {@link By} object. + * @since 9 + * @test + */ + longClickable(b?: bool): By; + + /** * Specifies the scrollable status of the target UiComponent. * @syscap SystemCapability.Test.UiTest * @param b the scrollable status,default to true. @@ -147,6 +179,26 @@ */ selected(b?:bool):By; + /** + * Specifies the checked status of the target UiComponent. + * @syscap SystemCapability.Test.UiTest + * @param b the checked status,default to false. + * @return Returns this {@link By} object. + * @since 9 + * @test + */ + checked(b?: bool): By; + + /** + * Specifies the checkable status of the target UiComponent. + * @syscap SystemCapability.Test.UiTest + * @param b the checkable status,default to false. + * @return Returns this {@link By} object. + * @since 9 + * @test + */ + checkable(b?: bool): By; + /** * Requires that the target UiComponent which is before another UiComponent that specified by the given {@link By} * object,used to locate UiComponent relatively. @@ -246,6 +298,15 @@ */ isClickable():Promise; + /** + * Get the longClickable status of this {@link UiComponent}. + * @syscap SystemCapability.Test.UiTest + * @returns the longClickable status. + * @since 9 + * @test + */ + isLongClickable(): Promise; + /** * Get the scrollable status of this {@link UiComponent}. * @syscap SystemCapability.Test.UiTest @@ -281,7 +342,25 @@ * @test */ isSelected():Promise; + + /** + * Get the checked status of this {@link UiComponent}. + * @syscap SystemCapability.Test.UiTest + * @returns the checked status. + * @since 9 + * @test + */ + isChecked(): Promise; + /** + * Get the checkable status of this {@link UiComponent}. + * @syscap SystemCapability.Test.UiTest + * @returns the checkable status. + * @since 9 + * @test + */ + isCheckable(): Promise; + /** * Inject text to this {@link UiComponent},applicable to TextInput. * @syscap SystemCapability.Test.UiTest @@ -291,6 +370,32 @@ */ inputText(text: string):Promise; + /** + * Clear text of this {@link UiComponent},applicable to TextInput. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + clearText(): Promise; + + /** + * Scroll on this {@link UiComponent} to the top,applicable to scrollable one. + * @syscap SystemCapability.Test.UiTest + * @param speed the speed of swipe,default 600. + * @since 9 + * @test + */ + scrollToTop(speed?: number): Promise; + + /** + * Scroll on this {@link UiComponent} to the bottom,applicable to scrollable one. + * @syscap SystemCapability.Test.UiTest + * @param speed the speed of swipe,default 600. + * @since 9 + * @test + */ + scrollToBottom(speed?: number): Promise; + /** * Scroll on this {@link UiComponent}to find matched {@link UiComponent},applicable to scrollable one. * @syscap SystemCapability.Test.UiTest @@ -300,6 +405,32 @@ * @test */ scrollSearch(by:By):Promise; + /** + * Get the bounds rect of this {@link UiComponent}. + * @syscap SystemCapability.Test.UiTest + * @return the bounds rect object. + * @since 9 + * @test + */ + getBounds(): Promise; + + /** + * Get the boundsCenter of this {@link UiComponent}. + * @syscap SystemCapability.Test.UiTest + * @return the boundsCenter object. + * @since 9 + * @test + */ + getBoundsCenter(): Promise; + + /** + * Drag this {@link UiComponent} to the bounds rect of target UiComponent. + * @syscap SystemCapability.Test.UiTest + * @param target the target {@link UiComponent}. + * @since 9 + * @test + */ + dragTo(target: UiComponent): Promise; } /** @@ -339,6 +470,17 @@ */ findComponent(by:By):Promise; + /** + * Find the first matched {@link UiComponent} on current UI during the time given. + * @syscap SystemCapability.Test.UiTest + * @param by the attribute requirements of the target {@link UiComponent}. + * @param time duration of finding in milliseconds + * @returns the first matched {@link UiComponent} or undefined. + * @since 9 + * @test + */ + waitForComponent(by: By, time: number): Promise; + /** * Find all the matched {@link UiComponent}s on current UI. * @syscap SystemCapability.Test.UiTest @@ -413,10 +555,24 @@ * @param starty the y-coordinate of the starting point. * @param endx the x-coordinate of the ending point. * @param endy the y-coordinate of the ending point. + * @param speed the speed of swipe,default 600. * @since 8 * @test */ - swipe(startx:number,starty:number,endx:number,endy:number):Promise; + swipe(startx: number, starty: number, endx: number, endy: number, speed?: number): Promise; + + /** + * Drag on the screen between the specified points. + * @syscap SystemCapability.Test.UiTest + * @param startx the x-coordinate of the starting point. + * @param starty the y-coordinate of the starting point. + * @param endx the x-coordinate of the ending point. + * @param endy the y-coordinate of the ending point. + * @param speed the speed of drag,default 600. + * @since 9 + * @test + */ + drag(startx: number, starty: number, endx: number, endy: number, speed?: number): Promise; /** * Capture current screen and save as picture which PNG format. -- Gitee