askui 0.1.6 → 0.2.2
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/bin/askui-postinstall +35 -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/core/model/test-case-dto/index.js +1 -3
- package/dist/cjs/core/model/test-case-dto/test-step.d.ts +3 -7
- package/dist/cjs/core/model/test-case-dto/test-step.js +0 -12
- package/dist/cjs/core/ui-control-commands/control-command.d.ts +1 -0
- package/dist/cjs/core/ui-control-commands/control-command.js +5 -0
- package/dist/cjs/core/ui-control-commands/input-event.d.ts +1 -2
- package/dist/cjs/core/ui-control-commands/input-event.js +0 -1
- 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 +7 -5
- package/dist/cjs/execution/execution-runtime.js +35 -23
- 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} +4 -4
- package/dist/cjs/execution/{control-your-ui-api.js → inference-client.js} +9 -9
- 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 +79 -0
- package/dist/cjs/execution/ui-control-client.js +185 -0
- 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/copy-example-project.js +2 -1
- package/dist/cjs/lib/download-binaries.js +10 -9
- 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 +38 -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/installation-timestamp-create-error.d.ts +4 -0
- package/dist/cjs/utils/analytics/installation-timestamp-create-error.js +9 -0
- package/dist/cjs/utils/analytics/installation-timestamp-get-error.d.ts +4 -0
- package/dist/cjs/utils/analytics/installation-timestamp-get-error.js +9 -0
- package/dist/cjs/utils/analytics/installation-timestamp.d.ts +7 -0
- package/dist/cjs/utils/analytics/installation-timestamp.js +68 -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-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/path.d.ts +1 -0
- package/dist/cjs/utils/path.js +11 -0
- 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/core/model/test-case-dto/index.js +0 -1
- package/dist/esm/core/model/test-case-dto/test-step.d.ts +3 -7
- package/dist/esm/core/model/test-case-dto/test-step.js +1 -10
- package/dist/esm/core/ui-control-commands/control-command.d.ts +1 -0
- package/dist/esm/core/ui-control-commands/control-command.js +5 -0
- package/dist/esm/core/ui-control-commands/input-event.d.ts +1 -2
- package/dist/esm/core/ui-control-commands/input-event.js +0 -1
- 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 +7 -5
- package/dist/esm/execution/execution-runtime.js +35 -23
- 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} +4 -4
- package/dist/esm/execution/{control-your-ui-api.js → inference-client.js} +7 -7
- 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 +79 -0
- package/dist/esm/execution/ui-control-client.js +181 -0
- 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/copy-example-project.js +2 -1
- package/dist/esm/lib/download-binaries.js +10 -9
- 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 +31 -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/installation-timestamp-create-error.d.ts +4 -0
- package/dist/esm/utils/analytics/installation-timestamp-create-error.js +5 -0
- package/dist/esm/utils/analytics/installation-timestamp-get-error.d.ts +4 -0
- package/dist/esm/utils/analytics/installation-timestamp-get-error.js +5 -0
- package/dist/esm/utils/analytics/installation-timestamp.d.ts +7 -0
- package/dist/esm/utils/analytics/installation-timestamp.js +61 -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-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/path.d.ts +1 -0
- package/dist/esm/utils/path.js +4 -0
- 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 +15 -8
- 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/execution/client.js +0 -116
- 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/cjs/utils/image-resize-errors/invalid-base64-image-error.d.ts +0 -3
- package/dist/cjs/utils/image-resize-errors/invalid-base64-image-error.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/execution/client.js +0 -112
- 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
- package/dist/esm/utils/image-resize-errors/invalid-base64-image-error.d.ts +0 -3
- package/dist/esm/utils/image-resize-errors/invalid-base64-image-error.js +0 -3
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { CustomElementJson } from '../core/model/test-case-dto';
|
|
2
|
+
import { Exec, Executable, FluentCommand, FluentFilters } 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
|
+
private secretText;
|
|
22
|
+
/**
|
|
23
|
+
* Types a text inside the filtered element.
|
|
24
|
+
*
|
|
25
|
+
* By default, the `text` is included in the logs and sent over to the askui Inference server to
|
|
26
|
+
* predict in which context the typing has to occur. You can exclude the `text` from the logs
|
|
27
|
+
* and the request to the askui Inference server setting `options.isSecret` to `true`.
|
|
28
|
+
* This should not change the quality of the prediction of the askui Inference server. In this
|
|
29
|
+
* case, `options.secretMask` is included in logs and sent over instead of the `text`.
|
|
30
|
+
*
|
|
31
|
+
* @param {string} text - A text to type.
|
|
32
|
+
* @param {Object} [options]
|
|
33
|
+
* @param {boolean} [options.isSecret = false] - If set to `true`, `text` is neither included in
|
|
34
|
+
* logs of askui nor sent over to askui Inference for prediction.
|
|
35
|
+
* @param {string} [options.secretMask = '****'] - If `options.isSecret` is set to `true`, this
|
|
36
|
+
* is included in logs and sent over to askui Inference for prediction instead of the `text`.
|
|
37
|
+
*
|
|
38
|
+
* @return {FluentFilters}
|
|
39
|
+
*/
|
|
40
|
+
typeIn(text: string, { isSecret, secretMask }?: {
|
|
41
|
+
isSecret?: boolean | undefined;
|
|
42
|
+
secretMask?: string | undefined;
|
|
43
|
+
}): FluentFilters;
|
|
44
|
+
/**
|
|
45
|
+
* Types a text at the current position.
|
|
46
|
+
*
|
|
47
|
+
* By default, the `text` is included in the logs and sent over to the askui Inference server to
|
|
48
|
+
* predict in which context the typing has to occur. You can exclude the `text` from the logs
|
|
49
|
+
* and the request to the askui Inference server setting `options.isSecret` to `true`.
|
|
50
|
+
* This should not change the quality of the prediction of the askui Inference server. In this
|
|
51
|
+
* case, `options.secretMask` is included in logs and sent over instead of the `text`.
|
|
52
|
+
*
|
|
53
|
+
* @param {string} text - A text to type.
|
|
54
|
+
* @param {Object} options
|
|
55
|
+
* @param {boolean} [options.isSecret = false] - If set to `true`, `text` is neither included in
|
|
56
|
+
* logs of askui nor sent over to askui Inference for prediction.
|
|
57
|
+
* @param {string} [options.secretMask = '****'] - If `options.isSecret` is set to `true`, this
|
|
58
|
+
* is included in logs and sent over to askui Inference for prediction instead of the `text`.
|
|
59
|
+
*
|
|
60
|
+
* @return {Exec}
|
|
61
|
+
*/
|
|
62
|
+
type(text: string, { isSecret, secretMask }?: {
|
|
63
|
+
isSecret?: boolean | undefined;
|
|
64
|
+
secretMask?: string | undefined;
|
|
65
|
+
}): Exec;
|
|
66
|
+
/**
|
|
67
|
+
* Waits for `<delayInMs>` ms, e.g., 1000 ms. The exact delay may be a little longer
|
|
68
|
+
* than `<delayInMs>` but never shorter than that.
|
|
69
|
+
*
|
|
70
|
+
* @param {number} delayInMs - The delay in ms to wait for.
|
|
71
|
+
*
|
|
72
|
+
* @return {Executable}
|
|
73
|
+
*/
|
|
74
|
+
waitFor(delayInMs: number): Executable;
|
|
75
|
+
/**
|
|
76
|
+
* closes the connection to the controlui-server`.
|
|
77
|
+
*/
|
|
78
|
+
close(): void;
|
|
79
|
+
}
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.UiControlClient = void 0;
|
|
13
|
+
const test_case_dto_1 = require("../core/model/test-case-dto");
|
|
14
|
+
const dsl_1 = require("./dsl");
|
|
15
|
+
const http_client_got_1 = require("../utils/http/http-client-got");
|
|
16
|
+
const ui_controller_client_1 = require("./ui-controller-client");
|
|
17
|
+
const execution_runtime_1 = require("./execution-runtime");
|
|
18
|
+
const inference_client_1 = require("./inference-client");
|
|
19
|
+
const annotation_writer_1 = require("../core/annotation/annotation-writer");
|
|
20
|
+
const logger_1 = require("../lib/logger");
|
|
21
|
+
const test_case_result_dto_1 = require("../core/model/test-case-result-dto");
|
|
22
|
+
const annotation_level_1 = require("./annotation-level");
|
|
23
|
+
const ui_control_client_error_1 = require("./ui-control-client-error");
|
|
24
|
+
const read_environment_credentials_1 = require("./read-environment-credentials");
|
|
25
|
+
const analytics_1 = require("../utils/analytics");
|
|
26
|
+
const getClientArgsWithDefaults = (clientArgs = {}) => (Object.assign({ uiControllerUrl: 'http://localhost:6769', inferenceServerUrl: 'https://inference.askui.com', annotationLevel: annotation_level_1.AnnotationLevel.DISABLED }, clientArgs));
|
|
27
|
+
class UiControlClient extends dsl_1.FluentCommand {
|
|
28
|
+
constructor(httpClient, clientArgs) {
|
|
29
|
+
super();
|
|
30
|
+
this.httpClient = httpClient;
|
|
31
|
+
this.clientArgs = clientArgs;
|
|
32
|
+
this.secretText = undefined;
|
|
33
|
+
}
|
|
34
|
+
static build(clientArgs) {
|
|
35
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
36
|
+
const analytics = new analytics_1.Analytics();
|
|
37
|
+
const analyticsHeaders = yield analytics.getAnalyticsHeaders();
|
|
38
|
+
const cas = getClientArgsWithDefaults(clientArgs);
|
|
39
|
+
const httpClient = new http_client_got_1.HttpClientGot(cas.credentials || (0, read_environment_credentials_1.envCredentials)(), analyticsHeaders);
|
|
40
|
+
return new UiControlClient(httpClient, cas);
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
get uiControllerClient() {
|
|
44
|
+
if (!this._uiControllerClient) {
|
|
45
|
+
this._uiControllerClient = new ui_controller_client_1.UiControllerClient(this.clientArgs.uiControllerUrl);
|
|
46
|
+
}
|
|
47
|
+
return this._uiControllerClient;
|
|
48
|
+
}
|
|
49
|
+
get inferenceClient() {
|
|
50
|
+
return new inference_client_1.InferenceClient(this.clientArgs.inferenceServerUrl, this.httpClient);
|
|
51
|
+
}
|
|
52
|
+
get executionRuntime() {
|
|
53
|
+
return new execution_runtime_1.ExecutionRuntime(this.uiControllerClient, this.inferenceClient);
|
|
54
|
+
}
|
|
55
|
+
annotateByDefault(testStepState, customElements = []) {
|
|
56
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
57
|
+
if ((testStepState === test_case_result_dto_1.TestStepState.FAILED
|
|
58
|
+
&& this.clientArgs.annotationLevel === annotation_level_1.AnnotationLevel.DISABLED)
|
|
59
|
+
|| (testStepState === test_case_result_dto_1.TestStepState.PASSED
|
|
60
|
+
&& this.clientArgs.annotationLevel !== annotation_level_1.AnnotationLevel.ALL)) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
yield this.annotate({
|
|
64
|
+
customElements,
|
|
65
|
+
fileNamePrefix: `${testStepState.toLowerCase()}_testStep_annotation`,
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
connect() {
|
|
70
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
71
|
+
const connectionState = yield this.uiControllerClient.connect();
|
|
72
|
+
return connectionState;
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
annotate(annotationRequest = {}) {
|
|
76
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
77
|
+
const annotation = yield this.executionRuntime.annotateImage(annotationRequest.imagePath, annotationRequest.customElements);
|
|
78
|
+
annotation_writer_1.AnnotationWriter.write(annotation.toHtml(), annotationRequest.outputPath, annotationRequest.fileNamePrefix);
|
|
79
|
+
return annotation;
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
annotateInteractively() {
|
|
83
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
84
|
+
try {
|
|
85
|
+
yield this.executionRuntime.annotateInteractively();
|
|
86
|
+
}
|
|
87
|
+
catch (err) {
|
|
88
|
+
logger_1.logger.error(err);
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
exec(instruction, customElementJson = []) {
|
|
93
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
94
|
+
const customElements = yield test_case_dto_1.CustomElement.fromJsonListWithImagePathOrImage(customElementJson);
|
|
95
|
+
const { secretText } = this;
|
|
96
|
+
try {
|
|
97
|
+
yield this.executionRuntime.executeTestStep({
|
|
98
|
+
instruction,
|
|
99
|
+
customElements,
|
|
100
|
+
secretText,
|
|
101
|
+
});
|
|
102
|
+
yield this.annotateByDefault(test_case_result_dto_1.TestStepState.PASSED, customElements);
|
|
103
|
+
return yield Promise.resolve();
|
|
104
|
+
}
|
|
105
|
+
catch (error) {
|
|
106
|
+
yield this.annotateByDefault(test_case_result_dto_1.TestStepState.FAILED, customElements);
|
|
107
|
+
return Promise.reject(new ui_control_client_error_1.UiControlClientError(`A problem occures while executing the instruction: ${instruction}. Reason ${error}`));
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Types a text inside the filtered element.
|
|
113
|
+
*
|
|
114
|
+
* By default, the `text` is included in the logs and sent over to the askui Inference server to
|
|
115
|
+
* predict in which context the typing has to occur. You can exclude the `text` from the logs
|
|
116
|
+
* and the request to the askui Inference server setting `options.isSecret` to `true`.
|
|
117
|
+
* This should not change the quality of the prediction of the askui Inference server. In this
|
|
118
|
+
* case, `options.secretMask` is included in logs and sent over instead of the `text`.
|
|
119
|
+
*
|
|
120
|
+
* @param {string} text - A text to type.
|
|
121
|
+
* @param {Object} [options]
|
|
122
|
+
* @param {boolean} [options.isSecret = false] - If set to `true`, `text` is neither included in
|
|
123
|
+
* logs of askui nor sent over to askui Inference for prediction.
|
|
124
|
+
* @param {string} [options.secretMask = '****'] - If `options.isSecret` is set to `true`, this
|
|
125
|
+
* is included in logs and sent over to askui Inference for prediction instead of the `text`.
|
|
126
|
+
*
|
|
127
|
+
* @return {FluentFilters}
|
|
128
|
+
*/
|
|
129
|
+
typeIn(text, { isSecret = false, secretMask = '****' } = {}) {
|
|
130
|
+
if (isSecret) {
|
|
131
|
+
this.secretText = text;
|
|
132
|
+
return super.typeIn(secretMask);
|
|
133
|
+
}
|
|
134
|
+
return super.typeIn(text);
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Types a text at the current position.
|
|
138
|
+
*
|
|
139
|
+
* By default, the `text` is included in the logs and sent over to the askui Inference server to
|
|
140
|
+
* predict in which context the typing has to occur. You can exclude the `text` from the logs
|
|
141
|
+
* and the request to the askui Inference server setting `options.isSecret` to `true`.
|
|
142
|
+
* This should not change the quality of the prediction of the askui Inference server. In this
|
|
143
|
+
* case, `options.secretMask` is included in logs and sent over instead of the `text`.
|
|
144
|
+
*
|
|
145
|
+
* @param {string} text - A text to type.
|
|
146
|
+
* @param {Object} options
|
|
147
|
+
* @param {boolean} [options.isSecret = false] - If set to `true`, `text` is neither included in
|
|
148
|
+
* logs of askui nor sent over to askui Inference for prediction.
|
|
149
|
+
* @param {string} [options.secretMask = '****'] - If `options.isSecret` is set to `true`, this
|
|
150
|
+
* is included in logs and sent over to askui Inference for prediction instead of the `text`.
|
|
151
|
+
*
|
|
152
|
+
* @return {Exec}
|
|
153
|
+
*/
|
|
154
|
+
type(text, { isSecret = false, secretMask = '****' } = {}) {
|
|
155
|
+
if (isSecret) {
|
|
156
|
+
this.secretText = text;
|
|
157
|
+
return super.type(secretMask);
|
|
158
|
+
}
|
|
159
|
+
return super.type(text);
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Waits for `<delayInMs>` ms, e.g., 1000 ms. The exact delay may be a little longer
|
|
163
|
+
* than `<delayInMs>` but never shorter than that.
|
|
164
|
+
*
|
|
165
|
+
* @param {number} delayInMs - The delay in ms to wait for.
|
|
166
|
+
*
|
|
167
|
+
* @return {Executable}
|
|
168
|
+
*/
|
|
169
|
+
// eslint-disable-next-line class-methods-use-this
|
|
170
|
+
waitFor(delayInMs) {
|
|
171
|
+
return {
|
|
172
|
+
exec() {
|
|
173
|
+
logger_1.logger.debug(`Wait for ${delayInMs} ms`);
|
|
174
|
+
return new Promise((resolve) => { setTimeout(() => resolve(), delayInMs); });
|
|
175
|
+
},
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* closes the connection to the controlui-server`.
|
|
180
|
+
*/
|
|
181
|
+
close() {
|
|
182
|
+
this.uiControllerClient.close();
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
exports.UiControlClient = UiControlClient;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UiControllerClientConnectionState = void 0;
|
|
4
|
+
var UiControllerClientConnectionState;
|
|
5
|
+
(function (UiControllerClientConnectionState) {
|
|
6
|
+
UiControllerClientConnectionState[UiControllerClientConnectionState["NOT_CONNECTED"] = 0] = "NOT_CONNECTED";
|
|
7
|
+
UiControllerClientConnectionState[UiControllerClientConnectionState["CONNECTING"] = 1] = "CONNECTING";
|
|
8
|
+
UiControllerClientConnectionState[UiControllerClientConnectionState["CONNECTED"] = 2] = "CONNECTED";
|
|
9
|
+
UiControllerClientConnectionState[UiControllerClientConnectionState["ERROR"] = 3] = "ERROR";
|
|
10
|
+
})(UiControllerClientConnectionState = exports.UiControllerClientConnectionState || (exports.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;
|
|
@@ -3,23 +3,23 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.UiControllerClient = void 0;
|
|
7
7
|
const ws_1 = __importDefault(require("ws"));
|
|
8
8
|
const runner_protocol_1 = require("../core/runner-protocol");
|
|
9
9
|
const logger_1 = require("../lib/logger");
|
|
10
|
-
const
|
|
10
|
+
const ui_controller_client_connection_state_1 = require("./ui-controller-client-connection-state");
|
|
11
11
|
const read_recording_response_stream_handler_1 = require("./read-recording-response-stream-handler");
|
|
12
|
-
const
|
|
13
|
-
class
|
|
14
|
-
constructor(
|
|
15
|
-
this.
|
|
16
|
-
this.connectionState =
|
|
17
|
-
this.currentReject =
|
|
18
|
-
this.currentResolve =
|
|
12
|
+
const ui_control_client_error_1 = require("./ui-control-client-error");
|
|
13
|
+
class UiControllerClient {
|
|
14
|
+
constructor(url) {
|
|
15
|
+
this.url = url;
|
|
16
|
+
this.connectionState = ui_controller_client_connection_state_1.UiControllerClientConnectionState.NOT_CONNECTED;
|
|
17
|
+
this.currentReject = UiControllerClient.EMPTY_REJECT;
|
|
18
|
+
this.currentResolve = UiControllerClient.EMPTY_RESOLVE;
|
|
19
19
|
}
|
|
20
20
|
clearResponse() {
|
|
21
|
-
this.currentReject =
|
|
22
|
-
this.currentResolve =
|
|
21
|
+
this.currentReject = UiControllerClient.EMPTY_REJECT;
|
|
22
|
+
this.currentResolve = UiControllerClient.EMPTY_RESOLVE;
|
|
23
23
|
}
|
|
24
24
|
onMessage(data) {
|
|
25
25
|
clearTimeout(this.timeout);
|
|
@@ -36,24 +36,24 @@ class ControlYourUiClient {
|
|
|
36
36
|
this.clearResponse();
|
|
37
37
|
}
|
|
38
38
|
connect() {
|
|
39
|
-
this.connectionState =
|
|
39
|
+
this.connectionState = ui_controller_client_connection_state_1.UiControllerClientConnectionState.CONNECTING;
|
|
40
40
|
return new Promise((resolve, reject) => {
|
|
41
41
|
try {
|
|
42
|
-
this.ws = new ws_1.default(this.
|
|
42
|
+
this.ws = new ws_1.default(this.url);
|
|
43
43
|
this.ws.on('message', (data) => { this.onMessage(data); });
|
|
44
44
|
this.ws.on('open', () => {
|
|
45
|
-
this.connectionState =
|
|
45
|
+
this.connectionState = ui_controller_client_connection_state_1.UiControllerClientConnectionState.CONNECTED;
|
|
46
46
|
resolve(this.connectionState);
|
|
47
47
|
});
|
|
48
48
|
this.ws.on('error', (error) => {
|
|
49
|
-
this.connectionState =
|
|
50
|
-
reject(new
|
|
51
|
-
Probably it was not started. Makse sure you started
|
|
52
|
-
Url ${this.
|
|
49
|
+
this.connectionState = ui_controller_client_connection_state_1.UiControllerClientConnectionState.ERROR;
|
|
50
|
+
reject(new ui_control_client_error_1.UiControlClientError(`Connection to UI Controller cannot be established,
|
|
51
|
+
Probably it was not started. Makse sure you started UI Controller with this
|
|
52
|
+
Url ${this.url}. Error message ${error.message}`));
|
|
53
53
|
});
|
|
54
54
|
}
|
|
55
55
|
catch (error) {
|
|
56
|
-
reject(new
|
|
56
|
+
reject(new ui_control_client_error_1.UiControlClientError(`Connection to UI Controller cannot be established. Reason: ${error}`));
|
|
57
57
|
}
|
|
58
58
|
});
|
|
59
59
|
}
|
|
@@ -61,21 +61,21 @@ class ControlYourUiClient {
|
|
|
61
61
|
var _a;
|
|
62
62
|
(_a = this.ws) === null || _a === void 0 ? void 0 : _a.close();
|
|
63
63
|
}
|
|
64
|
-
sendAndReceive(msg, requestTimeout =
|
|
64
|
+
sendAndReceive(msg, requestTimeout = UiControllerClient.REQUEST_TIMEOUT_IN_MS) {
|
|
65
65
|
return new Promise((resolve, reject) => {
|
|
66
66
|
this.currentResolve = resolve;
|
|
67
67
|
this.currentReject = reject;
|
|
68
68
|
try {
|
|
69
69
|
this.send(msg, requestTimeout);
|
|
70
|
-
this.timeout = setTimeout(() => this.currentReject(`Request to
|
|
71
|
-
|
|
70
|
+
this.timeout = setTimeout(() => this.currentReject(`Request to UI Controller timed out.
|
|
71
|
+
It seems that the UI Controller is not running. Please, make sure that it is running when executing tests.`), UiControllerClient.REQUEST_TIMEOUT_IN_MS);
|
|
72
72
|
}
|
|
73
73
|
catch (error) {
|
|
74
|
-
this.currentReject(`The communication to the
|
|
74
|
+
this.currentReject(`The communication to the UI Controller is broken. Reason: ${error}`);
|
|
75
75
|
}
|
|
76
76
|
});
|
|
77
77
|
}
|
|
78
|
-
send(msg, _requestTimeout =
|
|
78
|
+
send(msg, _requestTimeout = UiControllerClient.REQUEST_TIMEOUT_IN_MS) {
|
|
79
79
|
if (!this.currentReject || !this.currentResolve) {
|
|
80
80
|
throw Error('Request is not finished! It is not possible to have multiple requests at the same time.');
|
|
81
81
|
}
|
|
@@ -113,7 +113,7 @@ class ControlYourUiClient {
|
|
|
113
113
|
return this.sendAndReceive(new runner_protocol_1.ControlRequest(controlCommand));
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
|
-
exports.
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
116
|
+
exports.UiControllerClient = UiControllerClient;
|
|
117
|
+
UiControllerClient.EMPTY_REJECT = (_reason) => { };
|
|
118
|
+
UiControllerClient.EMPTY_RESOLVE = (_value) => { };
|
|
119
|
+
UiControllerClient.REQUEST_TIMEOUT_IN_MS = 30000;
|
|
@@ -7,6 +7,7 @@ exports.init = void 0;
|
|
|
7
7
|
const commander_1 = require("commander");
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
10
|
+
const path_2 = require("../utils/path");
|
|
10
11
|
const createProgram = () => {
|
|
11
12
|
const program = new commander_1.Command('askui');
|
|
12
13
|
program.usage('<command> [options]');
|
|
@@ -14,7 +15,7 @@ const createProgram = () => {
|
|
|
14
15
|
};
|
|
15
16
|
function copyExampleProject() {
|
|
16
17
|
const exampleProjectPath = path_1.default.join('example_projects_templates', 'typescript_jest');
|
|
17
|
-
fs_extra_1.default.copySync(path_1.default.join(
|
|
18
|
+
fs_extra_1.default.copySync(path_1.default.join((0, path_2.getPathToNodeModulesRoot)(), exampleProjectPath), '.');
|
|
18
19
|
}
|
|
19
20
|
function init(argv) {
|
|
20
21
|
const args = argv || process.argv;
|
|
@@ -8,6 +8,7 @@ const fs_1 = __importDefault(require("fs"));
|
|
|
8
8
|
const got_1 = __importDefault(require("got"));
|
|
9
9
|
const os_1 = __importDefault(require("os"));
|
|
10
10
|
const path_1 = __importDefault(require("path"));
|
|
11
|
+
const path_2 = require("../utils/path");
|
|
11
12
|
const logger_1 = require("./logger");
|
|
12
13
|
var SupportedPlatform;
|
|
13
14
|
(function (SupportedPlatform) {
|
|
@@ -16,9 +17,9 @@ var SupportedPlatform;
|
|
|
16
17
|
SupportedPlatform["WIN32"] = "win32";
|
|
17
18
|
})(SupportedPlatform || (SupportedPlatform = {}));
|
|
18
19
|
const binarySubPathsByPlatform = {
|
|
19
|
-
linux: ['linux', '
|
|
20
|
-
darwin: ['darwin', '
|
|
21
|
-
win32: ['windows', '
|
|
20
|
+
linux: ['linux', 'askui-ui-controller.AppImage'],
|
|
21
|
+
darwin: ['darwin', 'askui-ui-controller.dmg'],
|
|
22
|
+
win32: ['windows', 'askui-ui-controller.exe'],
|
|
22
23
|
};
|
|
23
24
|
function isSupportedPlatform(value) {
|
|
24
25
|
return Object.values(SupportedPlatform).includes(value);
|
|
@@ -32,14 +33,14 @@ function platform() {
|
|
|
32
33
|
}
|
|
33
34
|
exports.platform = platform;
|
|
34
35
|
function buildBinaryNotAvailbleError(binaryVersion) {
|
|
35
|
-
return new Error(`It seems that the
|
|
36
|
+
return new Error(`It seems that the UI Controller version "${binaryVersion}" for your system "${platform()} ${os_1.default.arch}" is not availble, Please contact as at info@askui.com for more information`);
|
|
36
37
|
}
|
|
37
38
|
function getBinaryPath(version) {
|
|
38
|
-
return path_1.default.join(
|
|
39
|
+
return path_1.default.join((0, path_2.getPathToNodeModulesRoot)(), 'release', version, ...binarySubPathsByPlatform[platform()]);
|
|
39
40
|
}
|
|
40
41
|
exports.getBinaryPath = getBinaryPath;
|
|
41
42
|
function getBinaryDownloadUrl(binaryVersion) {
|
|
42
|
-
const baseUrl = `https://askui-public.s3.eu-central-1.amazonaws.com/releases/
|
|
43
|
+
const baseUrl = `https://askui-public.s3.eu-central-1.amazonaws.com/releases/askui-ui-controller/${binaryVersion}`;
|
|
43
44
|
const arch = os_1.default.arch();
|
|
44
45
|
return `${baseUrl}/${platform()}/${arch}/${binarySubPathsByPlatform[platform()][1]}`;
|
|
45
46
|
}
|
|
@@ -48,7 +49,7 @@ function downloadServerBinaries(binaryVersion) {
|
|
|
48
49
|
const url = getBinaryDownloadUrl(binaryVersion);
|
|
49
50
|
const binaryOutputPath = getBinaryPath(binaryVersion);
|
|
50
51
|
const binaryFolder = path_1.default.dirname(binaryOutputPath);
|
|
51
|
-
logger_1.logger.info(`Start downloading
|
|
52
|
+
logger_1.logger.info(`Start downloading UI Controller version "${binaryVersion}"`);
|
|
52
53
|
if (!(fs_1.default.existsSync(binaryFolder))) {
|
|
53
54
|
fs_1.default.mkdirSync(binaryFolder, { recursive: true });
|
|
54
55
|
}
|
|
@@ -65,8 +66,8 @@ function downloadServerBinaries(binaryVersion) {
|
|
|
65
66
|
reject(new Error('oops, an error during the downloaded occurred, try again with fresh install'));
|
|
66
67
|
})
|
|
67
68
|
.on('finish', () => {
|
|
68
|
-
logger_1.logger.info(`
|
|
69
|
-
logger_1.logger.debug(`Binary of
|
|
69
|
+
logger_1.logger.info(`UI Controller version ${binaryVersion} for your system "${platform()} ${os_1.default.arch}" was downloaded`);
|
|
70
|
+
logger_1.logger.debug(`Binary of UI Controller is located at "${binaryOutputPath}".`);
|
|
70
71
|
resolve();
|
|
71
72
|
});
|
|
72
73
|
downloadStream.pipe(fileWriterStream);
|
package/dist/cjs/lib/index.d.ts
CHANGED
package/dist/cjs/lib/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.logger = exports.
|
|
3
|
+
exports.logger = exports.UiController = exports.TimeoutError = exports.UnkownError = void 0;
|
|
4
4
|
var unkown_error_1 = require("./unkown-error");
|
|
5
5
|
Object.defineProperty(exports, "UnkownError", { enumerable: true, get: function () { return unkown_error_1.UnkownError; } });
|
|
6
6
|
var timeout_error_1 = require("./timeout-error");
|
|
7
7
|
Object.defineProperty(exports, "TimeoutError", { enumerable: true, get: function () { return timeout_error_1.TimeoutError; } });
|
|
8
|
-
var
|
|
9
|
-
Object.defineProperty(exports, "
|
|
8
|
+
var ui_controller_1 = require("./ui-controller");
|
|
9
|
+
Object.defineProperty(exports, "UiController", { enumerable: true, get: function () { return ui_controller_1.UiController; } });
|
|
10
10
|
var logger_1 = require("./logger");
|
|
11
11
|
Object.defineProperty(exports, "logger", { enumerable: true, get: function () { return logger_1.logger; } });
|
package/dist/cjs/lib/logger.js
CHANGED
|
@@ -23,7 +23,7 @@ const stream = (0, pino_pretty_1.default)({
|
|
|
23
23
|
const defaultLogLevel = 'info';
|
|
24
24
|
const pinoLevel = isProcessEnvLogLevelValid() ? process.env['LOG_LEVEL'] : defaultLogLevel;
|
|
25
25
|
const logger = (0, pino_1.default)({
|
|
26
|
-
name: '
|
|
26
|
+
name: 'askuiUiControlClient',
|
|
27
27
|
level: pinoLevel,
|
|
28
28
|
customLevels: {
|
|
29
29
|
verbose: 5,
|
|
@@ -2,10 +2,5 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TimeoutError = void 0;
|
|
4
4
|
class TimeoutError extends Error {
|
|
5
|
-
constructor(message) {
|
|
6
|
-
super(message);
|
|
7
|
-
this.contructorName = this.constructor.name;
|
|
8
|
-
this.name = this.contructorName;
|
|
9
|
-
}
|
|
10
5
|
}
|
|
11
6
|
exports.TimeoutError = TimeoutError;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { LogLevels } from '../shared/log-levels';
|
|
2
|
+
/**
|
|
3
|
+
* Configuration options for the askui UI Controller
|
|
4
|
+
*
|
|
5
|
+
* @param {number} display - Default: `0`
|
|
6
|
+
* You can choose on which display you want to excecute all tests.
|
|
7
|
+
* 0 is your main monitor.
|
|
8
|
+
* If you want to use your second monitor you can change
|
|
9
|
+
* the value to `1` (`2` for your third monitor etc.).
|
|
10
|
+
* @param {string} binaryVersion - Default: `'latest'`
|
|
11
|
+
* Choose the version of the askui UI Controller Server.
|
|
12
|
+
* @param {number} port - Default: `6769`
|
|
13
|
+
* The port the askui UI Controller is running on.
|
|
14
|
+
* @param {string} host - Default: `'127.0.0.1'`
|
|
15
|
+
* The host the askui UI Controller is running on.
|
|
16
|
+
* @param {boolean} minimize - Default: `true`
|
|
17
|
+
* askui UI Controller will be started as minimized window.
|
|
18
|
+
* @param {boolean} overWriteBinary - Default: `false`
|
|
19
|
+
* Download the provided Version of askui UI Controller.
|
|
20
|
+
* If a version is already downloaded. This version will be overwritten
|
|
21
|
+
* @param {LogLevels} logLevel - Default: `'debug'`
|
|
22
|
+
* You can use different types of Log Level.
|
|
23
|
+
* Options: "fatal", "error", "warn", "info", "debug", "trace", "silent", "verbose".
|
|
24
|
+
* @param {string} logFilePath - Default: `'<temp-dir>/askui/askui-server.log'`
|
|
25
|
+
* It is possible to specify a path for your log files.
|
|
26
|
+
* Per default we create the askui-server.log file and askui folder in your temp folder.
|
|
27
|
+
*/
|
|
28
|
+
export interface UiControllerArgs {
|
|
29
|
+
readonly display?: number;
|
|
30
|
+
readonly binaryVersion?: string;
|
|
31
|
+
readonly port?: number;
|
|
32
|
+
readonly host?: string;
|
|
33
|
+
readonly minimize?: boolean;
|
|
34
|
+
readonly overWriteBinary?: boolean;
|
|
35
|
+
readonly logLevel?: LogLevels;
|
|
36
|
+
readonly logFilePath?: string;
|
|
37
|
+
}
|
|
38
|
+
export interface UiControllerArgsWithDefaults extends UiControllerArgs {
|
|
39
|
+
readonly display: number;
|
|
40
|
+
readonly binaryVersion: string;
|
|
41
|
+
readonly overWriteBinary: boolean;
|
|
42
|
+
readonly port: number;
|
|
43
|
+
readonly host: string;
|
|
44
|
+
readonly logLevel?: LogLevels;
|
|
45
|
+
}
|
|
46
|
+
export declare function createArgsWithDefaults(args?: UiControllerArgs): UiControllerArgsWithDefaults;
|
|
47
|
+
export declare function createCliFlagsFromArgs(args: UiControllerArgsWithDefaults): string[];
|
|
File without changes
|
|
File without changes
|