From d0447c8db36f8e6a039fdb14e100c3014eefd3c7 Mon Sep 17 00:00:00 2001 From: wanglongjin Date: Tue, 8 Mar 2022 08:55:19 +0000 Subject: [PATCH 1/5] =?UTF-8?q?uitest=E6=A1=86=E6=9E=B6=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E6=8F=8F=E8=BF=B0=E6=96=87=E4=BB=B6=20uitest=E6=A1=86=E6=9E=B6?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E6=8F=8F=E8=BF=B0=E6=96=87=E4=BB=B6=EF=BC=8C?= =?UTF-8?q?=E4=BE=9B=E5=BC=80=E5=8F=91=E8=80=85=E5=9C=A8IDE=E4=B8=AD?= =?UTF-8?q?=E7=BC=96=E5=86=99UI=E6=B5=8B=E8=AF=95=E7=94=A8=E4=BE=8B?= =?UTF-8?q?=E4=B8=AD=E5=81=9A=E4=BB=A3=E7=A0=81=E6=8F=90=E7=A4=BA=E5=92=8C?= =?UTF-8?q?=E8=81=94=E6=83=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/@ohos.uitest.d.ts.ts | 421 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 421 insertions(+) create mode 100644 api/@ohos.uitest.d.ts.ts diff --git a/api/@ohos.uitest.d.ts.ts b/api/@ohos.uitest.d.ts.ts new file mode 100644 index 0000000000..a884571d43 --- /dev/null +++ b/api/@ohos.uitest.d.ts.ts @@ -0,0 +1,421 @@ +/* + * Copyright (C) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License,Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing,software + * distributed under the License is distributed on an "ASIS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Enumerates the string value match pattern. + * + * @since 8 + */ + enum MatchPattern{ + /**Equals to a string.*/ + EQUALS = 0, + /**Contains a substring.*/ + CONTAINS = 1, + /**StartsWith a substring.*/ + STARTS_WITH = 2, + /**EndsWith a substring.*/ + ENDS_WITH = 3 +} + +/** + * Describes the attribute requirements for the target UiComponents. + * + * @since 8 + * @syscap SystemCapability.Test.UiTest + */ + 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?:bool):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?:bool):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?:bool):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?:bool):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?:bool):By; + + /** + * Requires that the target UiComponent which is before another UiComponent that specified by the given {@link By} + * object,used to locate UiComponent relatively. + * @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 + * @test + * @syscap SystemCapability.Test.UiTest + */ + 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 + * @devices phone,tablet,tv,wearable,car + * @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 + * @test + * @syscap SystemCapability.Test.UiTest + */ + 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; +} + +/** + * The static builder for building {@link By}object conveniently,usage example:BY.text('txt').enabled(true). + * @syscap SystemCapability.Test.UiTest + * @since 8 + * @test + */ + const BY:By; + + export {UiComponent,UiDriver,BY}; \ No newline at end of file -- Gitee From 6ae48f0358b3dca28414e07b3f3e6d90a0d514b0 Mon Sep 17 00:00:00 2001 From: wanglongjin Date: Tue, 8 Mar 2022 08:58:53 +0000 Subject: [PATCH 2/5] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20api/?= =?UTF-8?q?@ohos.uitest.d.ts.ts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/@ohos.uitest.d.ts.ts | 421 --------------------------------------- 1 file changed, 421 deletions(-) delete mode 100644 api/@ohos.uitest.d.ts.ts diff --git a/api/@ohos.uitest.d.ts.ts b/api/@ohos.uitest.d.ts.ts deleted file mode 100644 index a884571d43..0000000000 --- a/api/@ohos.uitest.d.ts.ts +++ /dev/null @@ -1,421 +0,0 @@ -/* - * Copyright (C) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License,Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing,software - * distributed under the License is distributed on an "ASIS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Enumerates the string value match pattern. - * - * @since 8 - */ - enum MatchPattern{ - /**Equals to a string.*/ - EQUALS = 0, - /**Contains a substring.*/ - CONTAINS = 1, - /**StartsWith a substring.*/ - STARTS_WITH = 2, - /**EndsWith a substring.*/ - ENDS_WITH = 3 -} - -/** - * Describes the attribute requirements for the target UiComponents. - * - * @since 8 - * @syscap SystemCapability.Test.UiTest - */ - 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?:bool):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?:bool):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?:bool):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?:bool):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?:bool):By; - - /** - * Requires that the target UiComponent which is before another UiComponent that specified by the given {@link By} - * object,used to locate UiComponent relatively. - * @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 - * @test - * @syscap SystemCapability.Test.UiTest - */ - 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 - * @devices phone,tablet,tv,wearable,car - * @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 - * @test - * @syscap SystemCapability.Test.UiTest - */ - 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; -} - -/** - * The static builder for building {@link By}object conveniently,usage example:BY.text('txt').enabled(true). - * @syscap SystemCapability.Test.UiTest - * @since 8 - * @test - */ - const BY:By; - - export {UiComponent,UiDriver,BY}; \ No newline at end of file -- Gitee From 286a58d7bf131d312e5d36e91ebc15d4c795609c Mon Sep 17 00:00:00 2001 From: wanglongjin Date: Tue, 8 Mar 2022 09:00:19 +0000 Subject: [PATCH 3/5] =?UTF-8?q?uitest=E6=A1=86=E6=9E=B6=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E6=8F=8F=E8=BF=B0=E6=96=87=E4=BB=B6=20uitest=E6=A1=86=E6=9E=B6?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E6=8F=8F=E8=BF=B0=E6=96=87=E4=BB=B6=EF=BC=8C?= =?UTF-8?q?=E4=BE=9B=E5=BC=80=E5=8F=91=E8=80=85=E5=9C=A8IDE=E4=B8=AD?= =?UTF-8?q?=E7=BC=96=E5=86=99UI=E6=B5=8B=E8=AF=95=E7=94=A8=E4=BE=8B?= =?UTF-8?q?=E6=97=B6=E5=81=9A=E4=BB=A3=E7=A0=81=E6=8F=90=E7=A4=BA=E5=92=8C?= =?UTF-8?q?=E8=81=94=E6=83=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- @ohos.uitest.d.ts | 421 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 421 insertions(+) create mode 100644 @ohos.uitest.d.ts diff --git a/@ohos.uitest.d.ts b/@ohos.uitest.d.ts new file mode 100644 index 0000000000..a884571d43 --- /dev/null +++ b/@ohos.uitest.d.ts @@ -0,0 +1,421 @@ +/* + * Copyright (C) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License,Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing,software + * distributed under the License is distributed on an "ASIS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Enumerates the string value match pattern. + * + * @since 8 + */ + enum MatchPattern{ + /**Equals to a string.*/ + EQUALS = 0, + /**Contains a substring.*/ + CONTAINS = 1, + /**StartsWith a substring.*/ + STARTS_WITH = 2, + /**EndsWith a substring.*/ + ENDS_WITH = 3 +} + +/** + * Describes the attribute requirements for the target UiComponents. + * + * @since 8 + * @syscap SystemCapability.Test.UiTest + */ + 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?:bool):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?:bool):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?:bool):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?:bool):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?:bool):By; + + /** + * Requires that the target UiComponent which is before another UiComponent that specified by the given {@link By} + * object,used to locate UiComponent relatively. + * @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 + * @test + * @syscap SystemCapability.Test.UiTest + */ + 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 + * @devices phone,tablet,tv,wearable,car + * @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 + * @test + * @syscap SystemCapability.Test.UiTest + */ + 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; +} + +/** + * The static builder for building {@link By}object conveniently,usage example:BY.text('txt').enabled(true). + * @syscap SystemCapability.Test.UiTest + * @since 8 + * @test + */ + const BY:By; + + export {UiComponent,UiDriver,BY}; \ No newline at end of file -- Gitee From cad7e53107082505ed11caddc2d23ba63f3ef7b7 Mon Sep 17 00:00:00 2001 From: wanglongjin Date: Tue, 8 Mar 2022 09:02:09 +0000 Subject: [PATCH 4/5] =?UTF-8?q?=E6=96=B0=E5=A2=9Euitest=E6=A1=86=E6=9E=B6?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E6=8F=8F=E8=BF=B0=E6=96=87=E4=BB=B6=20?= =?UTF-8?q?=E6=96=B0=E5=A2=9Euitest=E6=A1=86=E6=9E=B6=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E6=8F=8F=E8=BF=B0=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/@ohos.uitest.d.ts | 421 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 421 insertions(+) create mode 100644 api/@ohos.uitest.d.ts diff --git a/api/@ohos.uitest.d.ts b/api/@ohos.uitest.d.ts new file mode 100644 index 0000000000..a884571d43 --- /dev/null +++ b/api/@ohos.uitest.d.ts @@ -0,0 +1,421 @@ +/* + * Copyright (C) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License,Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing,software + * distributed under the License is distributed on an "ASIS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Enumerates the string value match pattern. + * + * @since 8 + */ + enum MatchPattern{ + /**Equals to a string.*/ + EQUALS = 0, + /**Contains a substring.*/ + CONTAINS = 1, + /**StartsWith a substring.*/ + STARTS_WITH = 2, + /**EndsWith a substring.*/ + ENDS_WITH = 3 +} + +/** + * Describes the attribute requirements for the target UiComponents. + * + * @since 8 + * @syscap SystemCapability.Test.UiTest + */ + 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?:bool):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?:bool):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?:bool):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?:bool):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?:bool):By; + + /** + * Requires that the target UiComponent which is before another UiComponent that specified by the given {@link By} + * object,used to locate UiComponent relatively. + * @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 + * @test + * @syscap SystemCapability.Test.UiTest + */ + 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 + * @devices phone,tablet,tv,wearable,car + * @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 + * @test + * @syscap SystemCapability.Test.UiTest + */ + 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; +} + +/** + * The static builder for building {@link By}object conveniently,usage example:BY.text('txt').enabled(true). + * @syscap SystemCapability.Test.UiTest + * @since 8 + * @test + */ + const BY:By; + + export {UiComponent,UiDriver,BY}; \ No newline at end of file -- Gitee From 88f6cc9389583ed66041ef1e61620661c5f88941 Mon Sep 17 00:00:00 2001 From: wanglongjin Date: Tue, 8 Mar 2022 09:28:06 +0000 Subject: [PATCH 5/5] update api/@ohos.uitest.d.ts. Singed-off-by: --- api/@ohos.uitest.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/@ohos.uitest.d.ts b/api/@ohos.uitest.d.ts index a884571d43..1ed61739f3 100644 --- a/api/@ohos.uitest.d.ts +++ b/api/@ohos.uitest.d.ts @@ -40,7 +40,7 @@ * 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} + * @param pattern the {@link MatchPattern} of the text value,default to {@link MatchPattern.EQUALS}. * @return Returns this {@link By} object. * @since 8 * @test -- Gitee