askui 0.1.5 → 0.2.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 (223) hide show
  1. package/README.md +6 -0
  2. package/bin/askui-postinstall +35 -0
  3. package/dist/cjs/core/model/test-case-dto/custom-element.d.ts +2 -2
  4. package/dist/cjs/core/model/test-case-dto/custom-element.js +2 -2
  5. package/dist/cjs/core/model/test-case-dto/custom-element.spec.js +7 -6
  6. package/dist/cjs/core/model/test-case-dto/index.js +1 -3
  7. package/dist/cjs/core/model/test-case-dto/test-step.d.ts +3 -7
  8. package/dist/cjs/core/model/test-case-dto/test-step.js +0 -12
  9. package/dist/cjs/core/ui-control-commands/control-command.d.ts +1 -0
  10. package/dist/cjs/core/ui-control-commands/control-command.js +5 -0
  11. package/dist/cjs/core/ui-control-commands/input-event.d.ts +1 -2
  12. package/dist/cjs/core/ui-control-commands/input-event.js +0 -1
  13. package/dist/cjs/execution/dsl.d.ts +6 -17
  14. package/dist/cjs/execution/dsl.js +4 -21
  15. package/dist/cjs/execution/execution-runtime.d.ts +7 -5
  16. package/dist/cjs/execution/execution-runtime.js +35 -23
  17. package/dist/cjs/execution/index.d.ts +2 -1
  18. package/dist/cjs/execution/index.js +5 -3
  19. package/dist/cjs/execution/{control-your-ui-api.d.ts → inference-client.d.ts} +4 -4
  20. package/dist/cjs/execution/{control-your-ui-api.js → inference-client.js} +9 -9
  21. package/dist/cjs/execution/ui-control-client-error.d.ts +2 -0
  22. package/dist/cjs/execution/ui-control-client-error.js +6 -0
  23. package/dist/cjs/execution/ui-control-client.d.ts +79 -0
  24. package/dist/cjs/execution/ui-control-client.js +185 -0
  25. package/dist/cjs/execution/{client-connection-state.d.ts → ui-controller-client-connection-state.d.ts} +1 -1
  26. package/dist/cjs/execution/ui-controller-client-connection-state.js +10 -0
  27. package/dist/cjs/execution/ui-controller-client-interface.d.ts +27 -0
  28. package/dist/cjs/execution/{client-interface.js → ui-controller-client-interface.js} +0 -0
  29. package/dist/cjs/execution/{control-your-ui-client.d.ts → ui-controller-client.d.ts} +6 -6
  30. package/dist/cjs/execution/{control-your-ui-client.js → ui-controller-client.js} +28 -28
  31. package/dist/cjs/lib/copy-example-project.js +2 -1
  32. package/dist/cjs/lib/download-binaries.js +10 -9
  33. package/dist/cjs/lib/index.d.ts +1 -1
  34. package/dist/cjs/lib/index.js +3 -3
  35. package/dist/cjs/lib/libfuse-error.d.ts +2 -0
  36. package/dist/cjs/lib/libfuse-error.js +6 -0
  37. package/dist/cjs/lib/logger.js +1 -1
  38. package/dist/cjs/lib/timeout-error.d.ts +0 -2
  39. package/dist/cjs/lib/timeout-error.js +0 -5
  40. package/dist/cjs/lib/ui-controller-args.d.ts +47 -0
  41. package/dist/cjs/lib/{control-ui-server-args.js → ui-controller-args.js} +0 -0
  42. package/dist/cjs/lib/{control-ui-server-args.spec.d.ts → ui-controller-args.spec.d.ts} +0 -0
  43. package/dist/cjs/lib/{control-ui-server-args.spec.js → ui-controller-args.spec.js} +7 -7
  44. package/dist/cjs/lib/ui-controller-darwin.d.ts +6 -0
  45. package/dist/cjs/lib/{control-ui-server-darwin.js → ui-controller-darwin.js} +8 -8
  46. package/dist/cjs/lib/ui-controller-facade.d.ts +17 -0
  47. package/dist/cjs/lib/{control-ui-server-facade.js → ui-controller-facade.js} +22 -16
  48. package/dist/cjs/lib/ui-controller-linux.d.ts +5 -0
  49. package/dist/cjs/lib/ui-controller-linux.js +52 -0
  50. package/dist/cjs/lib/ui-controller-win32.d.ts +3 -0
  51. package/dist/cjs/lib/ui-controller-win32.js +7 -0
  52. package/dist/cjs/lib/ui-controller.d.ts +8 -0
  53. package/dist/cjs/lib/{askui-control-server.js → ui-controller.js} +9 -9
  54. package/dist/cjs/lib/unkown-error.d.ts +0 -2
  55. package/dist/cjs/lib/unkown-error.js +0 -5
  56. package/dist/cjs/lib/wayland-error.d.ts +2 -0
  57. package/dist/cjs/lib/wayland-error.js +6 -0
  58. package/dist/cjs/main.d.ts +3 -2
  59. package/dist/cjs/main.js +6 -3
  60. package/dist/cjs/shared/index.d.ts +1 -0
  61. package/dist/cjs/shared/index.js +5 -0
  62. package/dist/cjs/utils/analytics/analytics-interface.d.ts +3 -0
  63. package/dist/cjs/utils/analytics/analytics-interface.js +2 -0
  64. package/dist/cjs/utils/analytics/analytics.d.ts +5 -0
  65. package/dist/cjs/utils/analytics/analytics.js +38 -0
  66. package/dist/cjs/utils/analytics/index.d.ts +1 -0
  67. package/dist/cjs/utils/analytics/index.js +5 -0
  68. package/dist/cjs/utils/analytics/installation-timestamp-create-error.d.ts +4 -0
  69. package/dist/cjs/utils/analytics/installation-timestamp-create-error.js +9 -0
  70. package/dist/cjs/utils/analytics/installation-timestamp-get-error.d.ts +4 -0
  71. package/dist/cjs/utils/analytics/installation-timestamp-get-error.js +9 -0
  72. package/dist/cjs/utils/analytics/installation-timestamp.d.ts +7 -0
  73. package/dist/cjs/utils/analytics/installation-timestamp.js +68 -0
  74. package/dist/cjs/utils/analytics/user-identifier-interface.d.ts +3 -0
  75. package/dist/cjs/utils/analytics/user-identifier-interface.js +2 -0
  76. package/dist/cjs/utils/analytics/user-identifier.d.ts +4 -0
  77. package/dist/cjs/utils/analytics/user-identifier.js +22 -0
  78. package/dist/cjs/utils/base_64_image/base-64-image-error.d.ts +2 -0
  79. package/dist/cjs/utils/base_64_image/base-64-image-error.js +6 -0
  80. package/dist/cjs/utils/base_64_image/base-64-image-string-error.d.ts +4 -0
  81. package/dist/cjs/utils/base_64_image/base-64-image-string-error.js +11 -0
  82. package/dist/cjs/utils/base_64_image/base-64-image.d.ts +18 -0
  83. package/dist/cjs/utils/base_64_image/base-64-image.js +86 -0
  84. package/dist/cjs/utils/http/custom-errors/http-client-error.d.ts +0 -2
  85. package/dist/cjs/utils/http/custom-errors/http-client-error.js +0 -5
  86. package/dist/cjs/utils/http/http-client-got.d.ts +6 -5
  87. package/dist/cjs/utils/http/http-client-got.js +11 -11
  88. package/dist/cjs/utils/image-resize-errors/image-resizing-base-error.d.ts +0 -2
  89. package/dist/cjs/utils/image-resize-errors/image-resizing-base-error.js +0 -5
  90. package/dist/cjs/utils/image-resize-errors/index.d.ts +0 -1
  91. package/dist/cjs/utils/image-resize-errors/index.js +1 -3
  92. package/dist/cjs/utils/path.d.ts +1 -0
  93. package/dist/cjs/utils/path.js +11 -0
  94. package/dist/cjs/utils/transformations.d.ts +0 -2
  95. package/dist/cjs/utils/transformations.js +11 -44
  96. package/dist/esm/core/model/test-case-dto/custom-element.d.ts +2 -2
  97. package/dist/esm/core/model/test-case-dto/custom-element.js +2 -2
  98. package/dist/esm/core/model/test-case-dto/custom-element.spec.js +7 -6
  99. package/dist/esm/core/model/test-case-dto/index.js +0 -1
  100. package/dist/esm/core/model/test-case-dto/test-step.d.ts +3 -7
  101. package/dist/esm/core/model/test-case-dto/test-step.js +1 -10
  102. package/dist/esm/core/ui-control-commands/control-command.d.ts +1 -0
  103. package/dist/esm/core/ui-control-commands/control-command.js +5 -0
  104. package/dist/esm/core/ui-control-commands/input-event.d.ts +1 -2
  105. package/dist/esm/core/ui-control-commands/input-event.js +0 -1
  106. package/dist/esm/execution/dsl.d.ts +6 -17
  107. package/dist/esm/execution/dsl.js +3 -21
  108. package/dist/esm/execution/execution-runtime.d.ts +7 -5
  109. package/dist/esm/execution/execution-runtime.js +35 -23
  110. package/dist/esm/execution/index.d.ts +2 -1
  111. package/dist/esm/execution/index.js +2 -1
  112. package/dist/esm/execution/{control-your-ui-api.d.ts → inference-client.d.ts} +4 -4
  113. package/dist/esm/execution/{control-your-ui-api.js → inference-client.js} +7 -7
  114. package/dist/esm/execution/ui-control-client-error.d.ts +2 -0
  115. package/dist/esm/execution/ui-control-client-error.js +2 -0
  116. package/dist/esm/execution/ui-control-client.d.ts +79 -0
  117. package/dist/esm/execution/ui-control-client.js +181 -0
  118. package/dist/esm/execution/{client-connection-state.d.ts → ui-controller-client-connection-state.d.ts} +1 -1
  119. package/dist/esm/execution/ui-controller-client-connection-state.js +7 -0
  120. package/dist/esm/execution/ui-controller-client-interface.d.ts +27 -0
  121. package/dist/esm/execution/{client-interface.js → ui-controller-client-interface.js} +0 -0
  122. package/dist/esm/execution/{control-your-ui-client.d.ts → ui-controller-client.d.ts} +6 -6
  123. package/dist/esm/execution/{control-your-ui-client.js → ui-controller-client.js} +26 -26
  124. package/dist/esm/lib/copy-example-project.js +2 -1
  125. package/dist/esm/lib/download-binaries.js +10 -9
  126. package/dist/esm/lib/index.d.ts +1 -1
  127. package/dist/esm/lib/index.js +1 -1
  128. package/dist/esm/lib/libfuse-error.d.ts +2 -0
  129. package/dist/esm/lib/libfuse-error.js +2 -0
  130. package/dist/esm/lib/logger.js +1 -1
  131. package/dist/esm/lib/timeout-error.d.ts +0 -2
  132. package/dist/esm/lib/timeout-error.js +0 -5
  133. package/dist/esm/lib/ui-controller-args.d.ts +47 -0
  134. package/dist/esm/lib/{control-ui-server-args.js → ui-controller-args.js} +0 -0
  135. package/dist/esm/lib/{control-ui-server-args.spec.d.ts → ui-controller-args.spec.d.ts} +0 -0
  136. package/dist/esm/lib/{control-ui-server-args.spec.js → ui-controller-args.spec.js} +1 -1
  137. package/dist/esm/lib/ui-controller-darwin.d.ts +6 -0
  138. package/dist/esm/lib/{control-ui-server-darwin.js → ui-controller-darwin.js} +6 -6
  139. package/dist/esm/lib/ui-controller-facade.d.ts +17 -0
  140. package/dist/esm/lib/{control-ui-server-facade.js → ui-controller-facade.js} +17 -11
  141. package/dist/esm/lib/ui-controller-linux.d.ts +5 -0
  142. package/dist/esm/lib/ui-controller-linux.js +48 -0
  143. package/dist/esm/lib/ui-controller-win32.d.ts +3 -0
  144. package/dist/esm/lib/ui-controller-win32.js +3 -0
  145. package/dist/esm/lib/ui-controller.d.ts +8 -0
  146. package/dist/esm/lib/{askui-control-server.js → ui-controller.js} +7 -7
  147. package/dist/esm/lib/unkown-error.d.ts +0 -2
  148. package/dist/esm/lib/unkown-error.js +0 -5
  149. package/dist/esm/lib/wayland-error.d.ts +2 -0
  150. package/dist/esm/lib/wayland-error.js +2 -0
  151. package/dist/esm/main.d.ts +3 -2
  152. package/dist/esm/main.js +3 -2
  153. package/dist/esm/shared/index.d.ts +1 -0
  154. package/dist/esm/shared/index.js +1 -0
  155. package/dist/esm/utils/analytics/analytics-interface.d.ts +3 -0
  156. package/dist/esm/utils/analytics/analytics-interface.js +1 -0
  157. package/dist/esm/utils/analytics/analytics.d.ts +5 -0
  158. package/dist/esm/utils/analytics/analytics.js +31 -0
  159. package/dist/esm/utils/analytics/index.d.ts +1 -0
  160. package/dist/esm/utils/analytics/index.js +1 -0
  161. package/dist/esm/utils/analytics/installation-timestamp-create-error.d.ts +4 -0
  162. package/dist/esm/utils/analytics/installation-timestamp-create-error.js +5 -0
  163. package/dist/esm/utils/analytics/installation-timestamp-get-error.d.ts +4 -0
  164. package/dist/esm/utils/analytics/installation-timestamp-get-error.js +5 -0
  165. package/dist/esm/utils/analytics/installation-timestamp.d.ts +7 -0
  166. package/dist/esm/utils/analytics/installation-timestamp.js +61 -0
  167. package/dist/esm/utils/analytics/user-identifier-interface.d.ts +3 -0
  168. package/dist/esm/utils/analytics/user-identifier-interface.js +1 -0
  169. package/dist/esm/utils/analytics/user-identifier.d.ts +4 -0
  170. package/dist/esm/utils/analytics/user-identifier.js +18 -0
  171. package/dist/esm/utils/base_64_image/base-64-image-error.d.ts +2 -0
  172. package/dist/esm/utils/base_64_image/base-64-image-error.js +2 -0
  173. package/dist/esm/utils/base_64_image/base-64-image-string-error.d.ts +4 -0
  174. package/dist/esm/utils/base_64_image/base-64-image-string-error.js +7 -0
  175. package/dist/esm/utils/base_64_image/base-64-image.d.ts +18 -0
  176. package/dist/esm/utils/base_64_image/base-64-image.js +79 -0
  177. package/dist/esm/utils/http/custom-errors/http-client-error.d.ts +0 -2
  178. package/dist/esm/utils/http/custom-errors/http-client-error.js +0 -5
  179. package/dist/esm/utils/http/http-client-got.d.ts +6 -5
  180. package/dist/esm/utils/http/http-client-got.js +11 -11
  181. package/dist/esm/utils/image-resize-errors/image-resizing-base-error.d.ts +0 -2
  182. package/dist/esm/utils/image-resize-errors/image-resizing-base-error.js +0 -5
  183. package/dist/esm/utils/image-resize-errors/index.d.ts +0 -1
  184. package/dist/esm/utils/image-resize-errors/index.js +0 -1
  185. package/dist/esm/utils/path.d.ts +1 -0
  186. package/dist/esm/utils/path.js +4 -0
  187. package/dist/esm/utils/transformations.d.ts +0 -2
  188. package/dist/esm/utils/transformations.js +11 -39
  189. package/dist/example_projects_templates/typescript_jest/test/helper/jest.setup.ts +7 -7
  190. package/dist/example_projects_templates/typescript_jest/test/jest.config.ts +3 -0
  191. package/package.json +15 -8
  192. package/dist/cjs/execution/client-connection-state.js +0 -10
  193. package/dist/cjs/execution/client-error.d.ts +0 -2
  194. package/dist/cjs/execution/client-error.js +0 -6
  195. package/dist/cjs/execution/client-interface.d.ts +0 -13
  196. package/dist/cjs/execution/client.d.ts +0 -25
  197. package/dist/cjs/execution/client.js +0 -116
  198. package/dist/cjs/lib/askui-control-server.d.ts +0 -8
  199. package/dist/cjs/lib/control-ui-server-args.d.ts +0 -21
  200. package/dist/cjs/lib/control-ui-server-darwin.d.ts +0 -6
  201. package/dist/cjs/lib/control-ui-server-facade.d.ts +0 -16
  202. package/dist/cjs/lib/control-ui-server-linux.d.ts +0 -4
  203. package/dist/cjs/lib/control-ui-server-linux.js +0 -13
  204. package/dist/cjs/lib/control-ui-server-win32.d.ts +0 -3
  205. package/dist/cjs/lib/control-ui-server-win32.js +0 -7
  206. package/dist/cjs/utils/image-resize-errors/invalid-base64-image-error.d.ts +0 -3
  207. package/dist/cjs/utils/image-resize-errors/invalid-base64-image-error.js +0 -7
  208. package/dist/esm/execution/client-connection-state.js +0 -7
  209. package/dist/esm/execution/client-error.d.ts +0 -2
  210. package/dist/esm/execution/client-error.js +0 -2
  211. package/dist/esm/execution/client-interface.d.ts +0 -13
  212. package/dist/esm/execution/client.d.ts +0 -25
  213. package/dist/esm/execution/client.js +0 -112
  214. package/dist/esm/lib/askui-control-server.d.ts +0 -8
  215. package/dist/esm/lib/control-ui-server-args.d.ts +0 -21
  216. package/dist/esm/lib/control-ui-server-darwin.d.ts +0 -6
  217. package/dist/esm/lib/control-ui-server-facade.d.ts +0 -16
  218. package/dist/esm/lib/control-ui-server-linux.d.ts +0 -4
  219. package/dist/esm/lib/control-ui-server-linux.js +0 -9
  220. package/dist/esm/lib/control-ui-server-win32.d.ts +0 -3
  221. package/dist/esm/lib/control-ui-server-win32.js +0 -3
  222. package/dist/esm/utils/image-resize-errors/invalid-base64-image-error.d.ts +0 -3
  223. package/dist/esm/utils/image-resize-errors/invalid-base64-image-error.js +0 -3
