askui 0.7.2 → 0.9.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/dsl.d.ts +592 -1333
- package/dist/cjs/execution/dsl.js +1111 -2383
- package/dist/cjs/execution/inference-client.d.ts +3 -1
- package/dist/cjs/execution/inference-client.js +3 -1
- package/dist/cjs/execution/model-composition-branch.d.ts +8 -0
- package/dist/cjs/execution/ui-control-client.js +2 -1
- package/dist/cjs/execution/ui-controller-client-interface.d.ts +2 -0
- package/dist/cjs/execution/ui-controller-client.js +1 -1
- package/dist/esm/execution/dsl.d.ts +592 -1333
- package/dist/esm/execution/dsl.js +1119 -2391
- package/dist/esm/execution/inference-client.d.ts +3 -1
- package/dist/esm/execution/inference-client.js +3 -1
- package/dist/esm/execution/model-composition-branch.d.ts +8 -0
- package/dist/esm/execution/ui-control-client.js +2 -1
- package/dist/esm/execution/ui-controller-client-interface.d.ts +2 -0
- package/dist/esm/execution/ui-controller-client.js +1 -1
- package/dist/example_projects_templates/typescript_jest/test/README.md +2 -2
- package/dist/example_projects_templates/typescript_jest/test/my-first-askui-test-suite.test.ts +3 -3
- package/package.json +1 -1
- package/dist/cjs/core/annotation/annotation-json.d.ts +0 -5
- package/dist/cjs/core/model/test-case-dto/custom-element.spec.js +0 -53
- package/dist/cjs/execution/dsl.spec.d.ts +0 -1
- package/dist/cjs/execution/dsl.spec.js +0 -75
- package/dist/cjs/execution/read-environment-credentials.spec.d.ts +0 -1
- package/dist/cjs/execution/read-environment-credentials.spec.js +0 -11
- package/dist/cjs/lib/ui-controller-args.spec.d.ts +0 -1
- package/dist/cjs/lib/ui-controller-args.spec.js +0 -23
- package/dist/cjs/utils/http/credentials.spec.d.ts +0 -1
- package/dist/cjs/utils/http/credentials.spec.js +0 -11
- package/dist/esm/core/annotation/annotation-json.d.ts +0 -5
- package/dist/esm/core/annotation/annotation-json.js +0 -1
- package/dist/esm/core/model/test-case-dto/custom-element.spec.d.ts +0 -1
- package/dist/esm/core/model/test-case-dto/custom-element.spec.js +0 -51
- package/dist/esm/execution/dsl.spec.d.ts +0 -1
- package/dist/esm/execution/dsl.spec.js +0 -73
- package/dist/esm/execution/read-environment-credentials.spec.d.ts +0 -1
- package/dist/esm/execution/read-environment-credentials.spec.js +0 -9
- package/dist/esm/lib/ui-controller-args.spec.d.ts +0 -1
- package/dist/esm/lib/ui-controller-args.spec.js +0 -21
- package/dist/esm/utils/http/credentials.spec.d.ts +0 -1
- package/dist/esm/utils/http/credentials.spec.js +0 -9
- /package/dist/cjs/{core/annotation/annotation-json.js → execution/model-composition-branch.js} +0 -0
- /package/dist/{cjs/core/model/test-case-dto/custom-element.spec.d.ts → esm/execution/model-composition-branch.js} +0 -0
|
@@ -3,14 +3,16 @@ import { ControlCommand } from '../core/ui-control-commands';
|
|
|
3
3
|
import { CustomElement } from '../core/model/test-case-dto';
|
|
4
4
|
import { Annotation } from '../core/annotation/annotation';
|
|
5
5
|
import { DetectedElement } from '../core/model/annotation-result/detected-element';
|
|
6
|
+
import { ModelCompositionBranch } from './model-composition-branch';
|
|
6
7
|
export declare class InferenceClient {
|
|
7
8
|
baseUrl: string;
|
|
8
9
|
httpClient: HttpClientGot;
|
|
9
10
|
resize?: number | undefined;
|
|
10
11
|
readonly workspaceId?: string | undefined;
|
|
12
|
+
readonly modelComposition?: ModelCompositionBranch[] | undefined;
|
|
11
13
|
apiVersion: string;
|
|
12
14
|
url: string;
|
|
13
|
-
constructor(baseUrl: string, httpClient: HttpClientGot, resize?: number | undefined, workspaceId?: string | undefined, apiVersion?: string);
|
|
15
|
+
constructor(baseUrl: string, httpClient: HttpClientGot, resize?: number | undefined, workspaceId?: string | undefined, modelComposition?: ModelCompositionBranch[] | undefined, apiVersion?: string);
|
|
14
16
|
isImageRequired(instruction: string): Promise<boolean>;
|
|
15
17
|
private resizeIfNeeded;
|
|
16
18
|
inference(customElements?: CustomElement[], image?: string, instruction?: string): Promise<ControlCommand | Annotation>;
|
|
@@ -15,11 +15,12 @@ import { InferenceResponseError } from './inference-response-error';
|
|
|
15
15
|
import { ConfigurationError } from './config-error';
|
|
16
16
|
import { logger } from '../lib/logger';
|
|
17
17
|
export class InferenceClient {
|
|
18
|
-
constructor(baseUrl, httpClient, resize, workspaceId, apiVersion = 'v3') {
|
|
18
|
+
constructor(baseUrl, httpClient, resize, workspaceId, modelComposition, apiVersion = 'v3') {
|
|
19
19
|
this.baseUrl = baseUrl;
|
|
20
20
|
this.httpClient = httpClient;
|
|
21
21
|
this.resize = resize;
|
|
22
22
|
this.workspaceId = workspaceId;
|
|
23
|
+
this.modelComposition = modelComposition;
|
|
23
24
|
this.apiVersion = apiVersion;
|
|
24
25
|
const versionedBaseUrl = urljoin(this.baseUrl, 'api', this.apiVersion);
|
|
25
26
|
this.url = workspaceId
|
|
@@ -56,6 +57,7 @@ export class InferenceClient {
|
|
|
56
57
|
image: resizedImage.base64Image,
|
|
57
58
|
instruction,
|
|
58
59
|
customElements,
|
|
60
|
+
modelComposition: this.modelComposition,
|
|
59
61
|
};
|
|
60
62
|
const url = urljoin(this.url, 'inference');
|
|
61
63
|
const response = yield this.httpClient.post(url, requestBody);
|
|
@@ -49,7 +49,7 @@ export class UiControlClient extends ApiCommands {
|
|
|
49
49
|
return this._uiControllerClient;
|
|
50
50
|
}
|
|
51
51
|
get inferenceClient() {
|
|
52
|
-
return new InferenceClient(this.clientArgs.inferenceServerUrl, this.httpClient, this.clientArgs.resize, this.workspaceId);
|
|
52
|
+
return new InferenceClient(this.clientArgs.inferenceServerUrl, this.httpClient, this.clientArgs.resize, this.workspaceId, this.clientArgs.modelComposition);
|
|
53
53
|
}
|
|
54
54
|
get executionRuntime() {
|
|
55
55
|
return new ExecutionRuntime(this.uiControllerClient, this.inferenceClient);
|
|
@@ -107,6 +107,7 @@ export class UiControlClient extends ApiCommands {
|
|
|
107
107
|
customElements,
|
|
108
108
|
secretText,
|
|
109
109
|
});
|
|
110
|
+
this.secretText = undefined;
|
|
110
111
|
yield this.annotateByDefault(TestStepState.PASSED, customElements);
|
|
111
112
|
return yield Promise.resolve();
|
|
112
113
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AnnotationLevel } from './annotation-level';
|
|
2
2
|
import { CredentialArgs } from './credentials-args';
|
|
3
3
|
import { ProxyAgentArgs } from '../shared/proxy-agent-args';
|
|
4
|
+
import { ModelCompositionBranch } from './model-composition-branch';
|
|
4
5
|
/**
|
|
5
6
|
* Configuration options for the askui UI Control Client
|
|
6
7
|
*
|
|
@@ -32,6 +33,7 @@ export interface ClientArgs {
|
|
|
32
33
|
readonly credentials?: CredentialArgs;
|
|
33
34
|
readonly proxyAgents?: ProxyAgentArgs;
|
|
34
35
|
readonly resize?: number;
|
|
36
|
+
readonly modelComposition?: ModelCompositionBranch[];
|
|
35
37
|
}
|
|
36
38
|
export interface ClientArgsWithDefaults extends ClientArgs {
|
|
37
39
|
readonly uiControllerUrl: string;
|
|
@@ -42,7 +42,7 @@ export class UiControllerClient {
|
|
|
42
42
|
this.ws.on('error', (error) => {
|
|
43
43
|
this.connectionState = UiControllerClientConnectionState.ERROR;
|
|
44
44
|
reject(new UiControlClientError(`Connection to UI Controller cannot be established,
|
|
45
|
-
Probably it was not started.
|
|
45
|
+
Probably it was not started. Make sure you started UI Controller with this
|
|
46
46
|
Url ${this.url}. Error message ${error.message}`));
|
|
47
47
|
});
|
|
48
48
|
}
|
|
@@ -12,9 +12,9 @@ Use following command to set up Jest:
|
|
|
12
12
|
npm i -D jest @types/jest ts-jest typescript
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
## How to execute the example
|
|
15
|
+
## How to execute the example
|
|
16
16
|
|
|
17
|
-
This
|
|
17
|
+
This can be executed with the following command:
|
|
18
18
|
```shell
|
|
19
19
|
npx jest --config ./test/jest.config.ts
|
|
20
20
|
```
|
package/dist/example_projects_templates/typescript_jest/test/my-first-askui-test-suite.test.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { aui } from './helper/jest.setup';
|
|
2
2
|
|
|
3
3
|
describe('jest with askui', () => {
|
|
4
|
-
|
|
5
4
|
it('should generate an interactive annotation', async () => {
|
|
6
5
|
await aui.annotateInteractively();
|
|
7
6
|
});
|
|
8
7
|
|
|
9
8
|
it('should click on my element', async () => {
|
|
10
9
|
await aui
|
|
11
|
-
.click()
|
|
12
|
-
|
|
10
|
+
.click();
|
|
11
|
+
// <INSERT YOUR COPIED ELEMENT DESCRIPTION HERE AND UNCOMMENT THIS AND THE NEXT LINE>
|
|
12
|
+
// .exec();
|
|
13
13
|
});
|
|
14
14
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "askui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
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",
|
|
@@ -1,53 +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
|
-
const custom_element_1 = require("./custom-element");
|
|
13
|
-
const base64ImageString = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgA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5I6FyWn0hlzEdh9amQ96R6nA3wQsozpvLny8jck8HTSpsXUgkrgNOk4MbZj8BtTZZDQmBI7lH1/cZ0/fu7/Pf3aX/9RykjXe/laecml72y/Z/5XeT9V+TUnbMxlqDtWgjgRbAmx4xGG6PDNEfURjIhHfpHEPamZkUA6zBzlOHz+zjLNhbh0Zkl27pj7hdraxznbUGIDxrEQ9gDrBod3bEepTLU1RYpYXjM7J1lqiDlWG+e1TZwHfM8ehVrCbNOz+Q7RIQU+rXxZu2u9/SwxrAaAnIaiaz4ufcDoID/36z/6ngq0ecPIVAGaQxF33NxWW6T82gD16/64bnvW3a2sj0X+6irhg9SuHN5EWat8lK84Mt9NPrv66+bniV2H/ckDaZqSbVu0FpIie57NGRs8MAcSLFVeruQAzQ7YJQ4uaX6Z7xtN5TZl8GEy1LZIq/jmzUDL4ZUaG4baMNcD/H8hlYADpzRH1QAAAABJRU5ErkJggg==';
|
|
14
|
-
describe('CustomElement', () => {
|
|
15
|
-
describe('fromJsonWithImagePathOrImage', () => {
|
|
16
|
-
test('should return CustomElement if CustomElement created from JSON is valid', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
17
|
-
const expected = new custom_element_1.CustomElement(base64ImageString, 'Dummy_element', 0.7, 10, 'RGB', [{ x: 0, y: 1 }, { x: 1, y: 2 }, { x: 3, y: 4 }]);
|
|
18
|
-
const actual = yield custom_element_1.CustomElement.fromJsonWithImagePathOrImage({
|
|
19
|
-
customImage: base64ImageString,
|
|
20
|
-
name: 'Dummy_element',
|
|
21
|
-
threshold: 0.7,
|
|
22
|
-
rotationDegreePerStep: 10,
|
|
23
|
-
imageCompareFormat: 'RGB',
|
|
24
|
-
mask: [{ x: 0, y: 1 }, { x: 1, y: 2 }, { x: 3, y: 4 }],
|
|
25
|
-
});
|
|
26
|
-
expect(actual).toStrictEqual(expected);
|
|
27
|
-
}));
|
|
28
|
-
test('should throw ValidationError if threshold is invalid', () => {
|
|
29
|
-
expect(() => {
|
|
30
|
-
const customElement = new custom_element_1.CustomElement(base64ImageString, 'Dummy_element', 1.1, 10, 'RGB', [{ x: 0, y: 1 }, { x: 1, y: 2 }, { x: 3, y: 4 }]);
|
|
31
|
-
customElement.validate();
|
|
32
|
-
}).toThrow('threshold must be less than or equal to 1');
|
|
33
|
-
});
|
|
34
|
-
test('should throw ValidationError if rotationDegreePerStep is invalid', () => {
|
|
35
|
-
expect(() => {
|
|
36
|
-
const customElement = new custom_element_1.CustomElement(base64ImageString, 'Dummy_element', 0.9, -90, 'RGB', [{ x: 0, y: 1 }, { x: 1, y: 2 }, { x: 3, y: 4 }]);
|
|
37
|
-
customElement.validate();
|
|
38
|
-
}).toThrow('rotationDegreePerStep must be greater than or equal to 0');
|
|
39
|
-
});
|
|
40
|
-
test('should throw ValidationError if mask is invalid', () => {
|
|
41
|
-
expect(() => {
|
|
42
|
-
const customElement = new custom_element_1.CustomElement(base64ImageString, 'Dummy_element', 0.9, 10, 'RGB', [{ x: 0, y: 1 }, { x: 1, y: 2 }]);
|
|
43
|
-
customElement.validate();
|
|
44
|
-
}).toThrow('mask must contain at least 3 points');
|
|
45
|
-
});
|
|
46
|
-
test('should throw ValidationError if mask and threshold are both invalid', () => {
|
|
47
|
-
expect(() => {
|
|
48
|
-
const customElement = new custom_element_1.CustomElement(base64ImageString, 'Dummy_element', 90, 10, 'RGB', [{ x: 0, y: 1 }, { x: 1, y: 2 }]);
|
|
49
|
-
customElement.validate();
|
|
50
|
-
}).toThrow('threshold must be less than or equal to 1, mask must contain at least 3 points');
|
|
51
|
-
});
|
|
52
|
-
});
|
|
53
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,75 +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
|
-
const dsl_1 = require("./dsl");
|
|
13
|
-
class TestCommand extends dsl_1.FluentCommand {
|
|
14
|
-
// eslint-disable-next-line class-methods-use-this
|
|
15
|
-
fluentCommandExecutor(instruction, customElements) {
|
|
16
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
17
|
-
// eslint-disable-next-line no-console
|
|
18
|
-
console.log(`${instruction} ${customElements}`);
|
|
19
|
-
return Promise.resolve();
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
describe('DSL', () => {
|
|
24
|
-
describe('custom element', () => {
|
|
25
|
-
test('should call exec function with zero custom element', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
26
|
-
const underTest = new TestCommand();
|
|
27
|
-
const testCommandSpy = jest.spyOn(underTest, 'fluentCommandExecutor');
|
|
28
|
-
yield underTest.click().button()
|
|
29
|
-
.exec();
|
|
30
|
-
expect(testCommandSpy).toHaveBeenCalledWith('Click on button', []);
|
|
31
|
-
}));
|
|
32
|
-
test('should call exec function with one custom element', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
33
|
-
const underTest = new TestCommand();
|
|
34
|
-
const testCommandSpy = jest.spyOn(underTest, 'fluentCommandExecutor');
|
|
35
|
-
yield underTest.click().customElement({
|
|
36
|
-
customImage: 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z/C/HgAGgwJ/lK3Q6wAAAABJRU5ErkJggg==',
|
|
37
|
-
imageCompareFormat: 'grayscale',
|
|
38
|
-
name: 'custom element 1',
|
|
39
|
-
}).button()
|
|
40
|
-
.exec();
|
|
41
|
-
expect(testCommandSpy).toHaveBeenCalledWith('Click on custom element button', [{
|
|
42
|
-
customImage: 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z/C/HgAGgwJ/lK3Q6wAAAABJRU5ErkJggg==',
|
|
43
|
-
imageCompareFormat: 'grayscale',
|
|
44
|
-
name: 'custom element 1',
|
|
45
|
-
}]);
|
|
46
|
-
}));
|
|
47
|
-
test('should call exec function with two custom element', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
48
|
-
const underTest = new TestCommand();
|
|
49
|
-
const testCommandSpy = jest.spyOn(underTest, 'fluentCommandExecutor');
|
|
50
|
-
yield underTest.click().customElement({
|
|
51
|
-
customImage: 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z/C/HgAGgwJ/lK3Q6wAAAABJRU5ErkJggg==',
|
|
52
|
-
imageCompareFormat: 'grayscale',
|
|
53
|
-
name: 'custom element 1',
|
|
54
|
-
})
|
|
55
|
-
.button()
|
|
56
|
-
.customElement({
|
|
57
|
-
customImage: 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z/C/HgAGgwJ/lK3Q6wAAAABJRU5ErkJggg==',
|
|
58
|
-
imageCompareFormat: 'grayscale',
|
|
59
|
-
name: 'custom element 2',
|
|
60
|
-
})
|
|
61
|
-
.exec();
|
|
62
|
-
expect(testCommandSpy).toHaveBeenCalledWith('Click on custom element button custom element', [{
|
|
63
|
-
customImage: 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z/C/HgAGgwJ/lK3Q6wAAAABJRU5ErkJggg==',
|
|
64
|
-
imageCompareFormat: 'grayscale',
|
|
65
|
-
name: 'custom element 1',
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
customImage: 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z/C/HgAGgwJ/lK3Q6wAAAABJRU5ErkJggg==',
|
|
69
|
-
imageCompareFormat: 'grayscale',
|
|
70
|
-
name: 'custom element 2',
|
|
71
|
-
},
|
|
72
|
-
]);
|
|
73
|
-
}));
|
|
74
|
-
});
|
|
75
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const read_environment_credentials_1 = require("./read-environment-credentials");
|
|
4
|
-
describe('envCredentials()', () => {
|
|
5
|
-
test('should read the credentials from the environment variables', () => {
|
|
6
|
-
process.env['ASKUI_TOKEN'] = 'token';
|
|
7
|
-
process.env['ASKUI_WORKSPACE_ID'] = 'id123';
|
|
8
|
-
const credentialsFromTheEnv = (0, read_environment_credentials_1.envCredentials)();
|
|
9
|
-
expect(credentialsFromTheEnv).toStrictEqual({ workspaceId: 'id123', token: 'token' });
|
|
10
|
-
});
|
|
11
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const ui_controller_args_1 = require("./ui-controller-args");
|
|
4
|
-
describe('createCliFlagsFromArgs()', () => {
|
|
5
|
-
test('test createCliFlagsFromArgs should return -d 0 as default output', () => {
|
|
6
|
-
const expected = ['-d 0', '-p 6769', '--action_wait_time 1000', '--host 127.0.0.1', '-m ', '--log-level debug'];
|
|
7
|
-
const argsWithDefaults = (0, ui_controller_args_1.createArgsWithDefaults)();
|
|
8
|
-
const actual = (0, ui_controller_args_1.createCliFlagsFromArgs)(argsWithDefaults);
|
|
9
|
-
expect(actual).toStrictEqual(expected);
|
|
10
|
-
});
|
|
11
|
-
test('test createCliFlagsFromArgs output should include -d 0 when no display was selected', () => {
|
|
12
|
-
const expected = ['-d 0', '-p 6777', '--action_wait_time 1000', '--host 0.0.0.0', '-m ', '--log-level debug'];
|
|
13
|
-
const argsWithDefaults = (0, ui_controller_args_1.createArgsWithDefaults)({ port: 6777, host: '0.0.0.0' });
|
|
14
|
-
const actual = (0, ui_controller_args_1.createCliFlagsFromArgs)(argsWithDefaults);
|
|
15
|
-
expect(actual).toStrictEqual(expected);
|
|
16
|
-
});
|
|
17
|
-
test('test createCliFlagsFromArgs output should include the display that was selected ', () => {
|
|
18
|
-
const expected = ['-d 99', '-p 6777', '--action_wait_time 1000', '--host 0.0.0.0', '-m ', '--log-level debug'];
|
|
19
|
-
const argsWithDefaults = (0, ui_controller_args_1.createArgsWithDefaults)({ port: 6777, host: '0.0.0.0', display: 99 });
|
|
20
|
-
const actual = (0, ui_controller_args_1.createCliFlagsFromArgs)(argsWithDefaults);
|
|
21
|
-
expect(actual).toStrictEqual(expected);
|
|
22
|
-
});
|
|
23
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const credentials_1 = require("./credentials");
|
|
4
|
-
describe('Credentials', () => {
|
|
5
|
-
describe('base64Encoded()', () => {
|
|
6
|
-
test('should return base64-encoded credentials', () => {
|
|
7
|
-
const credentials = new credentials_1.Credentials('password');
|
|
8
|
-
expect(credentials.base64Encoded).toBe('cGFzc3dvcmQ=');
|
|
9
|
-
});
|
|
10
|
-
});
|
|
11
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,51 +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 { CustomElement } from './custom-element';
|
|
11
|
-
const base64ImageString = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAAA8CAYAAADWibxkAAAACXBIWXMAABYlAAAWJQFJUiTwAAAN20lEQVRogXVa3XrbSg7T7XHsfZyNneSJtm2cOH1/7UeCIMCRz4Xa2NYPhwRBkKPtdv7e306P/e3le7+dP+v43t9eHvt7HOfH/nb53q/12/vLdx5vL/f97RT/x/G53y73/e1S19Q5ccS9buc7zrt87+/nL1x/wvW3Sxz3/f3lnr/p/Pgu7HrUb/c8j/fC/XHdR9rJa2F7rieeV3/zmrhv3OP9BWvZciF1QvxwO9339xNPlvF+cX4+h2E/fe3bJf7GZxj2MMfiPrn4s84LJ9wu4bwwBosOJ6dN6Rhcm8+OxedBp69BgG08ImBxwB4G5qccEvbhui2ih+jy4jKAjokHnL73jzO9HOf/qRv/mEfj7wfuEWioB8O4QNGjIljO+k8hxc4nCuHQOF/RC4eEEyayLHCJQDoLqILzfvaP89884AA4vh1wLU9h8X9ycXQGoISFEdpKE0LUUBKQPoX36RQaGAbFgiKVaCzgncYy5c50UhyKWEY9I+8OKBsqRRk0OBUO78iffwp5SNc4cJ9HOEAGZ3RPf0YeEZaZ/5EambcF3YhWQ7VQE7A+uQPKmbHgiHwiipwh1DDKXFin3eW+Xy8RJMv9QiKDQFjLQfMz0MM0/oOUK3u3fFgQUhrCiMXfIsbXl9/pGPEFcwzOohG4jukjx3Ua8EikhBP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iM0jrpEYIKqG3wUPFMF6m0zh/lQqd2EUfWtcnztLv3FK59qzcBss9lh+TEC/Fcm/lxIZxFTNCiNMlVI2Vu5GqnVzdRpzg/62WV4D0XZ5bU2sVJt7bNzw0S20LVpwImb6nUZV1nMOYuYC6AelDoHPCMiDVSOCBEyQvrCKaYNnvQTo+wt8JZStPa67VUXuuFBLAvQ8FB+tmhLE2dtRm4lvTlbmK2xRJQ3Xfp+ONunSGPPgfeXWBtONjm8pspaGTZGH16ndrcF2JTItb/k86oFFA2gqQYrweyJEt9zoCq0UvgUcVPx+XzCU9JVo1rsZ0MRkfeGkzjY4M6w5n5MkV5kaXwuzrfKD5I6FyWn0hlzEdh9amQ96R6nA3wQsozpvLny8jck8HTSpsXUgkrgNOk4MbZj8BtTZZDQmBI7lH1/cZ0/fu7/Pf3aX/9RykjXe/laecml72y/Z/5XeT9V+TUnbMxlqDtWgjgRbAmx4xGG6PDNEfURjIhHfpHEPamZkUA6zBzlOHz+zjLNhbh0Zkl27pj7hdraxznbUGIDxrEQ9gDrBod3bEepTLU1RYpYXjM7J1lqiDlWG+e1TZwHfM8ehVrCbNOz+Q7RIQU+rXxZu2u9/SwxrAaAnIaiaz4ufcDoID/36z/6ngq0ecPIVAGaQxF33NxWW6T82gD16/64bnvW3a2sj0X+6irhg9SuHN5EWat8lK84Mt9NPrv66+bniV2H/ckDaZqSbVu0FpIie57NGRs8MAcSLFVeruQAzQ7YJQ4uaX6Z7xtN5TZl8GEy1LZIq/jmzUDL4ZUaG4baMNcD/H8hlYADpzRH1QAAAABJRU5ErkJggg==';
|
|
12
|
-
describe('CustomElement', () => {
|
|
13
|
-
describe('fromJsonWithImagePathOrImage', () => {
|
|
14
|
-
test('should return CustomElement if CustomElement created from JSON is valid', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
15
|
-
const expected = new CustomElement(base64ImageString, 'Dummy_element', 0.7, 10, 'RGB', [{ x: 0, y: 1 }, { x: 1, y: 2 }, { x: 3, y: 4 }]);
|
|
16
|
-
const actual = yield CustomElement.fromJsonWithImagePathOrImage({
|
|
17
|
-
customImage: base64ImageString,
|
|
18
|
-
name: 'Dummy_element',
|
|
19
|
-
threshold: 0.7,
|
|
20
|
-
rotationDegreePerStep: 10,
|
|
21
|
-
imageCompareFormat: 'RGB',
|
|
22
|
-
mask: [{ x: 0, y: 1 }, { x: 1, y: 2 }, { x: 3, y: 4 }],
|
|
23
|
-
});
|
|
24
|
-
expect(actual).toStrictEqual(expected);
|
|
25
|
-
}));
|
|
26
|
-
test('should throw ValidationError if threshold is invalid', () => {
|
|
27
|
-
expect(() => {
|
|
28
|
-
const customElement = new CustomElement(base64ImageString, 'Dummy_element', 1.1, 10, 'RGB', [{ x: 0, y: 1 }, { x: 1, y: 2 }, { x: 3, y: 4 }]);
|
|
29
|
-
customElement.validate();
|
|
30
|
-
}).toThrow('threshold must be less than or equal to 1');
|
|
31
|
-
});
|
|
32
|
-
test('should throw ValidationError if rotationDegreePerStep is invalid', () => {
|
|
33
|
-
expect(() => {
|
|
34
|
-
const customElement = new CustomElement(base64ImageString, 'Dummy_element', 0.9, -90, 'RGB', [{ x: 0, y: 1 }, { x: 1, y: 2 }, { x: 3, y: 4 }]);
|
|
35
|
-
customElement.validate();
|
|
36
|
-
}).toThrow('rotationDegreePerStep must be greater than or equal to 0');
|
|
37
|
-
});
|
|
38
|
-
test('should throw ValidationError if mask is invalid', () => {
|
|
39
|
-
expect(() => {
|
|
40
|
-
const customElement = new CustomElement(base64ImageString, 'Dummy_element', 0.9, 10, 'RGB', [{ x: 0, y: 1 }, { x: 1, y: 2 }]);
|
|
41
|
-
customElement.validate();
|
|
42
|
-
}).toThrow('mask must contain at least 3 points');
|
|
43
|
-
});
|
|
44
|
-
test('should throw ValidationError if mask and threshold are both invalid', () => {
|
|
45
|
-
expect(() => {
|
|
46
|
-
const customElement = new CustomElement(base64ImageString, 'Dummy_element', 90, 10, 'RGB', [{ x: 0, y: 1 }, { x: 1, y: 2 }]);
|
|
47
|
-
customElement.validate();
|
|
48
|
-
}).toThrow('threshold must be less than or equal to 1, mask must contain at least 3 points');
|
|
49
|
-
});
|
|
50
|
-
});
|
|
51
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,73 +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 { FluentCommand } from './dsl';
|
|
11
|
-
class TestCommand extends FluentCommand {
|
|
12
|
-
// eslint-disable-next-line class-methods-use-this
|
|
13
|
-
fluentCommandExecutor(instruction, customElements) {
|
|
14
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
15
|
-
// eslint-disable-next-line no-console
|
|
16
|
-
console.log(`${instruction} ${customElements}`);
|
|
17
|
-
return Promise.resolve();
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
describe('DSL', () => {
|
|
22
|
-
describe('custom element', () => {
|
|
23
|
-
test('should call exec function with zero custom element', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
24
|
-
const underTest = new TestCommand();
|
|
25
|
-
const testCommandSpy = jest.spyOn(underTest, 'fluentCommandExecutor');
|
|
26
|
-
yield underTest.click().button()
|
|
27
|
-
.exec();
|
|
28
|
-
expect(testCommandSpy).toHaveBeenCalledWith('Click on button', []);
|
|
29
|
-
}));
|
|
30
|
-
test('should call exec function with one custom element', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
31
|
-
const underTest = new TestCommand();
|
|
32
|
-
const testCommandSpy = jest.spyOn(underTest, 'fluentCommandExecutor');
|
|
33
|
-
yield underTest.click().customElement({
|
|
34
|
-
customImage: 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z/C/HgAGgwJ/lK3Q6wAAAABJRU5ErkJggg==',
|
|
35
|
-
imageCompareFormat: 'grayscale',
|
|
36
|
-
name: 'custom element 1',
|
|
37
|
-
}).button()
|
|
38
|
-
.exec();
|
|
39
|
-
expect(testCommandSpy).toHaveBeenCalledWith('Click on custom element button', [{
|
|
40
|
-
customImage: 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z/C/HgAGgwJ/lK3Q6wAAAABJRU5ErkJggg==',
|
|
41
|
-
imageCompareFormat: 'grayscale',
|
|
42
|
-
name: 'custom element 1',
|
|
43
|
-
}]);
|
|
44
|
-
}));
|
|
45
|
-
test('should call exec function with two custom element', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
46
|
-
const underTest = new TestCommand();
|
|
47
|
-
const testCommandSpy = jest.spyOn(underTest, 'fluentCommandExecutor');
|
|
48
|
-
yield underTest.click().customElement({
|
|
49
|
-
customImage: 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z/C/HgAGgwJ/lK3Q6wAAAABJRU5ErkJggg==',
|
|
50
|
-
imageCompareFormat: 'grayscale',
|
|
51
|
-
name: 'custom element 1',
|
|
52
|
-
})
|
|
53
|
-
.button()
|
|
54
|
-
.customElement({
|
|
55
|
-
customImage: 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z/C/HgAGgwJ/lK3Q6wAAAABJRU5ErkJggg==',
|
|
56
|
-
imageCompareFormat: 'grayscale',
|
|
57
|
-
name: 'custom element 2',
|
|
58
|
-
})
|
|
59
|
-
.exec();
|
|
60
|
-
expect(testCommandSpy).toHaveBeenCalledWith('Click on custom element button custom element', [{
|
|
61
|
-
customImage: 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z/C/HgAGgwJ/lK3Q6wAAAABJRU5ErkJggg==',
|
|
62
|
-
imageCompareFormat: 'grayscale',
|
|
63
|
-
name: 'custom element 1',
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
customImage: 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z/C/HgAGgwJ/lK3Q6wAAAABJRU5ErkJggg==',
|
|
67
|
-
imageCompareFormat: 'grayscale',
|
|
68
|
-
name: 'custom element 2',
|
|
69
|
-
},
|
|
70
|
-
]);
|
|
71
|
-
}));
|
|
72
|
-
});
|
|
73
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { envCredentials } from './read-environment-credentials';
|
|
2
|
-
describe('envCredentials()', () => {
|
|
3
|
-
test('should read the credentials from the environment variables', () => {
|
|
4
|
-
process.env['ASKUI_TOKEN'] = 'token';
|
|
5
|
-
process.env['ASKUI_WORKSPACE_ID'] = 'id123';
|
|
6
|
-
const credentialsFromTheEnv = envCredentials();
|
|
7
|
-
expect(credentialsFromTheEnv).toStrictEqual({ workspaceId: 'id123', token: 'token' });
|
|
8
|
-
});
|
|
9
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { createArgsWithDefaults, createCliFlagsFromArgs } from './ui-controller-args';
|
|
2
|
-
describe('createCliFlagsFromArgs()', () => {
|
|
3
|
-
test('test createCliFlagsFromArgs should return -d 0 as default output', () => {
|
|
4
|
-
const expected = ['-d 0', '-p 6769', '--action_wait_time 1000', '--host 127.0.0.1', '-m ', '--log-level debug'];
|
|
5
|
-
const argsWithDefaults = createArgsWithDefaults();
|
|
6
|
-
const actual = createCliFlagsFromArgs(argsWithDefaults);
|
|
7
|
-
expect(actual).toStrictEqual(expected);
|
|
8
|
-
});
|
|
9
|
-
test('test createCliFlagsFromArgs output should include -d 0 when no display was selected', () => {
|
|
10
|
-
const expected = ['-d 0', '-p 6777', '--action_wait_time 1000', '--host 0.0.0.0', '-m ', '--log-level debug'];
|
|
11
|
-
const argsWithDefaults = createArgsWithDefaults({ port: 6777, host: '0.0.0.0' });
|
|
12
|
-
const actual = createCliFlagsFromArgs(argsWithDefaults);
|
|
13
|
-
expect(actual).toStrictEqual(expected);
|
|
14
|
-
});
|
|
15
|
-
test('test createCliFlagsFromArgs output should include the display that was selected ', () => {
|
|
16
|
-
const expected = ['-d 99', '-p 6777', '--action_wait_time 1000', '--host 0.0.0.0', '-m ', '--log-level debug'];
|
|
17
|
-
const argsWithDefaults = createArgsWithDefaults({ port: 6777, host: '0.0.0.0', display: 99 });
|
|
18
|
-
const actual = createCliFlagsFromArgs(argsWithDefaults);
|
|
19
|
-
expect(actual).toStrictEqual(expected);
|
|
20
|
-
});
|
|
21
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Credentials } from './credentials';
|
|
2
|
-
describe('Credentials', () => {
|
|
3
|
-
describe('base64Encoded()', () => {
|
|
4
|
-
test('should return base64-encoded credentials', () => {
|
|
5
|
-
const credentials = new Credentials('password');
|
|
6
|
-
expect(credentials.base64Encoded).toBe('cGFzc3dvcmQ=');
|
|
7
|
-
});
|
|
8
|
-
});
|
|
9
|
-
});
|
/package/dist/cjs/{core/annotation/annotation-json.js → execution/model-composition-branch.js}
RENAMED
|
File without changes
|
|
File without changes
|