askui 0.6.1 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/core/annotation/template.html +11390 -1
- package/dist/cjs/core/model/annotation-result/detected-element.d.ts +3 -3
- package/dist/cjs/core/model/annotation-result/detected-element.js +4 -4
- package/dist/cjs/execution/dsl.d.ts +196 -81
- package/dist/cjs/execution/dsl.js +196 -90
- package/dist/cjs/execution/ui-controller-client-interface.d.ts +1 -1
- package/dist/cjs/lib/download-binaries.d.ts +1 -1
- package/dist/cjs/lib/download-binaries.js +42 -29
- package/dist/cjs/lib/ui-controller-darwin.js +3 -3
- package/dist/cjs/lib/ui-controller-facade.d.ts +1 -2
- package/dist/cjs/lib/ui-controller-facade.js +6 -11
- package/dist/cjs/lib/ui-controller-linux.js +1 -1
- package/dist/esm/core/annotation/template.html +11390 -1
- package/dist/esm/core/model/annotation-result/detected-element.d.ts +3 -3
- package/dist/esm/core/model/annotation-result/detected-element.js +4 -4
- package/dist/esm/execution/dsl.d.ts +196 -81
- package/dist/esm/execution/dsl.js +196 -90
- package/dist/esm/execution/ui-controller-client-interface.d.ts +1 -1
- package/dist/esm/lib/download-binaries.d.ts +1 -1
- package/dist/esm/lib/download-binaries.js +40 -27
- package/dist/esm/lib/ui-controller-darwin.js +3 -3
- package/dist/esm/lib/ui-controller-facade.d.ts +1 -2
- package/dist/esm/lib/ui-controller-facade.js +7 -12
- package/dist/esm/lib/ui-controller-linux.js +1 -1
- package/dist/example_projects_templates/typescript_jest/test/my-first-askui-test-suite.test.ts +5 -6
- package/package.json +1 -1
- package/dist/cjs/core/annotation/annotation-json.d.ts +0 -5
- package/dist/cjs/core/annotation/annotation-json.js +0 -2
- package/dist/cjs/core/model/test-case-dto/custom-element.spec.d.ts +0 -1
- package/dist/cjs/core/model/test-case-dto/custom-element.spec.js +0 -53
- package/dist/cjs/execution/dsl.spec.d.ts +0 -1
- package/dist/cjs/execution/dsl.spec.js +0 -75
- package/dist/cjs/execution/read-environment-credentials.spec.d.ts +0 -1
- package/dist/cjs/execution/read-environment-credentials.spec.js +0 -11
- package/dist/cjs/lib/ui-controller-args.spec.d.ts +0 -1
- package/dist/cjs/lib/ui-controller-args.spec.js +0 -23
- package/dist/cjs/utils/http/credentials.spec.d.ts +0 -1
- package/dist/cjs/utils/http/credentials.spec.js +0 -11
- package/dist/esm/core/annotation/annotation-json.d.ts +0 -5
- package/dist/esm/core/annotation/annotation-json.js +0 -1
- package/dist/esm/core/model/test-case-dto/custom-element.spec.d.ts +0 -1
- package/dist/esm/core/model/test-case-dto/custom-element.spec.js +0 -51
- package/dist/esm/execution/dsl.spec.d.ts +0 -1
- package/dist/esm/execution/dsl.spec.js +0 -73
- package/dist/esm/execution/read-environment-credentials.spec.d.ts +0 -1
- package/dist/esm/execution/read-environment-credentials.spec.js +0 -9
- package/dist/esm/lib/ui-controller-args.spec.d.ts +0 -1
- package/dist/esm/lib/ui-controller-args.spec.js +0 -21
- package/dist/esm/utils/http/credentials.spec.d.ts +0 -1
- package/dist/esm/utils/http/credentials.spec.js +0 -9
|
@@ -14,7 +14,7 @@ import { ProxyAgentArgs } from '../shared/proxy-agent-args';
|
|
|
14
14
|
* This can be used to reduce the inference time by reducing
|
|
15
15
|
* the request size in case of a bad internet connection.
|
|
16
16
|
* But it can cause a decrease in the prediction quality.
|
|
17
|
-
* @param {string}
|
|
17
|
+
* @param {string} inferenceServerUrl - Default: https://inference.askui.com`
|
|
18
18
|
* Address of the askui Inference server.
|
|
19
19
|
* @param {AnnotationLevel} annotationLevel - Default: AnnotationLevel.DISABLED
|
|
20
20
|
* Usage of annotate command
|
|
@@ -7,7 +7,7 @@ declare enum SupportedPlatform {
|
|
|
7
7
|
WIN32 = "win32"
|
|
8
8
|
}
|
|
9
9
|
export declare function platform(): SupportedPlatform;
|
|
10
|
-
export declare function
|
|
10
|
+
export declare function getBinaryFilePath(version: string): string;
|
|
11
11
|
export declare function downloadServerBinaries(binaryVersion: string, proxyAgent?: {
|
|
12
12
|
http: http.Agent;
|
|
13
13
|
https: https.Agent;
|
|
@@ -1,13 +1,24 @@
|
|
|
1
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
|
+
};
|
|
2
11
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
13
|
};
|
|
5
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.downloadServerBinaries = exports.
|
|
15
|
+
exports.downloadServerBinaries = exports.getBinaryFilePath = exports.platform = void 0;
|
|
7
16
|
const fs_1 = __importDefault(require("fs"));
|
|
8
17
|
const got_1 = __importDefault(require("got"));
|
|
9
18
|
const os_1 = __importDefault(require("os"));
|
|
10
19
|
const path_1 = __importDefault(require("path"));
|
|
20
|
+
const util_1 = require("util");
|
|
21
|
+
const stream_1 = __importDefault(require("stream"));
|
|
11
22
|
const path_2 = require("../utils/path");
|
|
12
23
|
const logger_1 = require("./logger");
|
|
13
24
|
var SupportedPlatform;
|
|
@@ -32,45 +43,47 @@ function platform() {
|
|
|
32
43
|
throw new Error(`Platform "${pf}" is not supported.`);
|
|
33
44
|
}
|
|
34
45
|
exports.platform = platform;
|
|
35
|
-
function
|
|
36
|
-
return new Error(`
|
|
46
|
+
function buildBinaryNotAvailableError(binaryVersion) {
|
|
47
|
+
return new Error(`There was an error during downloading and creating the askui UI Controller. You can try a fresh install.
|
|
48
|
+
If you specified a binary version it is possible that the askui UI Controller version "${binaryVersion}"
|
|
49
|
+
for your system "${platform()} ${os_1.default.arch}" is not available.
|
|
50
|
+
If this problem still occurs, please contact us at info@askui.com for more information`);
|
|
37
51
|
}
|
|
38
|
-
function
|
|
52
|
+
function getBinaryFilePath(version) {
|
|
39
53
|
return path_1.default.join((0, path_2.getPathToNodeModulesRoot)(), 'release', version, ...binarySubPathsByPlatform[platform()]);
|
|
40
54
|
}
|
|
41
|
-
exports.
|
|
55
|
+
exports.getBinaryFilePath = getBinaryFilePath;
|
|
42
56
|
function getBinaryDownloadUrl(binaryVersion) {
|
|
43
57
|
const baseUrl = `https://askui-public.s3.eu-central-1.amazonaws.com/releases/askui-ui-controller/${binaryVersion}`;
|
|
44
58
|
const arch = os_1.default.arch();
|
|
45
59
|
return `${baseUrl}/${platform()}/${arch}/${binarySubPathsByPlatform[platform()][1]}`;
|
|
46
60
|
}
|
|
47
61
|
function downloadServerBinaries(binaryVersion, proxyAgent) {
|
|
48
|
-
return
|
|
49
|
-
const url = getBinaryDownloadUrl(binaryVersion);
|
|
50
|
-
const binaryOutputPath = getBinaryPath(binaryVersion);
|
|
51
|
-
const binaryFolder = path_1.default.dirname(binaryOutputPath);
|
|
62
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
52
63
|
logger_1.logger.info(`Start downloading UI Controller version "${binaryVersion}"`);
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
64
|
+
const url = getBinaryDownloadUrl(binaryVersion);
|
|
65
|
+
const binaryFilePath = getBinaryFilePath(binaryVersion);
|
|
66
|
+
const binaryFolderPath = path_1.default.dirname(binaryFilePath);
|
|
67
|
+
const tempFilePath = path_1.default.join(binaryFolderPath, 'askui-ui-controller.temp');
|
|
68
|
+
const pipeline = (0, util_1.promisify)(stream_1.default.pipeline);
|
|
56
69
|
const downloadStream = got_1.default.stream(url, proxyAgent ? { agent: proxyAgent } : {});
|
|
57
|
-
const fileWriterStream = fs_1.default.createWriteStream(
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
logger_1.logger.
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
|
|
70
|
+
const fileWriterStream = fs_1.default.createWriteStream(tempFilePath);
|
|
71
|
+
if (!(fs_1.default.existsSync(binaryFolderPath))) {
|
|
72
|
+
fs_1.default.mkdirSync(binaryFolderPath, { recursive: true });
|
|
73
|
+
}
|
|
74
|
+
try {
|
|
75
|
+
yield pipeline(downloadStream, fileWriterStream);
|
|
76
|
+
fs_1.default.rename(tempFilePath, binaryFilePath, () => {
|
|
77
|
+
logger_1.logger.info(`UI Controller version ${binaryVersion} for your system "${platform()} ${os_1.default.arch}" was downloaded`);
|
|
78
|
+
logger_1.logger.debug(`Binary of UI Controller is located at "${binaryFilePath}".`);
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
logger_1.logger.error(error);
|
|
83
|
+
fs_1.default.unlink(tempFilePath, (err) => { logger_1.logger.error(err); });
|
|
84
|
+
throw buildBinaryNotAvailableError(binaryVersion);
|
|
85
|
+
}
|
|
86
|
+
return Promise.resolve();
|
|
74
87
|
});
|
|
75
88
|
}
|
|
76
89
|
exports.downloadServerBinaries = downloadServerBinaries;
|
|
@@ -14,7 +14,7 @@ class UiControllerDarwin extends ui_controller_facade_1.UiControllerFacade {
|
|
|
14
14
|
this.makeDiskImageExecutable();
|
|
15
15
|
}
|
|
16
16
|
getStartingCommand() {
|
|
17
|
-
return `"${path_1.default.dirname(this.
|
|
17
|
+
return `"${path_1.default.dirname(this.binaryFilePath)}/askui-ui-controller.app/Contents/MacOS/askui-ui-controller"`;
|
|
18
18
|
}
|
|
19
19
|
makeDiskImageExecutable() {
|
|
20
20
|
const mountPoint = '/Volumes/askui-ui-controller.dmg';
|
|
@@ -25,11 +25,11 @@ class UiControllerDarwin extends ui_controller_facade_1.UiControllerFacade {
|
|
|
25
25
|
'-noautofsck',
|
|
26
26
|
'-noautoopen',
|
|
27
27
|
`-mountpoint "${mountPoint}"`,
|
|
28
|
-
`"${this.
|
|
28
|
+
`"${this.binaryFilePath}"`,
|
|
29
29
|
].join(' '));
|
|
30
30
|
const appBaseName = 'askui-ui-controller.app';
|
|
31
31
|
const appSrcPath = `${mountPoint}/${appBaseName}`;
|
|
32
|
-
const appDestPath = `${path_1.default.dirname(this.
|
|
32
|
+
const appDestPath = `${path_1.default.dirname(this.binaryFilePath)}/${appBaseName}`;
|
|
33
33
|
fs_extra_1.default.removeSync(appDestPath);
|
|
34
34
|
fs_extra_1.default.copySync(appSrcPath, appDestPath);
|
|
35
35
|
(0, child_process_1.exec)(`hdiutil detach "${mountPoint}"`, (_exception, stdout) => logger_1.logger.debug(stdout));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { UiControllerArgs, UiControllerArgsWithDefaults } from './ui-controller-args';
|
|
2
2
|
export declare abstract class UiControllerFacade {
|
|
3
|
-
protected
|
|
3
|
+
protected binaryFilePath: string;
|
|
4
4
|
protected serverLogFile: string;
|
|
5
5
|
protected readonly DefaultmaxWaitingForStartingInMs: number;
|
|
6
6
|
start(args?: UiControllerArgs, maxWaitingForStartingInSeconds?: number): Promise<void>;
|
|
@@ -11,7 +11,6 @@ export declare abstract class UiControllerFacade {
|
|
|
11
11
|
protected makeBinaryExecutable(): void;
|
|
12
12
|
protected runPreStartChecks(): Promise<void>;
|
|
13
13
|
protected waitUntilStarted(args: UiControllerArgsWithDefaults, maxWaitingForStartingInSeconds?: number): Promise<void>;
|
|
14
|
-
private isBinaryValid;
|
|
15
14
|
private getBinary;
|
|
16
15
|
private startWithDefaults;
|
|
17
16
|
}
|
|
@@ -27,7 +27,7 @@ const unkown_error_1 = require("./unkown-error");
|
|
|
27
27
|
const proxy_builder_1 = require("../utils/proxy/proxy-builder");
|
|
28
28
|
class UiControllerFacade {
|
|
29
29
|
constructor() {
|
|
30
|
-
this.
|
|
30
|
+
this.binaryFilePath = (0, download_binaries_1.getBinaryFilePath)('latest');
|
|
31
31
|
this.DefaultmaxWaitingForStartingInMs = 30 * 1000;
|
|
32
32
|
}
|
|
33
33
|
start(args, maxWaitingForStartingInSeconds) {
|
|
@@ -35,7 +35,7 @@ class UiControllerFacade {
|
|
|
35
35
|
yield this.runPreStartChecks();
|
|
36
36
|
const argsWithDefaults = (0, ui_controller_args_1.createArgsWithDefaults)(args);
|
|
37
37
|
const argsWithLogPath = this.serverLogFilePath(argsWithDefaults);
|
|
38
|
-
this.
|
|
38
|
+
this.binaryFilePath = (0, download_binaries_1.getBinaryFilePath)(argsWithLogPath.binaryVersion);
|
|
39
39
|
yield this.getBinary(argsWithLogPath.binaryVersion, argsWithLogPath.overWriteBinary, argsWithLogPath.proxyAgents || (yield (0, proxy_builder_1.buildProxyAgentArgsFromEnvironment)()));
|
|
40
40
|
this.makeBinaryExecutable();
|
|
41
41
|
logger_1.logger.debug(`UI Controller log path "${this.serverLogFile}"`);
|
|
@@ -71,7 +71,7 @@ class UiControllerFacade {
|
|
|
71
71
|
});
|
|
72
72
|
}
|
|
73
73
|
getStartingCommand() {
|
|
74
|
-
return `"${this.
|
|
74
|
+
return `"${this.binaryFilePath}"`;
|
|
75
75
|
}
|
|
76
76
|
// eslint-disable-next-line class-methods-use-this
|
|
77
77
|
makeBinaryExecutable() {
|
|
@@ -105,19 +105,14 @@ class UiControllerFacade {
|
|
|
105
105
|
}
|
|
106
106
|
});
|
|
107
107
|
}
|
|
108
|
-
isBinaryValid() {
|
|
109
|
-
const sizeThresholdInMB = 100;
|
|
110
|
-
const binarysizeInMB = fs_extra_1.default.statSync(this.binaryPath).size / (1024 * 1024);
|
|
111
|
-
return binarysizeInMB > sizeThresholdInMB;
|
|
112
|
-
}
|
|
113
108
|
getBinary(binaryVersion, overWriteBinary = false, proxyAgent) {
|
|
114
109
|
return __awaiter(this, void 0, void 0, function* () {
|
|
115
|
-
if (!fs_extra_1.default.existsSync(this.
|
|
116
|
-
logger_1.logger.debug(`Currently, no binary of the UI Controller is available at "${this.
|
|
110
|
+
if (!fs_extra_1.default.existsSync(this.binaryFilePath) || overWriteBinary) {
|
|
111
|
+
logger_1.logger.debug(`Currently, no binary of the UI Controller is available at "${this.binaryFilePath}"`);
|
|
117
112
|
yield (0, download_binaries_1.downloadServerBinaries)(binaryVersion, proxyAgent);
|
|
118
113
|
}
|
|
119
114
|
else {
|
|
120
|
-
logger_1.logger.debug(`Binary of UI Controller is already present at "${this.
|
|
115
|
+
logger_1.logger.debug(`Binary of UI Controller is already present at "${this.binaryFilePath}".`);
|
|
121
116
|
}
|
|
122
117
|
});
|
|
123
118
|
}
|
|
@@ -19,7 +19,7 @@ const libfuse_error_1 = require("./libfuse-error");
|
|
|
19
19
|
class UiControllerLinux extends ui_controller_facade_1.UiControllerFacade {
|
|
20
20
|
// eslint-disable-next-line class-methods-use-this
|
|
21
21
|
makeBinaryExecutable() {
|
|
22
|
-
(0, child_process_1.exec)(`chmod +x "${this.
|
|
22
|
+
(0, child_process_1.exec)(`chmod +x "${this.binaryFilePath}"`, (_exception, stdout) => logger_1.logger.debug(stdout));
|
|
23
23
|
}
|
|
24
24
|
// eslint-disable-next-line class-methods-use-this
|
|
25
25
|
runPreStartChecks() {
|