package/README.md CHANGED
@@ -42,6 +42,12 @@ npx askui init
42
42
 
43
43
  Visit our [documentation](https://docs.askui.com) for examples and a full list of supported commands.
44
44
 
45
+ ### Notes
46
+
47
+ Important note for Linux users: Currently, Wayland is not supported.
48
+ You can read more in our [troubleshooting chapter](https://docs.askui.com/docs/general/Troubleshooting/askui-ui-controller#wayland).
49
+ If you want to use the askui library libfuse2 is needed ([libfuse2 installation](https://docs.askui.com/docs/general/Troubleshooting/askui-ui-controller#libfuse2)).
50
+
45
51
  ## Example
46
52
 
47
53
  The following example shows the use of **askui** for testing a desktop application.
@@ -0,0 +1,35 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { access } = require('fs/promises');
4
+ const { join } = require('path');
5
+
6
+ async function shouldBeExecuted() {
7
+ try {
8
+ await access(join(__dirname, '../.no-askui-postinstall'));
9
+ } catch (err) {
10
+ if (err.code === 'ENOENT') {
11
+ return true;
12
+ }
13
+ // eslint-disable-next-line no-console
14
+ console.error(err);
15
+ }
16
+ return false;
17
+ }
18
+
19
+ async function createInstallationTimestamp() {
20
+ try {
21
+ const { InstallationTimestamp } = require('../dist/cjs/utils/analytics/installation-timestamp');
22
+ InstallationTimestamp.create();
23
+ } catch (err) {
24
+ // eslint-disable-next-line no-console
25
+ console.error(err);
26
+ }
27
+ }
28
+
29
+ async function main() {
30
+ if (await shouldBeExecuted()) {
31
+ await createInstallationTimestamp();
32
+ }
33
+ }
34
+
35
+ main();
@@ -4,13 +4,13 @@ export declare class CustomElement implements CustomElementJson {
4
4
  name?: string | undefined;
5
5
  threshold?: number | undefined;
6
6
  rotationDegreePerStep?: number | undefined;
7
- imageCompareFormat?: "grayscale" | "RGB" | undefined;
7
+ imageCompareFormat?: "RGB" | "grayscale" | undefined;
8
8
  mask?: {
9
9
  x: number;
10
10
  y: number;
11
11
  }[] | undefined;
12
12
  private static schema;
13
- constructor(customImage: string, name?: string | undefined, threshold?: number | undefined, rotationDegreePerStep?: number | undefined, imageCompareFormat?: "grayscale" | "RGB" | undefined, mask?: {
13
+ constructor(customImage: string, name?: string | undefined, threshold?: number | undefined, rotationDegreePerStep?: number | undefined, imageCompareFormat?: "RGB" | "grayscale" | undefined, mask?: {
14
14
  x: number;
15
15
  y: number;
16
16
  }[] | undefined);
@@ -11,7 +11,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.CustomElement = void 0;
13
13
  const yup_1 = require("yup");
14
- const transformations_1 = require("../../../utils/transformations");
14
+ const base_64_image_1 = require("../../../utils/base_64_image/base-64-image");
15
15
  class CustomElement {
16
16
  constructor(customImage, name, threshold, rotationDegreePerStep, imageCompareFormat, mask) {
17
17
  this.customImage = customImage;
@@ -28,7 +28,7 @@ class CustomElement {
28
28
  }
29
29
  static fromJsonWithImagePathOrImage(ceJson) {
30
30
  return __awaiter(this, void 0, void 0, function* () {
31
- const customImage = yield (0, transformations_1.toBase64ImageIfNeeded)(ceJson.customImage);
31
+ const customImage = (yield base_64_image_1.Base64Image.fromPathOrString(ceJson.customImage)).toString();
32
32
  const customElement = CustomElement.fromJson(Object.assign(Object.assign({}, ceJson), { customImage }));
33
33
  customElement.validate();
34
34
  return customElement;
@@ -10,12 +10,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  const custom_element_1 = require("./custom-element");
13
+ const base64ImageString = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAAA8CAYAAADWibxkAAAACXBIWXMAABYlAAAWJQFJUiTwAAAN20lEQVRogXVa3XrbSg7T7XHsfZyNneSJtm2cOH1/7UeCIMCRz4Xa2NYPhwRBkKPtdv7e306P/e3le7+dP+v43t9eHvt7HOfH/nb53q/12/vLdx5vL/f97RT/x/G53y73/e1S19Q5ccS9buc7zrt87+/nL1x/wvW3Sxz3/f3lnr/p/Pgu7HrUb/c8j/fC/XHdR9rJa2F7rieeV3/zmrhv3OP9BWvZciF1QvxwO9339xNPlvF+cX4+h2E/fe3bJf7GZxj2MMfiPrn4s84LJ9wu4bwwBosOJ6dN6Rhcm8+OxedBp69BgG08ImBxwB4G5qccEvbhui2ih+jy4jKAjokHnL73jzO9HOf/qRv/mEfj7wfuEWioB8O4QNGjIljO+k8hxc4nCuHQOF/RC4eEEyayLHCJQDoLqILzfvaP89884AA4vh1wLU9h8X9ycXQGoISFEdpKE0LUUBKQPoX36RQaGAbFgiKVaCzgncYy5c50UhyKWEY9I+8OKBsqRRk0OBUO78iffwp5SNc4cJ9HOEAGZ3RPf0YeEZaZ/5EambcF3YhWQ7VQE7A+uQPKmbHgiHwiipwh1DDKXFin3eW+Xy8RJMv9QiKDQFjLQfMz0MM0/oOUK3u3fFgQUhrCiMXfIsbXl9/pGPEFcwzOohG4jukjx3Ua8EikhBP4LEsBg+fMa6WCf5cQN9LryGcgxCfOY7Lvvm+3jAhvsOYibpDGVlT9YjA4HfAjBr945YCh7dyGvKVHoUWcYc+oRQZaWDGUolU9ysFMNRD0dKAqhx8POIBGzCMgj1xRBMETOIqR0wGAcqYSr3GvR/5npOHYhPMpokQO4EKRo5OHCHM5INO2iVYl0T+vaRVph8/xfdj42D/OP0gB5V0s4rGHUzwigmg83IlSBDbqfZ0n3eAO8FpNp8rpt+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WBtONjm8pspaGTZGH16ndrcF2JTItb/k86oFFA2gqQYrweyJEt9zoCq0UvgUcVPx+XzCU9JVo1rsZ0MRkfeGkzjY4M6w5n5MkV5kaXwuzrfKD5I6FyWn0hlzEdh9amQ96R6nA3wQsozpvLny8jck8HTSpsXUgkrgNOk4MbZj8BtTZZDQmBI7lH1/cZ0/fu7/Pf3aX/9RykjXe/laecml72y/Z/5XeT9V+TUnbMxlqDtWgjgRbAmx4xGG6PDNEfURjIhHfpHEPamZkUA6zBzlOHz+zjLNhbh0Zkl27pj7hdraxznbUGIDxrEQ9gDrBod3bEepTLU1RYpYXjM7J1lqiDlWG+e1TZwHfM8ehVrCbNOz+Q7RIQU+rXxZu2u9/SwxrAaAnIaiaz4ufcDoID/36z/6ngq0ecPIVAGaQxF33NxWW6T82gD16/64bnvW3a2sj0X+6irhg9SuHN5EWat8lK84Mt9NPrv66+bniV2H/ckDaZqSbVu0FpIie57NGRs8MAcSLFVeruQAzQ7YJQ4uaX6Z7xtN5TZl8GEy1LZIq/jmzUDL4ZUaG4baMNcD/H8hlYADpzRH1QAAAABJRU5ErkJggg==';
13
14
  describe('CustomElement', () => {
14
15
  describe('fromJsonWithImagePathOrImage', () => {
15
16
  test('should return CustomElement if CustomElement created from JSON is valid', () => __awaiter(void 0, void 0, void 0, function* () {
16
- const expected = new custom_element_1.CustomElement('data:image', 'Dummy_element', 0.7, 10, 'RGB', [{ x: 0, y: 1 }, { x: 1, y: 2 }, { x: 3, y: 4 }]);
17
+ const expected = new custom_element_1.CustomElement(base64ImageString, 'Dummy_element', 0.7, 10, 'RGB', [{ x: 0, y: 1 }, { x: 1, y: 2 }, { x: 3, y: 4 }]);
17
18
  const actual = yield custom_element_1.CustomElement.fromJsonWithImagePathOrImage({
18
- customImage: 'data:image',
19
+ customImage: base64ImageString,
19
20
  name: 'Dummy_element',
20
21
  threshold: 0.7,
21
22
  rotationDegreePerStep: 10,
@@ -26,25 +27,25 @@ describe('CustomElement', () => {
26
27
  }));
27
28
  test('should throw ValidationError if threshold is invalid', () => {
28
29
  expect(() => {
29
- const customElement = new custom_element_1.CustomElement('data:image', 'Dummy_element', 1.1, 10, 'RGB', [{ x: 0, y: 1 }, { x: 1, y: 2 }, { x: 3, y: 4 }]);
30
+ const customElement = new custom_element_1.CustomElement(base64ImageString, 'Dummy_element', 1.1, 10, 'RGB', [{ x: 0, y: 1 }, { x: 1, y: 2 }, { x: 3, y: 4 }]);
30
31
  customElement.validate();
31
32
  }).toThrow('threshold must be less than or equal to 1');
32
33
  });
33
34
  test('should throw ValidationError if rotationDegreePerStep is invalid', () => {
34
35
  expect(() => {
35
- const customElement = new custom_element_1.CustomElement('data:image', 'Dummy_element', 0.9, -90, 'RGB', [{ x: 0, y: 1 }, { x: 1, y: 2 }, { x: 3, y: 4 }]);
36
+ const customElement = new custom_element_1.CustomElement(base64ImageString, 'Dummy_element', 0.9, -90, 'RGB', [{ x: 0, y: 1 }, { x: 1, y: 2 }, { x: 3, y: 4 }]);
36
37
  customElement.validate();
37
38
  }).toThrow('rotationDegreePerStep must be greater than or equal to 0');
38
39
  });
39
40
  test('should throw ValidationError if mask is invalid', () => {
40
41
  expect(() => {
41
- const customElement = new custom_element_1.CustomElement('data:image', 'Dummy_element', 0.9, 10, 'RGB', [{ x: 0, y: 1 }, { x: 1, y: 2 }]);
42
+ const customElement = new custom_element_1.CustomElement(base64ImageString, 'Dummy_element', 0.9, 10, 'RGB', [{ x: 0, y: 1 }, { x: 1, y: 2 }]);
42
43
  customElement.validate();
43
44
  }).toThrow('mask must contain at least 3 points');
44
45
  });
45
46
  test('should throw ValidationError if mask and threshold are both invalid', () => {
46
47
  expect(() => {
47
- const customElement = new custom_element_1.CustomElement('data:image', 'Dummy_element', 90, 10, 'RGB', [{ x: 0, y: 1 }, { x: 1, y: 2 }]);
48
+ const customElement = new custom_element_1.CustomElement(base64ImageString, 'Dummy_element', 90, 10, 'RGB', [{ x: 0, y: 1 }, { x: 1, y: 2 }]);
48
49
  customElement.validate();
49
50
  }).toThrow('threshold must be less than or equal to 1, mask must contain at least 3 points');
50
51
  });
@@ -1,7 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TestStep = exports.CustomElement = void 0;
3
+ exports.CustomElement = void 0;
4
4
  var custom_element_1 = require("./custom-element");
5
5
  Object.defineProperty(exports, "CustomElement", { enumerable: true, get: function () { return custom_element_1.CustomElement; } });
6
- var test_step_1 = require("./test-step");
7
- Object.defineProperty(exports, "TestStep", { enumerable: true, get: function () { return test_step_1.TestStep; } });
@@ -1,10 +1,6 @@
1
1
  import { CustomElement } from './custom-element';
2
- import { CustomElementJson } from './custom-element-json';
3
- export declare class TestStep {
2
+ export interface TestStep {
4
3
  instruction: string;
5
- customElements: CustomElement[];
6
- constructor(instruction: string, customElements?: CustomElement[]);
7
- static fromJson(step: TestStep & {
8
- customElements: CustomElementJson[];
9
- }): TestStep;
4
+ customElements?: CustomElement[];
5
+ secretText?: string | undefined;
10
6
  }
@@ -1,14 +1,2 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TestStep = void 0;
4
- const custom_element_1 = require("./custom-element");
5
- class TestStep {
6
- constructor(instruction, customElements = []) {
7
- this.instruction = instruction;
8
- this.customElements = customElements;
9
- }
10
- static fromJson(step) {
11
- return new TestStep(step.instruction, (step.customElements || []).map((customELement) => custom_element_1.CustomElement.fromJson(customELement)));
12
- }
13
- }
14
- exports.TestStep = TestStep;
@@ -6,4 +6,5 @@ export declare class ControlCommand {
6
6
  tryToRepeat: boolean;
7
7
  constructor(code: ControlCommandCode, actions: Action[], tryToRepeat?: boolean);
8
8
  static fromJson(json: ControlCommand, resizeRatio?: number): ControlCommand;
9
+ setTextToBeTyped(text: string): void;
9
10
  }
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ControlCommand = void 0;
4
4
  const action_1 = require("./action");
5
5
  const control_command_code_1 = require("./control-command-code");
6
+ const input_event_1 = require("./input-event");
6
7
  class ControlCommand {
7
8
  constructor(code, actions, tryToRepeat = false) {
8
9
  this.code = code;
@@ -12,5 +13,9 @@ class ControlCommand {
12
13
  static fromJson(json, resizeRatio = 1) {
13
14
  return new ControlCommand(control_command_code_1.ControlCommandCode[json.code], json.actions.map((action) => action_1.Action.fromJson(action, resizeRatio)), json.tryToRepeat);
14
15
  }
16
+ setTextToBeTyped(text) {
17
+ this.actions = this.actions.map((action) => ([input_event_1.InputEvent.TYPE, input_event_1.InputEvent.TYPE_TEXT].includes(action.inputEvent)
18
+ ? new action_1.Action(action.inputEvent, action.position, text) : action));
19
+ }
15
20
  }
16
21
  exports.ControlCommand = ControlCommand;
@@ -16,6 +16,5 @@ export declare enum InputEvent {
16
16
  MOUSE_MOVE = "MOUSE_MOVE",
17
17
  MOUSE_DOWN = "MOUSE_DOWN",
18
18
  MOUSE_UP = "MOUSE_UP",
19
- EXECUTE_COMMAND = "EXECUTE_COMMAND",
20
- WAIT = "WAIT"
19
+ EXECUTE_COMMAND = "EXECUTE_COMMAND"
21
20
  }
@@ -21,5 +21,4 @@ var InputEvent;
21
21
  InputEvent["MOUSE_DOWN"] = "MOUSE_DOWN";
22
22
  InputEvent["MOUSE_UP"] = "MOUSE_UP";
23
23
  InputEvent["EXECUTE_COMMAND"] = "EXECUTE_COMMAND";
24
- InputEvent["WAIT"] = "WAIT";
25
24
  })(InputEvent = exports.InputEvent || (exports.InputEvent = {}));
@@ -1,9 +1,4 @@
1
1
  import { CustomElementJson } from '../core/model/test-case-dto';
2
- export declare enum TimeUnit {
3
- MS = "millisecond",
4
- S = "seconds",
5
- MIN = "minutes"
6
- }
7
2
  export declare type PC_KEY = 'backspace' | 'delete' | 'enter' | 'tab' | 'escape' | 'up' | 'down' | 'right' | 'left' | 'home' | 'end' | 'pageup' | 'pagedown' | 'f1' | 'f2' | 'f3' | 'f4' | 'f5' | 'f6' | 'f7' | 'f8' | 'f9' | 'f10' | 'f11' | 'f12' | 'space' | '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g' | 'h' | 'i' | 'j' | 'k' | 'l' | 'm' | 'n' | 'o' | 'p' | 'q' | 'r' | 's' | 't' | 'u' | 'v' | 'w' | 'x' | 'y' | 'z' | 'A' | 'B' | 'C' | 'D' | 'E' | 'F' | 'G' | 'H' | 'I' | 'J' | 'K' | 'L' | 'M' | 'N' | 'O' | 'P' | 'Q' | 'R' | 'S' | 'T' | 'U' | 'V' | 'W' | 'X' | 'Y' | 'Z' | '!' | '"' | '#' | '$' | '%' | '&' | "'" | '(' | ')' | '*' | '+' | ',' | '-' | '.' | '/' | ':' | ';' | '<' | '=' | '>' | '?' | '@' | '[' | '\\' | ']' | '^' | '_' | '`' | '{' | '|' | '}' | '~ ';
8
3
  export declare type ANDROID_KEY = 'home' | 'back' | 'call' | 'endcall' | '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | 'star' | 'pound' | 'dpad_up' | 'dpad_down' | 'dpad_left' | 'dpad_right' | 'dpad_center' | 'volume_up' | 'volume_down' | 'power' | 'camera' | 'clear' | 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g' | 'h' | 'i' | 'j' | 'k' | 'l' | 'm' | 'n' | 'o' | 'p' | 'q' | 'r' | 's' | 't' | 'u' | 'v' | 'w' | 'x' | 'y' | 'z' | 'comma' | 'period' | 'alt_left' | 'alt_right' | 'shift_left' | 'shift_right' | 'tab' | 'space' | 'sym' | 'explorer' | 'envelope' | 'enter' | 'del' | 'grave' | 'minus' | 'equals' | 'left_bracket' | 'right_bracket' | 'backslash' | 'semicolon' | 'apostrophe' | 'slash' | 'at' | 'num' | 'headsethook' | 'focus' | 'plus' | 'menu' | 'notification' | 'search' | 'media_play_pause' | 'media_stop' | 'media_next' | 'media_previous' | 'media_rewind' | 'media_fast_forward' | 'mute' | 'page_up' | 'page_down' | 'switch_charset' | 'escape' | 'forward_del' | 'ctrl_left' | 'ctrl_right' | 'caps_lock' | 'scroll_lock' | 'function' | 'break' | 'move_home' | 'move_end' | 'insert' | 'forward' | 'media_play' | 'media_pause' | 'media_close' | 'media_eject' | 'media_record' | 'f1' | 'f2' | 'f3' | 'f4' | 'f5' | 'f6' | 'f7' | 'f8' | 'f9' | 'f10' | 'f11' | 'f12' | 'num_lock' | 'numpad_0' | 'numpad_1' | 'numpad_2' | 'numpad_3' | 'numpad_4' | 'numpad_5' | 'numpad_6' | 'numpad_7' | 'numpad_8' | 'numpad_9' | 'numpad_divide' | 'numpad_multiply' | 'numpad_subtract' | 'numpad_add' | 'numpad_dot' | 'numpad_comma' | 'numpad_enter' | 'numpad_equals' | 'numpad_left_paren' | 'numpad_right_paren' | 'volume_mute' | 'info' | 'channel_up' | 'channel_down' | 'zoom_in' | 'zoom_out' | 'window' | 'guide' | 'bookmark' | 'captions' | 'settings' | 'app_switch' | 'language_switch' | 'contacts' | 'calendar' | 'music' | 'calculator' | 'assist' | 'brightness_down' | 'brightness_up' | 'media_audio_track' | 'sleep' | 'wakeup' | 'pairing' | 'media_top_menu' | 'last_channel' | 'tv_data_service' | 'voice_assist' | 'help' | 'navigate_previous' | 'navigate_next' | 'navigate_in' | 'navigate_out' | 'dpad_up_left' | 'dpad_down_left' | 'dpad_up_right' | 'dpad_down_right' | 'media_skip_forward' | 'media_skip_backward' | 'media_step_forward' | 'media_step_backward' | 'soft_sleep' | 'cut' | 'copy' | 'paste' | 'all_apps' | 'refresh';
9
4
  export declare type MODIFIER_KEY = 'command' | 'alt' | 'control' | 'shift' | 'right_shift';
@@ -19,7 +14,10 @@ declare abstract class FluentBase {
19
14
  protected get textStr(): string;
20
15
  protected get params(): Map<string, unknown>;
21
16
  }
22
- declare class Exec extends FluentBase {
17
+ export interface Executable {
18
+ exec(): Promise<void>;
19
+ }
20
+ export declare class Exec extends FluentBase implements Executable {
23
21
  exec(): Promise<void>;
24
22
  }
25
23
  export declare class FluentFilters extends FluentBase {
@@ -1333,14 +1331,14 @@ export declare abstract class FluentCommand extends FluentBase {
1333
1331
  */
1334
1332
  typeIn(text: string): FluentFilters;
1335
1333
  /**
1336
- * Scrolls in the x and y direction, e.g., until an element is visible.
1334
+ * Moves mouse to the filtered element and scrolls in the x and y direction
1337
1335
  *
1338
1336
  * @param {number} x_offset - A (positive/negative) x direction.
1339
1337
  * @param {number} y_offset - A (positive/negative) y direction.
1340
1338
  *
1341
1339
  * @return {FluentFilters}
1342
1340
  */
1343
- scrollUntil(x_offset: number, y_offset: number): FluentFilters;
1341
+ scrollInside(x_offset: number, y_offset: number): FluentFilters;
1344
1342
  /**
1345
1343
  * Moves the mouse relatively to an element in the direction.
1346
1344
  * This can be used when the mouse should not hover over on an element anymore.
@@ -1368,15 +1366,6 @@ export declare abstract class FluentCommand extends FluentBase {
1368
1366
  * @return {Exec}
1369
1367
  */
1370
1368
  type(text: string): Exec;
1371
- /**
1372
- * Waits for `<timeValue> <timeUnit>`, e.g., 10 seconds.
1373
- *
1374
- * @param {number} timeValue - A number of time unit, e.g., ms or min, to wait for.
1375
- * @param {TimeUnit} timeUnit - A time unit, e.g., ms, s or min.
1376
- *
1377
- * @return {Exec}
1378
- */
1379
- waitFor(timeValue: number, timeUnit: TimeUnit): Exec;
1380
1369
  /**
1381
1370
  * Moves the mouse from the current position (relative) in x and y direction.
1382
1371
  *
@@ -4,13 +4,7 @@
4
4
  /* eslint-disable max-classes-per-file */
5
5
  // Autogenerated from typescript.template file
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.FluentCommand = exports.FluentFiltersOrRelationsCondition = exports.FluentFiltersCondition = exports.FluentFiltersOrRelations = exports.FluentFilters = exports.TimeUnit = void 0;
8
- var TimeUnit;
9
- (function (TimeUnit) {
10
- TimeUnit["MS"] = "millisecond";
11
- TimeUnit["S"] = "seconds";
12
- TimeUnit["MIN"] = "minutes";
13
- })(TimeUnit = exports.TimeUnit || (exports.TimeUnit = {}));
7
+ exports.FluentCommand = exports.FluentFiltersOrRelationsCondition = exports.FluentFiltersCondition = exports.FluentFiltersOrRelations = exports.FluentFilters = exports.Exec = void 0;
14
8
  class FluentBase {
15
9
  constructor(prev) {
16
10
  this.prev = prev;
@@ -47,6 +41,7 @@ class Exec extends FluentBase {
47
41
  return this.commandStringBuilder();
48
42
  }
49
43
  }
44
+ exports.Exec = Exec;
50
45
  // Filters
51
46
  class FluentFilters extends FluentBase {
52
47
  /**
@@ -1877,14 +1872,14 @@ class FluentCommand extends FluentBase {
1877
1872
  return new FluentFilters(this);
1878
1873
  }
1879
1874
  /**
1880
- * Scrolls in the x and y direction, e.g., until an element is visible.
1875
+ * Moves mouse to the filtered element and scrolls in the x and y direction
1881
1876
  *
1882
1877
  * @param {number} x_offset - A (positive/negative) x direction.
1883
1878
  * @param {number} y_offset - A (positive/negative) y direction.
1884
1879
  *
1885
1880
  * @return {FluentFilters}
1886
1881
  */
1887
- scrollUntil(x_offset, y_offset) {
1882
+ scrollInside(x_offset, y_offset) {
1888
1883
  this._textStr = `Scroll x ${x_offset} y ${y_offset} in`;
1889
1884
  return new FluentFilters(this);
1890
1885
  }
@@ -1924,18 +1919,6 @@ class FluentCommand extends FluentBase {
1924
1919
  this._textStr = `Type "${text}"`;
1925
1920
  return new Exec(this);
1926
1921
  }
1927
- /**
1928
- * Waits for `<timeValue> <timeUnit>`, e.g., 10 seconds.
1929
- *
1930
- * @param {number} timeValue - A number of time unit, e.g., ms or min, to wait for.
1931
- * @param {TimeUnit} timeUnit - A time unit, e.g., ms, s or min.
1932
- *
1933
- * @return {Exec}
1934
- */
1935
- waitFor(timeValue, timeUnit) {
1936
- this._textStr = `Wait for ${timeValue} ${timeUnit}`;
1937
- return new Exec(this);
1938
- }
1939
1922
  /**
1940
1923
  * Moves the mouse from the current position (relative) in x and y direction.
1941
1924
  *
@@ -1,13 +1,14 @@
1
1
  import { TestStep } from '../core/model/test-case-dto';
2
- import { ControlYourUiClient } from './control-your-ui-client';
3
- import { ControlYourUiApi } from './control-your-ui-api';
2
+ import { UiControllerClient } from './ui-controller-client';
3
+ import { InferenceClient } from './inference-client';
4
4
  import { Annotation } from '../core/annotation/annotation';
5
5
  import { CustomElementJson } from '../core/model/test-case-dto/custom-element-json';
6
6
  export declare class ExecutionRuntime {
7
- private client;
8
- private api;
9
- constructor(client: ControlYourUiClient, api: ControlYourUiApi);
7
+ private uiControllerClient;
8
+ private inferenceClient;
9
+ constructor(uiControllerClient: UiControllerClient, inferenceClient: InferenceClient);
10
10
  executeTestStep(step: TestStep): Promise<void>;
11
+ private requestControl;
11
12
  /**
12
13
  * @param {TestStep} step - Test step used for predicting command.
13
14
  */
@@ -20,6 +21,7 @@ export declare class ExecutionRuntime {
20
21
  * --> retry with linear back-off
21
22
  */
22
23
  private predictCommandWithRetry;
24
+ private getImageIfRequired;
23
25
  private predictCommand;
24
26
  annotateInteractively(): Promise<void>;
25
27
  takeScreenshotIfImageisNotProvided(imagePath?: string): Promise<string>;
@@ -15,12 +15,12 @@ const test_case_dto_1 = require("../core/model/test-case-dto");
15
15
  const repeat_error_1 = require("./repeat-error");
16
16
  const misc_1 = require("./misc");
17
17
  const control_command_error_1 = require("./control-command-error");
18
- const transformations_1 = require("../utils/transformations");
19
18
  const logger_1 = require("../lib/logger");
19
+ const base_64_image_1 = require("../utils/base_64_image/base-64-image");
20
20
  class ExecutionRuntime {
21
- constructor(client, api) {
22
- this.client = client;
23
- this.api = api;
21
+ constructor(uiControllerClient, inferenceClient) {
22
+ this.uiControllerClient = uiControllerClient;
23
+ this.inferenceClient = inferenceClient;
24
24
  this.EXEC_REPETITION_COUNT = 25;
25
25
  this.PREDICT_COMMAND_RETRY_COUNT = 2;
26
26
  }
@@ -30,6 +30,11 @@ class ExecutionRuntime {
30
30
  yield this.executeCommand(step);
31
31
  });
32
32
  }
33
+ requestControl(controlCommand) {
34
+ return __awaiter(this, void 0, void 0, function* () {
35
+ yield this.uiControllerClient.requestControl(controlCommand);
36
+ });
37
+ }
33
38
  /**
34
39
  * @param {TestStep} step - Test step used for predicting command.
35
40
  */
@@ -38,15 +43,13 @@ class ExecutionRuntime {
38
43
  return __awaiter(this, void 0, void 0, function* () {
39
44
  const controlCommand = yield this.predictCommandWithRetry(step);
40
45
  if (controlCommand.code === ui_control_commands_1.ControlCommandCode.OK) {
41
- yield this.client.requestControl(controlCommand);
42
- }
43
- else if (controlCommand.tryToRepeat) {
44
- yield this.client.requestControl(controlCommand);
45
- this.executeCommandRepeatedly(step);
46
+ return this.requestControl(controlCommand);
46
47
  }
47
- else {
48
- throw new control_command_error_1.ControlCommandError(((_a = controlCommand.actions[0]) === null || _a === void 0 ? void 0 : _a.text) || '');
48
+ if (controlCommand.tryToRepeat) {
49
+ yield this.requestControl(controlCommand);
50
+ return this.executeCommandRepeatedly(step);
49
51
  }
52
+ throw new control_command_error_1.ControlCommandError(((_a = controlCommand.actions[0]) === null || _a === void 0 ? void 0 : _a.text) || '');
50
53
  });
51
54
  }
52
55
  executeCommandRepeatedly(step) {
@@ -63,8 +66,8 @@ class ExecutionRuntime {
63
66
  if (controlCommand.code === ui_control_commands_1.ControlCommandCode.OK) {
64
67
  break;
65
68
  }
66
- else if (controlCommand.tryToRepeat) {
67
- yield this.client.requestControl(controlCommand);
69
+ if (controlCommand.tryToRepeat) {
70
+ yield this.requestControl(controlCommand);
68
71
  }
69
72
  else {
70
73
  throw new control_command_error_1.ControlCommandError(((_a = controlCommand.actions[0]) === null || _a === void 0 ? void 0 : _a.text) || '');
@@ -94,31 +97,40 @@ class ExecutionRuntime {
94
97
  return command;
95
98
  });
96
99
  }
100
+ getImageIfRequired(instruction) {
101
+ return __awaiter(this, void 0, void 0, function* () {
102
+ const isImageRequired = yield this.inferenceClient.isImageRequired(instruction);
103
+ if (!isImageRequired) {
104
+ return undefined;
105
+ }
106
+ const screenshotResponse = yield this.uiControllerClient.requestScreenshot();
107
+ return screenshotResponse.data.image;
108
+ });
109
+ }
97
110
  predictCommand(step) {
98
111
  return __awaiter(this, void 0, void 0, function* () {
99
- const isImageRequired = yield this.api.isImageRequired(step.instruction);
100
- let image;
101
- if (isImageRequired) {
102
- const screenshotResponse = yield this.client.requestScreenshot();
103
- image = screenshotResponse.data.image;
112
+ const image = yield this.getImageIfRequired(step.instruction);
113
+ const controlCommand = yield this.inferenceClient.predictControlCommand(step.instruction, step.customElements, image);
114
+ if (step.secretText !== undefined) {
115
+ controlCommand.setTextToBeTyped(step.secretText);
104
116
  }
105
- return this.api.predictControlCommand(step.instruction, step.customElements, image);
117
+ return controlCommand;
106
118
  });
107
119
  }
108
120
  annotateInteractively() {
109
121
  return __awaiter(this, void 0, void 0, function* () {
110
122
  const annotationResponse = yield this.annotateImage();
111
- yield this.client.annotateInteractively(annotationResponse.objects, annotationResponse.image);
123
+ yield this.uiControllerClient.annotateInteractively(annotationResponse.objects, annotationResponse.image);
112
124
  });
113
125
  }
114
126
  takeScreenshotIfImageisNotProvided(imagePath) {
115
127
  return __awaiter(this, void 0, void 0, function* () {
116
128
  let base64Image = '';
117
129
  if (imagePath !== undefined) {
118
- base64Image = yield (0, transformations_1.toBase64Image)(imagePath);
130
+ base64Image = (yield base_64_image_1.Base64Image.fromPath(imagePath)).toString();
119
131
  }
120
132
  if (imagePath === undefined) {
121
- const screenshotResponse = yield this.client.requestScreenshot();
133
+ const screenshotResponse = yield this.uiControllerClient.requestScreenshot();
122
134
  base64Image = screenshotResponse.data.image;
123
135
  }
124
136
  return base64Image;
@@ -131,7 +143,7 @@ class ExecutionRuntime {
131
143
  if (customElementJson !== undefined) {
132
144
  customElements = yield test_case_dto_1.CustomElement.fromJsonListWithImagePathOrImage(customElementJson);
133
145
  }
134
- return this.api.predictImageAnnotation(base64Image, customElements);
146
+ return this.inferenceClient.predictImageAnnotation(base64Image, customElements);
135
147
  });
136
148
  }
137
149
  }
@@ -1 +1,2 @@
1
- export { AskuiClient } from './client';
1
+ export { AnnotationLevel } from './annotation-level';
2
+ export { UiControlClient } from './ui-control-client';
@@ -1,5 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AskuiClient = void 0;
4
- var client_1 = require("./client");
5
- Object.defineProperty(exports, "AskuiClient", { enumerable: true, get: function () { return client_1.AskuiClient; } });
3
+ exports.UiControlClient = exports.AnnotationLevel = void 0;
4
+ var annotation_level_1 = require("./annotation-level");
5
+ Object.defineProperty(exports, "AnnotationLevel", { enumerable: true, get: function () { return annotation_level_1.AnnotationLevel; } });
6
+ var ui_control_client_1 = require("./ui-control-client");
7
+ Object.defineProperty(exports, "UiControlClient", { enumerable: true, get: function () { return ui_control_client_1.UiControlClient; } });
@@ -2,12 +2,12 @@ import { HttpClientGot } from '../utils/http/http-client-got';
2
2
  import { ControlCommand } from '../core/ui-control-commands';
3
3
  import { CustomElement } from '../core/model/test-case-dto';
4
4
  import { Annotation } from '../core/annotation/annotation';
5
- export declare class ControlYourUiApi {
6
- apiEndpointUrl: string;
5
+ export declare class InferenceClient {
6
+ url: string;
7
7
  httpClient: HttpClientGot;
8
- constructor(apiEndpointUrl: string, httpClient: HttpClientGot);
8
+ constructor(url: string, httpClient: HttpClientGot);
9
9
  isImageRequired(instruction: string): Promise<boolean>;
10
10
  private resizeIfNeeded;
11
- predictControlCommand(instruction: string, customElements: CustomElement[], image?: string): Promise<ControlCommand>;
11
+ predictControlCommand(instruction: string, customElements?: CustomElement[], image?: string): Promise<ControlCommand>;
12
12
  predictImageAnnotation(image: string, customElements?: CustomElement[]): Promise<Annotation>;
13
13
  }
@@ -12,19 +12,19 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.ControlYourUiApi = void 0;
15
+ exports.InferenceClient = void 0;
16
16
  const url_join_1 = __importDefault(require("url-join"));
17
17
  const ui_control_commands_1 = require("../core/ui-control-commands");
18
18
  const annotation_1 = require("../core/annotation/annotation");
19
19
  const transformations_1 = require("../utils/transformations");
20
- class ControlYourUiApi {
21
- constructor(apiEndpointUrl, httpClient) {
22
- this.apiEndpointUrl = apiEndpointUrl;
20
+ class InferenceClient {
21
+ constructor(url, httpClient) {
22
+ this.url = url;
23
23
  this.httpClient = httpClient;
24
24
  }
25
25
  isImageRequired(instruction) {
26
26
  return __awaiter(this, void 0, void 0, function* () {
27
- const url = (0, url_join_1.default)(this.apiEndpointUrl, 'instruction', 'is-image-required');
27
+ const url = (0, url_join_1.default)(this.url, 'instruction', 'is-image-required');
28
28
  const httpBody = {
29
29
  instruction,
30
30
  };
@@ -41,7 +41,7 @@ class ControlYourUiApi {
41
41
  return (0, transformations_1.resizeBase64ImageWithSameRatio)(image);
42
42
  });
43
43
  }
44
- predictControlCommand(instruction, customElements, image) {
44
+ predictControlCommand(instruction, customElements = [], image) {
45
45
  return __awaiter(this, void 0, void 0, function* () {
46
46
  const resizedImage = yield this.resizeIfNeeded(customElements, image);
47
47
  const httpBody = {
@@ -49,7 +49,7 @@ class ControlYourUiApi {
49
49
  instruction,
50
50
  customElements,
51
51
  };
52
- const url = (0, url_join_1.default)(this.apiEndpointUrl, 'api', 'v1', 'predict-command');
52
+ const url = (0, url_join_1.default)(this.url, 'api', 'v1', 'predict-command');
53
53
  const httpResponse = yield this.httpClient.post(url, httpBody);
54
54
  return ui_control_commands_1.ControlCommand.fromJson(httpResponse, resizedImage.resizeRatio);
55
55
  });
@@ -61,10 +61,10 @@ class ControlYourUiApi {
61
61
  image: resizedImage.base64Image,
62
62
  customElements,
63
63
  };
64
- const url = (0, url_join_1.default)(this.apiEndpointUrl, 'annotate', '?format=json');
64
+ const url = (0, url_join_1.default)(this.url, 'annotate', '?format=json');
65
65
  const httpResponse = yield this.httpClient.post(url, httpBody);
66
66
  return annotation_1.Annotation.fromJson(Object.assign(Object.assign({}, httpResponse), { image }), resizedImage.resizeRatio);
67
67
  });
68
68
  }
69
69
  }
70
- exports.ControlYourUiApi = ControlYourUiApi;
70
+ exports.InferenceClient = InferenceClient;
@@ -0,0 +1,2 @@
1
+ export declare class UiControlClientError extends Error {
2
+ }
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UiControlClientError = void 0;
4
+ class UiControlClientError extends Error {
5
+ }
6
+ exports.UiControlClientError = UiControlClientError;