askui 0.6.1 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/dist/cjs/core/annotation/template.html +11390 -1
  2. package/dist/cjs/core/model/annotation-result/detected-element.d.ts +3 -3
  3. package/dist/cjs/core/model/annotation-result/detected-element.js +4 -4
  4. package/dist/cjs/execution/dsl.d.ts +194 -127
  5. package/dist/cjs/execution/dsl.js +194 -160
  6. package/dist/cjs/execution/ui-controller-client-interface.d.ts +1 -1
  7. package/dist/esm/core/annotation/template.html +11390 -1
  8. package/dist/esm/core/model/annotation-result/detected-element.d.ts +3 -3
  9. package/dist/esm/core/model/annotation-result/detected-element.js +4 -4
  10. package/dist/esm/execution/dsl.d.ts +194 -127
  11. package/dist/esm/execution/dsl.js +194 -160
  12. package/dist/esm/execution/ui-controller-client-interface.d.ts +1 -1
  13. package/package.json +1 -1
  14. package/dist/cjs/core/annotation/annotation-json.d.ts +0 -5
  15. package/dist/cjs/core/annotation/annotation-json.js +0 -2
  16. package/dist/cjs/core/model/test-case-dto/custom-element.spec.d.ts +0 -1
  17. package/dist/cjs/core/model/test-case-dto/custom-element.spec.js +0 -53
  18. package/dist/cjs/execution/dsl.spec.d.ts +0 -1
  19. package/dist/cjs/execution/dsl.spec.js +0 -75
  20. package/dist/cjs/execution/read-environment-credentials.spec.d.ts +0 -1
  21. package/dist/cjs/execution/read-environment-credentials.spec.js +0 -11
  22. package/dist/cjs/lib/ui-controller-args.spec.d.ts +0 -1
  23. package/dist/cjs/lib/ui-controller-args.spec.js +0 -23
  24. package/dist/cjs/utils/http/credentials.spec.d.ts +0 -1
  25. package/dist/cjs/utils/http/credentials.spec.js +0 -11
  26. package/dist/esm/core/annotation/annotation-json.d.ts +0 -5
  27. package/dist/esm/core/annotation/annotation-json.js +0 -1
  28. package/dist/esm/core/model/test-case-dto/custom-element.spec.d.ts +0 -1
  29. package/dist/esm/core/model/test-case-dto/custom-element.spec.js +0 -51
  30. package/dist/esm/execution/dsl.spec.d.ts +0 -1
  31. package/dist/esm/execution/dsl.spec.js +0 -73
  32. package/dist/esm/execution/read-environment-credentials.spec.d.ts +0 -1
  33. package/dist/esm/execution/read-environment-credentials.spec.js +0 -9
  34. package/dist/esm/lib/ui-controller-args.spec.d.ts +0 -1
  35. package/dist/esm/lib/ui-controller-args.spec.js +0 -21
  36. package/dist/esm/utils/http/credentials.spec.d.ts +0 -1
  37. package/dist/esm/utils/http/credentials.spec.js +0 -9
