askui 0.6.1 → 0.7.1

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 (50) 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 +196 -81
  5. package/dist/cjs/execution/dsl.js +196 -90
  6. package/dist/cjs/execution/ui-controller-client-interface.d.ts +1 -1
  7. package/dist/cjs/lib/download-binaries.d.ts +1 -1
  8. package/dist/cjs/lib/download-binaries.js +42 -29
  9. package/dist/cjs/lib/ui-controller-darwin.js +3 -3
  10. package/dist/cjs/lib/ui-controller-facade.d.ts +1 -2
  11. package/dist/cjs/lib/ui-controller-facade.js +6 -11
  12. package/dist/cjs/lib/ui-controller-linux.js +1 -1
  13. package/dist/esm/core/annotation/template.html +11390 -1
  14. package/dist/esm/core/model/annotation-result/detected-element.d.ts +3 -3
  15. package/dist/esm/core/model/annotation-result/detected-element.js +4 -4
  16. package/dist/esm/execution/dsl.d.ts +196 -81
  17. package/dist/esm/execution/dsl.js +196 -90
  18. package/dist/esm/execution/ui-controller-client-interface.d.ts +1 -1
  19. package/dist/esm/lib/download-binaries.d.ts +1 -1
  20. package/dist/esm/lib/download-binaries.js +40 -27
  21. package/dist/esm/lib/ui-controller-darwin.js +3 -3
  22. package/dist/esm/lib/ui-controller-facade.d.ts +1 -2
  23. package/dist/esm/lib/ui-controller-facade.js +7 -12
  24. package/dist/esm/lib/ui-controller-linux.js +1 -1
  25. package/dist/example_projects_templates/typescript_jest/test/my-first-askui-test-suite.test.ts +5 -6
  26. package/package.json +1 -1
  27. package/dist/cjs/core/annotation/annotation-json.d.ts +0 -5
  28. package/dist/cjs/core/annotation/annotation-json.js +0 -2
  29. package/dist/cjs/core/model/test-case-dto/custom-element.spec.d.ts +0 -1
  30. package/dist/cjs/core/model/test-case-dto/custom-element.spec.js +0 -53
  31. package/dist/cjs/execution/dsl.spec.d.ts +0 -1
  32. package/dist/cjs/execution/dsl.spec.js +0 -75
  33. package/dist/cjs/execution/read-environment-credentials.spec.d.ts +0 -1
  34. package/dist/cjs/execution/read-environment-credentials.spec.js +0 -11
  35. package/dist/cjs/lib/ui-controller-args.spec.d.ts +0 -1
  36. package/dist/cjs/lib/ui-controller-args.spec.js +0 -23
  37. package/dist/cjs/utils/http/credentials.spec.d.ts +0 -1
  38. package/dist/cjs/utils/http/credentials.spec.js +0 -11
  39. package/dist/esm/core/annotation/annotation-json.d.ts +0 -5
  40. package/dist/esm/core/annotation/annotation-json.js +0 -1
  41. package/dist/esm/core/model/test-case-dto/custom-element.spec.d.ts +0 -1
  42. package/dist/esm/core/model/test-case-dto/custom-element.spec.js +0 -51
  43. package/dist/esm/execution/dsl.spec.d.ts +0 -1
  44. package/dist/esm/execution/dsl.spec.js +0 -73
  45. package/dist/esm/execution/read-environment-credentials.spec.d.ts +0 -1
  46. package/dist/esm/execution/read-environment-credentials.spec.js +0 -9
  47. package/dist/esm/lib/ui-controller-args.spec.d.ts +0 -1
  48. package/dist/esm/lib/ui-controller-args.spec.js +0 -21
  49. package/dist/esm/utils/http/credentials.spec.d.ts +0 -1
  50. 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
  *
@@ -2325,7 +2424,7 @@ class FluentCommand extends FluentBase {
2325
2424
  return new Exec(this);
2326
2425
  }
2327
2426
  /**
2328
- * Toggles mouse down.
2427
+ * Toggles mouse down (Left mouse key).
2329
2428
  *
2330
2429
  * @return {Exec}
2331
2430
  */
