diff --git a/api/@ohos.UiTest.d.ts b/api/@ohos.UiTest.d.ts index 5d8b1069b0130a9ee1028b6cd14722b481ddd1cb..0330339106ceb190e4f2584d355134b1df62823a 100755 --- a/api/@ohos.UiTest.d.ts +++ b/api/@ohos.UiTest.d.ts @@ -1932,9 +1932,8 @@ declare class On { * @syscap SystemCapability.Test.UiTest * @crossplatform * @atomicservice - * @since arkts {'1.1':'11','1.2':'20'} + * @since 11 * @test - * @arkts 1.1&1.2 */ id(id: string): On; @@ -1968,9 +1967,8 @@ declare class On { * @syscap SystemCapability.Test.UiTest * @crossplatform * @atomicservice - * @since arkts {'1.1':'11','1.2':'20'} + * @since 11 * @test - * @arkts 1.1&1.2 */ type(tp: string): On; @@ -2403,11 +2401,43 @@ declare class On { * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. * @syscap SystemCapability.Test.UiTest * @atomicservice - * @since arkts {'1.1':'18','1.2':'20'} + * @since 18 * @test - * @arkts 1.1&1.2 */ id(id: string, pattern: MatchPattern): On; + + /** + * @arkts 1.2 + */ + overload id { idString, idStringMatchPattern }; + + /** + * Specifies the id of the target Component. + * + * @param { string } id - the id value. + * @returns { On } this {@link On} object. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Test.UiTest + * @since 20 + * @test + * @arkts 1.2 + */ + idString(id: string): On; + + /** + * Specifies the id of the target Component. + * + * @param { string } id - the id value. + * @param { MatchPattern } pattern - the {@link MatchPattern} of the text value,Set it default {@link MatchPattern.EQUALS} if null or undefined. + * @returns { On } this {@link On} object. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Test.UiTest + * @since 20 + * @test + * @arkts 1.2 + */ + idStringMatchPattern (id: string, pattern: MatchPattern): On; + /** * Specifies the type of the target Component. * @@ -2417,11 +2447,43 @@ declare class On { * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. * @syscap SystemCapability.Test.UiTest * @atomicservice - * @since arkts {'1.1':'18','1.2':'20'} + * @since 18 * @test - * @arkts 1.1&1.2 */ type(tp: string, pattern: MatchPattern): On; + + /** + * @arkts 1.2 + */ + overload type { typeString, typeStringMatchPattern }; + + /** + * Specifies the type of the target Component. + * + * @param { string } tp - The type value. + * @returns { On } this {@link On} object. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Test.UiTest + * @since 20 + * @test + * @arkts 1.2 + */ + typeString(tp: string): On; + + /** + * Specifies the type of the target Component. + * + * @param { string } tp - The type value. + * @param { MatchPattern } pattern - the {@link MatchPattern} of the text value,Set it default {@link MatchPattern.EQUALS} if null or undefined. + * @returns { On } this {@link On} object. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Test.UiTest + * @since 20 + * @test + * @arkts 1.2 + */ + typeStringMatchPattern(tp: string, pattern: MatchPattern): On; + /** * Specifies the hint for the target Component. * @@ -3034,9 +3096,8 @@ declare class Component { * @syscap SystemCapability.Test.UiTest * @crossplatform * @atomicservice - * @since arkts {'1.1':'11','1.2':'20'} + * @since 11 * @test - * @arkts 1.1&1.2 */ inputText(text: string): Promise; @@ -3052,12 +3113,48 @@ declare class Component { * @throws { BusinessError } 17000004 - The window or component is invisible or destroyed. * @syscap SystemCapability.Test.UiTest * @atomicservice - * @since arkts {'1.1':'20','1.2':'20'} + * @since 20 * @test - * @arkts 1.1&1.2 */ inputText(text: string, mode: InputTextMode): Promise; + /** + * @arkts 1.2 + */ + overload inputText { inputTextWithText, inputTextWithTextMode }; + + /** + * Inject text to this {@link Component},applicable to TextInput. + * + * @param { string } text - the text to inject. + * @returns { Promise } + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 17000002 - The async function is not called with await. + * @throws { BusinessError } 17000004 - The window or component is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @since 20 + * @test + * @arkts 1.2 + */ + inputTextWithText(text: string): Promise; + + /** + * Inject text to this {@link Component},applicable to TextInput. + * + * @param { string } text - the text to inject. + * @param { InputTextMode } mode - specific the mode to input text. + * @returns { Promise } + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported, function can not work correctly due to limited device capabilities. + * @throws { BusinessError } 17000002 - The async function is not called with await. + * @throws { BusinessError } 17000004 - The window or component is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @since 20 + * @test + * @arkts 1.2 + */ + inputTextWithTextMode(text: string, mode: InputTextMode): Promise; + /** * Clear text of this {@link Component},applicable to TextInput. * @@ -3375,8 +3472,10 @@ declare class Component { * @arkts 1.1&1.2 */ pinchIn(scale: double): Promise; - - + /** + * @arkts 1.2 + */ + overload scrollSearch { scrollSearchReturnsPromise, scrollSearchWithVerticalOffsetReturnsPromise }; /** * Scroll on this {@link Component}to find matched {@link Component},applicable to scrollable one. * @@ -3390,7 +3489,7 @@ declare class Component { * @test * @arkts 1.2 */ - scrollSearch(on: On): Promise; + scrollSearchReturnsPromise(on: On): Promise; /** * Get the description attribute value. * @@ -3398,7 +3497,6 @@ declare class Component { * @throws { BusinessError } 17000002 - The async function is not called with await. * @throws { BusinessError } 17000004 - The window or component is invisible or destroyed. * @syscap SystemCapability.Test.UiTest - * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @test * @arkts 1.1&1.2 @@ -3448,7 +3546,7 @@ declare class Component { * @test * @arkts 1.2 */ - scrollSearch(on: On, vertical?: boolean, offset?: int): Promise; + scrollSearchWithVerticalOffsetReturnsPromise (on: On, vertical?: boolean, offset?: int): Promise; /** * Get the original text attribute value. * If the accessibility property 'accessibilityLevel' of a component is set to 'no' or 'no-hide-descendants', @@ -3813,9 +3911,8 @@ declare class Driver { * @syscap SystemCapability.Test.UiTest * @crossplatform * @atomicservice - * @since arkts {'1.1':'11','1.2':'20'} + * @since 11 * @test - * @arkts 1.1&1.2 */ pressBack(): Promise; @@ -3828,12 +3925,42 @@ declare class Driver { * @throws { BusinessError } 17000007 - Parameter verification failed. * @syscap SystemCapability.Test.UiTest * @atomicservice - * @since arkts {'1.1':'20','1.2':'20'} + * @since 20 * @test - * @arkts 1.1&1.2 */ pressBack(displayId: int): Promise; + /** + * @arkts 1.2 + */ + overload pressBack { pressBackReturnsPromise, pressBackWithDisplayIdReturnsPromise }; + + /** + * Press the BACK key. + * + * @returns { Promise } + * @throws { BusinessError } 17000002 - The async function is not called with await. + * @syscap SystemCapability.Test.UiTest + * @since 20 + * @test + * @arkts 1.2 + */ + pressBackReturnsPromise(): Promise; + + /** + * Press the BACK key on the specified display. + * + * @param { int } displayId - the Id of the specified display. + * @returns { Promise } + * @throws { BusinessError } 17000002 - The async function is not called with await. + * @throws { BusinessError } 17000007 - Parameter verification failed. + * @syscap SystemCapability.Test.UiTest + * @since 20 + * @test + * @arkts 1.2 + */ + pressBackWithDisplayIdReturnsPromise(displayId: int): Promise; + /** * Press the specified key. * @@ -3855,9 +3982,8 @@ declare class Driver { * @syscap SystemCapability.Test.UiTest * @crossplatform * @atomicservice - * @since arkts {'1.1':'11','1.2':'20'} + * @since 11 * @test - * @arkts 1.1&1.2 */ triggerKey(keyCode: int): Promise; @@ -3871,12 +3997,46 @@ declare class Driver { * @throws { BusinessError } 17000002 - The async function is not called with await. * @syscap SystemCapability.Test.UiTest * @atomicservice - * @since arkts {'1.1':'20','1.2':'20'} + * @since 20 * @test - * @arkts 1.1&1.2 */ triggerKey(keyCode: int, displayId: int): Promise; + /** + * @arkts 1.2 + */ + overload triggerKey { triggerKeyWithKeyCode, triggerKeyWithKeyCodeDisplayId }; + + /** + * Press the specified key. + * + * @param { int } keyCode - the target keyCode. + * @returns { Promise } + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 17000002 - The async function is not called with await. + * @syscap SystemCapability.Test.UiTest + * @since 20 + * @test + * @arkts 1.2 + */ + triggerKeyWithKeyCode(keyCode: int): Promise; + + /** + * Press the specified key on the specified display. + * + * @param { int } keyCode - the target keyCode. + * @param { int } displayId - the Id of the specified display. + * @returns { Promise } + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 17000002 - The async function is not called with await. + * @syscap SystemCapability.Test.UiTest + * @since 20 + * @test + * @arkts 1.2 + */ + triggerKeyWithKeyCodeDisplayId(keyCode: int, displayId: int): Promise; + + /** * Press two or three key combinations * @@ -4357,9 +4517,8 @@ declare class Driver { * @throws { BusinessError } 17000002 - The async function is not called with await. * @syscap SystemCapability.Test.UiTest * @atomicservice - * @since arkts {'1.1':'11','1.2':'20'} + * @since 11 * @test - * @arkts 1.1&1.2 */ getDisplaySize(): Promise; @@ -4372,12 +4531,42 @@ declare class Driver { * @throws { BusinessError } 17000007 - Parameter verification failed. * @syscap SystemCapability.Test.UiTest * @atomicservice - * @since arkts {'1.1':'20','1.2':'20'} + * @since 20 * @test - * @arkts 1.1&1.2 */ getDisplaySize(displayId: int): Promise; + /** + * @arkts 1.2 + */ + overload getDisplaySize { getDisplaySizeReturnsPromise, getDisplaySizeWithdisplayIdReturnsPromise }; + + /** + * Get the size of the device display. + * + * @returns { Promise } the size of the device display. + * @throws { BusinessError } 17000002 - The async function is not called with await. + * @syscap SystemCapability.Test.UiTest + * @since 20 + * @test + * @arkts 1.2 + */ + getDisplaySizeReturnsPromise(): Promise; + + /** + * Get the size of the specified device display. + * + * @param { int } displayId - the Id of the specified display. + * @returns { Promise } the size of the device display. + * @throws { BusinessError } 17000002 - The async function is not called with await. + * @throws { BusinessError } 17000007 - Parameter verification failed. + * @syscap SystemCapability.Test.UiTest + * @since 20 + * @test + * @arkts 1.2 + */ + getDisplaySizeWithdisplayIdReturnsPromise(displayId: int): Promise; + /** * Get the density of the device display. * @@ -4452,9 +4641,8 @@ declare class Driver { * @throws { BusinessError } 17000002 - The async function is not called with await. * @syscap SystemCapability.Test.UiTest * @atomicservice - * @since arkts {'1.1':'11','1.2':'20'} + * @since 11 * @test - * @arkts 1.1&1.2 */ pressHome(): Promise; @@ -4467,12 +4655,42 @@ declare class Driver { * @throws { BusinessError } 17000007 - Parameter verification failed. * @syscap SystemCapability.Test.UiTest * @atomicservice - * @since arkts {'1.1':'20','1.2':'20'} + * @since 20 * @test - * @arkts 1.1&1.2 */ pressHome(displayId: int): Promise; + /** + * @arkts 1.2 + */ + overload pressHome { pressHomeReturnsPromise, pressHomeWithdisplayIdReturnsPromise }; + + /** + * Press the home key. + * + * @returns { Promise } + * @throws { BusinessError } 17000002 - The async function is not called with await. + * @syscap SystemCapability.Test.UiTest + * @since 20 + * @test + * @arkts 1.2 + */ + pressHomeReturnsPromise(): Promise; + + /** + * Press the home key to the specified display. + * + * @param { int } displayId - the Id of the specified display. + * @returns { Promise } + * @throws { BusinessError } 17000002 - The async function is not called with await. + * @throws { BusinessError } 17000007 - Parameter verification failed. + * @syscap SystemCapability.Test.UiTest + * @since 20 + * @test + * @arkts 1.2 + */ + pressHomeWithdisplayIdReturnsPromise(displayId: int): Promise; + /** * Wait for the UI become idle. * @@ -4543,9 +4761,8 @@ declare class Driver { * @syscap SystemCapability.Test.UiTest * @crossplatform * @atomicservice - * @since arkts {'1.1':'11','1.2':'20'} + * @since 11 * @test - * @arkts 1.1&1.2 */ fling(from: Point, to: Point, stepLen: int, speed: int): Promise; @@ -4614,9 +4831,8 @@ declare class Driver { * @syscap SystemCapability.Test.UiTest * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} + * @since 12 * @test - * @arkts 1.1&1.2 */ fling(direction: UiDirection, speed: int): Promise; @@ -4631,12 +4847,64 @@ declare class Driver { * @throws { BusinessError } 17000002 - The async function is not called with await. * @syscap SystemCapability.Test.UiTest * @atomicservice - * @since arkts {'1.1':'20','1.2':'20'} + * @since 20 * @test - * @arkts 1.1&1.2 */ fling(direction: UiDirection, speed: int, displayId: int): Promise; + /** + * @arkts 1.2 + */ + overload fling { flingWithFromToStepLen, flingWithDirection, flingWithDirectionDisplayId }; + + /** + * Inject fling on the device display. + * + * @param { Point } from - the coordinate point where the finger touches the screen. + * @param { Point } to - the coordinate point where the finger leaves the screen. + * @param { int } stepLen - the length of each step, in pixels. + * @param { int } [speed] - the speed of fling(pixels per second),ranges from 200 to 40000. Set it default 600 if out of range or null or undefined. + * @returns { Promise } + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 17000002 - The async function is not called with await. + * @syscap SystemCapability.Test.UiTest + * @since 20 + * @test + * @arkts 1.2 + */ + flingWithFromToStepLen(from: Point, to: Point, stepLen: int, speed: int): Promise; + + /** + * Inject fling on the device display. + * + * @param { UiDirection } direction - the direction of this action. + * @param { int } speed - the speed of fling (pixels per second),default is 600,the value ranges from 200 to 40000,set it 600 if out of range. + * @returns { Promise } + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 17000002 - The async function is not called with await. + * @syscap SystemCapability.Test.UiTest + * @since 20 + * @test + * @arkts 1.2 + */ + flingWithDirection(direction: UiDirection, speed: int): Promise; + + /** + * Inject fling on the specified device display. + * + * @param { UiDirection } direction - the direction of this action. + * @param { int } speed - the speed of fling (pixels per second),default is 600,the value ranges from 200 to 40000,set it 600 if out of range. + * @param { int } displayId - the Id of the specified display. + * @returns { Promise } + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 17000002 - The async function is not called with await. + * @syscap SystemCapability.Test.UiTest + * @since 20 + * @test + * @arkts 1.2 + */ + flingWithDirectionDisplayId(direction: UiDirection, speed: int, displayId: int): Promise; + /** * Click on the specified location on the screen with the specified mouse button, and press the specified key simultaneously if necessary. * @@ -4723,9 +4991,8 @@ declare class Driver { * @throws { BusinessError } 17000002 - The async function is not called with await. * @syscap SystemCapability.Test.UiTest * @atomicservice - * @since arkts {'1.1':'11','1.2':'20'} + * @since 11 * @test - * @arkts 1.1&1.2 */ mouseScroll(p: Point, down: boolean, d: int, key1?: int, key2?: int): Promise; @@ -4743,12 +5010,53 @@ declare class Driver { * @throws { BusinessError } 17000002 - The async function is not called with await. * @syscap SystemCapability.Test.UiTest * @atomicservice - * @since arkts {'1.1':'11','1.2':'20'} + * @since 11 * @test - * @arkts 1.1&1.2 */ mouseScroll(p: Point, down: boolean, d: int, key1?: int, key2?: int, speed?: int): Promise; + /** + * @arkts 1.2 + */ + overload mouseScroll { mouseScrollReturnsPromise, mouseScrollWithSpeedReturnsPromise }; + + /** + * The mouse wheel scrolls the specified cell at the specified position, and press the specified key simultaneously if necessary. + * + * @param { Point } p - the coordinate of the specified location. + * @param { boolean } down - whether the mouse wheel rolls down. + * @param { int } d - the number of cells that the mouse wheel scrolls, each cell will make the target point shift 120 pixels. + * @param { int } [key1] - the first keyCode,set it default 0 if null or undefined. + * @param { int } [key2] - the second keyCode,set it default 0 if null or undefined. + * @returns { Promise } + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 17000002 - The async function is not called with await. + * @syscap SystemCapability.Test.UiTest + * @since 20 + * @test + * @arkts 1.2 + */ + mouseScrollReturnsPromise(p: Point, down: boolean, d: int, key1?: int, key2?: int): Promise; + + /** + * The mouse wheel scrolls the specified cell at the specified position, and press the specified key simultaneously if necessary. + * + * @param { Point } p - the coordinate of the specified location. + * @param { boolean } down - whether the mouse wheel rolls down. + * @param { int } d - the number of cells that the mouse wheel scrolls, each cell will make the target point shift 120 pixels. + * @param { int } [key1] - the first keyCode,set it default 0 if null or undefined. + * @param { int } [key2] - the second keyCode,set it default 0 if null or undefined. + * @param { int } [speed] - The Speed of mouse wheel rolls(cells per second),ranges from 1 to 500.Set it default 20 if out of range or null or undefined. + * @returns { Promise } + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 17000002 - The async function is not called with await. + * @syscap SystemCapability.Test.UiTest + * @since 20 + * @test + * @arkts 1.2 + */ + mouseScrollWithSpeedReturnsPromise(p: Point, down: boolean, d: int, key1?: int, key2?: int, speed?: int): Promise; + /** * Capture the specified area of current screen and save as picture which PNG format. * @@ -4914,9 +5222,8 @@ declare class Driver { * @throws { BusinessError } 17000002 - The async function is not called with await. * @syscap SystemCapability.Test.UiTest * @atomicservice - * @since arkts {'1.1':'11','1.2':'20'} + * @since 11 * @test - * @arkts 1.1&1.2 */ inputText(p: Point, text: string): Promise; @@ -4932,12 +5239,48 @@ declare class Driver { * @throws { BusinessError } 17000002 - The async function is not called with await. * @syscap SystemCapability.Test.UiTest * @atomicservice - * @since arkts {'1.1':'20','1.2':'20'} + * @since arkts 20 * @test - * @arkts 1.1&1.2 */ inputText(p: Point, text: string, mode: InputTextMode): Promise; + /** + * @arkts 1.2 + */ + overload inputText { inputTextReturnsPromise, inputTextWithModeReturnsPromise }; + + /** + * Inject text on the specified location. + * + * @param { Point } p - the coordinate of the specified location. + * @param { string } text - the text to inject. + * @returns { Promise } + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 17000002 - The async function is not called with await. + * @syscap SystemCapability.Test.UiTest + * @since 20 + * @test + * @arkts 1.2 + */ + inputTextReturnsPromise(p: Point, text: string): Promise; + + /** + * Inject text on the specified location, default to input at the coordinate of the specified location. + * + * @param { Point } p - the coordinate of the specified location. + * @param { string } text - the text to inject. + * @param { InputTextMode } mode - specific the mode to input text. + * @returns { Promise } + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not support, function can not work correctly due to limited device capabilities. + * @throws { BusinessError } 17000002 - The async function is not called with await. + * @syscap SystemCapability.Test.UiTest + * @since 20 + * @test + * @arkts 1.2 + */ + inputTextWithModeReturnsPromise(p: Point, text: string, mode: InputTextMode): Promise; + /** * Simulate touchpad multi-finger swipe gestures. * @param { int } fingers Finger count of touchpad multi-finger swipe, ranges from 3 to 4.