diff --git a/api/@ohos.uitest.d.ts b/api/@ohos.uitest.d.ts index c7582608738c10ab6f8d0237113bbdbe10540dff..7d0eb03a930605e0301d820e25501adb38cbf8d0 100644 --- a/api/@ohos.uitest.d.ts +++ b/api/@ohos.uitest.d.ts @@ -13,591 +13,1085 @@ * limitations under the License. */ +/** + * Enumerates the string value match pattern. + * @syscap SystemCapability.Test.UiTest + * @since 8 + */ +declare enum MatchPattern { + /** + * Equals to a string. + * @syscap SystemCapability.Test.UiTest + * @since 8 + * @test + */ + EQUALS = 0, + /** + * Contains a substring. + * @syscap SystemCapability.Test.UiTest + * @since 8 + * @test + */ + CONTAINS = 1, + /** + * StartsWith a substring. + * @syscap SystemCapability.Test.UiTest + * @since 8 + * @test + */ + STARTS_WITH = 2, + /** + * EndsWith a substring. + * @syscap SystemCapability.Test.UiTest + * @since 8 + * @test + */ + ENDS_WITH = 3 +} + +/** + * Describes the attribute requirements for the target UiComponents. + * + * @since 8 + * @deprecated since 9 + * @syscap SystemCapability.Test.UiTest + */ +declare class By { + /** + * Specifies the text for the target UiComponent. + * @syscap SystemCapability.Test.UiTest + * @param txt the text value. + * @param pattern the {@link MatchPattern} of the text value,default to {@link MatchPattern.EQUALS} + * @return Returns this {@link By} object. + * @since 8 + * @test + */ + text(txt: string, pattern?: MatchPattern): By; + + /** + * Specifies the inspectorKey of the target UiComponent. + * @syscap SystemCapability.Test.UiTest + * @param key the inspectorKey value. + * @return Returns this {@link By} object. + * @since 8 + * @test + */ + key(key: string): By; + + /** + * Specifies the id of the target UiComponent. + * @syscap SystemCapability.Test.UiTest + * @param id the id value. + * @return Returns this {@link By} object. + * @since 8 + * @test + */ + id(id: number): By; + + /** + * Specifies the type of the target UiComponent. + * @syscap SystemCapability.Test.UiTest + * @param tp the type value. + * @return Returns this {@link By} object. + * @since 8 + * @test + */ + type(tp: string): By; + + /** + * Specifies the clickable status of the target UiComponent. + * @syscap SystemCapability.Test.UiTest + * @param b the clickable status,default to true. + * @return Returns this {@link By} object. + * @since 8 + * @test + */ + clickable(b?: boolean): By; + + /** + * Specifies the scrollable status of the target UiComponent. + * @syscap SystemCapability.Test.UiTest + * @param b the scrollable status,default to true. + * @return Returns this {@link By} object. + * @since 8 + * @test + */ + scrollable(b?: boolean): By; + + /** + * Specifies the enabled status of the target UiComponent. + * @syscap SystemCapability.Test.UiTest + * @param b the enabled status,default to true. + * @return Returns this {@link By} object. + * @since 8 + * @test + */ + enabled(b?: boolean): By; + + /** + * Specifies the focused status of the target UiComponent. + * @syscap SystemCapability.Test.UiTest + * @param b the focused status,default to true. + * @return Returns this {@link By} object. + * @since 8 + * @test + */ + focused(b?: boolean): By; + + /** + * Specifies the selected status of the target UiComponent. + * @syscap SystemCapability.Test.UiTest + * @param b the selected status,default to true. + * @return Returns this {@link By} object. + * @since 8 + * @test + */ + selected(b?: boolean): By; + + /** + * Requires that the target UiComponent which is before another UiComponent that specified by the given {@link By} + * object,used to locate UiComponent relatively. + * @syscap SystemCapability.Test.UiTest + * @param by describes the attribute requirements of UiComponent which the target one is in front of. + * @return Returns this {@link By} object. + * @since 8 + * @test + */ + isBefore(by: By): By; + + /** + * Requires that the target UiComponent which is after another UiComponent that specified by the given {@link By} + * object,used to locate UiComponent relatively. + * @syscap SystemCapability.Test.UiTest + * @param by describes the attribute requirements of UiComponent which the target one is in back of. + * @return Returns this {@link By} object. + * @since 8 + * @test + */ + isAfter(by: By): By; +} + +/** + * Represents a UiComponent of the ohos application,user can perform operations or query attributes on it. + * + * @since 8 + * @deprecated since 9 + * @test + * @syscap SystemCapability.Test.UiTest + */ +declare class UiComponent { + /** + * Click this {@link UiComponent}. + * @syscap SystemCapability.Test.UiTest + * @since 8 + * @test + */ + click(): Promise; + + /** + * Double click this {@link UiComponent}. + * @syscap SystemCapability.Test.UiTest + * @since 8 + * @test + */ + doubleClick(): Promise; + + /** + * Long click this {@link UiComponent}. + * @syscap SystemCapability.Test.UiTest + * @since 8 + * @test + */ + longClick(): Promise; + + /** + * Get the id attribute value. + * @syscap SystemCapability.Test.UiTest + * @returns the id value. + * @since 8 + * @test + */ + getId(): Promise; + + /** + * Get the inspectorKey attribute value. + * @syscap SystemCapability.Test.UiTest + * @returns the inspectorKey value. + * @since 8 + * @test + */ + getKey(): Promise; + + /** + * Get the text attribute value. + * @syscap SystemCapability.Test.UiTest + * @since 8 + * @test + */ + getText(): Promise; + + /** + * Get the type name. + * @syscap SystemCapability.Test.UiTest + * @returns the type name. + * @since 8 + * @test + */ + getType(): Promise; + + /** + * Get the clickable status of this {@link UiComponent}. + * @syscap SystemCapability.Test.UiTest + * @returns the clickable status. + * @since 8 + * @test + */ + isClickable(): Promise; + + /** + * Get the scrollable status of this {@link UiComponent}. + * @syscap SystemCapability.Test.UiTest + * @returns the scrollable status. + * @since 8 + * @test + */ + isScrollable(): Promise; + + /** + * Get the enabled status of this {@link UiComponent}. + * @syscap SystemCapability.Test.UiTest + * @returns the enabled status. + * @since 8 + * @test + */ + isEnabled(): Promise; + + /** + * Get the focused status of this {@link UiComponent}. + * @syscap SystemCapability.Test.UiTest + * @returns the focused status. + * @since 8 + * @test + */ + isFocused(): Promise; + + /** + * Get the selected status of this {@link UiComponent}. + * @syscap SystemCapability.Test.UiTest + * @returns the selected status. + * @since 8 + * @test + */ + isSelected(): Promise; + + /** + * Inject text to this {@link UiComponent},applicable to TextInput. + * @syscap SystemCapability.Test.UiTest + * @param text the text to inject. + * @since 8 + * @test + */ + inputText(text: string): Promise; + + /** + * Scroll on this {@link UiComponent}to find matched {@link UiComponent},applicable to scrollable one. + * @syscap SystemCapability.Test.UiTest + * @param by the attribute requirements of the target {@link UiComponent}. + * @return the found result,or undefined if not found. + * @since 8 + * @test + */ + scrollSearch(by: By): Promise; +} + +/** + * The unified facade of UiTest framework,can be used to find {@link UiComponent},trigger keyEvents,perform + * coordinates-based UI actions,capture screen and so on. + * + * @since 8 + * @deprecated since 9 + * @test + * @syscap SystemCapability.Test.UiTest + */ +declare class UiDriver { + /** + * Create an {@link UiDriver} object. + * @syscap SystemCapability.Test.UiTest + * @returns the {@link UiDriver} object. + * @since 8 + * @test + */ + static create(): UiDriver; + + /** + * Delay with specified duration. + * @syscap SystemCapability.Test.UiTest + * @param duration the delay duration in milliseconds. + * @since 8 + * @test + */ + delayMs(duration: number): Promise; + + /** + * Find the first matched {@link UiComponent} on current UI. + * @syscap SystemCapability.Test.UiTest + * @param by the attribute requirements of the target {@link UiComponent}. + * @returns the first matched {@link UiComponent} or undefined. + * @since 8 + * @test + */ + findComponent(by: By): Promise; + + /** + * Find all the matched {@link UiComponent}s on current UI. + * @syscap SystemCapability.Test.UiTest + * @param by the attribute requirements of the target {@link UiComponent}. + * @returns the matched {@link UiComponent}s list. + * @since 8 + * @test + */ + findComponents(by: By): Promise>; + + /** + * Assert t the matched {@link UiComponent}s exists on current UI;if not,assertError will be raised. + * @syscap SystemCapability.Test.UiTest + * @param by the attribute requirements of the target {@link UiComponent}. + * @throws Throws this exception if following error occurs:{@code ComponentExistAssertion Failure}. + * @since 8 + * @test + */ + assertComponentExist(by: By): Promise; + + /** + * Press the BACK key. + * @syscap SystemCapability.Test.UiTest + * @since 8 + * @test + */ + pressBack(): Promise; + + /** + * Press the specified key. + * @syscap SystemCapability.Test.UiTest + * @param keyCode the target keyCode. + * @since 8 + * @test + */ + triggerKey(keyCode: number): Promise; + + /** + * Click on the specified location on the screen. + * @syscap SystemCapability.Test.UiTest + * @param x the x-coordinate. + * @param y the y-coordinate. + * @since 8 + * @test + */ + click(x: number, y: number): Promise; + + /** + * DoubleClick on the specified location on the screen. + * @syscap SystemCapability.Test.UiTest + * @param x the x-coordinate. + * @param y the y-coordinate. + * @since 8 + * @test + */ + doubleClick(x: number, y: number): Promise; + + /** + * LongClick on the specified location on the screen. + * @syscap SystemCapability.Test.UiTest + * @param x the x-coordinate. + * @param y the y-coordinate. + * @since 8 + * @test + */ + longClick(x: number, y: number): Promise; + + /** + * Swipe 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 8 + * @test + */ + swipe(startx: number, starty: number, endx: number, endy: number): Promise; + + /** + * Capture current screen and save as picture which PNG format. + * @syscap SystemCapability.Test.UiTest + * @param savePath the path where to store the picture. + * @returns true if screen-capturing and file-storing are completed successfully,false otherwise. + * @since 8 + * @test + */ + screenCap(savePath: string): Promise; +} + + +/** + * Describes the window mode of the tested window + * @syscap SystemCapability.Test.UiTest + * @since 9 + */ +declare enum WindowMode { + FULLSCREEN, + PRIMARY, + SECONDARY, + FLOATING +} + /** * Resize direction for the window. * @syscap SystemCapability.Test.UiTest * @since 9 */ - declare enum ResizeDirection{ - LEFT, - RIGHT, - UP, - DOWN, - LEFT_UP, - LEFT_DOWN, - RIGHT_UP, - RIGHT_DOWN - } +declare enum ResizeDirection { + LEFT, + RIGHT, + UP, + DOWN, + LEFT_UP, + LEFT_DOWN, + RIGHT_UP, + RIGHT_DOWN +} + +/** + * Describes the rotation of the device display + * @syscap SystemCapability.Test.UiTest + * @since 9 + */ +declare enum DisplayRotation { + ROTATION_0, + ROTATION_90, + ROTATION_180, + ROTATION_270 +} + /** - * Enumerates the string value match pattern. + * Represents the point on the device screen. * @syscap SystemCapability.Test.UiTest - * @since 8 + * @since 9 */ - declare enum MatchPattern{ - /** - * Equals to a string. - * @syscap SystemCapability.Test.UiTest - * @since 8 - * @test - */ - EQUALS = 0, - /** - * Contains a substring. - * @syscap SystemCapability.Test.UiTest - * @since 8 - * @test - */ - CONTAINS = 1, - /** - * StartsWith a substring. - * @syscap SystemCapability.Test.UiTest - * @since 8 - * @test - */ - STARTS_WITH = 2, - /** - * EndsWith a substring. - * @syscap SystemCapability.Test.UiTest - * @since 8 - * @test - */ - ENDS_WITH = 3 +declare interface Point { + readonly X: number; + readonly Y: number; } -/** - * Describes the window mode of the tested window - * @syscap SystemCapability.Test.UiTest - * @since 9 - */ - declare enum WindowMode{ - FULLSCREEN, - PRIMARY, - SECONDARY, - FLOATING - } +/** + * Represents the rectangle area on the device screen. + * @syscap SystemCapability.Test.UiTest + * @since 9 + */ +declare interface Rect { + readonly leftX: number; + readonly topY: number; + readonly rightX: number; + readonly bottomY: number; +} + +/** + * Represents filer condition to get the window . + * @syscap SystemCapability.Test.UiTest + * @since 9 + */ +declare interface WindowFilter { + readonly bundleName?: string; + readonly title?: string; + readonly focused?: boolean; + readonly actived?: boolean; +} + +/** + * Describes the attribute requirements for the target Components. + * + * @since 9 + * @syscap SystemCapability.Test.UiTest + */ +declare class On { + /** + * Specifies the text for the target Component. + * @syscap SystemCapability.Test.UiTest + * @param txt the text value. + * @param pattern the {@link MatchPattern} of the text value, default to {@link MatchPattern.EQUALS} + * @return Returns this {@link On} object. + * @throws {BusinessError} 401 if the input parameters are invalid. + * @throws {BusinessError} 17000006 if there is a system internal error. + * @since 9 + * @test + */ + text(txt: string, pattern?: MatchPattern): On; + + /** + * Specifies the id of the target Component. + * @syscap SystemCapability.Test.UiTest + * @param id the id value. + * @return Returns this {@link On} object. + * @throws {BusinessError} 401 if the input parameters are invalid. + * @throws {BusinessError} 17000006 if there is a system internal error. + * @since 9 + * @test + */ + id(id: string): On; + + /** + * Specifies the type of the target Component. + * @syscap SystemCapability.Test.UiTest + * @param tp the type value. + * @return Returns this {@link On} object. + * @throws {BusinessError} 401 if the input parameters are invalid. + * @throws {BusinessError} 17000006 if there is a system internal error. + * @since 9 + * @test + */ + type(tp: string): On; + + /** + * Specifies the clickable status of the target Component. + * @syscap SystemCapability.Test.UiTest + * @param b the clickable status,default to true. + * @return Returns this {@link On} object. + * @throws {BusinessError} 401 if the input parameters are invalid. + * @throws {BusinessError} 17000006 if there is a system internal error. + * @since 9 + * @test + */ + clickable(b?: boolean): On; + + /** + * Specifies the longClickable status of the target Component. + * @syscap SystemCapability.Test.UiTest + * @param b the clickable status,default to true. + * @return Returns this {@link On} object. + * @throws {BusinessError} 401 if the input parameters are invalid. + * @throws {BusinessError} 17000006 if there is a system internal error. + * @since 9 + * @test + */ + longClickable(b?: boolean): On; + + /** + * Specifies the scrollable status of the target Component. + * @syscap SystemCapability.Test.UiTest + * @param b the scrollable status,default to true. + * @return Returns this {@link On} object. + * @throws {BusinessError} 401 if the input parameters are invalid. + * @throws {BusinessError} 17000006 if there is a system internal error. + * @since 9 + * @test + */ + scrollable(b?: boolean): On; + + /** + * Specifies the enabled status of the target Component. + * @syscap SystemCapability.Test.UiTest + * @param b the enabled status,default to true. + * @return Returns this {@link On} object. + * @throws {BusinessError} 401 if the input parameters are invalid. + * @throws {BusinessError} 17000006 if there is a system internal error. + * @since 9 + * @test + */ + enabled(b?: boolean): On; + + /** + * Specifies the focused status of the target Component. + * @syscap SystemCapability.Test.UiTest + * @param b the focused status,default to true. + * @return Returns this {@link On} object. + * @throws {BusinessError} 401 if the input parameters are invalid. + * @throws {BusinessError} 17000006 if there is a system internal error. + * @since 9 + * @test + */ + focused(b?: boolean): On; + + /** + * Specifies the selected status of the target Component. + * @syscap SystemCapability.Test.UiTest + * @param b the selected status,default to true. + * @return Returns this {@link On} object. + * @throws {BusinessError} 401 if the input parameters are invalid. + * @throws {BusinessError} 17000006 if there is a system internal error. + * @since 9 + * @test + */ + selected(b?: boolean): On; + + /** + * Specifies the checked status of the target Component. + * @syscap SystemCapability.Test.UiTest + * @param b the checked status,default to false. + * @return Returns this {@link On} object. + * @throws {BusinessError} 401 if the input parameters are invalid. + * @throws {BusinessError} 17000006 if there is a system internal error. + * @since 9 + * @test + */ + checked(b?: boolean): On; + + /** + * Specifies the checkable status of the target Component. + * @syscap SystemCapability.Test.UiTest + * @param b the checkable status,default to false. + * @return Returns this {@link On} object. + * @throws {BusinessError} 401 if the input parameters are invalid. + * @throws {BusinessError} 17000006 if there is a system internal error. + * @since 9 + * @test + */ + checkable(b?: boolean): On; + + /** + * Requires that the target Component which is before another Component that specified by the given {@link On} + * object,used to locate Component relatively. + * @syscap SystemCapability.Test.UiTest + * @param on describes the attribute requirements of Component which the target one is in front of. + * @return Returns this {@link On} object. + * @throws {BusinessError} 401 if the input parameters are invalid. + * @throws {BusinessError} 17000006 if there is a system internal error. + * @since 9 + * @test + */ + isBefore(on: On): On; + + /** + * Requires that the target Component which is after another Component that specified by the given {@link On} + * object,used to locate Component relatively. + * @syscap SystemCapability.Test.UiTest + * @param on describes the attribute requirements of Component which the target one is in back of. + * @return Returns this {@link On} object. + * @throws {BusinessError} 401 if the input parameters are invalid. + * @throws {BusinessError} 17000006 if there is a system internal error. + * @since 9 + * @test + */ + isAfter(on: On): On; +} /** - * Describes the rotation of the device display - * @syscap SystemCapability.Test.UiTest + * Represents an Component of the ohos application,user can perform operations or query attributes on it. + * * @since 9 - */ -declare enum DisplayRotation { - ROTATION_0, - ROTATION_90, - ROTATION_180, - ROTATION_270 -} - -/** - * Represents the point on the device screen. + * @test * @syscap SystemCapability.Test.UiTest - * @since 9 */ -declare interface Point { - readonly X: number; - readonly Y: number; -} +declare class Component { + /** + * Click this {@link Component}. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @throws {BusinessError} 17000002 if the async function was not called with await. + * @throws {BusinessError} 17000004 if the component is invisible or destroyed. + * @throws {BusinessError} 17000006 if there is a system internal error. + * @test + */ + click(): Promise; -/** - * Represents the rectangle area on the device screen. - * @syscap SystemCapability.Test.UiTest - * @since 9 - */ -declare interface Rect { - readonly leftX: number; - readonly topY: number; - readonly rightX: number; - readonly bottomY: number; -} + /** + * Double click this {@link Component}. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @throws {BusinessError} 17000002 if the async function was not called with await. + * @throws {BusinessError} 17000004 if the component is invisible or destroyed. + * @throws {BusinessError} 17000006 if there is a system internal error. + * @test + */ + doubleClick(): Promise; -/** - * Represents filer condition to get the window . - * @syscap SystemCapability.Test.UiTest - * @since 9 - */ -declare interface WindowFilter { - readonly bundleName?: string; - readonly title?: string; - readonly focused?: boolean; - readonly actived?: boolean; -} + /** + * Long click this {@link Component}. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @throws {BusinessError} 17000002 if the async function was not called with await. + * @throws {BusinessError} 17000004 if the component is invisible or destroyed. + * @throws {BusinessError} 17000006 if there is a system internal error. + * @test + */ + longClick(): Promise; -/** - * Describes the attribute requirements for the target UiComponents. - * - * @since 8 - * @syscap SystemCapability.Test.UiTest - */ - declare class By{ - - /** - * Specifies the text for the target UiComponent. - * @syscap SystemCapability.Test.UiTest - * @param txt the text value. - * @param pattern the {@link MatchPattern} of the text value,default to {@link MatchPattern.EQUALS} - * @return Returns this {@link By} object. - * @since 8 - * @test - */ - text(txt:string,pattern?:MatchPattern):By; - - /** - * Specifies the inspectorKey of the target UiComponent. - * @syscap SystemCapability.Test.UiTest - * @param key the inspectorKey value. - * @return Returns this {@link By} object. - * @since 8 - * @test - */ - key(key:string):By; - - /** - * Specifies the id of the target UiComponent. - * @syscap SystemCapability.Test.UiTest - * @param id the id value. - * @return Returns this {@link By} object. - * @since 8 - * @test - */ - id(id:number):By; - - /** - * Specifies the type of the target UiComponent. - * @syscap SystemCapability.Test.UiTest - * @param tp the type value. - * @return Returns this {@link By} object. - * @since 8 - * @test - */ - type(tp:string):By; - - /** - * Specifies the clickable status of the target UiComponent. - * @syscap SystemCapability.Test.UiTest - * @param b the clickable status,default to true. - * @return Returns this {@link By} object. - * @since 8 - * @test - */ - clickable(b?:boolean):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?: boolean): By; - - /** - * Specifies the scrollable status of the target UiComponent. - * @syscap SystemCapability.Test.UiTest - * @param b the scrollable status,default to true. - * @return Returns this {@link By} object. - * @since 8 - * @test - */ - scrollable(b?:boolean):By; - - /** - * Specifies the enabled status of the target UiComponent. - * @syscap SystemCapability.Test.UiTest - * @param b the enabled status,default to true. - * @return Returns this {@link By} object. - * @since 8 - * @test - */ - enabled(b?:boolean):By; - - /** - * Specifies the focused status of the target UiComponent. - * @syscap SystemCapability.Test.UiTest - * @param b the focused status,default to true. - * @return Returns this {@link By} object. - * @since 8 - * @test - */ - focused(b?:boolean):By; - - /** - * Specifies the selected status of the target UiComponent. - * @syscap SystemCapability.Test.UiTest - * @param b the selected status,default to true. - * @return Returns this {@link By} object. - * @since 8 - * @test - */ - selected(b?:boolean):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?: boolean): 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?: boolean): By; - - /** - * Requires that the target UiComponent which is before another UiComponent that specified by the given {@link By} - * object,used to locate UiComponent relatively. - * @syscap SystemCapability.Test.UiTest - * @param by describes the attribute requirements of UiComponent which the target one is in front of. - * @return Returns this {@link By} object. - * @since 8 - * @test - */ - isBefore(by:By):By; - - /** - * Requires that the target UiComponent which is after another UiComponent that specified by the given {@link By} - * object,used to locate UiComponent relatively. - * @syscap SystemCapability.Test.UiTest - * @param by describes the attribute requirements of UiComponent which the target one is in back of. - * @return Returns this {@link By} object. - * @since 8 - * @test - */ - isAfter(by:By):By; - } + /** + * Get the id attribute value. + * @syscap SystemCapability.Test.UiTest + * @returns the id value. + * @throws {BusinessError} 17000002 if the async function was not called with await. + * @throws {BusinessError} 17000004 if the component is invisible or destroyed. + * @throws {BusinessError} 17000006 if there is a system internal error. + * @since 9 + * @test + */ + getId(): Promise; -/** - * Represents a UiComponent of the ohos application,user can perform operations or query attributes on it. - * - * @since 8 - * @test - * @syscap SystemCapability.Test.UiTest - */ -declare class UiComponent{ - /** - * Click this {@link UiComponent}. - * @syscap SystemCapability.Test.UiTest - * @since 8 - * @test - */ - click():Promise; - - /** - * Double click this {@link UiComponent}. - * @syscap SystemCapability.Test.UiTest - * @since 8 - * @test - */ - doubleClick():Promise; - - /** - * Long click this {@link UiComponent}. - * @syscap SystemCapability.Test.UiTest - * @since 8 - * @test - */ - longClick():Promise; - - /** - * Get the id attribute value. - * @syscap SystemCapability.Test.UiTest - * @returns the id value. - * @since 8 - * @test - */ - getId():Promise; - - /** - * Get the inspectorKey attribute value. - * @syscap SystemCapability.Test.UiTest - * @returns the inspectorKey value. - * @since 8 - * @test - */ - getKey():Promise; - - /** - * Get the text attribute value. - * @syscap SystemCapability.Test.UiTest - * @since 8 - * @test - */ - getText():Promise; - - /** - * Get the type name. - * @syscap SystemCapability.Test.UiTest - * @returns the type name. - * @since 8 - * @test - */ - getType():Promise; - - /** - * Get the clickable status of this {@link UiComponent}. - * @syscap SystemCapability.Test.UiTest - * @returns the clickable status. - * @since 8 - * @test - */ - 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 - * @returns the scrollable status. - * @since 8 - * @test - */ - isScrollable():Promise; - - /** - * Get the enabled status of this {@link UiComponent}. - * @syscap SystemCapability.Test.UiTest - * @returns the enabled status. - * @since 8 - * @test - */ - isEnabled():Promise; - - /** - * Get the focused status of this {@link UiComponent}. - * @syscap SystemCapability.Test.UiTest - * @returns the focused status. - * @since 8 - * @test - */ - isFocused():Promise; - - /** - * Get the selected status of this {@link UiComponent}. - * @syscap SystemCapability.Test.UiTest - * @returns the selected status. - * @since 8 - * @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 - * @param text the text to inject. - * @since 8 - * @test - */ - 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 (pixels per second),default is 600,the value ranges from 200 to 3000,set it 600 if out of range. - * @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 (pixels per second),default is 600,the value ranges from 200 to 3000,set it 600 if out of range. - * @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 - * @param by the attribute requirements of the target {@link UiComponent}. - * @return the found result,or undefined if not found. - * @since 8 - * @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; - - /** - * Pinch enlarge this {@link UiComponent} to the target scale. - * @syscap SystemCapability.Test.UiTest - * @param scale the scale of the pinch enlarge this {@link UiComponent}'s size. - * @since 9 - * @test - */ - pinchOut(scale: number): Promise; - - /** - * Pinch shrink this {@link UiComponent} to the target scale. - * @syscap SystemCapability.Test.UiTest - * @param scale the scale of the pinch shrink this {@link UiComponent}'s size. - * @since 9 - * @test - */ - pinchIn(scale: number): Promise; + /** + * Get the text attribute value. + * @syscap SystemCapability.Test.UiTest + * @throws {BusinessError} 17000002 if the async function was not called with await. + * @throws {BusinessError} 17000004 if the component is invisible or destroyed. + * @throws {BusinessError} 17000006 if there is a system internal error. + * @since 9 + * @test + */ + getText(): Promise; + + /** + * Get the type name. + * @syscap SystemCapability.Test.UiTest + * @returns the type name. + * @throws {BusinessError} 17000002 if the async function was not called with await. + * @throws {BusinessError} 17000004 if the component is invisible or destroyed. + * @throws {BusinessError} 17000006 if there is a system internal error. + * @since 9 + * @test + */ + getType(): Promise; + + /** + * Get the clickable status of this {@link Component}. + * @syscap SystemCapability.Test.UiTest + * @returns the clickable status. + * @throws {BusinessError} 17000002 if the async function was not called with await. + * @throws {BusinessError} 17000004 if the component is invisible or destroyed. + * @throws {BusinessError} 17000006 if there is a system internal error. + * @since 9 + * @test + */ + isClickable(): Promise; + + /** + * Get the longClickable status of this {@link Component}. + * @syscap SystemCapability.Test.UiTest + * @returns the longClickable status. + * @throws {BusinessError} 17000002 if the async function was not called with await. + * @throws {BusinessError} 17000004 if the component is invisible or destroyed. + * @throws {BusinessError} 17000006 if there is a system internal error. + * @since 9 + * @test + */ + isLongClickable(): Promise; + + /** + * Get the scrollable status of this {@link Component}. + * @syscap SystemCapability.Test.UiTest + * @returns the scrollable status. + * @throws {BusinessError} 17000002 if the async function was not called with await. + * @throws {BusinessError} 17000004 if the component is invisible or destroyed. + * @throws {BusinessError} 17000006 if there is a system internal error. + * @since 9 + * @test + */ + isScrollable(): Promise; + + /** + * Get the enabled status of this {@link Component}. + * @syscap SystemCapability.Test.UiTest + * @returns the enabled status. + * @throws {BusinessError} 17000002 if the async function was not called with await. + * @throws {BusinessError} 17000004 if the component is invisible or destroyed. + * @throws {BusinessError} 17000006 if there is a system internal error. + * @since 9 + * @test + */ + isEnabled(): Promise; + + /** + * Get the focused status of this {@link Component}. + * @syscap SystemCapability.Test.UiTest + * @returns the focused status. + * @throws {BusinessError} 17000002 if the async function was not called with await. + * @throws {BusinessError} 17000004 if the component is invisible or destroyed. + * @throws {BusinessError} 17000006 if there is a system internal error. + * @since 9 + * @test + */ + isFocused(): Promise; + + /** + * Get the selected status of this {@link Component}. + * @syscap SystemCapability.Test.UiTest + * @returns the selected status. + * @throws {BusinessError} 17000002 if the async function was not called with await. + * @throws {BusinessError} 17000004 if the component is invisible or destroyed. + * @throws {BusinessError} 17000006 if there is a system internal error. + * @since 9 + * @test + */ + isSelected(): Promise; + + /** + * Get the checked status of this {@link Component}. + * @syscap SystemCapability.Test.UiTest + * @returns the checked status. + * @throws {BusinessError} 17000002 if the async function was not called with await. + * @throws {BusinessError} 17000004 if the component is invisible or destroyed. + * @throws {BusinessError} 17000006 if there is a system internal error. + * @since 9 + * @test + */ + isChecked(): Promise; + + /** + * Get the checkable status of this {@link Component}. + * @syscap SystemCapability.Test.UiTest + * @returns the checkable status. + * @throws {BusinessError} 17000002 if the async function was not called with await. + * @throws {BusinessError} 17000004 if the component is invisible or destroyed. + * @throws {BusinessError} 17000006 if there is a system internal error. + * @since 9 + * @test + */ + isCheckable(): Promise; + + /** + * Inject text to this {@link Component},applicable to TextInput. + * @syscap SystemCapability.Test.UiTest + * @param text the text to inject. + * @throws {BusinessError} 401 if the input parameters are invalid. + * @throws {BusinessError} 17000002 if the async function was not called with await. + * @throws {BusinessError} 17000004 if the component is invisible or destroyed. + * @throws {BusinessError} 17000006 if there is a system internal error. + * @since 9 + * @test + */ + inputText(text: string): Promise; + + /** + * Clear text of this {@link Component},applicable to TextInput. + * @syscap SystemCapability.Test.UiTest + * @throws {BusinessError} 17000002 if the async function was not called with await. + * @throws {BusinessError} 17000004 if the component is invisible or destroyed. + * @throws {BusinessError} 17000006 if there is a system internal error. + * @since 9 + * @test + */ + clearText(): Promise; + + /** + * Scroll on this {@link Component} to the top,applicable to scrollable one. + * @syscap SystemCapability.Test.UiTest + * @param speed the speed of swipe (pixels per second),default is 600,the value ranges from 200 to 15000,set it 600 if out of range. + * @throws {BusinessError} 401 if the input parameters are invalid. + * @throws {BusinessError} 17000002 if the async function was not called with await. + * @throws {BusinessError} 17000004 if the component is invisible or destroyed. + * @throws {BusinessError} 17000006 if there is a system internal error. + * @since 9 + * @test + */ + scrollToTop(speed?: number): Promise; + + /** + * Scroll on this {@link Component} to the bottom,applicable to scrollable one. + * @syscap SystemCapability.Test.UiTest + * @param speed the speed of swipe (pixels per second),default is 600,the value ranges from 200 to 15000,set it 600 if out of range. + * @throws {BusinessError} 401 if the input parameters are invalid. + * @throws {BusinessError} 17000002 if the async function was not called with await. + * @throws {BusinessError} 17000004 if the component is invisible or destroyed. + * @throws {BusinessError} 17000006 if there is a system internal error. + * @since 9 + * @test + */ + scrollToBottom(speed?: number): Promise; + + /** + * Scroll on this {@link Component}to find matched {@link Component},applicable to scrollable one. + * @syscap SystemCapability.Test.UiTest + * @param on the attribute requirements of the target {@link Component}. + * @return the found result,or undefined if not found. + * @throws {BusinessError} 401 if the input parameters are invalid. + * @throws {BusinessError} 17000002 if the async function was not called with await. + * @throws {BusinessError} 17000004 if the component is invisible or destroyed. + * @throws {BusinessError} 17000006 if there is a system internal error. + * @since 9 + * @test + */ + scrollSearch(on: On): Promise; + + /** + * Get the bounds rect of this {@link Component}. + * @syscap SystemCapability.Test.UiTest + * @return the bounds rect object. + * @throws {BusinessError} 17000002 if the async function was not called with await. + * @throws {BusinessError} 17000004 if the component is invisible or destroyed. + * @throws {BusinessError} 17000006 if there is a system internal error. + * @since 9 + * @test + */ + getBounds(): Promise; + + /** + * Get the boundsCenter of this {@link Component}. + * @syscap SystemCapability.Test.UiTest + * @return the boundsCenter object. + * @throws {BusinessError} 17000002 if the async function was not called with await. + * @throws {BusinessError} 17000004 if the component is invisible or destroyed. + * @throws {BusinessError} 17000006 if there is a system internal error. + * @since 9 + * @test + */ + getBoundsCenter(): Promise; + + /** + * Drag this {@link Component} to the bounds rect of target Component. + * @syscap SystemCapability.Test.UiTest + * @param target the target {@link Component}. + * @throws {BusinessError} 401 if the input parameters are invalid. + * @throws {BusinessError} 17000002 if the async function was not called with await. + * @throws {BusinessError} 17000004 if the component is invisible or destroyed. + * @throws {BusinessError} 17000006 if there is a system internal error. + * @since 9 + * @test + */ + dragTo(target: Component): Promise; + + /** + * Pinch enlarge this {@link Component} to the target scale. + * @syscap SystemCapability.Test.UiTest + * @param scale the scale of the pinch enlarge this {@link Component}'s size. + * @throws {BusinessError} 401 if the input parameters are invalid. + * @throws {BusinessError} 17000002 if the async function was not called with await. + * @throws {BusinessError} 17000004 if the component is invisible or destroyed. + * @throws {BusinessError} 17000006 if there is a system internal error. + * @since 9 + * @test + */ + pinchOut(scale: number): Promise; + + /** + * Pinch shrink this {@link Component} to the target scale. + * @syscap SystemCapability.Test.UiTest + * @param scale the scale of the pinch shrink this {@link Component}'s size. + * @throws {BusinessError} 401 if the input parameters are invalid. + * @throws {BusinessError} 17000002 if the async function was not called with await. + * @throws {BusinessError} 17000004 if the component is invisible or destroyed. + * @throws {BusinessError} 17000006 if there is a system internal error. + * @since 9 + * @test + */ + pinchIn(scale: number): Promise; } /** - * The unified facade of UiTest framework,can be used to find {@link UiComponent},trigger keyEvents,perform + * The unified facade of UiTest framework,can be used to find {@link Component},trigger keyEvents,perform * coordinates-based UI actions,capture screen and so on. * - * @since 8 + * @since 9 * @test * @syscap SystemCapability.Test.UiTest */ - declare class UiDriver{ +declare class Driver { /** - * Create an {@link UiDriver} object. + * Create an {@link Driver} object. * @syscap SystemCapability.Test.UiTest - * @returns the {@link UiDriver} object. - * @since 8 + * @returns the {@link Driver} object. + * @throws {BusinessError} 17000001 if the test framework failed to initialize. + * @throws {BusinessError} 17000006 if there is a system internal error. + * @since 9 * @test */ - static create():UiDriver; + static create(): Driver; /** * Delay with specified duration. * @syscap SystemCapability.Test.UiTest * @param duration the delay duration in milliseconds. - * @since 8 + * @throws {BusinessError} 401 if the input parameters are invalid. + * @throws {BusinessError} 17000002 if the async function was not called with await. + * @throws {BusinessError} 17000006 if there is a system internal error. + * @since 9 * @test */ - delayMs(duration:number):Promise; + delayMs(duration: number): Promise; /** - * Find the first matched {@link UiComponent} on current UI. + * Find the first matched {@link Component} on current UI. * @syscap SystemCapability.Test.UiTest - * @param by the attribute requirements of the target {@link UiComponent}. - * @returns the first matched {@link UiComponent} or undefined. - * @since 8 + * @param on the attribute requirements of the target {@link Component}. + * @returns the first matched {@link Component} or undefined. + * @throws {BusinessError} 401 if the input parameters are invalid. + * @throws {BusinessError} 17000002 if the async function was not called with await. + * @throws {BusinessError} 17000006 if there is a system internal error. + * @since 9 * @test */ - findComponent(by:By):Promise; + findComponent(on: On): Promise; /** * Find the first matched {@link UiWindow} window. * @syscap SystemCapability.Test.UiTest * @param filter the filer condition of the target {@link UiWindow}. * @returns the first matched {@link UiWindow} or undefined. + * @throws {BusinessError} 401 if the input parameters are invalid. + * @throws {BusinessError} 17000002 if the async function was not called with await. + * @throws {BusinessError} 17000006 if there is a system internal error. * @since 9 * @test */ - findWindow(filter:WindowFilter):Promise; + findWindow(filter: WindowFilter): Promise; /** - * Find the first matched {@link UiComponent} on current UI during the time given. + * Find the first matched {@link Component} on current UI during the time given. * @syscap SystemCapability.Test.UiTest - * @param by the attribute requirements of the target {@link UiComponent}. + * @param on the attribute requirements of the target {@link Component}. * @param time duration of finding in milliseconds - * @returns the first matched {@link UiComponent} or undefined. + * @returns the first matched {@link Component} or undefined. + * @throws {BusinessError} 401 if the input parameters are invalid. + * @throws {BusinessError} 17000002 if the async function was not called with await. + * @throws {BusinessError} 17000006 if there is a system internal error. * @since 9 * @test */ - waitForComponent(by: By, time: number): Promise; + waitForComponent(on: On, time: number): Promise; /** - * Find all the matched {@link UiComponent}s on current UI. + * Find all the matched {@link Component}s on current UI. * @syscap SystemCapability.Test.UiTest - * @param by the attribute requirements of the target {@link UiComponent}. - * @returns the matched {@link UiComponent}s list. - * @since 8 + * @param on the attribute requirements of the target {@link Component}. + * @returns the matched {@link Component}s list. + * @throws {BusinessError} 401 if the input parameters are invalid. + * @throws {BusinessError} 17000002 if the async function was not called with await. + * @throws {BusinessError} 17000006 if there is a system internal error. + * @since 9 * @test */ - findComponents(by:By):Promise>; + findComponents(on: On): Promise>; /** - * Assert t the matched {@link UiComponent}s exists on current UI;if not,assertError will be raised. + * Assert t the matched {@link Component}s exists on current UI;if not,assertError will be raised. * @syscap SystemCapability.Test.UiTest - * @param by the attribute requirements of the target {@link UiComponent}. - * @throws Throws this exception if following error occurs:{@code ComponentExistAssertion Failure}. - * @since 8 + * @param on the attribute requirements of the target {@link Component}. + * @throws {BusinessError} 401 if the input parameters are invalid. + * @throws {BusinessError} 17000002 if the async function was not called with await. + * @throws {BusinessError} 17000006 if there is a system internal error. + * @since 9 * @test */ - assertComponentExist(by:By):Promise; + assertComponentExist(on: On): Promise; /** * Press the BACK key. * @syscap SystemCapability.Test.UiTest - * @since 8 + * @throws {BusinessError} 17000002 if the async function was not called with await. + * @throws {BusinessError} 17000006 if there is a system internal error. + * @since 9 * @test */ - pressBack():Promise; + pressBack(): Promise; /** * Press the specified key. * @syscap SystemCapability.Test.UiTest * @param keyCode the target keyCode. - * @since 8 + * @throws {BusinessError} 401 if the input parameters are invalid. + * @throws {BusinessError} 17000002 if the async function was not called with await. + * @throws {BusinessError} 17000006 if there is a system internal error. + * @since 9 * @test */ - triggerKey(keyCode:number):Promise; + triggerKey(keyCode: number): Promise; /** * Press two or three key combinations @@ -605,6 +1099,9 @@ declare class UiComponent{ * @param key0 the first keyCode. * @param key1 the second keyCode. * @param key2 the third keyCode. + * @throws {BusinessError} 401 if the input parameters are invalid. + * @throws {BusinessError} 17000002 if the async function was not called with await. + * @throws {BusinessError} 17000006 if there is a system internal error. * @since 9 * @test */ @@ -615,43 +1112,39 @@ declare class UiComponent{ * @syscap SystemCapability.Test.UiTest * @param x the x-coordinate. * @param y the y-coordinate. - * @since 8 + * @throws {BusinessError} 401 if the input parameters are invalid. + * @throws {BusinessError} 17000002 if the async function was not called with await. + * @throws {BusinessError} 17000006 if there is a system internal error. + * @since 9 * @test */ - click(x:number,y:number):Promise; + click(x: number, y: number): Promise; /** * DoubleClick on the specified location on the screen. * @syscap SystemCapability.Test.UiTest * @param x the x-coordinate. * @param y the y-coordinate. - * @since 8 + * @throws {BusinessError} 401 if the input parameters are invalid. + * @throws {BusinessError} 17000002 if the async function was not called with await. + * @throws {BusinessError} 17000006 if there is a system internal error. + * @since 9 * @test */ - doubleClick(x:number,y:number):Promise; + doubleClick(x: number, y: number): Promise; /** * LongClick on the specified location on the screen. * @syscap SystemCapability.Test.UiTest * @param x the x-coordinate. * @param y the y-coordinate. - * @since 8 - * @test - */ - longClick(x:number,y:number):Promise; - - /** - * Swipe 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. - * @deprecated since 9 - * @since 8 + * @throws {BusinessError} 401 if the input parameters are invalid. + * @throws {BusinessError} 17000002 if the async function was not called with await. + * @throws {BusinessError} 17000006 if there is a system internal error. + * @since 9 * @test */ - swipe(startx:number,starty:number,endx:number,endy:number):Promise; + longClick(x: number, y: number): Promise; /** * Swipe on the screen between the specified points. @@ -660,20 +1153,26 @@ declare class UiComponent{ * @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 (pixels per second),default is 600,the value ranges from 200 to 3000,set it 600 if out of range. + * @param speed the speed of swipe (pixels per second),default is 600,the value ranges from 200 to 15000,set it 600 if out of range. + * @throws {BusinessError} 401 if the input parameters are invalid. + * @throws {BusinessError} 17000002 if the async function was not called with await. + * @throws {BusinessError} 17000006 if there is a system internal error. * @since 9 * @test */ - swipe(startx:number,starty:number,endx:number,endy:number, speed?: 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 swipe (pixels per second),default is 600,the value ranges from 200 to 3000,set it 600 if out of range. + * @param speed the speed of swipe (pixels per second),default is 600,the value ranges from 200 to 15000,set it 600 if out of range. + * @throws {BusinessError} 401 if the input parameters are invalid. + * @throws {BusinessError} 17000002 if the async function was not called with await. + * @throws {BusinessError} 17000006 if there is a system internal error. * @since 9 * @test */ @@ -684,71 +1183,90 @@ declare class UiComponent{ * @syscap SystemCapability.Test.UiTest * @param savePath the path where to store the picture. * @returns true if screen-capturing and file-storing are completed successfully,false otherwise. - * @since 8 + * @throws {BusinessError} 401 if the input parameters are invalid. + * @throws {BusinessError} 17000002 if the async function was not called with await. + * @throws {BusinessError} 17000006 if there is a system internal error. + * @since 9 * @test */ - screenCap(savePath:string):Promise; + screenCap(savePath: string): Promise; /** * Set the rotation of the device display. * @syscap SystemCapability.Test.UiTest * @param rotation the target rotation to set. + * @throws {BusinessError} 401 if the input parameters are invalid. + * @throws {BusinessError} 17000002 if the async function was not called with await. + * @throws {BusinessError} 17000006 if there is a system internal error. * @since 9 * @test */ - setDisplayRotation(rotation: DisplayRotation):Promise; + setDisplayRotation(rotation: DisplayRotation): Promise; /** * Get the rotation of the device display. * @syscap SystemCapability.Test.UiTest * @returns the current display rotation. + * @throws {BusinessError} 17000002 if the async function was not called with await. + * @throws {BusinessError} 17000006 if there is a system internal error. * @since 9 * @test */ - getDisplayRotation():Promise; + getDisplayRotation(): Promise; /** * Enable/disable the rotation of device display. * @syscap SystemCapability.Test.UiTest * @param enabled enable the rotation or not. + * @throws {BusinessError} 401 if the input parameters are invalid. + * @throws {BusinessError} 17000002 if the async function was not called with await. + * @throws {BusinessError} 17000006 if there is a system internal error. * @since 9 * @test */ - setDisplayRotationEnabled(enabled:boolean):Promise; + setDisplayRotationEnabled(enabled: boolean): Promise; /** * Get the size of the device display. * @syscap SystemCapability.Test.UiTest * @returns the size of the device display. + * @throws {BusinessError} 17000002 if the async function was not called with await. + * @throws {BusinessError} 17000006 if there is a system internal error. * @since 9 * @test */ - getDisplaySize():Promise; + getDisplaySize(): Promise; /** * Get the density of the device display. * @syscap SystemCapability.Test.UiTest * @returns the density of the device display. + * @throws {BusinessError} 17000002 if the async function was not called with await. + * @throws {BusinessError} 17000006 if there is a system internal error. * @since 9 * @test */ - getDisplayDensity():Promise; + getDisplayDensity(): Promise; /** * Wake up the device display. * @syscap SystemCapability.Test.UiTest + * @throws {BusinessError} 17000002 if the async function was not called with await. + * @throws {BusinessError} 17000006 if there is a system internal error. * @since 9 * @test */ - wakeUpDisplay():Promise; + wakeUpDisplay(): Promise; /** * Press the home key. * @syscap SystemCapability.Test.UiTest + * @throws {BusinessError} 17000002 if the async function was not called with await. + * @throws {BusinessError} 17000006 if there is a system internal error. * @since 9 * @test */ - pressHome():Promise; + pressHome(): Promise; /** * Wait for the UI become idle. @@ -756,10 +1274,13 @@ declare class UiComponent{ * @param idleTime the threshold of UI idle time, in millisecond. * @param timeout the maximum time to wait for idle, in millisecond. * @returns true if wait for idle succeed in the timeout, false otherwise. + * @throws {BusinessError} 401 if the input parameters are invalid. + * @throws {BusinessError} 17000002 if the async function was not called with await. + * @throws {BusinessError} 17000006 if there is a system internal error. * @since 9 * @test */ - waitForIdle(idleTime: number, timeout: number):Promise; + waitForIdle(idleTime: number, timeout: number): Promise; /** * Inject fling on the device display. @@ -767,157 +1288,210 @@ declare class UiComponent{ * @param from the coordinate point where the finger touches the screen. * @param to the coordinate point where the finger leaves the screen. * @param stepLen the length of each step, in pixels. - * @param speed the speed of fling (pixels per second),default is 600,the value ranges from 200 to 3000,set it 600 if out of range. + * @param speed the speed of fling (pixels per second),default is 600,the value ranges from 200 to 15000,set it 600 if out of range. + * @throws {BusinessError} 401 if the input parameters are invalid. + * @throws {BusinessError} 17000002 if the async function was not called with await. + * @throws {BusinessError} 17000006 if there is a system internal error. * @since 9 * @test */ - fling(from: Point, to: Point, stepLen: number, speed: number):Promise; + fling(from: Point, to: Point, stepLen: number, speed: number): Promise; /** * Inject multi-pointer action on the device display. * @syscap SystemCapability.Test.UiTest * @param pointers the two-dimensional array of pointers to inject. - * @param speed the speed of swipe (pixels per second),default is 600,the value ranges from 200 to 3000,set it 600 if out of range. + * @param speed the speed of swipe (pixels per second),default is 600,the value ranges from 200 to 15000,set it 600 if out of range. + * @returns true if the operation finished, false + * @throws {BusinessError} 401 if the input parameters are invalid. + * @throws {BusinessError} 17000002 if the async function was not called with await. + * @throws {BusinessError} 17000006 if there is a system internal error. * @since 9 * @test */ - injectMultiPointerAction(pointers: PointerMatrix, speed?: number):Promise; + injectMultiPointerAction(pointers: PointerMatrix, speed?: number): Promise; } /** - * - * * @since 9 * @test * @syscap SystemCapability.Test.UiTest */ - declare class UiWindow{ +declare class UiWindow { /** * Get the bundle name of this {@link UiWindow}. * @syscap SystemCapability.Test.UiTest * @returns the bundle name. + * @throws {BusinessError} 17000002 if the async function was not called with await. + * @throws {BusinessError} 17000004 if the window is invisible or destroyed. + * @throws {BusinessError} 17000006 if there is a system internal error. * @since 9 * @test */ - getBundleName():Promise; + getBundleName(): Promise; /** * Get the bounds rect of this {@link UiWindow}. * @syscap SystemCapability.Test.UiTest * @return the bounds rect object. + * @throws {BusinessError} 17000002 if the async function was not called with await. + * @throws {BusinessError} 17000004 if the window is invisible or destroyed. + * @throws {BusinessError} 17000006 if there is a system internal error. * @since 9 * @test */ - getBounds():Promise; - + getBounds(): Promise; + /** * Get the title of this {@link UiWindow}. * @syscap SystemCapability.Test.UiTest * @returns the title value. + * @throws {BusinessError} 17000002 if the async function was not called with await. + * @throws {BusinessError} 17000004 if the window is invisible or destroyed. + * @throws {BusinessError} 17000006 if there is a system internal error. * @since 9 * @test */ - getTitle():Promise; - + getTitle(): Promise; + /** - * Get the windoe mode of this {@link UiWindow}. + * Get the window mode of this {@link UiWindow}. * @syscap SystemCapability.Test.UiTest - * @returns the {@link WindowMode} object. + * @returns the {@link WindowMode} object + * @throws {BusinessError} 17000002 if the async function was not called with await. + * @throws {BusinessError} 17000004 if the window is invisible or destroyed. + * @throws {BusinessError} 17000006 if there is a system internal error. * @since 9 * @test */ - getWindowMode():Promise; + getWindowMode(): Promise; /** * Get the focused status of this {@link UiWindow}. * @syscap SystemCapability.Test.UiTest * @returns the focused status + * @throws {BusinessError} 17000002 if the async function was not called with await. + * @throws {BusinessError} 17000004 if the window is invisible or destroyed. + * @throws {BusinessError} 17000006 if there is a system internal error. * @since 9 * @test */ - isFocused():Promise; + isFocused(): Promise; /** - * Get the actived status of this {@link UiWindow}. + * Get the active status of this {@link UiWindow}. * @syscap SystemCapability.Test.UiTest * @returns the actived status + * @throws {BusinessError} 17000002 if the async function was not called with await. + * @throws {BusinessError} 17000004 if the window is invisible or destroyed. + * @throws {BusinessError} 17000006 if there is a system internal error. * @since 9 * @test */ - isActived():Promise; + isActived(): Promise; /** * Set the focused status of this {@link UiWindow}. * @syscap SystemCapability.Test.UiTest - * @returns the result of focus action + * @throws {BusinessError} 17000002 if the async function was not called with await. + * @throws {BusinessError} 17000004 if the window is invisible or destroyed. + * @throws {BusinessError} 17000006 if there is a system internal error. * @since 9 * @test */ - focus():Promise; + focus(): Promise; /** * Move this {@link UiWindow} to the specified points. * @syscap SystemCapability.Test.UiTest - * @returns the result of move action + * @param x the x coordinate of destination. + * @param y the y coordinate of destination. + * @throws {BusinessError} 401 if the input parameters are invalid. + * @throws {BusinessError} 17000002 if the async function was not called with await. + * @throws {BusinessError} 17000004 if the window is invisible or destroyed. + * @throws {BusinessError} 17000005 if the action is not supported on this window. + * @throws {BusinessError} 17000006 if there is a system internal error. * @since 9 * @test */ - moveTo(x: number, y: number):Promise; + moveTo(x: number, y: number): Promise; /** * Resize this {@link UiWindow} to the specified size for the specified direction. * @syscap SystemCapability.Test.UiTest - * @returns the result of resize action + * @param wide the expected wide of the window after resizing. + * @param height the expected height of the window after resizing. + * @param direction the expected direction of the window after resizing. + * @throws {BusinessError} 401 if the input parameters are invalid. + * @throws {BusinessError} 17000002 if the async function was not called with await. + * @throws {BusinessError} 17000004 if the window is invisible or destroyed. + * @throws {BusinessError} 17000005 if the action is not supported on this window. + * @throws {BusinessError} 17000006 if there is a system internal error. * @since 9 * @test */ - resize(wide: number, height: number, direction: ResizeDirection):Promise; + resize(wide: number, height: number, direction: ResizeDirection): Promise; /** * Change this {@link UiWindow} into split screen mode. * @syscap SystemCapability.Test.UiTest - * @returns the result of split action + * @throws {BusinessError} 17000002 if the async function was not called with await. + * @throws {BusinessError} 17000004 if the window is invisible or destroyed. + * @throws {BusinessError} 17000005 if the action is not supported on this window. + * @throws {BusinessError} 17000006 if there is a system internal error. * @since 9 * @test */ - split():Promise; + split(): Promise; /** * Maximize this {@link UiWindow}. * @syscap SystemCapability.Test.UiTest - * @returns the result of maximize action + * @throws {BusinessError} 17000002 if the async function was not called with await. + * @throws {BusinessError} 17000004 if the window is invisible or destroyed. + * @throws {BusinessError} 17000005 if the action is not supported on this window. + * @throws {BusinessError} 17000006 if there is a system internal error. * @since 9 * @test */ - maximize():Promise; + maximize(): Promise; /** * Minimize this {@link UiWindow}. * @syscap SystemCapability.Test.UiTest - * @returns the result of minimize action + * @throws {BusinessError} 17000002 if the async function was not called with await. + * @throws {BusinessError} 17000004 if the window is invisible or destroyed. + * @throws {BusinessError} 17000005 if the action is not supported on this window. + * @throws {BusinessError} 17000006 if there is a system internal error. * @since 9 * @test */ - minimize():Promise; + minimize(): Promise; /** * Resume this {@link UiWindow}. * @syscap SystemCapability.Test.UiTest - * @returns the result of resume action + * @throws {BusinessError} 17000002 if the async function was not called with await. + * @throws {BusinessError} 17000004 if the window is invisible or destroyed. + * @throws {BusinessError} 17000005 if the action is not supported on this window. + * @throws {BusinessError} 17000006 if there is a system internal error. * @since 9 * @test */ - resume():Promise; + resume(): Promise; /** * Close this {@link UiWindow}. * @syscap SystemCapability.Test.UiTest - * @returns the result of close action + * @throws {BusinessError} 17000002 if the async function was not called with await. + * @throws {BusinessError} 17000004 if the window is invisible or destroyed. + * @throws {BusinessError} 17000005 if the action is not supported on this window. + * @throws {BusinessError} 17000006 if there is a system internal error. * @since 9 * @test */ - close():Promise; - } + close(): Promise; +} /** * Represents a two-dimensional array of pointers on the device display, it's used to build a @@ -928,35 +1502,47 @@ declare class UiComponent{ * @syscap SystemCapability.Test.UiTest */ declare class PointerMatrix { - /** + /** * Create an {@link PointerMatrix} object. * @syscap SystemCapability.Test.UiTest * @param fingers the number of fingers. * @param steps the number of steps of each finger trace. * @returns the {@link PointerMatrix} object. + * @throws {BusinessError} 401 if the input parameters are invalid. + * @throws {BusinessError} 17000006 if there is a system internal error. * @since 9 * @test */ - static create(fingers: number, steps: number):PointerMatrix; + static create(fingers: number, steps: number): PointerMatrix; - /** - * Set the point value of an element in the PointerMatrix. - * @syscap SystemCapability.Test.UiTest - * @param finger the index of target finger to set. - * @param step the index of target step to set. - * @param point the coordinate of target step to set. - * @since 9 - * @test - */ - setPoint(finger: number, step: number, point: Point):void; + /** + * Set the point value of an element in the PointerMatrix. + * @syscap SystemCapability.Test.UiTest + * @param finger the index of target finger to set. + * @param step the index of target step to set. + * @param point the coordinate of target step to set. + * @throws {BusinessError} 401 if the input parameters are invalid. + * @throws {BusinessError} 17000006 if there is a system internal error. + * @since 9 + * @test + */ + setPoint(finger: number, step: number, point: Point): void; } /** * The static builder for building {@link By}object conveniently,usage example:BY.text('txt').enabled(true). * @syscap SystemCapability.Test.UiTest * @since 8 + * @deprecated since 9 + * @test + */ +declare const BY: By; +/** + * The static builder for building {@link On}object conveniently,usage example:ON.text('txt').enabled(true). + * @syscap SystemCapability.Test.UiTest + * @since 9 * @test */ - declare const BY:By; +declare const ON: On; - export {UiComponent,UiDriver,UiWindow,BY,MatchPattern,DisplayRotation,ResizeDirection,WindowMode,PointerMatrix}; +export {UiComponent, UiDriver, Component, Driver, UiWindow, ON, BY, MatchPattern, DisplayRotation, ResizeDirection, WindowMode, PointerMatrix};