From eb7a7fa245944e9a8d1b172e5b68154000e4492d Mon Sep 17 00:00:00 2001 From: zhouke Date: Mon, 16 May 2022 15:30:16 +0800 Subject: [PATCH] =?UTF-8?q?=20@ohos.uitest.d.ts=E5=A2=9E=E5=8A=A0=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E5=A3=B0=E6=98=8E.=20Signed-off-by:=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 | 134 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 134 insertions(+) diff --git a/api/@ohos.uitest.d.ts b/api/@ohos.uitest.d.ts index e24e756824..354d22d738 100755 --- a/api/@ohos.uitest.d.ts +++ b/api/@ohos.uitest.d.ts @@ -49,6 +49,18 @@ ENDS_WITH = 3 } +/** + * 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. * @@ -107,6 +119,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 @@ -147,6 +169,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 +288,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 @@ -282,6 +333,24 @@ */ 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 +360,30 @@ */ 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 + * @since 9 + * @test + */ + scrollToTop(): Promise; + + /** + * Scroll on this {@link UiComponent} to the bottom,applicable to scrollable one. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + scrollToBottom(): Promise; + /** * Scroll on this {@link UiComponent}to find matched {@link UiComponent},applicable to scrollable one. * @syscap SystemCapability.Test.UiTest @@ -300,6 +393,24 @@ * @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; + + /** + * 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 +450,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 @@ -418,6 +540,18 @@ */ swipe(startx:number,starty:number,endx:number,endy: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. + * @since 9 + * @test + */ + drag(startx: number, starty: number, endx: number, endy: number): Promise; + /** * Capture current screen and save as picture which PNG format. * @syscap SystemCapability.Test.UiTest -- Gitee