askui 0.13.1 → 0.14.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/ui-control-client.d.ts +86 -5
- package/dist/cjs/execution/ui-control-client.js +141 -0
- package/dist/cjs/lib/interactive_cli/create-example-project.d.ts +1 -1
- package/dist/cjs/lib/interactive_cli/create-example-project.js +3 -3
- package/dist/esm/execution/ui-control-client.d.ts +86 -5
- package/dist/esm/execution/ui-control-client.js +141 -0
- package/dist/esm/lib/interactive_cli/create-example-project.d.ts +1 -1
- package/dist/esm/lib/interactive_cli/create-example-project.js +3 -3
- package/package.json +4 -4
- 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/ui-control-client-error.d.ts +0 -2
- package/dist/cjs/execution/ui-control-client-error.js +0 -6
- package/dist/cjs/lib/copy-example-project.d.ts +0 -2
- package/dist/cjs/lib/copy-example-project.js +0 -65
- package/dist/cjs/lib/interactive_cli/replace-string-in-file.d.ts +0 -1
- package/dist/cjs/lib/interactive_cli/replace-string-in-file.js +0 -31
- 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/ui-control-client-error.d.ts +0 -2
- package/dist/esm/execution/ui-control-client-error.js +0 -2
- package/dist/esm/lib/copy-example-project.d.ts +0 -2
- package/dist/esm/lib/copy-example-project.js +0 -58
- package/dist/esm/lib/interactive_cli/replace-string-in-file.d.ts +0 -1
- package/dist/esm/lib/interactive_cli/replace-string-in-file.js +0 -24
- package/dist/example_projects_templates/typescript/.eslintignore +0 -1
- package/dist/example_projects_templates/typescript/.eslintrc.json +0 -20
- package/dist/example_projects_templates/typescript/askui_example/helpers/askui-helper.ts +0 -39
- package/dist/example_projects_templates/typescript_jest/test/README.md +0 -21
- package/dist/example_projects_templates/typescript_jest/test/helper/jest.setup.ts +0 -51
- package/dist/example_projects_templates/typescript_jest/test/jest.config.ts +0 -13
- package/dist/example_projects_templates/typescript_jest/test/my-first-askui-test-suite.test.ts +0 -21
- package/dist/example_projects_templates/typescript_jest/tsconfig.json +0 -7
|
@@ -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,65 +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
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.init = void 0;
|
|
16
|
-
const commander_1 = require("commander");
|
|
17
|
-
const path_1 = __importDefault(require("path"));
|
|
18
|
-
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
19
|
-
const path_2 = require("../utils/path");
|
|
20
|
-
const logger_1 = require("./logger");
|
|
21
|
-
const createProgram = () => {
|
|
22
|
-
const program = new commander_1.Command('askui');
|
|
23
|
-
program.usage('<command> [options]');
|
|
24
|
-
return program;
|
|
25
|
-
};
|
|
26
|
-
function replaceStringInFile(filePath, replace, replacement) {
|
|
27
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
28
|
-
try {
|
|
29
|
-
const data = yield fs_extra_1.default.readFile(filePath, 'utf8');
|
|
30
|
-
const result = data.replace(replace, replacement);
|
|
31
|
-
yield fs_extra_1.default.writeFile(filePath, result, 'utf8');
|
|
32
|
-
}
|
|
33
|
-
catch (error) {
|
|
34
|
-
logger_1.logger.error(`Could not replace '${replace}' with '${replacement}' in file '${path_1.default}'`);
|
|
35
|
-
logger_1.logger.error(error.message);
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
function copyExampleProject(options) {
|
|
40
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
41
|
-
const exampleProjectPath = path_1.default.join('example_projects_templates', 'typescript_jest');
|
|
42
|
-
fs_extra_1.default.copySync(path_1.default.join((0, path_2.getPathToNodeModulesRoot)(), exampleProjectPath), '.');
|
|
43
|
-
if (options['workspaceId']) {
|
|
44
|
-
yield replaceStringInFile('./test/helper/jest.setup.ts', '<your workspace id>', options['workspaceId']);
|
|
45
|
-
}
|
|
46
|
-
if (options['accessToken']) {
|
|
47
|
-
yield replaceStringInFile('./test/helper/jest.setup.ts', '<your access token>', options['accessToken']);
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
function init(argv) {
|
|
52
|
-
const args = argv || process.argv;
|
|
53
|
-
const program = createProgram();
|
|
54
|
-
program
|
|
55
|
-
.command('init')
|
|
56
|
-
.description('creates a typescript example project')
|
|
57
|
-
.option('-w, --workspace-id <value>', 'a workspace id')
|
|
58
|
-
.option('-a, --access-token <value>', 'an access token for the workspace with the id')
|
|
59
|
-
.usage('[-w workspace_id] [-a access_token]')
|
|
60
|
-
.action((opts) => __awaiter(this, void 0, void 0, function* () {
|
|
61
|
-
yield copyExampleProject(opts);
|
|
62
|
-
}));
|
|
63
|
-
return program.parse(args);
|
|
64
|
-
}
|
|
65
|
-
exports.init = init;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function replaceStringInFile(filePath: string, replace: string, replacement: string): Promise<void>;
|
|
@@ -1,31 +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
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.replaceStringInFile = void 0;
|
|
16
|
-
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
17
|
-
const logger_1 = require("../logger");
|
|
18
|
-
function replaceStringInFile(filePath, replace, replacement) {
|
|
19
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
-
try {
|
|
21
|
-
const data = yield fs_extra_1.default.readFile(filePath, 'utf8');
|
|
22
|
-
const result = data.replace(replace, replacement);
|
|
23
|
-
yield fs_extra_1.default.writeFile(filePath, result, 'utf8');
|
|
24
|
-
}
|
|
25
|
-
catch (error) {
|
|
26
|
-
logger_1.logger.error(`Could not replace '${replace}' with '${replacement}' in file '${filePath}'`);
|
|
27
|
-
logger_1.logger.error(error.message);
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
exports.replaceStringInFile = replaceStringInFile;
|
|
@@ -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 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -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,50 +0,0 @@
|
|
|
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
|
-
};
|
|
10
|
-
import { array, number, object, ValidationError, } from 'yup';
|
|
11
|
-
import { Base64Image } from '../../../utils/base_64_image/base-64-image';
|
|
12
|
-
export class CustomElement {
|
|
13
|
-
constructor(customImage, name, threshold, rotationDegreePerStep, imageCompareFormat, mask) {
|
|
14
|
-
this.customImage = customImage;
|
|
15
|
-
this.name = name;
|
|
16
|
-
this.threshold = threshold;
|
|
17
|
-
this.rotationDegreePerStep = rotationDegreePerStep;
|
|
18
|
-
this.imageCompareFormat = imageCompareFormat;
|
|
19
|
-
this.mask = mask;
|
|
20
|
-
}
|
|
21
|
-
static fromJsonListWithImagePathOrImage(ceJson = []) {
|
|
22
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
-
return Promise.all(ceJson.map((customElement) => CustomElement.fromJsonWithImagePathOrImage(customElement)));
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
static fromJsonWithImagePathOrImage(ceJson) {
|
|
27
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
28
|
-
const customImage = (yield Base64Image.fromPathOrString(ceJson.customImage)).toString();
|
|
29
|
-
const customElement = CustomElement.fromJson(Object.assign(Object.assign({}, ceJson), { customImage }));
|
|
30
|
-
customElement.validate();
|
|
31
|
-
return customElement;
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
static fromJson(ceJson) {
|
|
35
|
-
return new CustomElement(ceJson.customImage, ceJson.name, ceJson.threshold, ceJson.rotationDegreePerStep, ceJson.imageCompareFormat, ceJson.mask);
|
|
36
|
-
}
|
|
37
|
-
validate() {
|
|
38
|
-
try {
|
|
39
|
-
CustomElement.schema.validateSync(this, { abortEarly: false, strict: true });
|
|
40
|
-
}
|
|
41
|
-
catch (e) { // ValidationError
|
|
42
|
-
throw new ValidationError(e.errors.join(', '));
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
CustomElement.schema = object({
|
|
47
|
-
threshold: number().optional().min(0).max(1),
|
|
48
|
-
rotationDegreePerStep: number().optional().min(0).lessThan(360),
|
|
49
|
-
mask: array().optional().min(3, 'mask must contain at least 3 points'),
|
|
50
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { CustomElement } from './custom-element';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -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,12 +0,0 @@
|
|
|
1
|
-
import { TestStepState } from './test-step-state';
|
|
2
|
-
export class TestStepResultDto {
|
|
3
|
-
constructor(state, comment = '', createDate = new Date(), updateDate = new Date()) {
|
|
4
|
-
this.state = state;
|
|
5
|
-
this.comment = comment;
|
|
6
|
-
this.createDate = createDate;
|
|
7
|
-
this.updateDate = updateDate;
|
|
8
|
-
}
|
|
9
|
-
static fromJson(testStepResult) {
|
|
10
|
-
return new TestStepResultDto(TestStepState[testStepResult.state], testStepResult.comment, new Date(testStepResult.createDate), new Date(testStepResult.updateDate));
|
|
11
|
-
}
|
|
12
|
-
}
|
|
@@ -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
|
-
};
|