askui 0.4.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/execution/config-error.d.ts +2 -0
- package/dist/cjs/execution/config-error.js +6 -0
- package/dist/cjs/execution/dsl.d.ts +387 -2
- package/dist/cjs/execution/dsl.js +405 -2
- package/dist/cjs/execution/inference-client.d.ts +2 -1
- package/dist/cjs/execution/inference-client.js +9 -3
- package/dist/cjs/execution/ui-control-client.js +4 -2
- package/dist/cjs/execution/ui-controller-client-interface.d.ts +13 -0
- package/dist/cjs/lib/copy-example-project.js +40 -4
- package/dist/cjs/lib/download-binaries.d.ts +7 -1
- package/dist/cjs/lib/download-binaries.js +2 -2
- package/dist/cjs/lib/ui-controller-args.d.ts +4 -0
- package/dist/cjs/lib/ui-controller-facade.js +4 -3
- package/dist/cjs/shared/proxy-agent-args.d.ts +35 -0
- package/dist/cjs/shared/proxy-agent-args.js +2 -0
- package/dist/cjs/utils/http/http-client-got.d.ts +11 -1
- package/dist/cjs/utils/http/http-client-got.js +5 -3
- package/dist/cjs/utils/proxy/proxy-builder.d.ts +4 -0
- package/dist/cjs/utils/proxy/proxy-builder.js +67 -0
- package/dist/esm/execution/config-error.d.ts +2 -0
- package/dist/esm/execution/config-error.js +2 -0
- package/dist/esm/execution/dsl.d.ts +387 -2
- package/dist/esm/execution/dsl.js +405 -2
- package/dist/esm/execution/inference-client.d.ts +2 -1
- package/dist/esm/execution/inference-client.js +9 -3
- package/dist/esm/execution/ui-control-client.js +4 -2
- package/dist/esm/execution/ui-controller-client-interface.d.ts +13 -0
- package/dist/esm/lib/copy-example-project.js +40 -4
- package/dist/esm/lib/download-binaries.d.ts +7 -1
- package/dist/esm/lib/download-binaries.js +2 -2
- package/dist/esm/lib/ui-controller-args.d.ts +4 -0
- package/dist/esm/lib/ui-controller-facade.js +4 -3
- package/dist/esm/shared/proxy-agent-args.d.ts +35 -0
- package/dist/esm/shared/proxy-agent-args.js +1 -0
- package/dist/esm/utils/http/http-client-got.d.ts +11 -1
- package/dist/esm/utils/http/http-client-got.js +5 -3
- package/dist/esm/utils/proxy/proxy-builder.d.ts +4 -0
- package/dist/esm/utils/proxy/proxy-builder.js +43 -0
- package/dist/example_projects_templates/typescript_jest/test/helper/jest.setup.ts +8 -3
- package/dist/example_projects_templates/typescript_jest/test/my-first-askui-test-suite.test.ts +5 -0
- package/package.json +5 -2
|
@@ -24,6 +24,7 @@ const download_binaries_1 = require("./download-binaries");
|
|
|
24
24
|
const logger_1 = require("./logger");
|
|
25
25
|
const timeout_error_1 = require("./timeout-error");
|
|
26
26
|
const unkown_error_1 = require("./unkown-error");
|
|
27
|
+
const proxy_builder_1 = require("../utils/proxy/proxy-builder");
|
|
27
28
|
class UiControllerFacade {
|
|
28
29
|
constructor() {
|
|
29
30
|
this.binaryPath = (0, download_binaries_1.getBinaryPath)('latest');
|
|
@@ -35,7 +36,7 @@ class UiControllerFacade {
|
|
|
35
36
|
const argsWithDefaults = (0, ui_controller_args_1.createArgsWithDefaults)(args);
|
|
36
37
|
const argsWithLogPath = this.serverLogFilePath(argsWithDefaults);
|
|
37
38
|
this.binaryPath = (0, download_binaries_1.getBinaryPath)(argsWithLogPath.binaryVersion);
|
|
38
|
-
yield this.getBinary(argsWithLogPath.binaryVersion, argsWithLogPath.overWriteBinary);
|
|
39
|
+
yield this.getBinary(argsWithLogPath.binaryVersion, argsWithLogPath.overWriteBinary, argsWithLogPath.proxyAgents || (yield (0, proxy_builder_1.buildProxyAgentArgsFromEnvironment)()));
|
|
39
40
|
this.makeBinaryExecutable();
|
|
40
41
|
logger_1.logger.debug(`UI Controller log path "${this.serverLogFile}"`);
|
|
41
42
|
yield this.startWithDefaults(argsWithLogPath, maxWaitingForStartingInSeconds);
|
|
@@ -109,11 +110,11 @@ class UiControllerFacade {
|
|
|
109
110
|
const binarysizeInMB = fs_extra_1.default.statSync(this.binaryPath).size / (1024 * 1024);
|
|
110
111
|
return binarysizeInMB > sizeThresholdInMB;
|
|
111
112
|
}
|
|
112
|
-
getBinary(binaryVersion, overWriteBinary = false) {
|
|
113
|
+
getBinary(binaryVersion, overWriteBinary = false, proxyAgent) {
|
|
113
114
|
return __awaiter(this, void 0, void 0, function* () {
|
|
114
115
|
if (!fs_extra_1.default.existsSync(this.binaryPath) || overWriteBinary || !this.isBinaryValid()) {
|
|
115
116
|
logger_1.logger.debug(`Currently, no binary of the UI Controller is available at "${this.binaryPath}"`);
|
|
116
|
-
yield (0, download_binaries_1.downloadServerBinaries)(binaryVersion);
|
|
117
|
+
yield (0, download_binaries_1.downloadServerBinaries)(binaryVersion, proxyAgent);
|
|
117
118
|
}
|
|
118
119
|
else {
|
|
119
120
|
logger_1.logger.debug(`Binary of UI Controller is already present at "${this.binaryPath}".`);
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import http from 'http';
|
|
3
|
+
import https from 'https';
|
|
4
|
+
/**
|
|
5
|
+
* Proxy agent configuration for HTTP(S) requests
|
|
6
|
+
*
|
|
7
|
+
* All modules which implement the `http.Agent`'s or `https.Agent`'s
|
|
8
|
+
* interface, respectively, can be used.
|
|
9
|
+
* We recommend to use [hpagent](https://github.com/delvedore/hpagent).
|
|
10
|
+
*
|
|
11
|
+
* Installation:
|
|
12
|
+
* ```shell
|
|
13
|
+
* npm install --save hpagent
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* Configuration:
|
|
17
|
+
* ```typescript
|
|
18
|
+
* const httpProxyUrl = "http://your-proxy:3128";
|
|
19
|
+
* const httpsProxyUrl = "https://your-proxy:3129";
|
|
20
|
+
*
|
|
21
|
+
* const aui = await UiControlClient.build({
|
|
22
|
+
* proxyAgents: {
|
|
23
|
+
* http: new HttpProxyAgent({ proxy: httpProxyUrl }),
|
|
24
|
+
* https: new HttpsProxyAgent({ proxy: httpsProxyUrl }),
|
|
25
|
+
* },
|
|
26
|
+
* });
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* @param {http.Agent} http - Agent for http requests
|
|
30
|
+
* @param {https.Agent} https - Agent for https requests
|
|
31
|
+
** */
|
|
32
|
+
export interface ProxyAgentArgs {
|
|
33
|
+
http: http.Agent;
|
|
34
|
+
https: https.Agent;
|
|
35
|
+
}
|
|
@@ -1,10 +1,20 @@
|
|
|
1
1
|
import { OptionsOfJSONResponseBody } from 'got';
|
|
2
|
+
import http from 'http';
|
|
3
|
+
import https from 'https';
|
|
2
4
|
export declare class HttpClientGot {
|
|
3
5
|
readonly token?: string | undefined;
|
|
4
6
|
readonly customHeaders?: Record<string, string> | undefined;
|
|
5
7
|
private readonly cookies;
|
|
8
|
+
readonly proxyAgents?: {
|
|
9
|
+
http: http.Agent;
|
|
10
|
+
https: https.Agent;
|
|
11
|
+
} | undefined;
|
|
6
12
|
private headers;
|
|
7
|
-
|
|
13
|
+
private askuiGot;
|
|
14
|
+
constructor(token?: string | undefined, customHeaders?: Record<string, string> | undefined, cookies?: Record<string, string>, proxyAgents?: {
|
|
15
|
+
http: http.Agent;
|
|
16
|
+
https: https.Agent;
|
|
17
|
+
} | undefined);
|
|
8
18
|
private initHeaders;
|
|
9
19
|
private injectHeadersAndCookies;
|
|
10
20
|
post<T>(url: string, data: Record<string | number | symbol, unknown>): Promise<T>;
|
|
@@ -19,12 +19,14 @@ const lib_1 = require("../../lib");
|
|
|
19
19
|
const credentials_1 = require("./credentials");
|
|
20
20
|
const custom_errors_1 = require("./custom-errors");
|
|
21
21
|
class HttpClientGot {
|
|
22
|
-
constructor(token, customHeaders, cookies = {}) {
|
|
22
|
+
constructor(token, customHeaders, cookies = {}, proxyAgents) {
|
|
23
23
|
this.token = token;
|
|
24
24
|
this.customHeaders = customHeaders;
|
|
25
25
|
this.cookies = cookies;
|
|
26
|
+
this.proxyAgents = proxyAgents;
|
|
26
27
|
this.headers = {};
|
|
27
28
|
this.initHeaders(token, customHeaders);
|
|
29
|
+
this.askuiGot = got_1.default.extend(proxyAgents ? { agent: proxyAgents } : {});
|
|
28
30
|
}
|
|
29
31
|
initHeaders(token, customHeaders = {}) {
|
|
30
32
|
const credentials = token ? new credentials_1.Credentials(token) : undefined;
|
|
@@ -40,7 +42,7 @@ class HttpClientGot {
|
|
|
40
42
|
post(url, data) {
|
|
41
43
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42
44
|
const options = this.injectHeadersAndCookies(url, { json: data, responseType: 'json', throwHttpErrors: false });
|
|
43
|
-
const { body, statusCode, headers } = yield
|
|
45
|
+
const { body, statusCode, headers } = yield this.askuiGot.post(url, options);
|
|
44
46
|
if (headers['deprecation'] !== undefined) {
|
|
45
47
|
lib_1.logger.warn(headers['deprecation']);
|
|
46
48
|
}
|
|
@@ -52,7 +54,7 @@ class HttpClientGot {
|
|
|
52
54
|
}
|
|
53
55
|
get(url, options = { responseType: 'json' }) {
|
|
54
56
|
return __awaiter(this, void 0, void 0, function* () {
|
|
55
|
-
const response = yield
|
|
57
|
+
const response = yield this.askuiGot.get(url, this.injectHeadersAndCookies(url, options));
|
|
56
58
|
return response.body;
|
|
57
59
|
});
|
|
58
60
|
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
22
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
23
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
24
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
25
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
26
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
27
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
|
+
exports.buildProxyAgentArgsFromEnvironment = exports.ProxyImportError = void 0;
|
|
32
|
+
const logger_1 = require("../../lib/logger");
|
|
33
|
+
class ProxyImportError extends Error {
|
|
34
|
+
}
|
|
35
|
+
exports.ProxyImportError = ProxyImportError;
|
|
36
|
+
function dynmicImportHpagent() {
|
|
37
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
+
try {
|
|
39
|
+
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
40
|
+
return yield Promise.resolve().then(() => __importStar(require('hpagent')));
|
|
41
|
+
}
|
|
42
|
+
catch (err) {
|
|
43
|
+
throw new ProxyImportError('Can\'t find "hpagent" module to configure proxy! Please, install hpagent for proxy support with "npm install --save-dev hpagent".');
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
function buildProxyAgentArgsFromEnvironment() {
|
|
48
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
49
|
+
const httpProxyUrl = process.env['HTTP_PROXY'];
|
|
50
|
+
const httpsProxyUrl = process.env['HTTPS_PROXY'];
|
|
51
|
+
if (httpProxyUrl === undefined && httpsProxyUrl === undefined) {
|
|
52
|
+
logger_1.logger.debug('No proxy defined. "HTTPS_PROXY" and "HTTP_PROXY" environment variables are empty.');
|
|
53
|
+
return undefined;
|
|
54
|
+
}
|
|
55
|
+
const hpagent = yield dynmicImportHpagent();
|
|
56
|
+
logger_1.logger.info('Using proxy! One of following environment variables are defined: "HTTPS_PROXY", "https_proxy", "HTTP_PROXY" and "http_proxy"');
|
|
57
|
+
return {
|
|
58
|
+
http: new hpagent.HttpProxyAgent({
|
|
59
|
+
proxy: (httpProxyUrl || httpsProxyUrl),
|
|
60
|
+
}),
|
|
61
|
+
https: new hpagent.HttpsProxyAgent({
|
|
62
|
+
proxy: (httpsProxyUrl || httpProxyUrl),
|
|
63
|
+
}),
|
|
64
|
+
};
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
exports.buildProxyAgentArgsFromEnvironment = buildProxyAgentArgsFromEnvironment;
|
|
@@ -535,6 +535,114 @@ export declare class FluentFilters extends FluentBase {
|
|
|
535
535
|
colored(color: COLOR): FluentFiltersOrRelations;
|
|
536
536
|
}
|
|
537
537
|
export declare class FluentFiltersOrRelations extends FluentFilters {
|
|
538
|
+
/**
|
|
539
|
+
* Logic or operator
|
|
540
|
+
*
|
|
541
|
+
* **Examples:**
|
|
542
|
+
* ```text
|
|
543
|
+
* scene 1
|
|
544
|
+
* -------------- ---------------
|
|
545
|
+
* | button | | icon |
|
|
546
|
+
* -------------- ---------------
|
|
547
|
+
*
|
|
548
|
+
* scene 2
|
|
549
|
+
* -------------- ---------------
|
|
550
|
+
* | button | | text |
|
|
551
|
+
* -------------- ---------------
|
|
552
|
+
*
|
|
553
|
+
* ```
|
|
554
|
+
* In case, that your reference element can have multiple values, in the following example, the element right of the button can be either icon or text.
|
|
555
|
+
* You can use **the `or()` relation**, so your teststep is valid for both scenes
|
|
556
|
+
* ```typescript
|
|
557
|
+
* const button = await aui.get().button().rightOf().icon().or().text().exec();
|
|
558
|
+
* console.log(button);
|
|
559
|
+
* ```
|
|
560
|
+
* Returns the same button for both cases
|
|
561
|
+
* ```text
|
|
562
|
+
* console output: [
|
|
563
|
+
* DetectedElement {
|
|
564
|
+
* name: 'BUTTON',
|
|
565
|
+
* text: 'button',
|
|
566
|
+
* colors: [ 'red', 'black', 'red' ],
|
|
567
|
+
* bndbox: BoundingBox {
|
|
568
|
+
* xmin: 900,
|
|
569
|
+
* ymin: 910,
|
|
570
|
+
* xmax: 920,
|
|
571
|
+
* ymax: 930
|
|
572
|
+
* }
|
|
573
|
+
* }
|
|
574
|
+
* ]
|
|
575
|
+
* ```
|
|
576
|
+
*
|
|
577
|
+
* @return {FluentFilters}
|
|
578
|
+
*/
|
|
579
|
+
or(): FluentFilters;
|
|
580
|
+
/**
|
|
581
|
+
* Logic and operator
|
|
582
|
+
*
|
|
583
|
+
* **Examples:**
|
|
584
|
+
* ```text
|
|
585
|
+
* example scene:
|
|
586
|
+
* -------------------------- --------------------------
|
|
587
|
+
* | icon user colored black | | icon user colored red |
|
|
588
|
+
* -------------------------- --------------------------
|
|
589
|
+
* ```
|
|
590
|
+
* ```typescript
|
|
591
|
+
* const icons = await aui.get().icon().withText('user').exec();
|
|
592
|
+
* console.log(icons);
|
|
593
|
+
* ```
|
|
594
|
+
* Using only the filter withText, the get command will return both icons because they share the same text
|
|
595
|
+
* ```text
|
|
596
|
+
* console output: [
|
|
597
|
+
* DetectedElement {
|
|
598
|
+
* name: 'ICON',
|
|
599
|
+
* text: 'user',
|
|
600
|
+
* colors: [ 'black', 'black', 'black' ],
|
|
601
|
+
* bndbox: BoundingBox {
|
|
602
|
+
* xmin: 1000,
|
|
603
|
+
* ymin: 1010,
|
|
604
|
+
* xmax: 1020,
|
|
605
|
+
* ymax: 1030
|
|
606
|
+
* }
|
|
607
|
+
* },
|
|
608
|
+
* DetectedElement {
|
|
609
|
+
* name: 'ICON',
|
|
610
|
+
* text: 'user',
|
|
611
|
+
* colors: [ 'red', 'red', 'red' ],
|
|
612
|
+
* bndbox: BoundingBox {
|
|
613
|
+
* xmin: 900,
|
|
614
|
+
* ymin: 910,
|
|
615
|
+
* xmax: 920,
|
|
616
|
+
* ymax: 930
|
|
617
|
+
* }
|
|
618
|
+
* }
|
|
619
|
+
* ]
|
|
620
|
+
* ```
|
|
621
|
+
* You can combine filters with **the `and()` relation** and specify exactly which icon you want
|
|
622
|
+
* ```typescript
|
|
623
|
+
* const icons = await aui.get().icon().withText('user').and().colored('red').exec()
|
|
624
|
+
* console.log(icons)
|
|
625
|
+
* ```
|
|
626
|
+
* The get command returns only the red icon although both icons have the same text
|
|
627
|
+
* ```text
|
|
628
|
+
* console output: [
|
|
629
|
+
* DetectedElement {
|
|
630
|
+
* name: 'ICON',
|
|
631
|
+
* text: 'user',
|
|
632
|
+
* colors: [ 'red', 'red', 'red' ],
|
|
633
|
+
* bndbox: BoundingBox {
|
|
634
|
+
* xmin: 900,
|
|
635
|
+
* ymin: 910,
|
|
636
|
+
* xmax: 920,
|
|
637
|
+
* ymax: 930
|
|
638
|
+
* }
|
|
639
|
+
* }
|
|
640
|
+
* ]
|
|
641
|
+
* ```
|
|
642
|
+
*
|
|
643
|
+
* @return {FluentFilters}
|
|
644
|
+
*/
|
|
645
|
+
and(): FluentFilters;
|
|
538
646
|
/**
|
|
539
647
|
* Filters for an element inside another element.
|
|
540
648
|
*
|
|
@@ -1194,6 +1302,114 @@ export declare class FluentFiltersCondition extends FluentBase {
|
|
|
1194
1302
|
colored(color: COLOR): FluentFiltersOrRelationsCondition;
|
|
1195
1303
|
}
|
|
1196
1304
|
export declare class FluentFiltersOrRelationsCondition extends FluentFiltersCondition {
|
|
1305
|
+
/**
|
|
1306
|
+
* Logic or operator
|
|
1307
|
+
*
|
|
1308
|
+
* **Examples:**
|
|
1309
|
+
* ```text
|
|
1310
|
+
* scene 1
|
|
1311
|
+
* -------------- ---------------
|
|
1312
|
+
* | button | | icon |
|
|
1313
|
+
* -------------- ---------------
|
|
1314
|
+
*
|
|
1315
|
+
* scene 2
|
|
1316
|
+
* -------------- ---------------
|
|
1317
|
+
* | button | | text |
|
|
1318
|
+
* -------------- ---------------
|
|
1319
|
+
*
|
|
1320
|
+
* ```
|
|
1321
|
+
* In case, that your reference element can have multiple values, in the following example, the element right of the button can be either icon or text.
|
|
1322
|
+
* You can use **the `or()` relation**, so your teststep is valid for both scenes
|
|
1323
|
+
* ```typescript
|
|
1324
|
+
* const button = await aui.get().button().rightOf().icon().or().text().exec();
|
|
1325
|
+
* console.log(button);
|
|
1326
|
+
* ```
|
|
1327
|
+
* Returns the same button for both cases
|
|
1328
|
+
* ```text
|
|
1329
|
+
* console output: [
|
|
1330
|
+
* DetectedElement {
|
|
1331
|
+
* name: 'BUTTON',
|
|
1332
|
+
* text: 'button',
|
|
1333
|
+
* colors: [ 'red', 'black', 'red' ],
|
|
1334
|
+
* bndbox: BoundingBox {
|
|
1335
|
+
* xmin: 900,
|
|
1336
|
+
* ymin: 910,
|
|
1337
|
+
* xmax: 920,
|
|
1338
|
+
* ymax: 930
|
|
1339
|
+
* }
|
|
1340
|
+
* }
|
|
1341
|
+
* ]
|
|
1342
|
+
* ```
|
|
1343
|
+
*
|
|
1344
|
+
* @return {FluentFiltersCondition}
|
|
1345
|
+
*/
|
|
1346
|
+
or(): FluentFiltersCondition;
|
|
1347
|
+
/**
|
|
1348
|
+
* Logic and operator
|
|
1349
|
+
*
|
|
1350
|
+
* **Examples:**
|
|
1351
|
+
* ```text
|
|
1352
|
+
* example scene:
|
|
1353
|
+
* -------------------------- --------------------------
|
|
1354
|
+
* | icon user colored black | | icon user colored red |
|
|
1355
|
+
* -------------------------- --------------------------
|
|
1356
|
+
* ```
|
|
1357
|
+
* ```typescript
|
|
1358
|
+
* const icons = await aui.get().icon().withText('user').exec();
|
|
1359
|
+
* console.log(icons);
|
|
1360
|
+
* ```
|
|
1361
|
+
* Using only the filter withText, the get command will return both icons because they share the same text
|
|
1362
|
+
* ```text
|
|
1363
|
+
* console output: [
|
|
1364
|
+
* DetectedElement {
|
|
1365
|
+
* name: 'ICON',
|
|
1366
|
+
* text: 'user',
|
|
1367
|
+
* colors: [ 'black', 'black', 'black' ],
|
|
1368
|
+
* bndbox: BoundingBox {
|
|
1369
|
+
* xmin: 1000,
|
|
1370
|
+
* ymin: 1010,
|
|
1371
|
+
* xmax: 1020,
|
|
1372
|
+
* ymax: 1030
|
|
1373
|
+
* }
|
|
1374
|
+
* },
|
|
1375
|
+
* DetectedElement {
|
|
1376
|
+
* name: 'ICON',
|
|
1377
|
+
* text: 'user',
|
|
1378
|
+
* colors: [ 'red', 'red', 'red' ],
|
|
1379
|
+
* bndbox: BoundingBox {
|
|
1380
|
+
* xmin: 900,
|
|
1381
|
+
* ymin: 910,
|
|
1382
|
+
* xmax: 920,
|
|
1383
|
+
* ymax: 930
|
|
1384
|
+
* }
|
|
1385
|
+
* }
|
|
1386
|
+
* ]
|
|
1387
|
+
* ```
|
|
1388
|
+
* You can combine filters with **the `and()` relation** and specify exactly which icon you want
|
|
1389
|
+
* ```typescript
|
|
1390
|
+
* const icons = await aui.get().icon().withText('user').and().colored('red').exec()
|
|
1391
|
+
* console.log(icons)
|
|
1392
|
+
* ```
|
|
1393
|
+
* The get command returns only the red icon although both icons have the same text
|
|
1394
|
+
* ```text
|
|
1395
|
+
* console output: [
|
|
1396
|
+
* DetectedElement {
|
|
1397
|
+
* name: 'ICON',
|
|
1398
|
+
* text: 'user',
|
|
1399
|
+
* colors: [ 'red', 'red', 'red' ],
|
|
1400
|
+
* bndbox: BoundingBox {
|
|
1401
|
+
* xmin: 900,
|
|
1402
|
+
* ymin: 910,
|
|
1403
|
+
* xmax: 920,
|
|
1404
|
+
* ymax: 930
|
|
1405
|
+
* }
|
|
1406
|
+
* }
|
|
1407
|
+
* ]
|
|
1408
|
+
* ```
|
|
1409
|
+
*
|
|
1410
|
+
* @return {FluentFiltersCondition}
|
|
1411
|
+
*/
|
|
1412
|
+
and(): FluentFiltersCondition;
|
|
1197
1413
|
/**
|
|
1198
1414
|
* Filters for an element inside another element.
|
|
1199
1415
|
*
|
|
@@ -2078,6 +2294,114 @@ export declare class FluentFiltersGetter extends FluentBase {
|
|
|
2078
2294
|
colored(color: COLOR): FluentFiltersOrRelationsGetter;
|
|
2079
2295
|
}
|
|
2080
2296
|
export declare class FluentFiltersOrRelationsGetter extends FluentFiltersGetter {
|
|
2297
|
+
/**
|
|
2298
|
+
* Logic or operator
|
|
2299
|
+
*
|
|
2300
|
+
* **Examples:**
|
|
2301
|
+
* ```text
|
|
2302
|
+
* scene 1
|
|
2303
|
+
* -------------- ---------------
|
|
2304
|
+
* | button | | icon |
|
|
2305
|
+
* -------------- ---------------
|
|
2306
|
+
*
|
|
2307
|
+
* scene 2
|
|
2308
|
+
* -------------- ---------------
|
|
2309
|
+
* | button | | text |
|
|
2310
|
+
* -------------- ---------------
|
|
2311
|
+
*
|
|
2312
|
+
* ```
|
|
2313
|
+
* In case, that your reference element can have multiple values, in the following example, the element right of the button can be either icon or text.
|
|
2314
|
+
* You can use **the `or()` relation**, so your teststep is valid for both scenes
|
|
2315
|
+
* ```typescript
|
|
2316
|
+
* const button = await aui.get().button().rightOf().icon().or().text().exec();
|
|
2317
|
+
* console.log(button);
|
|
2318
|
+
* ```
|
|
2319
|
+
* Returns the same button for both cases
|
|
2320
|
+
* ```text
|
|
2321
|
+
* console output: [
|
|
2322
|
+
* DetectedElement {
|
|
2323
|
+
* name: 'BUTTON',
|
|
2324
|
+
* text: 'button',
|
|
2325
|
+
* colors: [ 'red', 'black', 'red' ],
|
|
2326
|
+
* bndbox: BoundingBox {
|
|
2327
|
+
* xmin: 900,
|
|
2328
|
+
* ymin: 910,
|
|
2329
|
+
* xmax: 920,
|
|
2330
|
+
* ymax: 930
|
|
2331
|
+
* }
|
|
2332
|
+
* }
|
|
2333
|
+
* ]
|
|
2334
|
+
* ```
|
|
2335
|
+
*
|
|
2336
|
+
* @return {FluentFiltersGetter}
|
|
2337
|
+
*/
|
|
2338
|
+
or(): FluentFiltersGetter;
|
|
2339
|
+
/**
|
|
2340
|
+
* Logic and operator
|
|
2341
|
+
*
|
|
2342
|
+
* **Examples:**
|
|
2343
|
+
* ```text
|
|
2344
|
+
* example scene:
|
|
2345
|
+
* -------------------------- --------------------------
|
|
2346
|
+
* | icon user colored black | | icon user colored red |
|
|
2347
|
+
* -------------------------- --------------------------
|
|
2348
|
+
* ```
|
|
2349
|
+
* ```typescript
|
|
2350
|
+
* const icons = await aui.get().icon().withText('user').exec();
|
|
2351
|
+
* console.log(icons);
|
|
2352
|
+
* ```
|
|
2353
|
+
* Using only the filter withText, the get command will return both icons because they share the same text
|
|
2354
|
+
* ```text
|
|
2355
|
+
* console output: [
|
|
2356
|
+
* DetectedElement {
|
|
2357
|
+
* name: 'ICON',
|
|
2358
|
+
* text: 'user',
|
|
2359
|
+
* colors: [ 'black', 'black', 'black' ],
|
|
2360
|
+
* bndbox: BoundingBox {
|
|
2361
|
+
* xmin: 1000,
|
|
2362
|
+
* ymin: 1010,
|
|
2363
|
+
* xmax: 1020,
|
|
2364
|
+
* ymax: 1030
|
|
2365
|
+
* }
|
|
2366
|
+
* },
|
|
2367
|
+
* DetectedElement {
|
|
2368
|
+
* name: 'ICON',
|
|
2369
|
+
* text: 'user',
|
|
2370
|
+
* colors: [ 'red', 'red', 'red' ],
|
|
2371
|
+
* bndbox: BoundingBox {
|
|
2372
|
+
* xmin: 900,
|
|
2373
|
+
* ymin: 910,
|
|
2374
|
+
* xmax: 920,
|
|
2375
|
+
* ymax: 930
|
|
2376
|
+
* }
|
|
2377
|
+
* }
|
|
2378
|
+
* ]
|
|
2379
|
+
* ```
|
|
2380
|
+
* You can combine filters with **the `and()` relation** and specify exactly which icon you want
|
|
2381
|
+
* ```typescript
|
|
2382
|
+
* const icons = await aui.get().icon().withText('user').and().colored('red').exec()
|
|
2383
|
+
* console.log(icons)
|
|
2384
|
+
* ```
|
|
2385
|
+
* The get command returns only the red icon although both icons have the same text
|
|
2386
|
+
* ```text
|
|
2387
|
+
* console output: [
|
|
2388
|
+
* DetectedElement {
|
|
2389
|
+
* name: 'ICON',
|
|
2390
|
+
* text: 'user',
|
|
2391
|
+
* colors: [ 'red', 'red', 'red' ],
|
|
2392
|
+
* bndbox: BoundingBox {
|
|
2393
|
+
* xmin: 900,
|
|
2394
|
+
* ymin: 910,
|
|
2395
|
+
* xmax: 920,
|
|
2396
|
+
* ymax: 930
|
|
2397
|
+
* }
|
|
2398
|
+
* }
|
|
2399
|
+
* ]
|
|
2400
|
+
* ```
|
|
2401
|
+
*
|
|
2402
|
+
* @return {FluentFiltersGetter}
|
|
2403
|
+
*/
|
|
2404
|
+
and(): FluentFiltersGetter;
|
|
2081
2405
|
/**
|
|
2082
2406
|
* Filters for an element inside another element.
|
|
2083
2407
|
*
|
|
@@ -2234,13 +2558,74 @@ export declare class FluentFiltersOrRelationsGetter extends FluentFiltersGetter
|
|
|
2234
2558
|
}
|
|
2235
2559
|
export declare abstract class Getter extends FluentCommand {
|
|
2236
2560
|
/**
|
|
2237
|
-
* Returns
|
|
2561
|
+
* Returns an array with all filtered elements.
|
|
2562
|
+
* A detected element has the following properties:
|
|
2563
|
+
* - `name` of the element
|
|
2564
|
+
* - `text` content of element
|
|
2565
|
+
* - `colors` of element
|
|
2566
|
+
* - `bndbox`: location of element described with coordinates of a bounding box
|
|
2567
|
+
* **Examples:**
|
|
2568
|
+
* ```typescript
|
|
2569
|
+
* const text = await aui.get().text().withText('Sign').exec();
|
|
2570
|
+
* console.log(text);
|
|
2571
|
+
* ```
|
|
2572
|
+
* ```text
|
|
2573
|
+
* console output: [
|
|
2574
|
+
* DetectedElement {
|
|
2575
|
+
* name: 'TEXT',
|
|
2576
|
+
* text: 'Sign In',
|
|
2577
|
+
* colors: [ 'black', 'gray', 'gray' ],
|
|
2578
|
+
* bndbox: BoundingBox {
|
|
2579
|
+
* xmin: 1128.2720982142857,
|
|
2580
|
+
* ymin: 160.21332310267857,
|
|
2581
|
+
* xmax: 1178.8204241071428,
|
|
2582
|
+
* ymax: 180.83512834821428
|
|
2583
|
+
* }
|
|
2584
|
+
* }
|
|
2585
|
+
* ]
|
|
2586
|
+
* ```
|
|
2238
2587
|
*
|
|
2239
2588
|
* @return {FluentFiltersGetter}
|
|
2240
2589
|
*/
|
|
2241
2590
|
get(): FluentFiltersGetter;
|
|
2242
2591
|
/**
|
|
2243
|
-
* Returns all detected elements
|
|
2592
|
+
* Returns an array with all detected elements.
|
|
2593
|
+
* A detected element has the following properties:
|
|
2594
|
+
* - `name` of the element
|
|
2595
|
+
* - `text` content of element
|
|
2596
|
+
* - `colors` of element
|
|
2597
|
+
* - `bndbox`: location of element described with coordinates of a bounding box
|
|
2598
|
+
* **Examples:**
|
|
2599
|
+
* ```typescript
|
|
2600
|
+
* const detectedElements = await aui.getAll().exec();
|
|
2601
|
+
* console.log(detectedElements);
|
|
2602
|
+
* ```
|
|
2603
|
+
* ```text
|
|
2604
|
+
* console output: [
|
|
2605
|
+
* DetectedElement {
|
|
2606
|
+
* name: 'TEXT',
|
|
2607
|
+
* text: 'Sign In',
|
|
2608
|
+
* colors: [ 'black', 'gray', 'gray' ],
|
|
2609
|
+
* bndbox: BoundingBox {
|
|
2610
|
+
* xmin: 1128.2720982142857,
|
|
2611
|
+
* ymin: 160.21332310267857,
|
|
2612
|
+
* xmax: 1178.8204241071428,
|
|
2613
|
+
* ymax: 180.83512834821428
|
|
2614
|
+
* },
|
|
2615
|
+
* DetectedElement {
|
|
2616
|
+
* name: 'ICON',
|
|
2617
|
+
* text: 'search',
|
|
2618
|
+
* colors: [ 'black', 'red', 'gray' ],
|
|
2619
|
+
* bndbox: BoundingBox {
|
|
2620
|
+
* xmin: 250.8204241071428,
|
|
2621
|
+
* ymin: 300.21332310267857,
|
|
2622
|
+
* xmax: 450.6304241071428,
|
|
2623
|
+
* ymax: 950.47812834821428
|
|
2624
|
+
* },
|
|
2625
|
+
* ... 381 more items
|
|
2626
|
+
* }
|
|
2627
|
+
* ]
|
|
2628
|
+
* ```
|
|
2244
2629
|
*
|
|
2245
2630
|
* @return {ExecGetter}
|
|
2246
2631
|
*/
|