askui 0.7.0 → 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/execution/dsl.d.ts +48 -0
- package/dist/cjs/execution/dsl.js +72 -0
- 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/execution/dsl.d.ts +48 -0
- package/dist/esm/execution/dsl.js +72 -0
- 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
|
@@ -1779,6 +1779,54 @@ export declare abstract class FluentCommand extends FluentBase {
|
|
|
1779
1779
|
* @return {Exec}
|
|
1780
1780
|
*/
|
|
1781
1781
|
execOnShell(shell_command: string): Exec;
|
|
1782
|
+
/**
|
|
1783
|
+
* Clicks with left mouse key.
|
|
1784
|
+
*
|
|
1785
|
+
* @return {Exec}
|
|
1786
|
+
*/
|
|
1787
|
+
mouseLeftClick(): Exec;
|
|
1788
|
+
/**
|
|
1789
|
+
* Clicks with right mouse key.
|
|
1790
|
+
*
|
|
1791
|
+
* @return {Exec}
|
|
1792
|
+
*/
|
|
1793
|
+
mouseRightClick(): Exec;
|
|
1794
|
+
/**
|
|
1795
|
+
* Clicks with middle mouse key.
|
|
1796
|
+
*
|
|
1797
|
+
* @return {Exec}
|
|
1798
|
+
*/
|
|
1799
|
+
mouseMiddleClick(): Exec;
|
|
1800
|
+
/**
|
|
1801
|
+
* Double-clicks with left mouse key.
|
|
1802
|
+
*
|
|
1803
|
+
* @return {Exec}
|
|
1804
|
+
*/
|
|
1805
|
+
mouseDoubleLeftClick(): Exec;
|
|
1806
|
+
/**
|
|
1807
|
+
* Double-clicks with right mouse key.
|
|
1808
|
+
*
|
|
1809
|
+
* @return {Exec}
|
|
1810
|
+
*/
|
|
1811
|
+
mouseDoubleRightClick(): Exec;
|
|
1812
|
+
/**
|
|
1813
|
+
* Double-clicks with middle mouse key.
|
|
1814
|
+
*
|
|
1815
|
+
* @return {Exec}
|
|
1816
|
+
*/
|
|
1817
|
+
mouseDoubleMiddleClick(): Exec;
|
|
1818
|
+
/**
|
|
1819
|
+
* Toggles mouse down (Left mouse key).
|
|
1820
|
+
*
|
|
1821
|
+
* @return {Exec}
|
|
1822
|
+
*/
|
|
1823
|
+
mouseToggleDown(): Exec;
|
|
1824
|
+
/**
|
|
1825
|
+
* Toggles mouse up (Left mouse key).
|
|
1826
|
+
*
|
|
1827
|
+
* @return {Exec}
|
|
1828
|
+
*/
|
|
1829
|
+
mouseToggleUp(): Exec;
|
|
1782
1830
|
/**
|
|
1783
1831
|
* Press three keys like `CTRL+ALT+DEL`
|
|
1784
1832
|
*
|
|
@@ -2369,6 +2369,78 @@ class FluentCommand extends FluentBase {
|
|
|
2369
2369
|
this._textStr = `Execute shell command ${Separators.STRING}${shell_command}${Separators.STRING}`;
|
|
2370
2370
|
return new Exec(this);
|
|
2371
2371
|
}
|
|
2372
|
+
/**
|
|
2373
|
+
* Clicks with left mouse key.
|
|
2374
|
+
*
|
|
2375
|
+
* @return {Exec}
|
|
2376
|
+
*/
|
|
2377
|
+
mouseLeftClick() {
|
|
2378
|
+
this._textStr = 'Mouse left click';
|
|
2379
|
+
return new Exec(this);
|
|
2380
|
+
}
|
|
2381
|
+
/**
|
|
2382
|
+
* Clicks with right mouse key.
|
|
2383
|
+
*
|
|
2384
|
+
* @return {Exec}
|
|
2385
|
+
*/
|
|
2386
|
+
mouseRightClick() {
|
|
2387
|
+
this._textStr = 'Mouse right click';
|
|
2388
|
+
return new Exec(this);
|
|
2389
|
+
}
|
|
2390
|
+
/**
|
|
2391
|
+
* Clicks with middle mouse key.
|
|
2392
|
+
*
|
|
2393
|
+
* @return {Exec}
|
|
2394
|
+
*/
|
|
2395
|
+
mouseMiddleClick() {
|
|
2396
|
+
this._textStr = 'Mouse middle click';
|
|
2397
|
+
return new Exec(this);
|
|
2398
|
+
}
|
|
2399
|
+
/**
|
|
2400
|
+
* Double-clicks with left mouse key.
|
|
2401
|
+
*
|
|
2402
|
+
* @return {Exec}
|
|
2403
|
+
*/
|
|
2404
|
+
mouseDoubleLeftClick() {
|
|
2405
|
+
this._textStr = 'Mouse double left click';
|
|
2406
|
+
return new Exec(this);
|
|
2407
|
+
}
|
|
2408
|
+
/**
|
|
2409
|
+
* Double-clicks with right mouse key.
|
|
2410
|
+
*
|
|
2411
|
+
* @return {Exec}
|
|
2412
|
+
*/
|
|
2413
|
+
mouseDoubleRightClick() {
|
|
2414
|
+
this._textStr = 'Mouse double right click';
|
|
2415
|
+
return new Exec(this);
|
|
2416
|
+
}
|
|
2417
|
+
/**
|
|
2418
|
+
* Double-clicks with middle mouse key.
|
|
2419
|
+
*
|
|
2420
|
+
* @return {Exec}
|
|
2421
|
+
*/
|
|
2422
|
+
mouseDoubleMiddleClick() {
|
|
2423
|
+
this._textStr = 'Mouse double middle click';
|
|
2424
|
+
return new Exec(this);
|
|
2425
|
+
}
|
|
2426
|
+
/**
|
|
2427
|
+
* Toggles mouse down (Left mouse key).
|
|
2428
|
+
*
|
|
2429
|
+
* @return {Exec}
|
|
2430
|
+
*/
|
|
2431
|
+
mouseToggleDown() {
|
|
2432
|
+
this._textStr = 'Mouse toggle down';
|
|
2433
|
+
return new Exec(this);
|
|
2434
|
+
}
|
|
2435
|
+
/**
|
|
2436
|
+
* Toggles mouse up (Left mouse key).
|
|
2437
|
+
*
|
|
2438
|
+
* @return {Exec}
|
|
2439
|
+
*/
|
|
2440
|
+
mouseToggleUp() {
|
|
2441
|
+
this._textStr = 'Mouse toggle up';
|
|
2442
|
+
return new Exec(this);
|
|
2443
|
+
}
|
|
2372
2444
|
/**
|
|
2373
2445
|
* Press three keys like `CTRL+ALT+DEL`
|
|
2374
2446
|
*
|
|
@@ -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() {
|
|
@@ -1779,6 +1779,54 @@ export declare abstract class FluentCommand extends FluentBase {
|
|
|
1779
1779
|
* @return {Exec}
|
|
1780
1780
|
*/
|
|
1781
1781
|
execOnShell(shell_command: string): Exec;
|
|
1782
|
+
/**
|
|
1783
|
+
* Clicks with left mouse key.
|
|
1784
|
+
*
|
|
1785
|
+
* @return {Exec}
|
|
1786
|
+
*/
|
|
1787
|
+
mouseLeftClick(): Exec;
|
|
1788
|
+
/**
|
|
1789
|
+
* Clicks with right mouse key.
|
|
1790
|
+
*
|
|
1791
|
+
* @return {Exec}
|
|
1792
|
+
*/
|
|
1793
|
+
mouseRightClick(): Exec;
|
|
1794
|
+
/**
|
|
1795
|
+
* Clicks with middle mouse key.
|
|
1796
|
+
*
|
|
1797
|
+
* @return {Exec}
|
|
1798
|
+
*/
|
|
1799
|
+
mouseMiddleClick(): Exec;
|
|
1800
|
+
/**
|
|
1801
|
+
* Double-clicks with left mouse key.
|
|
1802
|
+
*
|
|
1803
|
+
* @return {Exec}
|
|
1804
|
+
*/
|
|
1805
|
+
mouseDoubleLeftClick(): Exec;
|
|
1806
|
+
/**
|
|
1807
|
+
* Double-clicks with right mouse key.
|
|
1808
|
+
*
|
|
1809
|
+
* @return {Exec}
|
|
1810
|
+
*/
|
|
1811
|
+
mouseDoubleRightClick(): Exec;
|
|
1812
|
+
/**
|
|
1813
|
+
* Double-clicks with middle mouse key.
|
|
1814
|
+
*
|
|
1815
|
+
* @return {Exec}
|
|
1816
|
+
*/
|
|
1817
|
+
mouseDoubleMiddleClick(): Exec;
|
|
1818
|
+
/**
|
|
1819
|
+
* Toggles mouse down (Left mouse key).
|
|
1820
|
+
*
|
|
1821
|
+
* @return {Exec}
|
|
1822
|
+
*/
|
|
1823
|
+
mouseToggleDown(): Exec;
|
|
1824
|
+
/**
|
|
1825
|
+
* Toggles mouse up (Left mouse key).
|
|
1826
|
+
*
|
|
1827
|
+
* @return {Exec}
|
|
1828
|
+
*/
|
|
1829
|
+
mouseToggleUp(): Exec;
|
|
1782
1830
|
/**
|
|
1783
1831
|
* Press three keys like `CTRL+ALT+DEL`
|
|
1784
1832
|
*
|
|
@@ -2361,6 +2361,78 @@ export class FluentCommand extends FluentBase {
|
|
|
2361
2361
|
this._textStr = `Execute shell command ${Separators.STRING}${shell_command}${Separators.STRING}`;
|
|
2362
2362
|
return new Exec(this);
|
|
2363
2363
|
}
|
|
2364
|
+
/**
|
|
2365
|
+
* Clicks with left mouse key.
|
|
2366
|
+
*
|
|
2367
|
+
* @return {Exec}
|
|
2368
|
+
*/
|
|
2369
|
+
mouseLeftClick() {
|
|
2370
|
+
this._textStr = 'Mouse left click';
|
|
2371
|
+
return new Exec(this);
|
|
2372
|
+
}
|
|
2373
|
+
/**
|
|
2374
|
+
* Clicks with right mouse key.
|
|
2375
|
+
*
|
|
2376
|
+
* @return {Exec}
|
|
2377
|
+
*/
|
|
2378
|
+
mouseRightClick() {
|
|
2379
|
+
this._textStr = 'Mouse right click';
|
|
2380
|
+
return new Exec(this);
|
|
2381
|
+
}
|
|
2382
|
+
/**
|
|
2383
|
+
* Clicks with middle mouse key.
|
|
2384
|
+
*
|
|
2385
|
+
* @return {Exec}
|
|
2386
|
+
*/
|
|
2387
|
+
mouseMiddleClick() {
|
|
2388
|
+
this._textStr = 'Mouse middle click';
|
|
2389
|
+
return new Exec(this);
|
|
2390
|
+
}
|
|
2391
|
+
/**
|
|
2392
|
+
* Double-clicks with left mouse key.
|
|
2393
|
+
*
|
|
2394
|
+
* @return {Exec}
|
|
2395
|
+
*/
|
|
2396
|
+
mouseDoubleLeftClick() {
|
|
2397
|
+
this._textStr = 'Mouse double left click';
|
|
2398
|
+
return new Exec(this);
|
|
2399
|
+
}
|
|
2400
|
+
/**
|
|
2401
|
+
* Double-clicks with right mouse key.
|
|
2402
|
+
*
|
|
2403
|
+
* @return {Exec}
|
|
2404
|
+
*/
|
|
2405
|
+
mouseDoubleRightClick() {
|
|
2406
|
+
this._textStr = 'Mouse double right click';
|
|
2407
|
+
return new Exec(this);
|
|
2408
|
+
}
|
|
2409
|
+
/**
|
|
2410
|
+
* Double-clicks with middle mouse key.
|
|
2411
|
+
*
|
|
2412
|
+
* @return {Exec}
|
|
2413
|
+
*/
|
|
2414
|
+
mouseDoubleMiddleClick() {
|
|
2415
|
+
this._textStr = 'Mouse double middle click';
|
|
2416
|
+
return new Exec(this);
|
|
2417
|
+
}
|
|
2418
|
+
/**
|
|
2419
|
+
* Toggles mouse down (Left mouse key).
|
|
2420
|
+
*
|
|
2421
|
+
* @return {Exec}
|
|
2422
|
+
*/
|
|
2423
|
+
mouseToggleDown() {
|
|
2424
|
+
this._textStr = 'Mouse toggle down';
|
|
2425
|
+
return new Exec(this);
|
|
2426
|
+
}
|
|
2427
|
+
/**
|
|
2428
|
+
* Toggles mouse up (Left mouse key).
|
|
2429
|
+
*
|
|
2430
|
+
* @return {Exec}
|
|
2431
|
+
*/
|
|
2432
|
+
mouseToggleUp() {
|
|
2433
|
+
this._textStr = 'Mouse toggle up';
|
|
2434
|
+
return new Exec(this);
|
|
2435
|
+
}
|
|
2364
2436
|
/**
|
|
2365
2437
|
* Press three keys like `CTRL+ALT+DEL`
|
|
2366
2438
|
*
|
|
@@ -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,7 +1,18 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
1
10
|
import fs from 'fs';
|
|
2
11
|
import got from 'got';
|
|
3
12
|
import os from 'os';
|
|
4
13
|
import path from 'path';
|
|
14
|
+
import { promisify } from 'util';
|
|
15
|
+
import stream from 'stream';
|
|
5
16
|
import { getPathToNodeModulesRoot } from '../utils/path';
|
|
6
17
|
import { logger } from './logger';
|
|
7
18
|
var SupportedPlatform;
|
|
@@ -25,10 +36,13 @@ export function platform() {
|
|
|
25
36
|
}
|
|
26
37
|
throw new Error(`Platform "${pf}" is not supported.`);
|
|
27
38
|
}
|
|
28
|
-
function
|
|
29
|
-
return new Error(`
|
|
39
|
+
function buildBinaryNotAvailableError(binaryVersion) {
|
|
40
|
+
return new Error(`There was an error during downloading and creating the askui UI Controller. You can try a fresh install.
|
|
41
|
+
If you specified a binary version it is possible that the askui UI Controller version "${binaryVersion}"
|
|
42
|
+
for your system "${platform()} ${os.arch}" is not available.
|
|
43
|
+
If this problem still occurs, please contact us at info@askui.com for more information`);
|
|
30
44
|
}
|
|
31
|
-
export function
|
|
45
|
+
export function getBinaryFilePath(version) {
|
|
32
46
|
return path.join(getPathToNodeModulesRoot(), 'release', version, ...binarySubPathsByPlatform[platform()]);
|
|
33
47
|
}
|
|
34
48
|
function getBinaryDownloadUrl(binaryVersion) {
|
|
@@ -37,31 +51,30 @@ function getBinaryDownloadUrl(binaryVersion) {
|
|
|
37
51
|
return `${baseUrl}/${platform()}/${arch}/${binarySubPathsByPlatform[platform()][1]}`;
|
|
38
52
|
}
|
|
39
53
|
export function downloadServerBinaries(binaryVersion, proxyAgent) {
|
|
40
|
-
return
|
|
41
|
-
const url = getBinaryDownloadUrl(binaryVersion);
|
|
42
|
-
const binaryOutputPath = getBinaryPath(binaryVersion);
|
|
43
|
-
const binaryFolder = path.dirname(binaryOutputPath);
|
|
54
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
44
55
|
logger.info(`Start downloading UI Controller version "${binaryVersion}"`);
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
56
|
+
const url = getBinaryDownloadUrl(binaryVersion);
|
|
57
|
+
const binaryFilePath = getBinaryFilePath(binaryVersion);
|
|
58
|
+
const binaryFolderPath = path.dirname(binaryFilePath);
|
|
59
|
+
const tempFilePath = path.join(binaryFolderPath, 'askui-ui-controller.temp');
|
|
60
|
+
const pipeline = promisify(stream.pipeline);
|
|
48
61
|
const downloadStream = got.stream(url, proxyAgent ? { agent: proxyAgent } : {});
|
|
49
|
-
const fileWriterStream = fs.createWriteStream(
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
logger.
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
-
|
|
62
|
+
const fileWriterStream = fs.createWriteStream(tempFilePath);
|
|
63
|
+
if (!(fs.existsSync(binaryFolderPath))) {
|
|
64
|
+
fs.mkdirSync(binaryFolderPath, { recursive: true });
|
|
65
|
+
}
|
|
66
|
+
try {
|
|
67
|
+
yield pipeline(downloadStream, fileWriterStream);
|
|
68
|
+
fs.rename(tempFilePath, binaryFilePath, () => {
|
|
69
|
+
logger.info(`UI Controller version ${binaryVersion} for your system "${platform()} ${os.arch}" was downloaded`);
|
|
70
|
+
logger.debug(`Binary of UI Controller is located at "${binaryFilePath}".`);
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
catch (error) {
|
|
74
|
+
logger.error(error);
|
|
75
|
+
fs.unlink(tempFilePath, (err) => { logger.error(err); });
|
|
76
|
+
throw buildBinaryNotAvailableError(binaryVersion);
|
|
77
|
+
}
|
|
78
|
+
return Promise.resolve();
|
|
66
79
|
});
|
|
67
80
|
}
|
|
@@ -8,7 +8,7 @@ export class UiControllerDarwin extends UiControllerFacade {
|
|
|
8
8
|
this.makeDiskImageExecutable();
|
|
9
9
|
}
|
|
10
10
|
getStartingCommand() {
|
|
11
|
-
return `"${path.dirname(this.
|
|
11
|
+
return `"${path.dirname(this.binaryFilePath)}/askui-ui-controller.app/Contents/MacOS/askui-ui-controller"`;
|
|
12
12
|
}
|
|
13
13
|
makeDiskImageExecutable() {
|
|
14
14
|
const mountPoint = '/Volumes/askui-ui-controller.dmg';
|
|
@@ -19,11 +19,11 @@ export class UiControllerDarwin extends UiControllerFacade {
|
|
|
19
19
|
'-noautofsck',
|
|
20
20
|
'-noautoopen',
|
|
21
21
|
`-mountpoint "${mountPoint}"`,
|
|
22
|
-
`"${this.
|
|
22
|
+
`"${this.binaryFilePath}"`,
|
|
23
23
|
].join(' '));
|
|
24
24
|
const appBaseName = 'askui-ui-controller.app';
|
|
25
25
|
const appSrcPath = `${mountPoint}/${appBaseName}`;
|
|
26
|
-
const appDestPath = `${path.dirname(this.
|
|
26
|
+
const appDestPath = `${path.dirname(this.binaryFilePath)}/${appBaseName}`;
|
|
27
27
|
fs.removeSync(appDestPath);
|
|
28
28
|
fs.copySync(appSrcPath, appDestPath);
|
|
29
29
|
exec(`hdiutil detach "${mountPoint}"`, (_exception, stdout) => 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
|
}
|
|
@@ -14,14 +14,14 @@ import fkill from 'fkill';
|
|
|
14
14
|
import os from 'os';
|
|
15
15
|
import path from 'path';
|
|
16
16
|
import { createArgsWithDefaults, createCliFlagsFromArgs, } from './ui-controller-args';
|
|
17
|
-
import { downloadServerBinaries,
|
|
17
|
+
import { downloadServerBinaries, getBinaryFilePath } from './download-binaries';
|
|
18
18
|
import { logger } from './logger';
|
|
19
19
|
import { TimeoutError } from './timeout-error';
|
|
20
20
|
import { UnkownError } from './unkown-error';
|
|
21
21
|
import { buildProxyAgentArgsFromEnvironment } from '../utils/proxy/proxy-builder';
|
|
22
22
|
export class UiControllerFacade {
|
|
23
23
|
constructor() {
|
|
24
|
-
this.
|
|
24
|
+
this.binaryFilePath = getBinaryFilePath('latest');
|
|
25
25
|
this.DefaultmaxWaitingForStartingInMs = 30 * 1000;
|
|
26
26
|
}
|
|
27
27
|
start(args, maxWaitingForStartingInSeconds) {
|
|
@@ -29,7 +29,7 @@ export class UiControllerFacade {
|
|
|
29
29
|
yield this.runPreStartChecks();
|
|
30
30
|
const argsWithDefaults = createArgsWithDefaults(args);
|
|
31
31
|
const argsWithLogPath = this.serverLogFilePath(argsWithDefaults);
|
|
32
|
-
this.
|
|
32
|
+
this.binaryFilePath = getBinaryFilePath(argsWithLogPath.binaryVersion);
|
|
33
33
|
yield this.getBinary(argsWithLogPath.binaryVersion, argsWithLogPath.overWriteBinary, argsWithLogPath.proxyAgents || (yield buildProxyAgentArgsFromEnvironment()));
|
|
34
34
|
this.makeBinaryExecutable();
|
|
35
35
|
logger.debug(`UI Controller log path "${this.serverLogFile}"`);
|
|
@@ -65,7 +65,7 @@ export class UiControllerFacade {
|
|
|
65
65
|
});
|
|
66
66
|
}
|
|
67
67
|
getStartingCommand() {
|
|
68
|
-
return `"${this.
|
|
68
|
+
return `"${this.binaryFilePath}"`;
|
|
69
69
|
}
|
|
70
70
|
// eslint-disable-next-line class-methods-use-this
|
|
71
71
|
makeBinaryExecutable() {
|
|
@@ -99,19 +99,14 @@ export class UiControllerFacade {
|
|
|
99
99
|
}
|
|
100
100
|
});
|
|
101
101
|
}
|
|
102
|
-
isBinaryValid() {
|
|
103
|
-
const sizeThresholdInMB = 100;
|
|
104
|
-
const binarysizeInMB = fs.statSync(this.binaryPath).size / (1024 * 1024);
|
|
105
|
-
return binarysizeInMB > sizeThresholdInMB;
|
|
106
|
-
}
|
|
107
102
|
getBinary(binaryVersion, overWriteBinary = false, proxyAgent) {
|
|
108
103
|
return __awaiter(this, void 0, void 0, function* () {
|
|
109
|
-
if (!fs.existsSync(this.
|
|
110
|
-
logger.debug(`Currently, no binary of the UI Controller is available at "${this.
|
|
104
|
+
if (!fs.existsSync(this.binaryFilePath) || overWriteBinary) {
|
|
105
|
+
logger.debug(`Currently, no binary of the UI Controller is available at "${this.binaryFilePath}"`);
|
|
111
106
|
yield downloadServerBinaries(binaryVersion, proxyAgent);
|
|
112
107
|
}
|
|
113
108
|
else {
|
|
114
|
-
logger.debug(`Binary of UI Controller is already present at "${this.
|
|
109
|
+
logger.debug(`Binary of UI Controller is already present at "${this.binaryFilePath}".`);
|
|
115
110
|
}
|
|
116
111
|
});
|
|
117
112
|
}
|
|
@@ -16,7 +16,7 @@ import { LibfuseError } from './libfuse-error';
|
|
|
16
16
|
export class UiControllerLinux extends UiControllerFacade {
|
|
17
17
|
// eslint-disable-next-line class-methods-use-this
|
|
18
18
|
makeBinaryExecutable() {
|
|
19
|
-
exec(`chmod +x "${this.
|
|
19
|
+
exec(`chmod +x "${this.binaryFilePath}"`, (_exception, stdout) => logger.debug(stdout));
|
|
20
20
|
}
|
|
21
21
|
// eslint-disable-next-line class-methods-use-this
|
|
22
22
|
runPreStartChecks() {
|
package/dist/example_projects_templates/typescript_jest/test/my-first-askui-test-suite.test.ts
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { aui } from './helper/jest.setup';
|
|
2
2
|
|
|
3
3
|
describe('jest with askui', () => {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
|
|
5
|
+
it('should generate an interactive annotation', async () => {
|
|
6
6
|
await aui.annotateInteractively();
|
|
7
|
+
});
|
|
7
8
|
|
|
8
|
-
|
|
9
|
+
it('should click on my element', async () => {
|
|
9
10
|
await aui
|
|
10
11
|
.click()
|
|
11
|
-
|
|
12
|
-
.withText('Click on this text right here!')
|
|
13
|
-
.exec();
|
|
12
|
+
// <INSERT YOUR COPIED FILTER HERE AND UNCOMMENT THIS LINE>.exec();
|
|
14
13
|
});
|
|
15
14
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "askui",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "askui GmbH <info@askui.com> (http://www.askui.com/)",
|
|
6
6
|
"description": "Reliable, automated end-to-end-testing that depends on what is shown on your screen instead of the technology you are running on",
|