@@ -641,6 +641,11 @@ class FluentFilters extends FluentBase {
641
641
  /**
642
642
  * Filters for an UI element 'button'.
643
643
  *
644
+ * **Examples:**
645
+ * ```typescript
646
+ * await aui.moveMouseTo().button().exec()
647
+ * ```
648
+ *
644
649
  * @return {FluentFiltersOrRelations}
645
650
  */
646
651
  button() {
@@ -714,8 +719,17 @@ class FluentFilters extends FluentBase {
714
719
  * ```typescript
715
720
  * 'text' === withText('text') => true
716
721
  * 'test' === withText('text') => true
722
+ * 'Test' === withText('text') => true
723
+ * 'Text' === withText('text') => true
724
+ * 'TEXT' === withText('text') => true
725
+ * 'texst' === withText('text') => true
726
+ * 'texts' === withText('text') => true
727
+ *
728
+ * // usually false
729
+ * 'atebxtc' === withText('text') => false
717
730
  * 'other' === withText('text') => false
718
731
  * ```
732
+ * ![](https://docs.askui.com/img/gif/withText.gif)
719
733
  *
720
734
  * @param {string} text - A text to be matched.
721
735
  *
@@ -734,9 +748,11 @@ class FluentFilters extends FluentBase {
734
748
  * 'The rain in Spain' === withTextRegex('\b[Ss]\w+') => true
735
749
  * 'The rain in Portugal' === withTextRegex('\b[Ss]\w+') => false
736
750
  * 'The rain in switzerland' === withTextRegex('\b[Ss]\w+') => true
751
+ *
752
+ * await aui.get().text().withTextRegex('\b[Ss]\w+').exec()
737
753
  * ```
738
754
  *
739
- * @param {string} regex_pattern - An regex pattern
755
+ * @param {string} regex_pattern - A regex pattern
740
756
  *
741
757
  * @return {FluentFiltersOrRelations}
742
758
  */
@@ -756,6 +772,8 @@ class FluentFilters extends FluentBase {
756
772
  * 'text' === withExactText('text') => true
757
773
  * 'test' === withExactText('text') => false
758
774
  * 'other' === withExactText('text') => false
775
+ *
776
+ * await aui.moveMouseTo().text().withExactText('Password').exec()
759
777
  * ```
760
778
  *
761
779
  * @param {string} text - A text to be matched.
@@ -775,6 +793,7 @@ class FluentFilters extends FluentBase {
775
793
  * 'This is an text' === containsText('other text') => false
776
794
  * 'This is an text' === containsText('other') => false
777
795
  * ```
796
+ * ![](https://docs.askui.com/img/gif/containsText.gif)
778
797
  *
779
798
  * @param {string} text - A text to be matched.
780
799
  *
@@ -784,17 +803,6 @@ class FluentFilters extends FluentBase {
784
803
  this._textStr = `contain text ${Separators.STRING}${text}${Separators.STRING}`;
785
804
  return new FluentFiltersOrRelations(this);
786
805
  }
787
- /**
788
- * Filters for elements having a specific color.
789
- *
790
- * @param {COLOR} color - A color to match
791
- *
792
- * @return {FluentFiltersOrRelations}
793
- */
794
- colored(color) {
795
- this._textStr = `with color ${color}`;
796
- return new FluentFiltersOrRelations(this);
797
- }
798
806
  }
799
807
  exports.FluentFilters = FluentFilters;
800
808
  // Relations
@@ -827,7 +835,6 @@ class FluentFiltersOrRelations extends FluentFilters {
827
835
  * DetectedElement {
828
836
  * name: 'BUTTON',
829
837
  * text: 'button',
830
- * colors: [ 'red', 'black', 'red' ],
831
838
  * bndbox: BoundingBox {
832
839
  * xmin: 900,
833
840
  * ymin: 910,
@@ -850,21 +857,19 @@ class FluentFiltersOrRelations extends FluentFilters {
850
857
  * **Examples:**
851
858
  * ```text
852
859
  * example scene:
853
- * -------------------------- --------------------------
854
- * | icon user colored black | | icon user colored red |
855
- * -------------------------- --------------------------
856
- * ```
860
+ * --------------- ----------------
861
+ * | icon user | | icon search |
862
+ * --------------- ---------------n```
857
863
  * ```typescript
858
- * const icons = await aui.get().icon().withText('user').exec();
864
+ * const icons = await aui.get().icon().exec();
859
865
  * console.log(icons);
860
866
  * ```
861
- * Using only the filter withText, the get command will return both icons because they share the same text
867
+ * Using only the filter icon, the get command will return both icons
862
868
  * ```text
863
869
  * console output: [
864
870
  * DetectedElement {
865
871
  * name: 'ICON',
866
872
  * text: 'user',
867
- * colors: [ 'black', 'black', 'black' ],
868
873
  * bndbox: BoundingBox {
869
874
  * xmin: 1000,
870
875
  * ymin: 1010,
@@ -874,8 +879,7 @@ class FluentFiltersOrRelations extends FluentFilters {
874
879
  * },
875
880
  * DetectedElement {
876
881
  * name: 'ICON',
877
- * text: 'user',
878
- * colors: [ 'red', 'red', 'red' ],
882
+ * text: 'search',
879
883
  * bndbox: BoundingBox {
880
884
  * xmin: 900,
881
885
  * ymin: 910,
@@ -887,16 +891,15 @@ class FluentFiltersOrRelations extends FluentFilters {
887
891
  * ```
888
892
  * You can combine filters with **the `and()` relation** and specify exactly which icon you want
889
893
  * ```typescript
890
- * const icons = await aui.get().icon().withText('user').and().colored('red').exec()
894
+ * const icons = await aui.get().icon().and().withText('user').exec()
891
895
  * console.log(icons)
892
896
  * ```
893
- * The get command returns only the red icon although both icons have the same text
897
+ * The get command returns only the user icon although both elements are icons
894
898
  * ```text
895
899
  * console output: [
896
900
  * DetectedElement {
897
901
  * name: 'ICON',
898
902
  * text: 'user',
899
- * colors: [ 'red', 'red', 'red' ],
900
903
  * bndbox: BoundingBox {
901
904
  * xmin: 900,
902
905
  * ymin: 910,
@@ -931,6 +934,7 @@ class FluentFiltersOrRelations extends FluentFilters {
931
934
  * // Returns nothing because innerEl is not inside outerEl
932
935
  * ...outerEl().in().innerEl()
933
936
  * ```
937
+ * ![](https://docs.askui.com/img/gif/in.gif)
934
938
  *
935
939
  * @return {FluentFilters}
936
940
  */
@@ -952,6 +956,7 @@ class FluentFiltersOrRelations extends FluentFilters {
952
956
  * // Returns no element because leftEl is left of rightEl
953
957
  * ...leftEl().rightOf().rightEl()
954
958
  * ```
959
+ * ![](https://docs.askui.com/img/gif/rightOf.gif)
955
960
  *
956
961
  * @return {FluentFilters}
957
962
  */
@@ -973,6 +978,7 @@ class FluentFiltersOrRelations extends FluentFilters {
973
978
  * // Returns no element because rightEl is left of leftEl
974
979
  * ...rightEl().leftOf().leftEl()
975
980
  * ```
981
+ * ![](https://docs.askui.com/img/gif/leftOf.gif)
976
982
  *
977
983
  * @return {FluentFilters}
978
984
  */
@@ -997,6 +1003,7 @@ class FluentFiltersOrRelations extends FluentFilters {
997
1003
  * // Returns no element because text is above button
998
1004
  * ...text().below().button()
999
1005
  * ```
1006
+ * ![](https://docs.askui.com/img/gif/below.gif)
1000
1007
  *
1001
1008
  * @return {FluentFilters}
1002
1009
  */
@@ -1021,6 +1028,7 @@ class FluentFiltersOrRelations extends FluentFilters {
1021
1028
  * // Returns no element because button is below text
1022
1029
  * ...button().above().text()
1023
1030
  * ```
1031
+ * ![](https://docs.askui.com/img/gif/above.gif)
1024
1032
  *
1025
1033
  * @return {FluentFilters}
1026
1034
  */
@@ -1049,6 +1057,7 @@ class FluentFiltersOrRelations extends FluentFilters {
1049
1057
  * // Returns button 1 because button 1 is nearer to the text than button 2
1050
1058
  * ...button().nearestTo().text()
1051
1059
  * ```
1060
+ * ![](https://docs.askui.com/img/gif/nearestTo.gif)
1052
1061
  *
1053
1062
  * @return {FluentFilters}
1054
1063
  */
@@ -1074,6 +1083,7 @@ class FluentFiltersOrRelations extends FluentFilters {
1074
1083
  * // Returns no element because innerEl contains no outerEl
1075
1084
  * ...innerEl().contains().outerEl()
1076
1085
  * ```
1086
+ * ![](https://docs.askui.com/img/gif/contains.gif)
1077
1087
  *
1078
1088
  * @return {FluentFilters}
1079
1089
  */
@@ -1667,6 +1677,11 @@ class FluentFiltersCondition extends FluentBase {
1667
1677
  /**
1668
1678
  * Filters for an UI element 'button'.
1669
1679
  *
1680
+ * **Examples:**
1681
+ * ```typescript
1682
+ * await aui.moveMouseTo().button().exec()
1683
+ * ```
1684
+ *
1670
1685
  * @return {FluentFiltersOrRelationsCondition}
1671
1686
  */
1672
1687
  button() {
@@ -1740,8 +1755,17 @@ class FluentFiltersCondition extends FluentBase {
1740
1755
  * ```typescript
1741
1756
  * 'text' === withText('text') => true
1742
1757
  * 'test' === withText('text') => true
1758
+ * 'Test' === withText('text') => true
1759
+ * 'Text' === withText('text') => true
1760
+ * 'TEXT' === withText('text') => true
1761
+ * 'texst' === withText('text') => true
1762
+ * 'texts' === withText('text') => true
1763
+ *
1764
+ * // usually false
1765
+ * 'atebxtc' === withText('text') => false
1743
1766
  * 'other' === withText('text') => false
1744
1767
  * ```
1768
+ * ![](https://docs.askui.com/img/gif/withText.gif)
1745
1769
  *
1746
1770
  * @param {string} text - A text to be matched.
1747
1771
  *
@@ -1760,9 +1784,11 @@ class FluentFiltersCondition extends FluentBase {
1760
1784
  * 'The rain in Spain' === withTextRegex('\b[Ss]\w+') => true
1761
1785
  * 'The rain in Portugal' === withTextRegex('\b[Ss]\w+') => false
1762
1786
  * 'The rain in switzerland' === withTextRegex('\b[Ss]\w+') => true
1787
+ *
1788
+ * await aui.get().text().withTextRegex('\b[Ss]\w+').exec()
1763
1789
  * ```
1764
1790
  *
1765
- * @param {string} regex_pattern - An regex pattern
1791
+ * @param {string} regex_pattern - A regex pattern
1766
1792
  *
1767
1793
  * @return {FluentFiltersOrRelationsCondition}
1768
1794
  */
@@ -1782,6 +1808,8 @@ class FluentFiltersCondition extends FluentBase {
1782
1808
  * 'text' === withExactText('text') => true
1783
1809
  * 'test' === withExactText('text') => false
1784
1810
  * 'other' === withExactText('text') => false
1811
+ *
1812
+ * await aui.moveMouseTo().text().withExactText('Password').exec()
1785
1813
  * ```
1786
1814
  *
1787
1815
  * @param {string} text - A text to be matched.
@@ -1801,6 +1829,7 @@ class FluentFiltersCondition extends FluentBase {
1801
1829
  * 'This is an text' === containsText('other text') => false
1802
1830
  * 'This is an text' === containsText('other') => false
1803
1831
  * ```
1832
+ * ![](https://docs.askui.com/img/gif/containsText.gif)
1804
1833
  *
1805
1834
  * @param {string} text - A text to be matched.
1806
1835
  *
@@ -1810,17 +1839,6 @@ class FluentFiltersCondition extends FluentBase {
1810
1839
  this._textStr = `contain text ${Separators.STRING}${text}${Separators.STRING}`;
1811
1840
  return new FluentFiltersOrRelationsCondition(this);
1812
1841
  }
1813
- /**
1814
- * Filters for elements having a specific color.
1815
- *
1816
- * @param {COLOR} color - A color to match
1817
- *
1818
- * @return {FluentFiltersOrRelationsCondition}
1819
- */
1820
- colored(color) {
1821
- this._textStr = `with color ${color}`;
1822
- return new FluentFiltersOrRelationsCondition(this);
1823
- }
1824
1842
  }
1825
1843
  exports.FluentFiltersCondition = FluentFiltersCondition;
1826
1844
  // Relations
@@ -1853,7 +1871,6 @@ class FluentFiltersOrRelationsCondition extends FluentFiltersCondition {
1853
1871
  * DetectedElement {
1854
1872
  * name: 'BUTTON',
1855
1873
  * text: 'button',
1856
- * colors: [ 'red', 'black', 'red' ],
1857
1874
  * bndbox: BoundingBox {
1858
1875
  * xmin: 900,
1859
1876
  * ymin: 910,
@@ -1876,21 +1893,19 @@ class FluentFiltersOrRelationsCondition extends FluentFiltersCondition {
1876
1893
  * **Examples:**
1877
1894
  * ```text
1878
1895
  * example scene:
1879
- * -------------------------- --------------------------
1880
- * | icon user colored black | | icon user colored red |
1881
- * -------------------------- --------------------------
1882
- * ```
1896
+ * --------------- ----------------
1897
+ * | icon user | | icon search |
1898
+ * --------------- ---------------n```
1883
1899
  * ```typescript
1884
- * const icons = await aui.get().icon().withText('user').exec();
1900
+ * const icons = await aui.get().icon().exec();
1885
1901
  * console.log(icons);
1886
1902
  * ```
1887
- * Using only the filter withText, the get command will return both icons because they share the same text
1903
+ * Using only the filter icon, the get command will return both icons
1888
1904
  * ```text
1889
1905
  * console output: [
1890
1906
  * DetectedElement {
1891
1907
  * name: 'ICON',
1892
1908
  * text: 'user',
1893
- * colors: [ 'black', 'black', 'black' ],
1894
1909
  * bndbox: BoundingBox {
1895
1910
  * xmin: 1000,
1896
1911
  * ymin: 1010,
@@ -1900,8 +1915,7 @@ class FluentFiltersOrRelationsCondition extends FluentFiltersCondition {
1900
1915
  * },
1901
1916
  * DetectedElement {
1902
1917
  * name: 'ICON',
1903
- * text: 'user',
1904
- * colors: [ 'red', 'red', 'red' ],
1918
+ * text: 'search',
1905
1919
  * bndbox: BoundingBox {
1906
1920
  * xmin: 900,
1907
1921
  * ymin: 910,
@@ -1913,16 +1927,15 @@ class FluentFiltersOrRelationsCondition extends FluentFiltersCondition {
1913
1927
  * ```
1914
1928
  * You can combine filters with **the `and()` relation** and specify exactly which icon you want
1915
1929
  * ```typescript
1916
- * const icons = await aui.get().icon().withText('user').and().colored('red').exec()
1930
+ * const icons = await aui.get().icon().and().withText('user').exec()
1917
1931
  * console.log(icons)
1918
1932
  * ```
1919
- * The get command returns only the red icon although both icons have the same text
1933
+ * The get command returns only the user icon although both elements are icons
1920
1934
  * ```text
1921
1935
  * console output: [
1922
1936
  * DetectedElement {
1923
1937
  * name: 'ICON',
1924
1938
  * text: 'user',
1925
- * colors: [ 'red', 'red', 'red' ],
1926
1939
  * bndbox: BoundingBox {
1927
1940
  * xmin: 900,
1928
1941
  * ymin: 910,
@@ -1957,6 +1970,7 @@ class FluentFiltersOrRelationsCondition extends FluentFiltersCondition {
1957
1970
  * // Returns nothing because innerEl is not inside outerEl
1958
1971
  * ...outerEl().in().innerEl()
1959
1972
  * ```
1973
+ * ![](https://docs.askui.com/img/gif/in.gif)
1960
1974
  *
1961
1975
  * @return {FluentFiltersCondition}
1962
1976
  */
@@ -1978,6 +1992,7 @@ class FluentFiltersOrRelationsCondition extends FluentFiltersCondition {
1978
1992
  * // Returns no element because leftEl is left of rightEl
1979
1993
  * ...leftEl().rightOf().rightEl()
1980
1994
  * ```
1995
+ * ![](https://docs.askui.com/img/gif/rightOf.gif)
1981
1996
  *
1982
1997
  * @return {FluentFiltersCondition}
1983
1998
  */
@@ -1999,6 +2014,7 @@ class FluentFiltersOrRelationsCondition extends FluentFiltersCondition {
1999
2014
  * // Returns no element because rightEl is left of leftEl
2000
2015
  * ...rightEl().leftOf().leftEl()
2001
2016
  * ```
2017
+ * ![](https://docs.askui.com/img/gif/leftOf.gif)
2002
2018
  *
2003
2019
  * @return {FluentFiltersCondition}
2004
2020
  */
@@ -2023,6 +2039,7 @@ class FluentFiltersOrRelationsCondition extends FluentFiltersCondition {
2023
2039
  * // Returns no element because text is above button
2024
2040
  * ...text().below().button()
2025
2041
  * ```
2042
+ * ![](https://docs.askui.com/img/gif/below.gif)
2026
2043
  *
2027
2044
  * @return {FluentFiltersCondition}
2028
2045
  */
@@ -2047,6 +2064,7 @@ class FluentFiltersOrRelationsCondition extends FluentFiltersCondition {
2047
2064
  * // Returns no element because button is below text
2048
2065
  * ...button().above().text()
2049
2066
  * ```
2067
+ * ![](https://docs.askui.com/img/gif/above.gif)
2050
2068
  *
2051
2069
  * @return {FluentFiltersCondition}
2052
2070
  */
@@ -2075,6 +2093,7 @@ class FluentFiltersOrRelationsCondition extends FluentFiltersCondition {
2075
2093
  * // Returns button 1 because button 1 is nearer to the text than button 2
2076
2094
  * ...button().nearestTo().text()
2077
2095
  * ```
2096
+ * ![](https://docs.askui.com/img/gif/nearestTo.gif)
2078
2097
  *
2079
2098
  * @return {FluentFiltersCondition}
2080
2099
  */
@@ -2100,6 +2119,7 @@ class FluentFiltersOrRelationsCondition extends FluentFiltersCondition {
2100
2119
  * // Returns no element because innerEl contains no outerEl
2101
2120
  * ...innerEl().contains().outerEl()
2102
2121
  * ```
2122
+ * ![](https://docs.askui.com/img/gif/contains.gif)
2103
2123
  *
2104
2124
  * @return {FluentFiltersCondition}
2105
2125
  */
@@ -2110,6 +2130,11 @@ class FluentFiltersOrRelationsCondition extends FluentFiltersCondition {
2110
2130
  /**
2111
2131
  * Expects that filtered element exists.
2112
2132
  *
2133
+ * **Examples:**
2134
+ * ```typescript
2135
+ * await aui.expect().text().withText('Login').exists().exec()
2136
+ * ```
2137
+ *
2113
2138
  * @return {ExecCondition}
2114
2139
  */
2115
2140
  exists() {
@@ -2119,6 +2144,11 @@ class FluentFiltersOrRelationsCondition extends FluentFiltersCondition {
2119
2144
  /**
2120
2145
  * Expects that filtered element does not exist.
2121
2146
  *
2147
+ * **Examples:**
2148
+ * ```typescript
2149
+ * await aui.expect().text().withText('Login').notExists().exec()
2150
+ * ```
2151
+ *
2122
2152
  * @return {ExecCondition}
2123
2153
  */
2124
2154
  notExists() {
@@ -2135,8 +2165,13 @@ class FluentCommand extends FluentBase {
2135
2165
  super(undefined);
2136
2166
  }
2137
2167
  /**
2138
- * Expects a condition, e.g., `exists()` or `notExits()`,
2139
- * e.g., `...expect().text().withText('Login').exists()`.
2168
+ * Expects a condition, e.g., `exists()` or `notExits()`.
2169
+ *
2170
+ * **Examples:**
2171
+ * ```typescript
2172
+ * await aui.expect().text().withText('Login').exists().exec()
2173
+ * await aui.expect().text().withText('Login').notExists().exec()
2174
+ * ```
2140
2175
  *
2141
2176
  * @return {FluentFiltersCondition}
2142
2177
  */
@@ -2147,6 +2182,11 @@ class FluentCommand extends FluentBase {
2147
2182
  /**
2148
2183
  * Clicks on the filtered element.
2149
2184
  *
2185
+ * **Example:**
2186
+ * ```typescript
2187
+ * await aui.click().button().withText('Submit').exec()
2188
+ * ```
2189
+ *
2150
2190
  * @return {FluentFilters}
2151
2191
  */
2152
2192
  click() {
@@ -2156,6 +2196,11 @@ class FluentCommand extends FluentBase {
2156
2196
  /**
2157
2197
  * Move mouse over the filtered element.
2158
2198
  *
2199
+ * **Example:**
2200
+ * ```typescript
2201
+ * await aui.moveMouseTo().button().withText('Submit').exec()
2202
+ * ```
2203
+ *
2159
2204
  * @return {FluentFilters}
2160
2205
  */
2161
2206
  moveMouseTo() {
@@ -2163,7 +2208,16 @@ class FluentCommand extends FluentBase {
2163
2208
  return new FluentFilters(this);
2164
2209
  }
2165
2210
  /**
2166
- * Types a text inside the filtered element.
2211
+ * Puts the focus on the filtered element and types in the text.
2212
+ *
2213
+ * **Examples:**
2214
+ * ```typescript
2215
+ * await aui.typeIn('Type some text').textfield().exec()
2216
+ *
2217
+ * // mask the text so it is not send to the askui-inference server
2218
+ * await aui.typeIn('Type some text', { isSecret: true, secretMask: '**' }).textfield().exec()
2219
+ * ```
2220
+ * ![](https://docs.askui.com/img/gif/typeIn.gif)
2167
2221
  *
2168
2222
  * @param {string} text - A text to type
2169
2223
  *
@@ -2176,6 +2230,13 @@ class FluentCommand extends FluentBase {
2176
2230
  /**
2177
2231
  * Moves mouse to the filtered element and scrolls in the x and y direction.
2178
2232
  *
2233
+ * **macOS**: May not work as expected!
2234
+ *
2235
+ * **Example:**
2236
+ * ```typescript
2237
+ * await aui.scroll(0, 10).textarea().exec()
2238
+ * ```
2239
+ *
2179
2240
  * @param {number} x_offset - A (positive/negative) x direction.
2180
2241
  * @param {number} y_offset - A (positive/negative) y direction.
2181
2242
  *
@@ -2187,7 +2248,14 @@ class FluentCommand extends FluentBase {
2187
2248
  }
2188
2249
  /**
2189
2250
  * Moves the mouse relatively to an element in the direction.
2190
- * This can be used when the mouse should not hover over on an element anymore.
2251
+ * This can be used when the mouse should not hover over an element anymore.
2252
+ *
2253
+ * **Examples:**
2254
+ * ```typescript
2255
+ * // Move mouse 30 pixels below button
2256
+ * await aui.moveMouseRelativelyTo(0, 30).button().withText('Submit').exec()
2257
+ * ```
2258
+ * ![](https://docs.askui.com/img/gif/moveMouseRelativelyTo.gif)
2191
2259
  *
2192
2260
  * @param {number} x_offset - A (positive/negative) x direction.
2193
2261
  * @param {number} y_offset - A (positive/negative) y direction.
@@ -2199,10 +2267,19 @@ class FluentCommand extends FluentBase {
2199
2267
  return new FluentFilters(this);
2200
2268
  }
2201
2269
  /**
2202
- * Swipe an element in the x and y direction
2270
+ * Swipe an element in the x and y direction.
2271
+ * Holds the left mouse button down on Windows, Linux and macOS and drags the element.
2272
+ * On touch devices it taps the element and then drags it.
2203
2273
  *
2204
- * @param {number} x_offset - A x direction. positive an negative values are accepted
2205
- * @param {number} y_offset - A y direction. positive an negative values are accepted
2274
+ * **Example:**
2275
+ * ```typescript
2276
+ * // Swipe the element 500 to the right
2277
+ * await aui.swipe(500, 0).image().exec()
2278
+ * ```
2279
+ * ![](https://docs.askui.com/img/gif/swipe.gif)
2280
+ *
2281
+ * @param {number} x_offset - A x direction. positive and negative values are accepted
2282
+ * @param {number} y_offset - A y direction. positive and negative values are accepted
2206
2283
  *
2207
2284
  * @return {FluentFilters}
2208
2285
  */
@@ -2212,6 +2289,14 @@ class FluentCommand extends FluentBase {
2212
2289
  }
2213
2290
  /**
2214
2291
  * Types a text at the current position.
2292
+ * If you need to focus the element first, use typeIn()
2293
+ *
2294
+ * **Examples:**
2295
+ * ```typescript
2296
+ * await aui.type('Type some text').exec()
2297
+ *
2298
+ * // mask the text so it is not send to the askui-inference serverawait aui.type('Type some text', { isSecret: true, secretMask: '**' }).exec()
2299
+ * ```
2215
2300
  *
2216
2301
  * @param {string} text - A text to type
2217
2302
  *
@@ -2250,6 +2335,14 @@ class FluentCommand extends FluentBase {
2250
2335
  *
2251
2336
  * **Important**: Mouse must be positioned in a scrollable area.
2252
2337
  *
2338
+ * **macOS**: May not work as expected!
2339
+ *
2340
+ * **Example:**
2341
+ * ```typescript
2342
+ * // Scroll 10 up in y direction
2343
+ * await aui.scroll(0, 10).exec()
2344
+ * ```
2345
+ *
2253
2346
  * @param {number} x_offset - A (positive/negative) x direction.
2254
2347
  * @param {number} y_offset - A (positive/negative) y direction.
2255
2348
  *
@@ -2260,7 +2353,13 @@ class FluentCommand extends FluentBase {
2260
2353
  return new Exec(this);
2261
2354
  }
2262
2355
  /**
2263
- * Executes a shell command.
2356
+ * Executes a shell command on the device.
2357
+ *
2358
+ * **Example:**
2359
+ * ```typescript
2360
+ * // Open the lastpass app
2361
+ * await aui.execOnShell('monkey -p com.lastpass.authenticator 1').exec()
2362
+ * ```
2264
2363
  *
2265
2364
  * @param {string} shell_command - A shell command which is executed.
2266
2365
  *
@@ -2270,78 +2369,6 @@ class FluentCommand extends FluentBase {
2270
2369
  this._textStr = `Execute shell command ${Separators.STRING}${shell_command}${Separators.STRING}`;
2271
2370
  return new Exec(this);
2272
2371
  }
2273
- /**
2274
- * Clicks with left mouse key.
2275
- *
2276
- * @return {Exec}
2277
- */
2278
- mouseLeftClick() {
2279
- this._textStr = 'Mouse left click';
2280
- return new Exec(this);
2281
- }
2282
- /**
2283
- * Clicks with right mouse key.
2284
- *
2285
- * @return {Exec}
2286
- */
2287
- mouseRightClick() {
2288
- this._textStr = 'Mouse right click';
2289
- return new Exec(this);
2290
- }
2291
- /**
2292
- * Clicks with middle mouse key.
2293
- *
2294
- * @return {Exec}
2295
- */
2296
- mouseMiddleClick() {
2297
- this._textStr = 'Mouse middle click';
2298
- return new Exec(this);
2299
- }
2300
- /**
2301
- * Double-clicks with left mouse key.
2302
- *
2303
- * @return {Exec}
2304
- */
2305
- mouseDoubleLeftClick() {
2306
- this._textStr = 'Mouse double left click';
2307
- return new Exec(this);
2308
- }
2309
- /**
2310
- * Double-clicks with right mouse key.
2311
- *
2312
- * @return {Exec}
2313
- */
2314
- mouseDoubleRightClick() {
2315
- this._textStr = 'Mouse double right click';
2316
- return new Exec(this);
2317
- }
2318
- /**
2319
- * Double-clicks with middle mouse key.
2320
- *
2321
- * @return {Exec}
2322
- */
2323
- mouseDoubleMiddleClick() {
2324
- this._textStr = 'Mouse double middle click';
2325
- return new Exec(this);
2326
- }
2327
- /**
2328
- * Toggles mouse down.
2329
- *
2330
- * @return {Exec}
2331
- */
2332
- mouseToggleDown() {
2333
- this._textStr = 'Mouse toggle down';
2334
- return new Exec(this);
2335
- }
2336
- /**
2337
- * Toggles mouse up.
2338
- *
2339
- * @return {Exec}
2340
- */
2341
- mouseToggleUp() {
2342
- this._textStr = 'Mouse toggle up';
2343
- return new Exec(this);
2344
- }
2345
2372
  /**
2346
2373
  * Press three keys like `CTRL+ALT+DEL`
2347
2374
  *
@@ -3003,6 +3030,11 @@ class FluentFiltersGetter extends FluentBase {
3003
3030
  /**
3004
3031
  * Filters for an UI element 'button'.
3005
3032
  *
3033
+ * **Examples:**
3034
+ * ```typescript
3035
+ * await aui.moveMouseTo().button().exec()
3036
+ * ```
3037
+ *
3006
3038
  * @return {FluentFiltersOrRelationsGetter}
3007
3039
  */
3008
3040
  button() {
@@ -3076,8 +3108,17 @@ class FluentFiltersGetter extends FluentBase {
3076
3108
  * ```typescript
3077
3109
  * 'text' === withText('text') => true
3078
3110
  * 'test' === withText('text') => true
3111
+ * 'Test' === withText('text') => true
3112
+ * 'Text' === withText('text') => true
3113
+ * 'TEXT' === withText('text') => true
3114
+ * 'texst' === withText('text') => true
3115
+ * 'texts' === withText('text') => true
3116
+ *
3117
+ * // usually false
3118
+ * 'atebxtc' === withText('text') => false
3079
3119
  * 'other' === withText('text') => false
3080
3120
  * ```
3121
+ * ![](https://docs.askui.com/img/gif/withText.gif)
3081
3122
  *
3082
3123
  * @param {string} text - A text to be matched.
3083
3124
  *
@@ -3096,9 +3137,11 @@ class FluentFiltersGetter extends FluentBase {
3096
3137
  * 'The rain in Spain' === withTextRegex('\b[Ss]\w+') => true
3097
3138
  * 'The rain in Portugal' === withTextRegex('\b[Ss]\w+') => false
3098
3139
  * 'The rain in switzerland' === withTextRegex('\b[Ss]\w+') => true
3140
+ *
3141
+ * await aui.get().text().withTextRegex('\b[Ss]\w+').exec()
3099
3142
  * ```
3100
3143
  *
3101
- * @param {string} regex_pattern - An regex pattern
3144
+ * @param {string} regex_pattern - A regex pattern
3102
3145
  *
3103
3146
  * @return {FluentFiltersOrRelationsGetter}
3104
3147
  */
@@ -3118,6 +3161,8 @@ class FluentFiltersGetter extends FluentBase {
3118
3161
  * 'text' === withExactText('text') => true
3119
3162
  * 'test' === withExactText('text') => false
3120
3163
  * 'other' === withExactText('text') => false
3164
+ *
3165
+ * await aui.moveMouseTo().text().withExactText('Password').exec()
3121
3166
  * ```
3122
3167
  *
3123
3168
  * @param {string} text - A text to be matched.
@@ -3137,6 +3182,7 @@ class FluentFiltersGetter extends FluentBase {
3137
3182
  * 'This is an text' === containsText('other text') => false
3138
3183
  * 'This is an text' === containsText('other') => false
3139
3184
  * ```
3185
+ * ![](https://docs.askui.com/img/gif/containsText.gif)
3140
3186
  *
3141
3187
  * @param {string} text - A text to be matched.
3142
3188
  *
@@ -3146,17 +3192,6 @@ class FluentFiltersGetter extends FluentBase {
3146
3192
  this._textStr = `contain text ${Separators.STRING}${text}${Separators.STRING}`;
3147
3193
  return new FluentFiltersOrRelationsGetter(this);
3148
3194
  }
3149
- /**
3150
- * Filters for elements having a specific color.
3151
- *
3152
- * @param {COLOR} color - A color to match
3153
- *
3154
- * @return {FluentFiltersOrRelationsGetter}
3155
- */
3156
- colored(color) {
3157
- this._textStr = `with color ${color}`;
3158
- return new FluentFiltersOrRelationsGetter(this);
3159
- }
3160
3195
  }
3161
3196
  exports.FluentFiltersGetter = FluentFiltersGetter;
3162
3197
  // Relations
@@ -3189,7 +3224,6 @@ class FluentFiltersOrRelationsGetter extends FluentFiltersGetter {
3189
3224
  * DetectedElement {
3190
3225
  * name: 'BUTTON',
3191
3226
  * text: 'button',
3192
- * colors: [ 'red', 'black', 'red' ],
3193
3227
  * bndbox: BoundingBox {
3194
3228
  * xmin: 900,
3195
3229
  * ymin: 910,
@@ -3212,21 +3246,19 @@ class FluentFiltersOrRelationsGetter extends FluentFiltersGetter {
3212
3246
  * **Examples:**
3213
3247
  * ```text
3214
3248
  * example scene:
3215
- * -------------------------- --------------------------
3216
- * | icon user colored black | | icon user colored red |
3217
- * -------------------------- --------------------------
3218
- * ```
3249
+ * --------------- ----------------
3250
+ * | icon user | | icon search |
3251
+ * --------------- ---------------n```
3219
3252
  * ```typescript
3220
- * const icons = await aui.get().icon().withText('user').exec();
3253
+ * const icons = await aui.get().icon().exec();
3221
3254
  * console.log(icons);
3222
3255
  * ```
3223
- * Using only the filter withText, the get command will return both icons because they share the same text
3256
+ * Using only the filter icon, the get command will return both icons
3224
3257
  * ```text
3225
3258
  * console output: [
3226
3259
  * DetectedElement {
3227
3260
  * name: 'ICON',
3228
3261
  * text: 'user',
3229
- * colors: [ 'black', 'black', 'black' ],
3230
3262
  * bndbox: BoundingBox {
3231
3263
  * xmin: 1000,
3232
3264
  * ymin: 1010,
@@ -3236,8 +3268,7 @@ class FluentFiltersOrRelationsGetter extends FluentFiltersGetter {
3236
3268
  * },
3237
3269
  * DetectedElement {
3238
3270
  * name: 'ICON',
3239
- * text: 'user',
3240
- * colors: [ 'red', 'red', 'red' ],
3271
+ * text: 'search',
3241
3272
  * bndbox: BoundingBox {
3242
3273
  * xmin: 900,
3243
3274
  * ymin: 910,
@@ -3249,16 +3280,15 @@ class FluentFiltersOrRelationsGetter extends FluentFiltersGetter {
3249
3280
  * ```
3250
3281
  * You can combine filters with **the `and()` relation** and specify exactly which icon you want
3251
3282
  * ```typescript
3252
- * const icons = await aui.get().icon().withText('user').and().colored('red').exec()
3283
+ * const icons = await aui.get().icon().and().withText('user').exec()
3253
3284
  * console.log(icons)
3254
3285
  * ```
3255
- * The get command returns only the red icon although both icons have the same text
3286
+ * The get command returns only the user icon although both elements are icons
3256
3287
  * ```text
3257
3288
  * console output: [
3258
3289
  * DetectedElement {
3259
3290
  * name: 'ICON',
3260
3291
  * text: 'user',
3261
- * colors: [ 'red', 'red', 'red' ],
3262
3292
  * bndbox: BoundingBox {
3263
3293
  * xmin: 900,
3264
3294
  * ymin: 910,
@@ -3293,6 +3323,7 @@ class FluentFiltersOrRelationsGetter extends FluentFiltersGetter {
3293
3323
  * // Returns nothing because innerEl is not inside outerEl
3294
3324
  * ...outerEl().in().innerEl()
3295
3325
  * ```
3326
+ * ![](https://docs.askui.com/img/gif/in.gif)
3296
3327
  *
3297
3328
  * @return {FluentFiltersGetter}
3298
3329
  */
@@ -3314,6 +3345,7 @@ class FluentFiltersOrRelationsGetter extends FluentFiltersGetter {
3314
3345
  * // Returns no element because leftEl is left of rightEl
3315
3346
  * ...leftEl().rightOf().rightEl()
3316
3347
  * ```
3348
+ * ![](https://docs.askui.com/img/gif/rightOf.gif)
3317
3349
  *
3318
3350
  * @return {FluentFiltersGetter}
3319
3351
  */
@@ -3335,6 +3367,7 @@ class FluentFiltersOrRelationsGetter extends FluentFiltersGetter {
3335
3367
  * // Returns no element because rightEl is left of leftEl
3336
3368
  * ...rightEl().leftOf().leftEl()
3337
3369
  * ```
3370
+ * ![](https://docs.askui.com/img/gif/leftOf.gif)
3338
3371
  *
3339
3372
  * @return {FluentFiltersGetter}
3340
3373
  */
@@ -3359,6 +3392,7 @@ class FluentFiltersOrRelationsGetter extends FluentFiltersGetter {
3359
3392
  * // Returns no element because text is above button
3360
3393
  * ...text().below().button()
3361
3394
  * ```
3395
+ * ![](https://docs.askui.com/img/gif/below.gif)
3362
3396
  *
3363
3397
  * @return {FluentFiltersGetter}
3364
3398
  */
@@ -3383,6 +3417,7 @@ class FluentFiltersOrRelationsGetter extends FluentFiltersGetter {
3383
3417
  * // Returns no element because button is below text
3384
3418
  * ...button().above().text()
3385
3419
  * ```
3420
+ * ![](https://docs.askui.com/img/gif/above.gif)
3386
3421
  *
3387
3422
  * @return {FluentFiltersGetter}
3388
3423
  */
@@ -3411,6 +3446,7 @@ class FluentFiltersOrRelationsGetter extends FluentFiltersGetter {
3411
3446
  * // Returns button 1 because button 1 is nearer to the text than button 2
3412
3447
  * ...button().nearestTo().text()
3413
3448
  * ```
3449
+ * ![](https://docs.askui.com/img/gif/nearestTo.gif)
3414
3450
  *
3415
3451
  * @return {FluentFiltersGetter}
3416
3452
  */
@@ -3436,6 +3472,7 @@ class FluentFiltersOrRelationsGetter extends FluentFiltersGetter {
3436
3472
  * // Returns no element because innerEl contains no outerEl
3437
3473
  * ...innerEl().contains().outerEl()
3438
3474
  * ```
3475
+ * ![](https://docs.askui.com/img/gif/contains.gif)
3439
3476
  *
3440
3477
  * @return {FluentFiltersGetter}
3441
3478
  */
@@ -3460,8 +3497,8 @@ class Getter extends FluentCommand {
3460
3497
  * A detected element has the following properties:
3461
3498
  * - `name` of the element
3462
3499
  * - `text` content of element
3463
- * - `colors` of element
3464
3500
  * - `bndbox`: location of element described with coordinates of a bounding box
3501
+ *
3465
3502
  * **Examples:**
3466
3503
  * ```typescript
3467
3504
  * const text = await aui.get().text().withText('Sign').exec();
@@ -3472,7 +3509,6 @@ class Getter extends FluentCommand {
3472
3509
  * DetectedElement {
3473
3510
  * name: 'TEXT',
3474
3511
  * text: 'Sign In',
3475
- * colors: [ 'black', 'gray', 'gray' ],
3476
3512
  * bndbox: BoundingBox {
3477
3513
  * xmin: 1128.2720982142857,
3478
3514
  * ymin: 160.21332310267857,
@@ -3494,8 +3530,8 @@ class Getter extends FluentCommand {
3494
3530
  * A detected element has the following properties:
3495
3531
  * - `name` of the element
3496
3532
  * - `text` content of element
3497
- * - `colors` of element
3498
3533
  * - `bndbox`: location of element described with coordinates of a bounding box
3534
+ *
3499
3535
  * **Examples:**
3500
3536
  * ```typescript
3501
3537
  * const detectedElements = await aui.getAll().exec();
@@ -3506,7 +3542,6 @@ class Getter extends FluentCommand {
3506
3542
  * DetectedElement {
3507
3543
  * name: 'TEXT',
3508
3544
  * text: 'Sign In',
3509
- * colors: [ 'black', 'gray', 'gray' ],
3510
3545
  * bndbox: BoundingBox {
3511
3546
  * xmin: 1128.2720982142857,
3512
3547
  * ymin: 160.21332310267857,
@@ -3516,7 +3551,6 @@ class Getter extends FluentCommand {
3516
3551
  * DetectedElement {
3517
3552
  * name: 'ICON',
3518
3553
  * text: 'search',
3519
- * colors: [ 'black', 'red', 'gray' ],
3520
3554
  * bndbox: BoundingBox {
3521
3555
  * xmin: 250.8204241071428,
3522
3556
  * ymin: 300.21332310267857,