askui 0.1.6 → 0.2.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.
- package/README.md +6 -0
- package/dist/cjs/core/model/test-case-dto/custom-element.d.ts +2 -2
- package/dist/cjs/core/model/test-case-dto/custom-element.js +2 -2
- package/dist/cjs/core/model/test-case-dto/custom-element.spec.js +7 -6
- package/dist/cjs/execution/dsl.d.ts +6 -17
- package/dist/cjs/execution/dsl.js +4 -21
- package/dist/cjs/execution/execution-runtime.d.ts +5 -5
- package/dist/cjs/execution/execution-runtime.js +14 -14
- package/dist/cjs/execution/index.d.ts +2 -1
- package/dist/cjs/execution/index.js +5 -3
- package/dist/cjs/execution/{control-your-ui-api.d.ts → inference-client.d.ts} +3 -3
- package/dist/cjs/execution/{control-your-ui-api.js → inference-client.js} +8 -8
- package/dist/cjs/execution/ui-control-client-error.d.ts +2 -0
- package/dist/cjs/execution/ui-control-client-error.js +6 -0
- package/dist/cjs/execution/ui-control-client.d.ts +34 -0
- package/dist/cjs/execution/{client.js → ui-control-client.js} +48 -29
- package/dist/cjs/execution/{client-connection-state.d.ts → ui-controller-client-connection-state.d.ts} +1 -1
- package/dist/cjs/execution/ui-controller-client-connection-state.js +10 -0
- package/dist/cjs/execution/ui-controller-client-interface.d.ts +27 -0
- package/dist/cjs/execution/{client-interface.js → ui-controller-client-interface.js} +0 -0
- package/dist/cjs/execution/{control-your-ui-client.d.ts → ui-controller-client.d.ts} +6 -6
- package/dist/cjs/execution/{control-your-ui-client.js → ui-controller-client.js} +28 -28
- package/dist/cjs/lib/download-binaries.js +8 -8
- package/dist/cjs/lib/index.d.ts +1 -1
- package/dist/cjs/lib/index.js +3 -3
- package/dist/cjs/lib/libfuse-error.d.ts +2 -0
- package/dist/cjs/lib/libfuse-error.js +6 -0
- package/dist/cjs/lib/logger.js +1 -1
- package/dist/cjs/lib/timeout-error.d.ts +0 -2
- package/dist/cjs/lib/timeout-error.js +0 -5
- package/dist/cjs/lib/ui-controller-args.d.ts +47 -0
- package/dist/cjs/lib/{control-ui-server-args.js → ui-controller-args.js} +0 -0
- package/dist/cjs/lib/{control-ui-server-args.spec.d.ts → ui-controller-args.spec.d.ts} +0 -0
- package/dist/cjs/lib/{control-ui-server-args.spec.js → ui-controller-args.spec.js} +7 -7
- package/dist/cjs/lib/ui-controller-darwin.d.ts +6 -0
- package/dist/cjs/lib/{control-ui-server-darwin.js → ui-controller-darwin.js} +8 -8
- package/dist/cjs/lib/ui-controller-facade.d.ts +17 -0
- package/dist/cjs/lib/{control-ui-server-facade.js → ui-controller-facade.js} +22 -16
- package/dist/cjs/lib/ui-controller-linux.d.ts +5 -0
- package/dist/cjs/lib/ui-controller-linux.js +52 -0
- package/dist/cjs/lib/ui-controller-win32.d.ts +3 -0
- package/dist/cjs/lib/ui-controller-win32.js +7 -0
- package/dist/cjs/lib/ui-controller.d.ts +8 -0
- package/dist/cjs/lib/{askui-control-server.js → ui-controller.js} +9 -9
- package/dist/cjs/lib/unkown-error.d.ts +0 -2
- package/dist/cjs/lib/unkown-error.js +0 -5
- package/dist/cjs/lib/wayland-error.d.ts +2 -0
- package/dist/cjs/lib/wayland-error.js +6 -0
- package/dist/cjs/main.d.ts +3 -2
- package/dist/cjs/main.js +6 -3
- package/dist/cjs/shared/index.d.ts +1 -0
- package/dist/cjs/shared/index.js +5 -0
- package/dist/cjs/utils/analytics/analytics-interface.d.ts +3 -0
- package/dist/cjs/utils/analytics/analytics-interface.js +2 -0
- package/dist/cjs/utils/analytics/analytics.d.ts +5 -0
- package/dist/cjs/utils/analytics/analytics.js +32 -0
- package/dist/cjs/utils/analytics/index.d.ts +1 -0
- package/dist/cjs/utils/analytics/index.js +5 -0
- package/dist/cjs/utils/analytics/user-identifier-interface.d.ts +3 -0
- package/dist/cjs/utils/analytics/user-identifier-interface.js +2 -0
- package/dist/cjs/utils/analytics/user-identifier.d.ts +4 -0
- package/dist/cjs/utils/analytics/user-identifier.js +22 -0
- package/dist/cjs/utils/base_64_image/base-64-image-error.d.ts +2 -0
- package/dist/cjs/utils/base_64_image/base-64-image-error.js +6 -0
- package/dist/cjs/utils/base_64_image/base-64-image-path-error.d.ts +4 -0
- package/dist/cjs/utils/base_64_image/base-64-image-path-error.js +11 -0
- package/dist/cjs/utils/base_64_image/base-64-image-string-error.d.ts +4 -0
- package/dist/cjs/utils/base_64_image/base-64-image-string-error.js +11 -0
- package/dist/cjs/utils/base_64_image/base-64-image.d.ts +18 -0
- package/dist/cjs/utils/base_64_image/base-64-image.js +86 -0
- package/dist/cjs/utils/http/custom-errors/http-client-error.d.ts +0 -2
- package/dist/cjs/utils/http/custom-errors/http-client-error.js +0 -5
- package/dist/cjs/utils/http/http-client-got.d.ts +6 -5
- package/dist/cjs/utils/http/http-client-got.js +11 -11
- package/dist/cjs/utils/image-resize-errors/image-resizing-base-error.d.ts +0 -2
- package/dist/cjs/utils/image-resize-errors/image-resizing-base-error.js +0 -5
- package/dist/cjs/utils/image-resize-errors/index.d.ts +0 -1
- package/dist/cjs/utils/image-resize-errors/index.js +1 -3
- package/dist/cjs/utils/transformations.d.ts +0 -2
- package/dist/cjs/utils/transformations.js +11 -44
- package/dist/esm/core/model/test-case-dto/custom-element.d.ts +2 -2
- package/dist/esm/core/model/test-case-dto/custom-element.js +2 -2
- package/dist/esm/core/model/test-case-dto/custom-element.spec.js +7 -6
- package/dist/esm/execution/dsl.d.ts +6 -17
- package/dist/esm/execution/dsl.js +3 -21
- package/dist/esm/execution/execution-runtime.d.ts +5 -5
- package/dist/esm/execution/execution-runtime.js +14 -14
- package/dist/esm/execution/index.d.ts +2 -1
- package/dist/esm/execution/index.js +2 -1
- package/dist/esm/execution/{control-your-ui-api.d.ts → inference-client.d.ts} +3 -3
- package/dist/esm/execution/{control-your-ui-api.js → inference-client.js} +6 -6
- package/dist/esm/execution/ui-control-client-error.d.ts +2 -0
- package/dist/esm/execution/ui-control-client-error.js +2 -0
- package/dist/esm/execution/ui-control-client.d.ts +34 -0
- package/dist/esm/execution/{client.js → ui-control-client.js} +46 -27
- package/dist/esm/execution/{client-connection-state.d.ts → ui-controller-client-connection-state.d.ts} +1 -1
- package/dist/esm/execution/ui-controller-client-connection-state.js +7 -0
- package/dist/esm/execution/ui-controller-client-interface.d.ts +27 -0
- package/dist/esm/execution/{client-interface.js → ui-controller-client-interface.js} +0 -0
- package/dist/esm/execution/{control-your-ui-client.d.ts → ui-controller-client.d.ts} +6 -6
- package/dist/esm/execution/{control-your-ui-client.js → ui-controller-client.js} +26 -26
- package/dist/esm/lib/download-binaries.js +8 -8
- package/dist/esm/lib/index.d.ts +1 -1
- package/dist/esm/lib/index.js +1 -1
- package/dist/esm/lib/libfuse-error.d.ts +2 -0
- package/dist/esm/lib/libfuse-error.js +2 -0
- package/dist/esm/lib/logger.js +1 -1
- package/dist/esm/lib/timeout-error.d.ts +0 -2
- package/dist/esm/lib/timeout-error.js +0 -5
- package/dist/esm/lib/ui-controller-args.d.ts +47 -0
- package/dist/esm/lib/{control-ui-server-args.js → ui-controller-args.js} +0 -0
- package/dist/esm/lib/{control-ui-server-args.spec.d.ts → ui-controller-args.spec.d.ts} +0 -0
- package/dist/esm/lib/{control-ui-server-args.spec.js → ui-controller-args.spec.js} +1 -1
- package/dist/esm/lib/ui-controller-darwin.d.ts +6 -0
- package/dist/esm/lib/{control-ui-server-darwin.js → ui-controller-darwin.js} +6 -6
- package/dist/esm/lib/ui-controller-facade.d.ts +17 -0
- package/dist/esm/lib/{control-ui-server-facade.js → ui-controller-facade.js} +17 -11
- package/dist/esm/lib/ui-controller-linux.d.ts +5 -0
- package/dist/esm/lib/ui-controller-linux.js +48 -0
- package/dist/esm/lib/ui-controller-win32.d.ts +3 -0
- package/dist/esm/lib/ui-controller-win32.js +3 -0
- package/dist/esm/lib/ui-controller.d.ts +8 -0
- package/dist/esm/lib/{askui-control-server.js → ui-controller.js} +7 -7
- package/dist/esm/lib/unkown-error.d.ts +0 -2
- package/dist/esm/lib/unkown-error.js +0 -5
- package/dist/esm/lib/wayland-error.d.ts +2 -0
- package/dist/esm/lib/wayland-error.js +2 -0
- package/dist/esm/main.d.ts +3 -2
- package/dist/esm/main.js +3 -2
- package/dist/esm/shared/index.d.ts +1 -0
- package/dist/esm/shared/index.js +1 -0
- package/dist/esm/utils/analytics/analytics-interface.d.ts +3 -0
- package/dist/esm/utils/analytics/analytics-interface.js +1 -0
- package/dist/esm/utils/analytics/analytics.d.ts +5 -0
- package/dist/esm/utils/analytics/analytics.js +25 -0
- package/dist/esm/utils/analytics/index.d.ts +1 -0
- package/dist/esm/utils/analytics/index.js +1 -0
- package/dist/esm/utils/analytics/user-identifier-interface.d.ts +3 -0
- package/dist/esm/utils/analytics/user-identifier-interface.js +1 -0
- package/dist/esm/utils/analytics/user-identifier.d.ts +4 -0
- package/dist/esm/utils/analytics/user-identifier.js +18 -0
- package/dist/esm/utils/base_64_image/base-64-image-error.d.ts +2 -0
- package/dist/esm/utils/base_64_image/base-64-image-error.js +2 -0
- package/dist/esm/utils/base_64_image/base-64-image-path-error.d.ts +4 -0
- package/dist/esm/utils/base_64_image/base-64-image-path-error.js +7 -0
- package/dist/esm/utils/base_64_image/base-64-image-string-error.d.ts +4 -0
- package/dist/esm/utils/base_64_image/base-64-image-string-error.js +7 -0
- package/dist/esm/utils/base_64_image/base-64-image.d.ts +18 -0
- package/dist/esm/utils/base_64_image/base-64-image.js +79 -0
- package/dist/esm/utils/http/custom-errors/http-client-error.d.ts +0 -2
- package/dist/esm/utils/http/custom-errors/http-client-error.js +0 -5
- package/dist/esm/utils/http/http-client-got.d.ts +6 -5
- package/dist/esm/utils/http/http-client-got.js +11 -11
- package/dist/esm/utils/image-resize-errors/image-resizing-base-error.d.ts +0 -2
- package/dist/esm/utils/image-resize-errors/image-resizing-base-error.js +0 -5
- package/dist/esm/utils/image-resize-errors/index.d.ts +0 -1
- package/dist/esm/utils/image-resize-errors/index.js +0 -1
- package/dist/esm/utils/transformations.d.ts +0 -2
- package/dist/esm/utils/transformations.js +11 -39
- package/dist/example_projects_templates/typescript_jest/test/helper/jest.setup.ts +7 -7
- package/dist/example_projects_templates/typescript_jest/test/jest.config.ts +3 -0
- package/package.json +9 -6
- package/dist/cjs/execution/client-connection-state.js +0 -10
- package/dist/cjs/execution/client-error.d.ts +0 -2
- package/dist/cjs/execution/client-error.js +0 -6
- package/dist/cjs/execution/client-interface.d.ts +0 -13
- package/dist/cjs/execution/client.d.ts +0 -25
- package/dist/cjs/lib/askui-control-server.d.ts +0 -8
- package/dist/cjs/lib/control-ui-server-args.d.ts +0 -21
- package/dist/cjs/lib/control-ui-server-darwin.d.ts +0 -6
- package/dist/cjs/lib/control-ui-server-facade.d.ts +0 -16
- package/dist/cjs/lib/control-ui-server-linux.d.ts +0 -4
- package/dist/cjs/lib/control-ui-server-linux.js +0 -13
- package/dist/cjs/lib/control-ui-server-win32.d.ts +0 -3
- package/dist/cjs/lib/control-ui-server-win32.js +0 -7
- package/dist/esm/execution/client-connection-state.js +0 -7
- package/dist/esm/execution/client-error.d.ts +0 -2
- package/dist/esm/execution/client-error.js +0 -2
- package/dist/esm/execution/client-interface.d.ts +0 -13
- package/dist/esm/execution/client.d.ts +0 -25
- package/dist/esm/lib/askui-control-server.d.ts +0 -8
- package/dist/esm/lib/control-ui-server-args.d.ts +0 -21
- package/dist/esm/lib/control-ui-server-darwin.d.ts +0 -6
- package/dist/esm/lib/control-ui-server-facade.d.ts +0 -16
- package/dist/esm/lib/control-ui-server-linux.d.ts +0 -4
- package/dist/esm/lib/control-ui-server-linux.js +0 -9
- package/dist/esm/lib/control-ui-server-win32.d.ts +0 -3
- package/dist/esm/lib/control-ui-server-win32.js +0 -3
|
@@ -8,12 +8,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { CustomElement } from './custom-element';
|
|
11
|
+
const base64ImageString = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAAA8CAYAAADWibx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96R6nA3wQsozpvLny8jck8HTSpsXUgkrgNOk4MbZj8BtTZZDQmBI7lH1/cZ0/fu7/Pf3aX/9RykjXe/laecml72y/Z/5XeT9V+TUnbMxlqDtWgjgRbAmx4xGG6PDNEfURjIhHfpHEPamZkUA6zBzlOHz+zjLNhbh0Zkl27pj7hdraxznbUGIDxrEQ9gDrBod3bEepTLU1RYpYXjM7J1lqiDlWG+e1TZwHfM8ehVrCbNOz+Q7RIQU+rXxZu2u9/SwxrAaAnIaiaz4ufcDoID/36z/6ngq0ecPIVAGaQxF33NxWW6T82gD16/64bnvW3a2sj0X+6irhg9SuHN5EWat8lK84Mt9NPrv66+bniV2H/ckDaZqSbVu0FpIie57NGRs8MAcSLFVeruQAzQ7YJQ4uaX6Z7xtN5TZl8GEy1LZIq/jmzUDL4ZUaG4baMNcD/H8hlYADpzRH1QAAAABJRU5ErkJggg==';
|
|
11
12
|
describe('CustomElement', () => {
|
|
12
13
|
describe('fromJsonWithImagePathOrImage', () => {
|
|
13
14
|
test('should return CustomElement if CustomElement created from JSON is valid', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
14
|
-
const expected = new CustomElement(
|
|
15
|
+
const expected = new CustomElement(base64ImageString, 'Dummy_element', 0.7, 10, 'RGB', [{ x: 0, y: 1 }, { x: 1, y: 2 }, { x: 3, y: 4 }]);
|
|
15
16
|
const actual = yield CustomElement.fromJsonWithImagePathOrImage({
|
|
16
|
-
customImage:
|
|
17
|
+
customImage: base64ImageString,
|
|
17
18
|
name: 'Dummy_element',
|
|
18
19
|
threshold: 0.7,
|
|
19
20
|
rotationDegreePerStep: 10,
|
|
@@ -24,25 +25,25 @@ describe('CustomElement', () => {
|
|
|
24
25
|
}));
|
|
25
26
|
test('should throw ValidationError if threshold is invalid', () => {
|
|
26
27
|
expect(() => {
|
|
27
|
-
const customElement = new CustomElement(
|
|
28
|
+
const customElement = new CustomElement(base64ImageString, 'Dummy_element', 1.1, 10, 'RGB', [{ x: 0, y: 1 }, { x: 1, y: 2 }, { x: 3, y: 4 }]);
|
|
28
29
|
customElement.validate();
|
|
29
30
|
}).toThrow('threshold must be less than or equal to 1');
|
|
30
31
|
});
|
|
31
32
|
test('should throw ValidationError if rotationDegreePerStep is invalid', () => {
|
|
32
33
|
expect(() => {
|
|
33
|
-
const customElement = new CustomElement(
|
|
34
|
+
const customElement = new CustomElement(base64ImageString, 'Dummy_element', 0.9, -90, 'RGB', [{ x: 0, y: 1 }, { x: 1, y: 2 }, { x: 3, y: 4 }]);
|
|
34
35
|
customElement.validate();
|
|
35
36
|
}).toThrow('rotationDegreePerStep must be greater than or equal to 0');
|
|
36
37
|
});
|
|
37
38
|
test('should throw ValidationError if mask is invalid', () => {
|
|
38
39
|
expect(() => {
|
|
39
|
-
const customElement = new CustomElement(
|
|
40
|
+
const customElement = new CustomElement(base64ImageString, 'Dummy_element', 0.9, 10, 'RGB', [{ x: 0, y: 1 }, { x: 1, y: 2 }]);
|
|
40
41
|
customElement.validate();
|
|
41
42
|
}).toThrow('mask must contain at least 3 points');
|
|
42
43
|
});
|
|
43
44
|
test('should throw ValidationError if mask and threshold are both invalid', () => {
|
|
44
45
|
expect(() => {
|
|
45
|
-
const customElement = new CustomElement(
|
|
46
|
+
const customElement = new CustomElement(base64ImageString, 'Dummy_element', 90, 10, 'RGB', [{ x: 0, y: 1 }, { x: 1, y: 2 }]);
|
|
46
47
|
customElement.validate();
|
|
47
48
|
}).toThrow('threshold must be less than or equal to 1, mask must contain at least 3 points');
|
|
48
49
|
});
|
|
@@ -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
|
-
|
|
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
|
-
*
|
|
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
|
-
|
|
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
|
*
|
|
@@ -2,12 +2,6 @@
|
|
|
2
2
|
/* eslint-disable @typescript-eslint/naming-convention */
|
|
3
3
|
/* eslint-disable max-classes-per-file */
|
|
4
4
|
// Autogenerated from typescript.template file
|
|
5
|
-
export var TimeUnit;
|
|
6
|
-
(function (TimeUnit) {
|
|
7
|
-
TimeUnit["MS"] = "millisecond";
|
|
8
|
-
TimeUnit["S"] = "seconds";
|
|
9
|
-
TimeUnit["MIN"] = "minutes";
|
|
10
|
-
})(TimeUnit || (TimeUnit = {}));
|
|
11
5
|
class FluentBase {
|
|
12
6
|
constructor(prev) {
|
|
13
7
|
this.prev = prev;
|
|
@@ -39,7 +33,7 @@ class FluentBase {
|
|
|
39
33
|
get textStr() { return this._textStr; }
|
|
40
34
|
get params() { return this._params; }
|
|
41
35
|
}
|
|
42
|
-
class Exec extends FluentBase {
|
|
36
|
+
export class Exec extends FluentBase {
|
|
43
37
|
exec() {
|
|
44
38
|
return this.commandStringBuilder();
|
|
45
39
|
}
|
|
@@ -1870,14 +1864,14 @@ export class FluentCommand extends FluentBase {
|
|
|
1870
1864
|
return new FluentFilters(this);
|
|
1871
1865
|
}
|
|
1872
1866
|
/**
|
|
1873
|
-
*
|
|
1867
|
+
* Moves mouse to the filtered element and scrolls in the x and y direction
|
|
1874
1868
|
*
|
|
1875
1869
|
* @param {number} x_offset - A (positive/negative) x direction.
|
|
1876
1870
|
* @param {number} y_offset - A (positive/negative) y direction.
|
|
1877
1871
|
*
|
|
1878
1872
|
* @return {FluentFilters}
|
|
1879
1873
|
*/
|
|
1880
|
-
|
|
1874
|
+
scrollInside(x_offset, y_offset) {
|
|
1881
1875
|
this._textStr = `Scroll x ${x_offset} y ${y_offset} in`;
|
|
1882
1876
|
return new FluentFilters(this);
|
|
1883
1877
|
}
|
|
@@ -1917,18 +1911,6 @@ export class FluentCommand extends FluentBase {
|
|
|
1917
1911
|
this._textStr = `Type "${text}"`;
|
|
1918
1912
|
return new Exec(this);
|
|
1919
1913
|
}
|
|
1920
|
-
/**
|
|
1921
|
-
* Waits for `<timeValue> <timeUnit>`, e.g., 10 seconds.
|
|
1922
|
-
*
|
|
1923
|
-
* @param {number} timeValue - A number of time unit, e.g., ms or min, to wait for.
|
|
1924
|
-
* @param {TimeUnit} timeUnit - A time unit, e.g., ms, s or min.
|
|
1925
|
-
*
|
|
1926
|
-
* @return {Exec}
|
|
1927
|
-
*/
|
|
1928
|
-
waitFor(timeValue, timeUnit) {
|
|
1929
|
-
this._textStr = `Wait for ${timeValue} ${timeUnit}`;
|
|
1930
|
-
return new Exec(this);
|
|
1931
|
-
}
|
|
1932
1914
|
/**
|
|
1933
1915
|
* Moves the mouse from the current position (relative) in x and y direction.
|
|
1934
1916
|
*
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { TestStep } from '../core/model/test-case-dto';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
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
|
|
8
|
-
private
|
|
9
|
-
constructor(
|
|
7
|
+
private uiControllerClient;
|
|
8
|
+
private inferenceClient;
|
|
9
|
+
constructor(uiControllerClient: UiControllerClient, inferenceClient: InferenceClient);
|
|
10
10
|
executeTestStep(step: TestStep): Promise<void>;
|
|
11
11
|
/**
|
|
12
12
|
* @param {TestStep} step - Test step used for predicting command.
|
|
@@ -12,12 +12,12 @@ import { CustomElement } from '../core/model/test-case-dto';
|
|
|
12
12
|
import { RepeatError } from './repeat-error';
|
|
13
13
|
import { delay } from './misc';
|
|
14
14
|
import { ControlCommandError } from './control-command-error';
|
|
15
|
-
import { toBase64Image } from '../utils/transformations';
|
|
16
15
|
import { logger } from '../lib/logger';
|
|
16
|
+
import { Base64Image } from '../utils/base_64_image/base-64-image';
|
|
17
17
|
export class ExecutionRuntime {
|
|
18
|
-
constructor(
|
|
19
|
-
this.
|
|
20
|
-
this.
|
|
18
|
+
constructor(uiControllerClient, inferenceClient) {
|
|
19
|
+
this.uiControllerClient = uiControllerClient;
|
|
20
|
+
this.inferenceClient = inferenceClient;
|
|
21
21
|
this.EXEC_REPETITION_COUNT = 25;
|
|
22
22
|
this.PREDICT_COMMAND_RETRY_COUNT = 2;
|
|
23
23
|
}
|
|
@@ -35,10 +35,10 @@ export class ExecutionRuntime {
|
|
|
35
35
|
return __awaiter(this, void 0, void 0, function* () {
|
|
36
36
|
const controlCommand = yield this.predictCommandWithRetry(step);
|
|
37
37
|
if (controlCommand.code === ControlCommandCode.OK) {
|
|
38
|
-
yield this.
|
|
38
|
+
yield this.uiControllerClient.requestControl(controlCommand);
|
|
39
39
|
}
|
|
40
40
|
else if (controlCommand.tryToRepeat) {
|
|
41
|
-
yield this.
|
|
41
|
+
yield this.uiControllerClient.requestControl(controlCommand);
|
|
42
42
|
this.executeCommandRepeatedly(step);
|
|
43
43
|
}
|
|
44
44
|
else {
|
|
@@ -61,7 +61,7 @@ export class ExecutionRuntime {
|
|
|
61
61
|
break;
|
|
62
62
|
}
|
|
63
63
|
else if (controlCommand.tryToRepeat) {
|
|
64
|
-
yield this.
|
|
64
|
+
yield this.uiControllerClient.requestControl(controlCommand);
|
|
65
65
|
}
|
|
66
66
|
else {
|
|
67
67
|
throw new ControlCommandError(((_a = controlCommand.actions[0]) === null || _a === void 0 ? void 0 : _a.text) || '');
|
|
@@ -93,29 +93,29 @@ export class ExecutionRuntime {
|
|
|
93
93
|
}
|
|
94
94
|
predictCommand(step) {
|
|
95
95
|
return __awaiter(this, void 0, void 0, function* () {
|
|
96
|
-
const isImageRequired = yield this.
|
|
96
|
+
const isImageRequired = yield this.inferenceClient.isImageRequired(step.instruction);
|
|
97
97
|
let image;
|
|
98
98
|
if (isImageRequired) {
|
|
99
|
-
const screenshotResponse = yield this.
|
|
99
|
+
const screenshotResponse = yield this.uiControllerClient.requestScreenshot();
|
|
100
100
|
image = screenshotResponse.data.image;
|
|
101
101
|
}
|
|
102
|
-
return this.
|
|
102
|
+
return this.inferenceClient.predictControlCommand(step.instruction, step.customElements, image);
|
|
103
103
|
});
|
|
104
104
|
}
|
|
105
105
|
annotateInteractively() {
|
|
106
106
|
return __awaiter(this, void 0, void 0, function* () {
|
|
107
107
|
const annotationResponse = yield this.annotateImage();
|
|
108
|
-
yield this.
|
|
108
|
+
yield this.uiControllerClient.annotateInteractively(annotationResponse.objects, annotationResponse.image);
|
|
109
109
|
});
|
|
110
110
|
}
|
|
111
111
|
takeScreenshotIfImageisNotProvided(imagePath) {
|
|
112
112
|
return __awaiter(this, void 0, void 0, function* () {
|
|
113
113
|
let base64Image = '';
|
|
114
114
|
if (imagePath !== undefined) {
|
|
115
|
-
base64Image = yield
|
|
115
|
+
base64Image = (yield Base64Image.fromPath(imagePath)).toString();
|
|
116
116
|
}
|
|
117
117
|
if (imagePath === undefined) {
|
|
118
|
-
const screenshotResponse = yield this.
|
|
118
|
+
const screenshotResponse = yield this.uiControllerClient.requestScreenshot();
|
|
119
119
|
base64Image = screenshotResponse.data.image;
|
|
120
120
|
}
|
|
121
121
|
return base64Image;
|
|
@@ -128,7 +128,7 @@ export class ExecutionRuntime {
|
|
|
128
128
|
if (customElementJson !== undefined) {
|
|
129
129
|
customElements = yield CustomElement.fromJsonListWithImagePathOrImage(customElementJson);
|
|
130
130
|
}
|
|
131
|
-
return this.
|
|
131
|
+
return this.inferenceClient.predictImageAnnotation(base64Image, customElements);
|
|
132
132
|
});
|
|
133
133
|
}
|
|
134
134
|
}
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { AnnotationLevel } from './annotation-level';
|
|
2
|
+
export { UiControlClient } from './ui-control-client';
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { AnnotationLevel } from './annotation-level';
|
|
2
|
+
export { UiControlClient } from './ui-control-client';
|
|
@@ -2,10 +2,10 @@ 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
|
|
6
|
-
|
|
5
|
+
export declare class InferenceClient {
|
|
6
|
+
url: string;
|
|
7
7
|
httpClient: HttpClientGot;
|
|
8
|
-
constructor(
|
|
8
|
+
constructor(url: string, httpClient: HttpClientGot);
|
|
9
9
|
isImageRequired(instruction: string): Promise<boolean>;
|
|
10
10
|
private resizeIfNeeded;
|
|
11
11
|
predictControlCommand(instruction: string, customElements: CustomElement[], image?: string): Promise<ControlCommand>;
|
|
@@ -11,14 +11,14 @@ import urljoin from 'url-join';
|
|
|
11
11
|
import { ControlCommand } from '../core/ui-control-commands';
|
|
12
12
|
import { Annotation } from '../core/annotation/annotation';
|
|
13
13
|
import { resizeBase64ImageWithSameRatio } from '../utils/transformations';
|
|
14
|
-
export class
|
|
15
|
-
constructor(
|
|
16
|
-
this.
|
|
14
|
+
export class InferenceClient {
|
|
15
|
+
constructor(url, httpClient) {
|
|
16
|
+
this.url = url;
|
|
17
17
|
this.httpClient = httpClient;
|
|
18
18
|
}
|
|
19
19
|
isImageRequired(instruction) {
|
|
20
20
|
return __awaiter(this, void 0, void 0, function* () {
|
|
21
|
-
const url = urljoin(this.
|
|
21
|
+
const url = urljoin(this.url, 'instruction', 'is-image-required');
|
|
22
22
|
const httpBody = {
|
|
23
23
|
instruction,
|
|
24
24
|
};
|
|
@@ -43,7 +43,7 @@ export class ControlYourUiApi {
|
|
|
43
43
|
instruction,
|
|
44
44
|
customElements,
|
|
45
45
|
};
|
|
46
|
-
const url = urljoin(this.
|
|
46
|
+
const url = urljoin(this.url, 'api', 'v1', 'predict-command');
|
|
47
47
|
const httpResponse = yield this.httpClient.post(url, httpBody);
|
|
48
48
|
return ControlCommand.fromJson(httpResponse, resizedImage.resizeRatio);
|
|
49
49
|
});
|
|
@@ -55,7 +55,7 @@ export class ControlYourUiApi {
|
|
|
55
55
|
image: resizedImage.base64Image,
|
|
56
56
|
customElements,
|
|
57
57
|
};
|
|
58
|
-
const url = urljoin(this.
|
|
58
|
+
const url = urljoin(this.url, 'annotate', '?format=json');
|
|
59
59
|
const httpResponse = yield this.httpClient.post(url, httpBody);
|
|
60
60
|
return Annotation.fromJson(Object.assign(Object.assign({}, httpResponse), { image }), resizedImage.resizeRatio);
|
|
61
61
|
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { CustomElementJson } from '../core/model/test-case-dto';
|
|
2
|
+
import { Executable, FluentCommand } from './dsl';
|
|
3
|
+
import { UiControllerClientConnectionState } from './ui-controller-client-connection-state';
|
|
4
|
+
import { Annotation } from '../core/annotation/annotation';
|
|
5
|
+
import { AnnotationRequest } from '../core/model/annotation-result/annotation-interface';
|
|
6
|
+
import { ClientArgs } from './ui-controller-client-interface';
|
|
7
|
+
export declare class UiControlClient extends FluentCommand {
|
|
8
|
+
private httpClient;
|
|
9
|
+
private clientArgs;
|
|
10
|
+
private _uiControllerClient?;
|
|
11
|
+
private constructor();
|
|
12
|
+
static build(clientArgs?: ClientArgs): Promise<UiControlClient>;
|
|
13
|
+
private get uiControllerClient();
|
|
14
|
+
private get inferenceClient();
|
|
15
|
+
private get executionRuntime();
|
|
16
|
+
private annotateByDefault;
|
|
17
|
+
connect(): Promise<UiControllerClientConnectionState>;
|
|
18
|
+
annotate(annotationRequest?: AnnotationRequest): Promise<Annotation>;
|
|
19
|
+
annotateInteractively(): Promise<void>;
|
|
20
|
+
exec(instruction: string, customElementJson?: CustomElementJson[]): Promise<void>;
|
|
21
|
+
/**
|
|
22
|
+
* Waits for `<delayInMs>` ms, e.g., 1000 ms. The exact delay may be a little longer
|
|
23
|
+
* than `<delayInMs>` but never shorter than that.
|
|
24
|
+
*
|
|
25
|
+
* @param {number} delayInMs - The delay in ms to wait for.
|
|
26
|
+
*
|
|
27
|
+
* @return {Executable}
|
|
28
|
+
*/
|
|
29
|
+
waitFor(delayInMs: number): Executable;
|
|
30
|
+
/**
|
|
31
|
+
* closes the connection to the controlui-server`.
|
|
32
|
+
*/
|
|
33
|
+
close(): void;
|
|
34
|
+
}
|
|
@@ -10,48 +10,50 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
import { CustomElement } from '../core/model/test-case-dto';
|
|
11
11
|
import { FluentCommand } from './dsl';
|
|
12
12
|
import { HttpClientGot } from '../utils/http/http-client-got';
|
|
13
|
-
import {
|
|
13
|
+
import { UiControllerClient } from './ui-controller-client';
|
|
14
14
|
import { ExecutionRuntime } from './execution-runtime';
|
|
15
|
-
import {
|
|
15
|
+
import { InferenceClient } from './inference-client';
|
|
16
16
|
import { AnnotationWriter } from '../core/annotation/annotation-writer';
|
|
17
17
|
import { logger } from '../lib/logger';
|
|
18
18
|
import { TestStepState } from '../core/model/test-case-result-dto';
|
|
19
19
|
import { AnnotationLevel } from './annotation-level';
|
|
20
|
-
import {
|
|
20
|
+
import { UiControlClientError } from './ui-control-client-error';
|
|
21
21
|
import { envCredentials } from './read-environment-credentials';
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
import { Analytics } from '../utils/analytics';
|
|
23
|
+
const getClientArgsWithDefaults = (clientArgs = {}) => (Object.assign({ uiControllerUrl: 'http://localhost:6769', inferenceServerUrl: 'https://inference.askui.com', annotationLevel: AnnotationLevel.DISABLED }, clientArgs));
|
|
24
|
+
export class UiControlClient extends FluentCommand {
|
|
25
|
+
constructor(httpClient, clientArgs) {
|
|
25
26
|
super();
|
|
27
|
+
this.httpClient = httpClient;
|
|
26
28
|
this.clientArgs = clientArgs;
|
|
27
|
-
this.httpClient = new HttpClientGot(((_a = this.clientArgs) === null || _a === void 0 ? void 0 : _a.credentials) ? this.clientArgs.credentials : envCredentials());
|
|
28
29
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
static build(clientArgs) {
|
|
31
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
32
|
+
const analytics = new Analytics();
|
|
33
|
+
const analyticsHeaders = yield analytics.getAnalyticsHeaders();
|
|
34
|
+
const cas = getClientArgsWithDefaults(clientArgs);
|
|
35
|
+
const httpClient = new HttpClientGot(cas.credentials || envCredentials(), analyticsHeaders);
|
|
36
|
+
return new UiControlClient(httpClient, cas);
|
|
37
|
+
});
|
|
34
38
|
}
|
|
35
|
-
get
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
};
|
|
41
|
-
return Object.assign(defaults, this.clientArgs);
|
|
39
|
+
get uiControllerClient() {
|
|
40
|
+
if (!this._uiControllerClient) {
|
|
41
|
+
this._uiControllerClient = new UiControllerClient(this.clientArgs.uiControllerUrl);
|
|
42
|
+
}
|
|
43
|
+
return this._uiControllerClient;
|
|
42
44
|
}
|
|
43
|
-
get
|
|
44
|
-
return new
|
|
45
|
+
get inferenceClient() {
|
|
46
|
+
return new InferenceClient(this.clientArgs.inferenceServerUrl, this.httpClient);
|
|
45
47
|
}
|
|
46
48
|
get executionRuntime() {
|
|
47
|
-
return new ExecutionRuntime(this.
|
|
49
|
+
return new ExecutionRuntime(this.uiControllerClient, this.inferenceClient);
|
|
48
50
|
}
|
|
49
51
|
annotateByDefault(testStepState, customElements = []) {
|
|
50
52
|
return __awaiter(this, void 0, void 0, function* () {
|
|
51
53
|
if ((testStepState === TestStepState.FAILED
|
|
52
|
-
&& this.
|
|
54
|
+
&& this.clientArgs.annotationLevel === AnnotationLevel.DISABLED)
|
|
53
55
|
|| (testStepState === TestStepState.PASSED
|
|
54
|
-
&& this.
|
|
56
|
+
&& this.clientArgs.annotationLevel !== AnnotationLevel.ALL)) {
|
|
55
57
|
return;
|
|
56
58
|
}
|
|
57
59
|
yield this.annotate({
|
|
@@ -62,7 +64,7 @@ export class AskuiClient extends FluentCommand {
|
|
|
62
64
|
}
|
|
63
65
|
connect() {
|
|
64
66
|
return __awaiter(this, void 0, void 0, function* () {
|
|
65
|
-
const connectionState = yield this.
|
|
67
|
+
const connectionState = yield this.uiControllerClient.connect();
|
|
66
68
|
return connectionState;
|
|
67
69
|
});
|
|
68
70
|
}
|
|
@@ -99,14 +101,31 @@ export class AskuiClient extends FluentCommand {
|
|
|
99
101
|
}
|
|
100
102
|
catch (error) {
|
|
101
103
|
yield this.annotateByDefault(TestStepState.FAILED, customElements);
|
|
102
|
-
return Promise.reject(new
|
|
104
|
+
return Promise.reject(new UiControlClientError(`A problem occures while executing the instruction: ${instruction}. Reason ${error}`));
|
|
103
105
|
}
|
|
104
106
|
});
|
|
105
107
|
}
|
|
108
|
+
/**
|
|
109
|
+
* Waits for `<delayInMs>` ms, e.g., 1000 ms. The exact delay may be a little longer
|
|
110
|
+
* than `<delayInMs>` but never shorter than that.
|
|
111
|
+
*
|
|
112
|
+
* @param {number} delayInMs - The delay in ms to wait for.
|
|
113
|
+
*
|
|
114
|
+
* @return {Executable}
|
|
115
|
+
*/
|
|
116
|
+
// eslint-disable-next-line class-methods-use-this
|
|
117
|
+
waitFor(delayInMs) {
|
|
118
|
+
return {
|
|
119
|
+
exec() {
|
|
120
|
+
logger.debug(`Wait for ${delayInMs} ms`);
|
|
121
|
+
return new Promise((resolve) => { setTimeout(() => resolve(), delayInMs); });
|
|
122
|
+
},
|
|
123
|
+
};
|
|
124
|
+
}
|
|
106
125
|
/**
|
|
107
126
|
* closes the connection to the controlui-server`.
|
|
108
127
|
*/
|
|
109
128
|
close() {
|
|
110
|
-
this.
|
|
129
|
+
this.uiControllerClient.close();
|
|
111
130
|
}
|
|
112
131
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export var UiControllerClientConnectionState;
|
|
2
|
+
(function (UiControllerClientConnectionState) {
|
|
3
|
+
UiControllerClientConnectionState[UiControllerClientConnectionState["NOT_CONNECTED"] = 0] = "NOT_CONNECTED";
|
|
4
|
+
UiControllerClientConnectionState[UiControllerClientConnectionState["CONNECTING"] = 1] = "CONNECTING";
|
|
5
|
+
UiControllerClientConnectionState[UiControllerClientConnectionState["CONNECTED"] = 2] = "CONNECTED";
|
|
6
|
+
UiControllerClientConnectionState[UiControllerClientConnectionState["ERROR"] = 3] = "ERROR";
|
|
7
|
+
})(UiControllerClientConnectionState || (UiControllerClientConnectionState = {}));
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { CredentialArgs } from '../utils/http/credentials';
|
|
2
|
+
import { AnnotationLevel } from './annotation-level';
|
|
3
|
+
/**
|
|
4
|
+
* Configuration options for the askui UI Control Client
|
|
5
|
+
*
|
|
6
|
+
* @param {string} uiControllerUrl - Default: http://localhost:6769
|
|
7
|
+
* The adress of the askui UI Controller server.
|
|
8
|
+
* @param {string} inferenceClientUrl - Default: https://inference.askui.com`
|
|
9
|
+
* Address of the askui Inference server.
|
|
10
|
+
* @param {AnnotationLevel} annotationLevel - Default: AnnotationLevel.DISABLED
|
|
11
|
+
* Usage of annotate command
|
|
12
|
+
* after execution of test steps.
|
|
13
|
+
* You have three options: `DISABLED`, `ON_FAILURE`, `ALL`.
|
|
14
|
+
* @param {CredentialArgs} credentials - We need to provide credentials for
|
|
15
|
+
* the authentication of the askui Inference Server.
|
|
16
|
+
*/
|
|
17
|
+
export interface ClientArgs {
|
|
18
|
+
readonly uiControllerUrl?: string;
|
|
19
|
+
readonly inferenceServerUrl?: string;
|
|
20
|
+
readonly annotationLevel?: AnnotationLevel;
|
|
21
|
+
readonly credentials?: CredentialArgs;
|
|
22
|
+
}
|
|
23
|
+
export interface ClientArgsWithDefaults extends ClientArgs {
|
|
24
|
+
readonly uiControllerUrl: string;
|
|
25
|
+
readonly inferenceServerUrl: string;
|
|
26
|
+
readonly annotationLevel: AnnotationLevel;
|
|
27
|
+
}
|
|
File without changes
|
|
@@ -2,21 +2,21 @@ import WebSocket from 'ws';
|
|
|
2
2
|
import { DetectedElement } from '../core/model/annotation-result/detected-element';
|
|
3
3
|
import { CaptureScreenshotResponse, ControlResponse, StartRecordingResponse, StopRecordingResponse, ReadRecordingPartResponse, InteractiveAnnotationResponse, GetProcessPidResponse } from '../core/runner-protocol';
|
|
4
4
|
import { ControlCommand } from '../core/ui-control-commands';
|
|
5
|
-
import {
|
|
6
|
-
export declare class
|
|
7
|
-
|
|
5
|
+
import { UiControllerClientConnectionState } from './ui-controller-client-connection-state';
|
|
6
|
+
export declare class UiControllerClient {
|
|
7
|
+
url: string;
|
|
8
8
|
private static readonly EMPTY_REJECT;
|
|
9
9
|
private static readonly EMPTY_RESOLVE;
|
|
10
10
|
private static readonly REQUEST_TIMEOUT_IN_MS;
|
|
11
11
|
ws: WebSocket;
|
|
12
|
-
connectionState:
|
|
12
|
+
connectionState: UiControllerClientConnectionState;
|
|
13
13
|
private timeout?;
|
|
14
14
|
private currentReject;
|
|
15
15
|
private currentResolve;
|
|
16
|
-
constructor(
|
|
16
|
+
constructor(url: string);
|
|
17
17
|
private clearResponse;
|
|
18
18
|
private onMessage;
|
|
19
|
-
connect(): Promise<
|
|
19
|
+
connect(): Promise<UiControllerClientConnectionState>;
|
|
20
20
|
close(): void;
|
|
21
21
|
private sendAndReceive;
|
|
22
22
|
private send;
|