@@ -2334,7 +2433,7 @@ class FluentCommand extends FluentBase {
2334
2433
  return new Exec(this);
2335
2434
  }
2336
2435
  /**
2337
- * Toggles mouse up.
2436
+ * Toggles mouse up (Left mouse key).
2338
2437
  *
2339
2438
  * @return {Exec}
2340
2439
  */
@@ -3003,6 +3102,11 @@ class FluentFiltersGetter extends FluentBase {
3003
3102
  /**
3004
3103
  * Filters for an UI element 'button'.
3005
3104
  *
3105
+ * **Examples:**
3106
+ * ```typescript
3107
+ * await aui.moveMouseTo().button().exec()
3108
+ * ```
3109
+ *
3006
3110
  * @return {FluentFiltersOrRelationsGetter}
3007
3111
  */
3008
3112
  button() {
@@ -3076,8 +3180,17 @@ class FluentFiltersGetter extends FluentBase {
3076
3180
  * ```typescript
3077
3181
  * 'text' === withText('text') => true
3078
3182
  * 'test' === withText('text') => true
3183
+ * 'Test' === withText('text') => true
3184
+ * 'Text' === withText('text') => true
3185
+ * 'TEXT' === withText('text') => true
3186
+ * 'texst' === withText('text') => true
3187
+ * 'texts' === withText('text') => true
3188
+ *
3189
+ * // usually false
3190
+ * 'atebxtc' === withText('text') => false
3079
3191
  * 'other' === withText('text') => false
3080
3192
  * ```
3193
+ * ![](https://docs.askui.com/img/gif/withText.gif)
3081
3194
  *
3082
3195
  * @param {string} text - A text to be matched.
3083
3196
  *
@@ -3096,9 +3209,11 @@ class FluentFiltersGetter extends FluentBase {
3096
3209
  * 'The rain in Spain' === withTextRegex('\b[Ss]\w+') => true
3097
3210
  * 'The rain in Portugal' === withTextRegex('\b[Ss]\w+') => false
3098
3211
  * 'The rain in switzerland' === withTextRegex('\b[Ss]\w+') => true
3212
+ *
3213
+ * await aui.get().text().withTextRegex('\b[Ss]\w+').exec()
3099
3214
  * ```
3100
3215
  *
3101
- * @param {string} regex_pattern - An regex pattern
3216
+ * @param {string} regex_pattern - A regex pattern
3102
3217
  *
3103
3218
  * @return {FluentFiltersOrRelationsGetter}
3104
3219
  */
@@ -3118,6 +3233,8 @@ class FluentFiltersGetter extends FluentBase {
3118
3233
  * 'text' === withExactText('text') => true
3119
3234
  * 'test' === withExactText('text') => false
3120
3235
  * 'other' === withExactText('text') => false
3236
+ *
3237
+ * await aui.moveMouseTo().text().withExactText('Password').exec()
3121
3238
  * ```
3122
3239
  *
3123
3240
  * @param {string} text - A text to be matched.
@@ -3137,6 +3254,7 @@ class FluentFiltersGetter extends FluentBase {
3137
3254
  * 'This is an text' === containsText('other text') => false
3138
3255
  * 'This is an text' === containsText('other') => false
3139
3256
  * ```
3257
+ * ![](https://docs.askui.com/img/gif/containsText.gif)
3140
3258
  *
3141
3259
  * @param {string} text - A text to be matched.
3142
3260
  *
@@ -3146,17 +3264,6 @@ class FluentFiltersGetter extends FluentBase {
3146
3264
  this._textStr = `contain text ${Separators.STRING}${text}${Separators.STRING}`;
3147
3265
  return new FluentFiltersOrRelationsGetter(this);
3148
3266
  }
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
3267
  }
3161
3268
  exports.FluentFiltersGetter = FluentFiltersGetter;
3162
3269
  // Relations
@@ -3189,7 +3296,6 @@ class FluentFiltersOrRelationsGetter extends FluentFiltersGetter {
3189
3296
  * DetectedElement {
3190
3297
  * name: 'BUTTON',
3191
3298
  * text: 'button',
3192
- * colors: [ 'red', 'black', 'red' ],
3193
3299
  * bndbox: BoundingBox {
3194
3300
  * xmin: 900,
3195
3301
  * ymin: 910,
@@ -3212,21 +3318,19 @@ class FluentFiltersOrRelationsGetter extends FluentFiltersGetter {
3212
3318
  * **Examples:**
3213
3319
  * ```text
3214
3320
  * example scene:
3215
- * -------------------------- --------------------------
3216
- * | icon user colored black | | icon user colored red |
3217
- * -------------------------- --------------------------
3218
- * ```
3321
+ * --------------- ----------------
3322
+ * | icon user | | icon search |
3323
+ * --------------- ---------------n```
3219
3324
  * ```typescript
3220
- * const icons = await aui.get().icon().withText('user').exec();
3325
+ * const icons = await aui.get().icon().exec();
3221
3326
  * console.log(icons);
3222
3327
  * ```
3223
- * Using only the filter withText, the get command will return both icons because they share the same text
3328
+ * Using only the filter icon, the get command will return both icons
3224
3329
  * ```text
3225
3330
  * console output: [
3226
3331
  * DetectedElement {
3227
3332
  * name: 'ICON',
3228
3333
  * text: 'user',
3229
- * colors: [ 'black', 'black', 'black' ],
3230
3334
  * bndbox: BoundingBox {
3231
3335
  * xmin: 1000,
3232
3336
  * ymin: 1010,
@@ -3236,8 +3340,7 @@ class FluentFiltersOrRelationsGetter extends FluentFiltersGetter {
3236
3340
  * },
3237
3341
  * DetectedElement {
3238
3342
  * name: 'ICON',
3239
- * text: 'user',
3240
- * colors: [ 'red', 'red', 'red' ],
3343
+ * text: 'search',
3241
3344
  * bndbox: BoundingBox {
3242
3345
  * xmin: 900,
3243
3346
  * ymin: 910,
@@ -3249,16 +3352,15 @@ class FluentFiltersOrRelationsGetter extends FluentFiltersGetter {
3249
3352
  * ```
3250
3353
  * You can combine filters with **the `and()` relation** and specify exactly which icon you want
3251
3354
  * ```typescript
3252
- * const icons = await aui.get().icon().withText('user').and().colored('red').exec()
3355
+ * const icons = await aui.get().icon().and().withText('user').exec()
3253
3356
  * console.log(icons)
3254
3357
  * ```
3255
- * The get command returns only the red icon although both icons have the same text
3358
+ * The get command returns only the user icon although both elements are icons
3256
3359
  * ```text
3257
3360
  * console output: [
3258
3361
  * DetectedElement {
3259
3362
  * name: 'ICON',
3260
3363
  * text: 'user',
3261
- * colors: [ 'red', 'red', 'red' ],
3262
3364
  * bndbox: BoundingBox {
3263
3365
  * xmin: 900,
3264
3366
  * ymin: 910,
@@ -3293,6 +3395,7 @@ class FluentFiltersOrRelationsGetter extends FluentFiltersGetter {
3293
3395
  * // Returns nothing because innerEl is not inside outerEl
3294
3396
  * ...outerEl().in().innerEl()
3295
3397
  * ```
3398
+ * ![](https://docs.askui.com/img/gif/in.gif)
3296
3399
  *
3297
3400
  * @return {FluentFiltersGetter}
3298
3401
  */
@@ -3314,6 +3417,7 @@ class FluentFiltersOrRelationsGetter extends FluentFiltersGetter {
3314
3417
  * // Returns no element because leftEl is left of rightEl
3315
3418
  * ...leftEl().rightOf().rightEl()
3316
3419
  * ```
3420
+ * ![](https://docs.askui.com/img/gif/rightOf.gif)
3317
3421
  *
3318
3422
  * @return {FluentFiltersGetter}
3319
3423
  */
@@ -3335,6 +3439,7 @@ class FluentFiltersOrRelationsGetter extends FluentFiltersGetter {
3335
3439
  * // Returns no element because rightEl is left of leftEl
3336
3440
  * ...rightEl().leftOf().leftEl()
3337
3441
  * ```
3442
+ * ![](https://docs.askui.com/img/gif/leftOf.gif)
3338
3443
  *
3339
3444
  * @return {FluentFiltersGetter}
3340
3445
  */
@@ -3359,6 +3464,7 @@ class FluentFiltersOrRelationsGetter extends FluentFiltersGetter {
3359
3464
  * // Returns no element because text is above button
3360
3465
  * ...text().below().button()
3361
3466
  * ```
3467
+ * ![](https://docs.askui.com/img/gif/below.gif)
3362
3468
  *
3363
3469
  * @return {FluentFiltersGetter}
3364
3470
  */
@@ -3383,6 +3489,7 @@ class FluentFiltersOrRelationsGetter extends FluentFiltersGetter {
3383
3489
  * // Returns no element because button is below text
3384
3490
  * ...button().above().text()
3385
3491
  * ```
3492
+ * ![](https://docs.askui.com/img/gif/above.gif)
3386
3493
  *
3387
3494
  * @return {FluentFiltersGetter}
3388
3495
  */
@@ -3411,6 +3518,7 @@ class FluentFiltersOrRelationsGetter extends FluentFiltersGetter {
3411
3518
  * // Returns button 1 because button 1 is nearer to the text than button 2
3412
3519
  * ...button().nearestTo().text()
3413
3520
  * ```
3521
+ * ![](https://docs.askui.com/img/gif/nearestTo.gif)
3414
3522
  *
3415
3523
  * @return {FluentFiltersGetter}
3416
3524
  */
@@ -3436,6 +3544,7 @@ class FluentFiltersOrRelationsGetter extends FluentFiltersGetter {
3436
3544
  * // Returns no element because innerEl contains no outerEl
3437
3545
  * ...innerEl().contains().outerEl()
3438
3546
  * ```
3547
+ * ![](https://docs.askui.com/img/gif/contains.gif)
3439
3548
  *
3440
3549
  * @return {FluentFiltersGetter}
3441
3550
  */
@@ -3460,8 +3569,8 @@ class Getter extends FluentCommand {
3460
3569
  * A detected element has the following properties:
3461
3570
  * - `name` of the element
3462
3571
  * - `text` content of element
3463
- * - `colors` of element
3464
3572
  * - `bndbox`: location of element described with coordinates of a bounding box
3573
+ *
3465
3574
  * **Examples:**
3466
3575
  * ```typescript
3467
3576
  * const text = await aui.get().text().withText('Sign').exec();
@@ -3472,7 +3581,6 @@ class Getter extends FluentCommand {
3472
3581
  * DetectedElement {
3473
3582
  * name: 'TEXT',
3474
3583
  * text: 'Sign In',
3475
- * colors: [ 'black', 'gray', 'gray' ],
3476
3584
  * bndbox: BoundingBox {
3477
3585
  * xmin: 1128.2720982142857,
3478
3586
  * ymin: 160.21332310267857,
@@ -3494,8 +3602,8 @@ class Getter extends FluentCommand {
3494
3602
  * A detected element has the following properties:
3495
3603
  * - `name` of the element
3496
3604
  * - `text` content of element
3497
- * - `colors` of element
3498
3605
  * - `bndbox`: location of element described with coordinates of a bounding box
3606
+ *
3499
3607
  * **Examples:**
3500
3608
  * ```typescript
3501
3609
  * const detectedElements = await aui.getAll().exec();
@@ -3506,7 +3614,6 @@ class Getter extends FluentCommand {
3506
3614
  * DetectedElement {
3507
3615
  * name: 'TEXT',
3508
3616
  * text: 'Sign In',
3509
- * colors: [ 'black', 'gray', 'gray' ],
3510
3617
  * bndbox: BoundingBox {
3511
3618
  * xmin: 1128.2720982142857,
3512
3619
  * ymin: 160.21332310267857,
@@ -3516,7 +3623,6 @@ class Getter extends FluentCommand {
3516
3623
  * DetectedElement {
3517
3624
  * name: 'ICON',
3518
3625
  * text: 'search',
3519
- * colors: [ 'black', 'red', 'gray' ],
3520
3626
  * bndbox: BoundingBox {
3521
3627
  * xmin: 250.8204241071428,
3522
3628
  * ymin: 300.21332310267857,