askui 0.11.6 → 0.12.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/model/annotation-result/detected-element.d.ts +2 -1
- package/dist/cjs/core/model/annotation-result/detected-element.js +3 -2
- package/dist/cjs/core/reporting/default-step.js +4 -3
- package/dist/cjs/core/reporting/index.d.ts +0 -1
- package/dist/cjs/core/reporting/index.js +0 -1
- package/dist/cjs/core/reporting/snapshot-detail-level.d.ts +1 -0
- package/dist/cjs/core/reporting/snapshot-detail-level.js +8 -0
- package/dist/cjs/core/reporting/step-reporter.d.ts +7 -6
- package/dist/cjs/core/reporting/step-reporter.js +49 -34
- package/dist/cjs/execution/dsl.d.ts +3 -3
- package/dist/cjs/execution/dsl.js +12 -3
- package/dist/cjs/execution/ui-control-client-dependency-builder.d.ts +0 -1
- package/dist/cjs/execution/ui-control-client-dependency-builder.js +1 -13
- package/dist/cjs/execution/ui-controller-client-interface.d.ts +4 -6
- package/dist/esm/core/model/annotation-result/detected-element.d.ts +2 -1
- package/dist/esm/core/model/annotation-result/detected-element.js +3 -2
- package/dist/esm/core/reporting/default-step.js +4 -3
- package/dist/esm/core/reporting/index.d.ts +0 -1
- package/dist/esm/core/reporting/index.js +0 -1
- package/dist/esm/core/reporting/snapshot-detail-level.d.ts +1 -0
- package/dist/esm/core/reporting/snapshot-detail-level.js +6 -1
- package/dist/esm/core/reporting/step-reporter.d.ts +7 -6
- package/dist/esm/core/reporting/step-reporter.js +49 -34
- package/dist/esm/execution/dsl.d.ts +3 -3
- package/dist/esm/execution/dsl.js +12 -3
- package/dist/esm/execution/ui-control-client-dependency-builder.d.ts +0 -1
- package/dist/esm/execution/ui-control-client-dependency-builder.js +2 -14
- package/dist/esm/execution/ui-controller-client-interface.d.ts +4 -6
- package/package.json +3 -1
- package/dist/cjs/core/model/test-case-dto/custom-element-json.d.ts +0 -75
- package/dist/cjs/core/model/test-case-dto/custom-element-json.js +0 -2
- package/dist/cjs/core/model/test-case-dto/custom-element.d.ts +0 -21
- package/dist/cjs/core/model/test-case-dto/custom-element.js +0 -54
- package/dist/cjs/core/model/test-case-dto/index.d.ts +0 -3
- package/dist/cjs/core/model/test-case-dto/index.js +0 -5
- package/dist/cjs/core/model/test-case-dto/test-step.d.ts +0 -6
- package/dist/cjs/core/model/test-case-dto/test-step.js +0 -2
- package/dist/cjs/core/model/test-case-result-dto/index.d.ts +0 -2
- package/dist/cjs/core/model/test-case-result-dto/index.js +0 -7
- package/dist/cjs/core/model/test-case-result-dto/test-step-result-dto.d.ts +0 -9
- package/dist/cjs/core/model/test-case-result-dto/test-step-result-dto.js +0 -16
- package/dist/cjs/core/model/test-case-result-dto/test-step-state.d.ts +0 -4
- package/dist/cjs/core/model/test-case-result-dto/test-step-state.js +0 -8
- package/dist/cjs/core/reporting/default-reporter.d.ts +0 -10
- package/dist/cjs/core/reporting/default-reporter.js +0 -12
- package/dist/cjs/execution/annotation-level.d.ts +0 -5
- package/dist/cjs/execution/annotation-level.js +0 -9
- package/dist/cjs/execution/reporter.d.ts +0 -132
- package/dist/cjs/execution/reporter.js +0 -146
- package/dist/cjs/execution/ui-control-client-error.d.ts +0 -2
- package/dist/cjs/execution/ui-control-client-error.js +0 -6
- package/dist/esm/core/model/test-case-dto/custom-element-json.d.ts +0 -75
- package/dist/esm/core/model/test-case-dto/custom-element-json.js +0 -1
- package/dist/esm/core/model/test-case-dto/custom-element.d.ts +0 -21
- package/dist/esm/core/model/test-case-dto/custom-element.js +0 -50
- package/dist/esm/core/model/test-case-dto/index.d.ts +0 -3
- package/dist/esm/core/model/test-case-dto/index.js +0 -1
- package/dist/esm/core/model/test-case-dto/test-step.d.ts +0 -6
- package/dist/esm/core/model/test-case-dto/test-step.js +0 -1
- package/dist/esm/core/model/test-case-result-dto/index.d.ts +0 -2
- package/dist/esm/core/model/test-case-result-dto/index.js +0 -2
- package/dist/esm/core/model/test-case-result-dto/test-step-result-dto.d.ts +0 -9
- package/dist/esm/core/model/test-case-result-dto/test-step-result-dto.js +0 -12
- package/dist/esm/core/model/test-case-result-dto/test-step-state.d.ts +0 -4
- package/dist/esm/core/model/test-case-result-dto/test-step-state.js +0 -5
- package/dist/esm/core/reporting/default-reporter.d.ts +0 -10
- package/dist/esm/core/reporting/default-reporter.js +0 -9
- package/dist/esm/execution/annotation-level.d.ts +0 -5
- package/dist/esm/execution/annotation-level.js +0 -6
- package/dist/esm/execution/reporter.d.ts +0 -132
- package/dist/esm/execution/reporter.js +0 -142
- package/dist/esm/execution/ui-control-client-error.d.ts +0 -3
- package/dist/esm/execution/ui-control-client-error.js +0 -6
|
@@ -351,11 +351,14 @@ export class FluentFilters extends FluentBase {
|
|
|
351
351
|
*
|
|
352
352
|
* @return {FluentFiltersOrRelations}
|
|
353
353
|
*/
|
|
354
|
-
withText(text) {
|
|
354
|
+
withText(text, similarityScore = 70) {
|
|
355
355
|
this._textStr = '';
|
|
356
356
|
this._textStr += 'with';
|
|
357
357
|
this._textStr += ' text';
|
|
358
358
|
this._textStr += ` ${Separators.STRING}${text}${Separators.STRING}`;
|
|
359
|
+
if (similarityScore !== undefined) {
|
|
360
|
+
this._textStr += ` that matches to ${similarityScore} %`;
|
|
361
|
+
}
|
|
359
362
|
return new FluentFiltersOrRelations(this);
|
|
360
363
|
}
|
|
361
364
|
/**
|
|
@@ -1069,11 +1072,14 @@ export class FluentFiltersCondition extends FluentBase {
|
|
|
1069
1072
|
*
|
|
1070
1073
|
* @return {FluentFiltersOrRelationsCondition}
|
|
1071
1074
|
*/
|
|
1072
|
-
withText(text) {
|
|
1075
|
+
withText(text, similarityScore = 70) {
|
|
1073
1076
|
this._textStr = '';
|
|
1074
1077
|
this._textStr += 'with';
|
|
1075
1078
|
this._textStr += ' text';
|
|
1076
1079
|
this._textStr += ` ${Separators.STRING}${text}${Separators.STRING}`;
|
|
1080
|
+
if (similarityScore !== undefined) {
|
|
1081
|
+
this._textStr += ` that matches to ${similarityScore} %`;
|
|
1082
|
+
}
|
|
1077
1083
|
return new FluentFiltersOrRelationsCondition(this);
|
|
1078
1084
|
}
|
|
1079
1085
|
/**
|
|
@@ -2408,11 +2414,14 @@ export class FluentFiltersGetter extends FluentBase {
|
|
|
2408
2414
|
*
|
|
2409
2415
|
* @return {FluentFiltersOrRelationsGetter}
|
|
2410
2416
|
*/
|
|
2411
|
-
withText(text) {
|
|
2417
|
+
withText(text, similarityScore = 70) {
|
|
2412
2418
|
this._textStr = '';
|
|
2413
2419
|
this._textStr += 'with';
|
|
2414
2420
|
this._textStr += ' text';
|
|
2415
2421
|
this._textStr += ` ${Separators.STRING}${text}${Separators.STRING}`;
|
|
2422
|
+
if (similarityScore !== undefined) {
|
|
2423
|
+
this._textStr += ` that matches to ${similarityScore} %`;
|
|
2424
|
+
}
|
|
2416
2425
|
return new FluentFiltersOrRelationsGetter(this);
|
|
2417
2426
|
}
|
|
2418
2427
|
/**
|
|
@@ -14,7 +14,7 @@ import { envCredentials } from './read-environment-credentials';
|
|
|
14
14
|
import { Analytics } from '../utils/analytics';
|
|
15
15
|
import { envProxyAgents } from '../utils/proxy/proxy-builder';
|
|
16
16
|
import { ExecutionRuntime } from './execution-runtime';
|
|
17
|
-
import {
|
|
17
|
+
import { StepReporter } from '../core/reporting';
|
|
18
18
|
export class UiControlClientDependencyBuilder {
|
|
19
19
|
static buildHttpClient(clientArgs) {
|
|
20
20
|
var _a;
|
|
@@ -46,22 +46,10 @@ export class UiControlClientDependencyBuilder {
|
|
|
46
46
|
};
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
|
-
static buildReporter(reporterArg) {
|
|
50
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
51
|
-
return {
|
|
52
|
-
config: {
|
|
53
|
-
withScreenshots: (_b = (_a = reporterArg === null || reporterArg === void 0 ? void 0 : reporterArg.config) === null || _a === void 0 ? void 0 : _a.withScreenshots) !== null && _b !== void 0 ? _b : DEFAULT_REPORTER.config.withScreenshots,
|
|
54
|
-
withDetectedElements: (_d = (_c = reporterArg === null || reporterArg === void 0 ? void 0 : reporterArg.config) === null || _c === void 0 ? void 0 : _c.withDetectedElements) !== null && _d !== void 0 ? _d : DEFAULT_REPORTER.config.withDetectedElements,
|
|
55
|
-
},
|
|
56
|
-
onStepBegin: (_f = (_e = reporterArg === null || reporterArg === void 0 ? void 0 : reporterArg.onStepBegin) === null || _e === void 0 ? void 0 : _e.bind(reporterArg)) !== null && _f !== void 0 ? _f : DEFAULT_REPORTER.onStepBegin.bind(DEFAULT_REPORTER),
|
|
57
|
-
onStepRetry: (_h = (_g = reporterArg === null || reporterArg === void 0 ? void 0 : reporterArg.onStepRetry) === null || _g === void 0 ? void 0 : _g.bind(reporterArg)) !== null && _h !== void 0 ? _h : DEFAULT_REPORTER.onStepRetry.bind(DEFAULT_REPORTER),
|
|
58
|
-
onStepEnd: (_k = (_j = reporterArg === null || reporterArg === void 0 ? void 0 : reporterArg.onStepEnd) === null || _j === void 0 ? void 0 : _j.bind(reporterArg)) !== null && _k !== void 0 ? _k : DEFAULT_REPORTER.onStepEnd.bind(DEFAULT_REPORTER),
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
49
|
static getClientArgsWithDefaults(clientArgs) {
|
|
62
50
|
var _a, _b, _c, _d;
|
|
63
51
|
return __awaiter(this, void 0, void 0, function* () {
|
|
64
|
-
return Object.assign(Object.assign({}, clientArgs), { uiControllerUrl: (_a = clientArgs.uiControllerUrl) !== null && _a !== void 0 ? _a : 'http://127.0.0.1:6769', inferenceServerUrl: (_b = clientArgs.inferenceServerUrl) !== null && _b !== void 0 ? _b : 'https://inference.askui.com', credentials: (_c = clientArgs.credentials) !== null && _c !== void 0 ? _c : envCredentials(), proxyAgents: (_d = clientArgs.proxyAgents) !== null && _d !== void 0 ? _d : yield envProxyAgents()
|
|
52
|
+
return Object.assign(Object.assign({}, clientArgs), { uiControllerUrl: (_a = clientArgs.uiControllerUrl) !== null && _a !== void 0 ? _a : 'http://127.0.0.1:6769', inferenceServerUrl: (_b = clientArgs.inferenceServerUrl) !== null && _b !== void 0 ? _b : 'https://inference.askui.com', credentials: (_c = clientArgs.credentials) !== null && _c !== void 0 ? _c : envCredentials(), proxyAgents: (_d = clientArgs.proxyAgents) !== null && _d !== void 0 ? _d : yield envProxyAgents() });
|
|
65
53
|
});
|
|
66
54
|
}
|
|
67
55
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CredentialArgs } from './credentials-args';
|
|
2
2
|
import { ProxyAgentArgs } from '../shared/proxy-agent-args';
|
|
3
3
|
import { ModelCompositionBranch } from './model-composition-branch';
|
|
4
|
-
import { Reporter
|
|
4
|
+
import { Reporter } from '../core/reporting';
|
|
5
5
|
/**
|
|
6
6
|
* Configuration options for the askui UI Control Client
|
|
7
7
|
*
|
|
@@ -21,7 +21,8 @@ import { Reporter, ReporterConfig } from '../core/reporting';
|
|
|
21
21
|
* the authentication of the askui Inference Server.
|
|
22
22
|
* You have three options: `DISABLED`, `ON_FAILURE`, `ALL`.
|
|
23
23
|
* @param {ProxyAgentArgs} proxyAgents - To configure the proxy agents for http(s) requests.
|
|
24
|
-
* @param {Reporter} reporter - To configure the reporter
|
|
24
|
+
* @param {Reporter | Reporter[]} reporter - To configure the reporter(s)
|
|
25
|
+
* to report on step runs/executions.
|
|
25
26
|
*/
|
|
26
27
|
export interface ClientArgs {
|
|
27
28
|
readonly uiControllerUrl?: string;
|
|
@@ -30,12 +31,9 @@ export interface ClientArgs {
|
|
|
30
31
|
readonly proxyAgents?: ProxyAgentArgs | undefined;
|
|
31
32
|
readonly resize?: number;
|
|
32
33
|
readonly modelComposition?: ModelCompositionBranch[];
|
|
33
|
-
readonly reporter?: Reporter | undefined;
|
|
34
|
+
readonly reporter?: Reporter | Reporter[] | undefined;
|
|
34
35
|
}
|
|
35
36
|
export interface ClientArgsWithDefaults extends ClientArgs {
|
|
36
37
|
readonly uiControllerUrl: string;
|
|
37
38
|
readonly inferenceServerUrl: string;
|
|
38
|
-
readonly reporter: Required<Reporter> & {
|
|
39
|
-
config: Required<ReporterConfig>;
|
|
40
|
-
};
|
|
41
39
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "askui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.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",
|
|
@@ -54,6 +54,7 @@
|
|
|
54
54
|
"fs-extra": "10.0.0",
|
|
55
55
|
"got": "11.8.6",
|
|
56
56
|
"jsdom": "20.0.0",
|
|
57
|
+
"lodash": "^4.17.21",
|
|
57
58
|
"node-machine-id": "1.1.12",
|
|
58
59
|
"pino": "7.8.1",
|
|
59
60
|
"pino-pretty": "7.5.3",
|
|
@@ -75,6 +76,7 @@
|
|
|
75
76
|
"@types/ws": "7.4.4",
|
|
76
77
|
"hpagent": "^1.2.0",
|
|
77
78
|
"jest": "28.1.1",
|
|
79
|
+
"jest-extended": "^4.0.1",
|
|
78
80
|
"proxy": "^1.0.2",
|
|
79
81
|
"proxy-agent": "^5.0.0",
|
|
80
82
|
"sharp": "0.30.6",
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Defines a 'custom element'. This is a UI element which is defined by
|
|
3
|
-
* providing an image and other parameters such as degree of rotation.
|
|
4
|
-
* It allows filtering for a UI element that is not recognized
|
|
5
|
-
* by our machine learning models by default.
|
|
6
|
-
* It can also be used for pixel assertions of elements using classical
|
|
7
|
-
* [template matching](https://en.wikipedia.org/wiki/Template_matching).
|
|
8
|
-
*
|
|
9
|
-
* **Important:** The `CustomElementJson` needs to capture as accurately as possible
|
|
10
|
-
* what the custom element looks like during test execution as otherwise
|
|
11
|
-
* our machine learning models cannot find it, even with the additional data
|
|
12
|
-
* provided. This is especially true for the resolution used while cropping
|
|
13
|
-
* the `CustomElementJson.customImage` which should match the resolution during
|
|
14
|
-
* test execution.
|
|
15
|
-
*
|
|
16
|
-
* Rotated custom elements can be filtered for using
|
|
17
|
-
* `CustomElementJson.rotationDegreePerStep`.
|
|
18
|
-
*/
|
|
19
|
-
export interface CustomElementJson {
|
|
20
|
-
/**
|
|
21
|
-
* An cropped image in form of a base64 string or file path,
|
|
22
|
-
* e.g., "./custom.png".
|
|
23
|
-
*/
|
|
24
|
-
customImage: string;
|
|
25
|
-
/**
|
|
26
|
-
* A unique name which can be used for filtering for the custom element,
|
|
27
|
-
* e.g.,
|
|
28
|
-
* ```typescript
|
|
29
|
-
* ...customElement({
|
|
30
|
-
* name: 'unique-name',
|
|
31
|
-
* // ... (rest of the custom element)
|
|
32
|
-
* }).withText('unique-name')
|
|
33
|
-
* ```
|
|
34
|
-
*
|
|
35
|
-
* If not set, the text inside the custom element is
|
|
36
|
-
* detected via
|
|
37
|
-
* [OCR](https://en.wikipedia.org/wiki/Optical_character_recognition).
|
|
38
|
-
* It can also be used for filtering for the custom element.
|
|
39
|
-
*/
|
|
40
|
-
name?: string | undefined;
|
|
41
|
-
/**
|
|
42
|
-
* A threshold for how similar UI elements shown during test execution
|
|
43
|
-
* need to be to the custom element as defined by the other fields in
|
|
44
|
-
* `CustomElementJson` to be recognized as such. Takes values between
|
|
45
|
-
* `0.0` (= all elements are recognized as the custom element which is
|
|
46
|
-
* probably not what you want) and `1.0` (= elements need to look exactly
|
|
47
|
-
* like defined by `CustomElementJson` which is unlikely to be achieved
|
|
48
|
-
* as even minor differences count). Defaults to `0.9`.
|
|
49
|
-
*/
|
|
50
|
-
threshold?: number | undefined;
|
|
51
|
-
/**
|
|
52
|
-
* A step size in rotation degree. Rotates the custom image by
|
|
53
|
-
* `rotationDegreePerStep` until 360° is exceeded. Range is between
|
|
54
|
-
* 0° - 360°. Defaults to 0°.
|
|
55
|
-
*
|
|
56
|
-
* **Important**: This increases the prediction time quite a bit. So only use
|
|
57
|
-
* it when absolutely necessary.
|
|
58
|
-
*/
|
|
59
|
-
rotationDegreePerStep?: number | undefined;
|
|
60
|
-
/**
|
|
61
|
-
* A color compare style. Allows matching a custom element by color, e.g.,
|
|
62
|
-
* instead of filtering for all icons (blue and green ones),
|
|
63
|
-
* only the green ones captured by `customImage` are filtered for using 'RGB'.
|
|
64
|
-
* Defaults to 'grayscale'.
|
|
65
|
-
*
|
|
66
|
-
* **Important**: This increases the prediction time quite a bit. So only use
|
|
67
|
-
* it when absolutely necessary.
|
|
68
|
-
*/
|
|
69
|
-
imageCompareFormat?: 'RGB' | 'grayscale' | undefined;
|
|
70
|
-
/** A polygon to match only a certain area of the custom element. */
|
|
71
|
-
mask?: ({
|
|
72
|
-
x: number;
|
|
73
|
-
y: number;
|
|
74
|
-
})[] | undefined;
|
|
75
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { CustomElementJson } from './custom-element-json';
|
|
2
|
-
export declare class CustomElement implements CustomElementJson {
|
|
3
|
-
customImage: string;
|
|
4
|
-
name?: string | undefined;
|
|
5
|
-
threshold?: number | undefined;
|
|
6
|
-
rotationDegreePerStep?: number | undefined;
|
|
7
|
-
imageCompareFormat?: "RGB" | "grayscale" | undefined;
|
|
8
|
-
mask?: {
|
|
9
|
-
x: number;
|
|
10
|
-
y: number;
|
|
11
|
-
}[] | undefined;
|
|
12
|
-
private static schema;
|
|
13
|
-
constructor(customImage: string, name?: string | undefined, threshold?: number | undefined, rotationDegreePerStep?: number | undefined, imageCompareFormat?: "RGB" | "grayscale" | undefined, mask?: {
|
|
14
|
-
x: number;
|
|
15
|
-
y: number;
|
|
16
|
-
}[] | undefined);
|
|
17
|
-
static fromJsonListWithImagePathOrImage(ceJson?: CustomElementJson[]): Promise<CustomElement[]>;
|
|
18
|
-
static fromJsonWithImagePathOrImage(ceJson: CustomElementJson): Promise<CustomElement>;
|
|
19
|
-
static fromJson(ceJson: CustomElementJson): CustomElement;
|
|
20
|
-
validate(): void;
|
|
21
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
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.CustomElement = void 0;
|
|
13
|
-
const yup_1 = require("yup");
|
|
14
|
-
const base_64_image_1 = require("../../../utils/base_64_image/base-64-image");
|
|
15
|
-
class CustomElement {
|
|
16
|
-
constructor(customImage, name, threshold, rotationDegreePerStep, imageCompareFormat, mask) {
|
|
17
|
-
this.customImage = customImage;
|
|
18
|
-
this.name = name;
|
|
19
|
-
this.threshold = threshold;
|
|
20
|
-
this.rotationDegreePerStep = rotationDegreePerStep;
|
|
21
|
-
this.imageCompareFormat = imageCompareFormat;
|
|
22
|
-
this.mask = mask;
|
|
23
|
-
}
|
|
24
|
-
static fromJsonListWithImagePathOrImage(ceJson = []) {
|
|
25
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
-
return Promise.all(ceJson.map((customElement) => CustomElement.fromJsonWithImagePathOrImage(customElement)));
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
static fromJsonWithImagePathOrImage(ceJson) {
|
|
30
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
31
|
-
const customImage = (yield base_64_image_1.Base64Image.fromPathOrString(ceJson.customImage)).toString();
|
|
32
|
-
const customElement = CustomElement.fromJson(Object.assign(Object.assign({}, ceJson), { customImage }));
|
|
33
|
-
customElement.validate();
|
|
34
|
-
return customElement;
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
static fromJson(ceJson) {
|
|
38
|
-
return new CustomElement(ceJson.customImage, ceJson.name, ceJson.threshold, ceJson.rotationDegreePerStep, ceJson.imageCompareFormat, ceJson.mask);
|
|
39
|
-
}
|
|
40
|
-
validate() {
|
|
41
|
-
try {
|
|
42
|
-
CustomElement.schema.validateSync(this, { abortEarly: false, strict: true });
|
|
43
|
-
}
|
|
44
|
-
catch (e) { // ValidationError
|
|
45
|
-
throw new yup_1.ValidationError(e.errors.join(', '));
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
exports.CustomElement = CustomElement;
|
|
50
|
-
CustomElement.schema = (0, yup_1.object)({
|
|
51
|
-
threshold: (0, yup_1.number)().optional().min(0).max(1),
|
|
52
|
-
rotationDegreePerStep: (0, yup_1.number)().optional().min(0).lessThan(360),
|
|
53
|
-
mask: (0, yup_1.array)().optional().min(3, 'mask must contain at least 3 points'),
|
|
54
|
-
});
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CustomElement = void 0;
|
|
4
|
-
var custom_element_1 = require("./custom-element");
|
|
5
|
-
Object.defineProperty(exports, "CustomElement", { enumerable: true, get: function () { return custom_element_1.CustomElement; } });
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TestStepState = exports.TestStepResultDto = void 0;
|
|
4
|
-
var test_step_result_dto_1 = require("./test-step-result-dto");
|
|
5
|
-
Object.defineProperty(exports, "TestStepResultDto", { enumerable: true, get: function () { return test_step_result_dto_1.TestStepResultDto; } });
|
|
6
|
-
var test_step_state_1 = require("./test-step-state");
|
|
7
|
-
Object.defineProperty(exports, "TestStepState", { enumerable: true, get: function () { return test_step_state_1.TestStepState; } });
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { TestStepState } from './test-step-state';
|
|
2
|
-
export declare class TestStepResultDto {
|
|
3
|
-
state: TestStepState;
|
|
4
|
-
comment: string;
|
|
5
|
-
createDate: Date;
|
|
6
|
-
updateDate: Date;
|
|
7
|
-
constructor(state: TestStepState, comment?: string, createDate?: Date, updateDate?: Date);
|
|
8
|
-
static fromJson(testStepResult: TestStepResultDto): TestStepResultDto;
|
|
9
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TestStepResultDto = void 0;
|
|
4
|
-
const test_step_state_1 = require("./test-step-state");
|
|
5
|
-
class TestStepResultDto {
|
|
6
|
-
constructor(state, comment = '', createDate = new Date(), updateDate = new Date()) {
|
|
7
|
-
this.state = state;
|
|
8
|
-
this.comment = comment;
|
|
9
|
-
this.createDate = createDate;
|
|
10
|
-
this.updateDate = updateDate;
|
|
11
|
-
}
|
|
12
|
-
static fromJson(testStepResult) {
|
|
13
|
-
return new TestStepResultDto(test_step_state_1.TestStepState[testStepResult.state], testStepResult.comment, new Date(testStepResult.createDate), new Date(testStepResult.updateDate));
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
exports.TestStepResultDto = TestStepResultDto;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TestStepState = void 0;
|
|
4
|
-
var TestStepState;
|
|
5
|
-
(function (TestStepState) {
|
|
6
|
-
TestStepState["PASSED"] = "PASSED";
|
|
7
|
-
TestStepState["FAILED"] = "FAILED";
|
|
8
|
-
})(TestStepState = exports.TestStepState || (exports.TestStepState = {}));
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Step } from './step';
|
|
2
|
-
export declare const DEFAULT_REPORTER: {
|
|
3
|
-
config: {
|
|
4
|
-
readonly withScreenshots: "onFailure";
|
|
5
|
-
readonly withDetectedElements: "onFailure";
|
|
6
|
-
};
|
|
7
|
-
onStepBegin: (_step: Step) => Promise<void>;
|
|
8
|
-
onStepRetry: (_step: Step) => Promise<void>;
|
|
9
|
-
onStepEnd: (_step: Step) => Promise<void>;
|
|
10
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DEFAULT_REPORTER = void 0;
|
|
4
|
-
exports.DEFAULT_REPORTER = {
|
|
5
|
-
config: {
|
|
6
|
-
withScreenshots: 'onFailure',
|
|
7
|
-
withDetectedElements: 'onFailure',
|
|
8
|
-
},
|
|
9
|
-
onStepBegin: (_step) => Promise.resolve(),
|
|
10
|
-
onStepRetry: (_step) => Promise.resolve(),
|
|
11
|
-
onStepEnd: (_step) => Promise.resolve(),
|
|
12
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AnnotationLevel = void 0;
|
|
4
|
-
var AnnotationLevel;
|
|
5
|
-
(function (AnnotationLevel) {
|
|
6
|
-
AnnotationLevel["DISABLED"] = "disabled";
|
|
7
|
-
AnnotationLevel["ON_FAILURE"] = "onFailure";
|
|
8
|
-
AnnotationLevel["ALL"] = "all";
|
|
9
|
-
})(AnnotationLevel = exports.AnnotationLevel || (exports.AnnotationLevel = {}));
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
import { DetectedElement } from "@/core/model/annotation-result/detected-element";
|
|
2
|
-
import { CustomElement } from "@/core/model/custom-element";
|
|
3
|
-
export interface Snapshot {
|
|
4
|
-
readonly createdAt: Date;
|
|
5
|
-
readonly screenshot?: string | undefined;
|
|
6
|
-
readonly detectedElements?: Readonly<Readonly<DetectedElement>>[] | undefined;
|
|
7
|
-
}
|
|
8
|
-
export interface Instruction {
|
|
9
|
-
readonly value: string;
|
|
10
|
-
readonly valueHumanReadable: string;
|
|
11
|
-
readonly customElements?: Readonly<Readonly<CustomElement>>[];
|
|
12
|
-
readonly secretText?: string | undefined;
|
|
13
|
-
}
|
|
14
|
-
export interface Step {
|
|
15
|
-
readonly instruction: Readonly<Instruction>;
|
|
16
|
-
readonly status: StepStatus;
|
|
17
|
-
/**
|
|
18
|
-
* A snapshot of the state of the screen before the step is ran which is nearly immediately after the call to `.exec()`
|
|
19
|
-
*/
|
|
20
|
-
readonly begin?: Snapshot | undefined;
|
|
21
|
-
/**
|
|
22
|
-
* The duration of the step in milliseconds based on the start and end time. If the step is still running, this property is undefined.
|
|
23
|
-
*/
|
|
24
|
-
readonly duration?: number | undefined;
|
|
25
|
-
/**
|
|
26
|
-
* A snapshot of the state of the screen after the step has been run. If the step is still running or still pending, this property is undefined.
|
|
27
|
-
*/
|
|
28
|
-
readonly end?: Snapshot | undefined;
|
|
29
|
-
/**
|
|
30
|
-
* When a step failed or is erroneous, this property contains the error.
|
|
31
|
-
*/
|
|
32
|
-
readonly error?: Error | undefined;
|
|
33
|
-
readonly runs: Readonly<StepRun[]>;
|
|
34
|
-
readonly retries: Readonly<StepRun[]>;
|
|
35
|
-
readonly retryCount: number;
|
|
36
|
-
readonly firstRun?: StepRun | undefined;
|
|
37
|
-
readonly lastRun?: StepRun | undefined;
|
|
38
|
-
/**
|
|
39
|
-
* retryCount > 0.
|
|
40
|
-
*/
|
|
41
|
-
readonly flaky: boolean;
|
|
42
|
-
}
|
|
43
|
-
export interface StepRun {
|
|
44
|
-
readonly status: StepStatus;
|
|
45
|
-
readonly begin?: Snapshot | undefined;
|
|
46
|
-
readonly end?: Snapshot | undefined;
|
|
47
|
-
readonly duration?: number | undefined;
|
|
48
|
-
readonly error?: Error | undefined;
|
|
49
|
-
}
|
|
50
|
-
declare class askuiStep implements Step {
|
|
51
|
-
instruction: Instruction;
|
|
52
|
-
runs: Readonly<StepRun[]>;
|
|
53
|
-
constructor(instruction: Instruction);
|
|
54
|
-
get status(): StepStatus;
|
|
55
|
-
get begin(): Snapshot | undefined;
|
|
56
|
-
get end(): Snapshot | undefined;
|
|
57
|
-
get error(): Error | undefined;
|
|
58
|
-
get retries(): StepRun[];
|
|
59
|
-
get retryCount(): number;
|
|
60
|
-
get firstRun(): StepRun | undefined;
|
|
61
|
-
get lastRun(): StepRun | undefined;
|
|
62
|
-
get flaky(): boolean;
|
|
63
|
-
get duration(): number | undefined;
|
|
64
|
-
onBegin(snapshot: Snapshot): askuiStep;
|
|
65
|
-
onRetry(snapshot: Snapshot, error: Error): askuiStep;
|
|
66
|
-
onEnd(snapshot: Snapshot, error?: Error): askuiStep;
|
|
67
|
-
private determineLastRunStatus;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* - `passed`: the step passed
|
|
71
|
-
* - `failed`: the step failed because of a failed (implicit/explicit) assertion, e.g., an element could not be found
|
|
72
|
-
* - `pending`: the step is waiting for a previous step to pass
|
|
73
|
-
* - `running`: the step is currently running (including retries)
|
|
74
|
-
* - `skipped`: the step was skipped, e.g., because a previous step failed or because workflow was skipped
|
|
75
|
-
* - `erroneous`: the step could not be run because of a runtime error, e.g., the user has no usage left, response of inference backend cannot be processed, e.g., because lib version is outdated, etc. (currently not supported, everything "failed")
|
|
76
|
-
*/
|
|
77
|
-
export declare type StepStatus = 'passed' | 'failed' | 'pending' | 'running' | 'erroneous';
|
|
78
|
-
export declare type StepStatusEnd = 'passed' | 'failed' | 'erroneous';
|
|
79
|
-
/**
|
|
80
|
-
* Can be used to report on a step run.
|
|
81
|
-
*
|
|
82
|
-
* The reporter is an interface (instead of a class) so that the it may be implemented by a class that already extends another class, e.g., the reporter of a test framework.
|
|
83
|
-
*/
|
|
84
|
-
export interface Reporter {
|
|
85
|
-
config?: ReporterConfig;
|
|
86
|
-
onStepBegin?(step: Step): Promise<void>;
|
|
87
|
-
onStepRetry?(step: Step): Promise<void>;
|
|
88
|
-
onStepEnd?(step: Step): Promise<void>;
|
|
89
|
-
}
|
|
90
|
-
export declare type SnapshotDetailLevel =
|
|
91
|
-
/**
|
|
92
|
-
* Details of snapshot, e.g., screenshot or detected elements, may or may not be available depending on if they are required by the step. There are not guarantees made.
|
|
93
|
-
*/
|
|
94
|
-
'required' |
|
|
95
|
-
/**
|
|
96
|
-
* Details are available when the step fails, e.g., for debugging. Includes everything of required.
|
|
97
|
-
*/
|
|
98
|
-
'onFailure' |
|
|
99
|
-
/**
|
|
100
|
-
* Details are available also when the command is started, e.g., for detecting why a certain element was interacted with. Includes everything of onFailure.
|
|
101
|
-
*/
|
|
102
|
-
'begin' |
|
|
103
|
-
/**
|
|
104
|
-
* Details are available always, e.g., before and after a step has been run no matter if it failed or not for debugging.
|
|
105
|
-
*/
|
|
106
|
-
'always';
|
|
107
|
-
export interface ReporterConfig {
|
|
108
|
-
withScreenshots?: SnapshotDetailLevel;
|
|
109
|
-
withDetectedElements?: SnapshotDetailLevel;
|
|
110
|
-
}
|
|
111
|
-
export declare const DEFAULT_REPORTER: {
|
|
112
|
-
config: {
|
|
113
|
-
readonly withScreenshots: "onFailure";
|
|
114
|
-
readonly withDetectedElements: "onFailure";
|
|
115
|
-
};
|
|
116
|
-
onStepBegin: (_step: Step) => Promise<void>;
|
|
117
|
-
onStepRetry: (_step: Step) => Promise<void>;
|
|
118
|
-
onStepEnd: (_step: Step) => Promise<void>;
|
|
119
|
-
};
|
|
120
|
-
export declare class StepReporter {
|
|
121
|
-
private reporter;
|
|
122
|
-
currentStep?: askuiStep | undefined;
|
|
123
|
-
constructor(reporter: Required<Reporter> & {
|
|
124
|
-
config: Required<ReporterConfig>;
|
|
125
|
-
});
|
|
126
|
-
get config(): Required<ReporterConfig>;
|
|
127
|
-
resetStep(instruction: Instruction): void;
|
|
128
|
-
onStepBegin(snapshot: Snapshot): Promise<void>;
|
|
129
|
-
onStepRetry(snapshot: Snapshot, error: Error): Promise<void>;
|
|
130
|
-
onStepEnd(snapshot: Snapshot, error?: Error): Promise<void>;
|
|
131
|
-
}
|
|
132
|
-
export {};
|