@@ -37,35 +37,80 @@ export enum Platform {
3737}
3838
3939export interface IDevice {
40+ /**
41+ * Helper method to identify which the mobile OS running on the device.
42+ * @returns "android" or "ios"
43+ */
44+ getPlatform : ( ) => Platform ;
45+
46+ /**
47+ * Closes the automation session. This is called automatically after each test.
48+ */
4049 close : ( ) => Promise < void > ;
4150
51+ /**
52+ * Tap on the screen at the given coordinates, specified as x and y. The top left corner
53+ * of the screen is { x: 0, y: 0 }.
54+ *
55+ * @param coordinates to tap on
56+ * @returns
57+ */
4258 tap : ( { x, y } : { x : number ; y : number } ) => Promise < void > ;
4359
60+ /**
61+ * Locate an element on the screen with text content. This method defaults to a
62+ * substring match, and this be overridden by setting the `exact` option to `true`.
63+ *
64+ * **Usage:**
65+ * ```js
66+ * // with string
67+ * const submitButton = device.getByText("Submit");
68+ *
69+ * // with RegExp
70+ * const counter = device.getByText(/^Counter: \d+/);
71+ * ```
72+ *
73+ * @param text string or regular expression to search for
74+ * @param options
75+ * @returns
76+ */
4477 getByText : (
4578 text : string | RegExp ,
4679 options ?: { exact ?: boolean } ,
4780 ) => AppwrightLocator ;
4881
82+ /**
83+ * Locate an element on the screen with accessibility identifier. This method defaults to
84+ * a substring match, and this can be overridden by setting the `exact` option to `true`.
85+ *
86+ * @param text string or regular expression to search for
87+ * @param options
88+ * @returns
89+ */
4990 getById : (
5091 text : string | RegExp ,
5192 options ?: { exact ?: boolean } ,
5293 ) => AppwrightLocator ;
5394
5495 getByXpath : ( xpath : string ) => AppwrightLocator ;
5596
97+ /**
98+ * Retrieves text content from the clipboard of the mobile device. This is useful
99+ * after a "copy to clipboard" action has been performed.
100+ *
101+ * @returns Returns the text content of the clipboard.
102+ */
56103 getClipboardText : ( ) => Promise < string > ;
57104
58105 beta : {
59106 tap : ( prompt : string ) => Promise < void > ;
60107 extractText : ( prompt : string ) => Promise < string > ;
61108 } ;
62-
63- getPlatform : ( ) => Platform ;
64109}
65110
66111export interface AppwrightLocator {
67112 /**
68- * Clicks (taps ) on the element. This method waits for the element to be visible before clicking it.
113+ * Taps (clicks ) on the element. This method waits for the element to be visible before clicking it.
69114 *
70115 * **Usage:**
71116 * ```js
0 commit comments