diff --git a/api/@ohos.uitest.d.ts b/api/@ohos.uitest.d.ts index 354d22d738c1e27bcb0748521934a62ba752b84f..52045d42607b429bb57384e1c221d393fdb1141b 100755 --- a/api/@ohos.uitest.d.ts +++ b/api/@ohos.uitest.d.ts @@ -13,6 +13,21 @@ * limitations under the License. */ +/** + * Resize dircetion for the window. + * + * @since 9 + */ + enum ResizeDirection{ + LEFT, + RIGHT, + UP, + DOWN, + LEFT_UP, + LEFT_DOWN, + RIGHT_UP, + RIGHT_DOWN + } /** * Enumerates the string value match pattern. * @@ -49,6 +64,28 @@ ENDS_WITH = 3 } +/** + * Describes the window mode of the tested window + * + * @since 9 + */ + enum WindowMode{ + FULLSCREEN, + PRIMARY, + SECONDARY, + FLOATING + } + +/** + * 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. * @@ -61,6 +98,18 @@ declare interface Rect { readonly bottomY: number; } +/** + * Represents filer condation to get the window . + * + * @since 9 + */ +declare interface WindowFilter { + readonly bundleNmae?: string; + readonly title?: string; + readonly focused?: bool; + readonly actived?: bool; +} + /** * Describes the attribute requirements for the target UiComponents. * @@ -212,14 +261,14 @@ declare interface Rect { isAfter(by:By):By; } - /** - * Represents a UiComponent of the ohos application,user can perform operations or query attributes on it. - * - * @since 8 - * @test - * @syscap SystemCapability.Test.UiTest - */ - class UiComponent{ +/** + * Represents a UiComponent of the ohos application,user can perform operations or query attributes on it. + * + * @since 8 + * @test + * @syscap SystemCapability.Test.UiTest + */ +class UiComponent{ /** * Click this {@link UiComponent}. * @syscap SystemCapability.Test.UiTest @@ -371,18 +420,20 @@ declare interface Rect { /** * 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 0 to 3000,set it 3000 if greater than 3000. * @since 9 * @test */ - scrollToTop(): Promise; + 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 0 to 3000,set it 3000 if greater than 3000. * @since 9 * @test */ - scrollToBottom(): Promise; + scrollToBottom(speed?: number): Promise; /** * Scroll on this {@link UiComponent}to find matched {@link UiComponent},applicable to scrollable one. @@ -403,6 +454,15 @@ declare interface Rect { */ 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 @@ -450,6 +510,16 @@ declare interface Rect { */ findComponent(by:By):Promise; + /** + * Find the first matched {@link UiWindow} window. + * @syscap SystemCapability.Test.UiTest + * @param filter the filer condation of the target {@link UiWindow}. + * @returns the first matched {@link UiWindow} or undefined. + * @since 9 + * @test + */ + findWindow(filter:WindowFilter):Promise; + /** * Find the first matched {@link UiComponent} on current UI during the time given. * @syscap SystemCapability.Test.UiTest @@ -535,10 +605,11 @@ declare interface Rect { * @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 0 to 3000,set it 3000 if greater than 3000. * @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. @@ -547,10 +618,11 @@ declare interface Rect { * @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 0 to 3000,set it 3000 if greater than 3000. * @since 9 * @test */ - drag(startx: number, starty: number, endx: number, endy: number): Promise; + drag(startx: number, starty: number, endx: number, endy: number, speed?: number): Promise; /** * Capture current screen and save as picture which PNG format. @@ -563,6 +635,141 @@ declare interface Rect { screenCap(savePath:string):Promise; } +/** + * + * + * @since 9 + * @test + * @syscap SystemCapability.Test.UiTest + */ + class UiWindow{ + /** + * Get the bundle name of this {@link UiWindow}. + * @syscap SystemCapability.Test.UiTest + * @returns the bundle name. + * @since 9 + * @test + */ + getBundleName():Promise; + + /** + * Get the bounds rect of this {@link UiWindow}. + * @syscap SystemCapability.Test.UiTest + * @return the bounds rect object. + * @since 9 + * @test + */ + getBounds():Promise; + + /** + * Get the title of this {@link UiWindow}. + * @syscap SystemCapability.Test.UiTest + * @returns the title value. + * @since 9 + * @test + */ + getTitle():Promise; + + /** + * Get the windoe mode of this {@link UiWindow}. + * @syscap SystemCapability.Test.UiTest + * @returns the {@link WindowMode} object. + * @since 9 + * @test + */ + getWindowMode():Promise; + + /** + * Get the focused status of this {@link UiWindow}. + * @syscap SystemCapability.Test.UiTest + * @returns the focused status + * @since 9 + * @test + */ + isFocused():Promise; + + /** + * Get the actived status of this {@link UiWindow}. + * @syscap SystemCapability.Test.UiTest + * @returns the actived status + * @since 9 + * @test + */ + isActived():Promise; + + /** + * Set the focused status of this {@link UiWindow}. + * @syscap SystemCapability.Test.UiTest + * @returns the result of focus action + * @since 9 + * @test + */ + focus():Promise; + + /** + * Move this {@link UiWindow} to the specified points. + * @syscap SystemCapability.Test.UiTest + * @returns the result of move action + * @since 9 + * @test + */ + 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 + * @since 9 + * @test + */ + 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 + * @since 9 + * @test + */ + split():Promise; + + /** + * Maximize this {@link UiWindow}. + * @syscap SystemCapability.Test.UiTest + * @returns the result of maximize action + * @since 9 + * @test + */ + maximize():Promise; + + /** + * Minimize this {@link UiWindow}. + * @syscap SystemCapability.Test.UiTest + * @returns the result of minimize action + * @since 9 + * @test + */ + minimize():Promise; + + /** + * Resume this {@link UiWindow}. + * @syscap SystemCapability.Test.UiTest + * @returns the result of resume action + * @since 9 + * @test + */ + resume():Promise; + + /** + * Close this {@link UiWindow}. + * @syscap SystemCapability.Test.UiTest + * @returns the result of close action + * @since 9 + * @test + */ + close():Promise; + } + /** * The static builder for building {@link By}object conveniently,usage example:BY.text('txt').enabled(true). * @syscap SystemCapability.Test.UiTest