askui 0.3.2 → 0.5.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/README.md +6 -12
- package/dist/cjs/core/annotation/annotation-writer.js +2 -4
- package/dist/cjs/core/annotation/annotation.d.ts +3 -4
- package/dist/cjs/core/annotation/annotation.js +5 -4
- package/dist/cjs/core/inference-response/inference-response.d.ts +15 -0
- package/dist/cjs/core/inference-response/inference-response.js +25 -0
- package/dist/cjs/core/model/annotation-result/boundary-box.d.ts +23 -0
- package/dist/cjs/core/model/annotation-result/boundary-box.js +27 -0
- package/dist/cjs/core/model/annotation-result/detected-element.d.ts +9 -3
- package/dist/cjs/core/model/annotation-result/detected-element.js +10 -4
- package/dist/cjs/core/ui-control-commands/control-command.d.ts +1 -1
- package/dist/cjs/core/ui-control-commands/control-command.js +2 -1
- package/dist/cjs/core/ui-control-commands/index.d.ts +1 -0
- package/dist/cjs/core/ui-control-commands/index.js +3 -1
- package/dist/cjs/execution/dsl.d.ts +1076 -2
- package/dist/cjs/execution/dsl.js +1371 -7
- package/dist/cjs/execution/dsl.spec.js +4 -4
- package/dist/cjs/execution/execution-runtime.d.ts +2 -0
- package/dist/cjs/execution/execution-runtime.js +11 -1
- package/dist/cjs/execution/inference-client.d.ts +3 -0
- package/dist/cjs/execution/inference-client.js +28 -12
- package/dist/cjs/execution/inference-response-error.d.ts +2 -0
- package/dist/cjs/execution/inference-response-error.js +6 -0
- package/dist/cjs/execution/ui-control-client.d.ts +5 -3
- package/dist/cjs/execution/ui-control-client.js +10 -2
- package/dist/cjs/lib/copy-example-project.js +40 -4
- package/dist/cjs/utils/http/http-client-got.js +5 -1
- package/dist/esm/core/annotation/annotation-writer.js +2 -4
- package/dist/esm/core/annotation/annotation.d.ts +3 -4
- package/dist/esm/core/annotation/annotation.js +5 -4
- package/dist/esm/core/inference-response/inference-response.d.ts +15 -0
- package/dist/esm/core/inference-response/inference-response.js +21 -0
- package/dist/esm/core/model/annotation-result/boundary-box.d.ts +23 -0
- package/dist/esm/core/model/annotation-result/boundary-box.js +27 -0
- package/dist/esm/core/model/annotation-result/detected-element.d.ts +9 -3
- package/dist/esm/core/model/annotation-result/detected-element.js +10 -4
- package/dist/esm/core/ui-control-commands/control-command.d.ts +1 -1
- package/dist/esm/core/ui-control-commands/control-command.js +2 -1
- package/dist/esm/core/ui-control-commands/index.d.ts +1 -0
- package/dist/esm/core/ui-control-commands/index.js +1 -0
- package/dist/esm/execution/dsl.d.ts +1076 -2
- package/dist/esm/execution/dsl.js +1365 -6
- package/dist/esm/execution/dsl.spec.js +4 -4
- package/dist/esm/execution/execution-runtime.d.ts +2 -0
- package/dist/esm/execution/execution-runtime.js +11 -1
- package/dist/esm/execution/inference-client.d.ts +3 -0
- package/dist/esm/execution/inference-client.js +29 -13
- package/dist/esm/execution/inference-response-error.d.ts +2 -0
- package/dist/esm/execution/inference-response-error.js +2 -0
- package/dist/esm/execution/ui-control-client.d.ts +5 -3
- package/dist/esm/execution/ui-control-client.js +11 -3
- package/dist/esm/lib/copy-example-project.js +40 -4
- package/dist/esm/utils/http/http-client-got.js +5 -1
- package/dist/example_projects_templates/typescript_jest/test/helper/jest.setup.ts +6 -1
- package/dist/example_projects_templates/typescript_jest/test/my-first-askui-test-suite.test.ts +5 -0
- package/package.json +1 -1
- package/dist/cjs/core/annotation/annotation-json.d.ts +0 -5
- package/dist/cjs/core/annotation/annotation-json.js +0 -2
- package/dist/esm/core/annotation/annotation-json.d.ts +0 -5
- package/dist/esm/core/annotation/annotation-json.js +0 -1
|
@@ -10,7 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
import { FluentCommand } from './dsl';
|
|
11
11
|
class TestCommand extends FluentCommand {
|
|
12
12
|
// eslint-disable-next-line class-methods-use-this
|
|
13
|
-
|
|
13
|
+
fluentCommandExecutor(instruction, customElements) {
|
|
14
14
|
return __awaiter(this, void 0, void 0, function* () {
|
|
15
15
|
// eslint-disable-next-line no-console
|
|
16
16
|
console.log(`${instruction} ${customElements}`);
|
|
@@ -22,14 +22,14 @@ describe('DSL', () => {
|
|
|
22
22
|
describe('custom element', () => {
|
|
23
23
|
test('should call exec function with zero custom element', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
24
24
|
const underTest = new TestCommand();
|
|
25
|
-
const testCommandSpy = jest.spyOn(underTest, '
|
|
25
|
+
const testCommandSpy = jest.spyOn(underTest, 'fluentCommandExecutor');
|
|
26
26
|
yield underTest.click().button()
|
|
27
27
|
.exec();
|
|
28
28
|
expect(testCommandSpy).toHaveBeenCalledWith('Click on button', []);
|
|
29
29
|
}));
|
|
30
30
|
test('should call exec function with one custom element', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
31
31
|
const underTest = new TestCommand();
|
|
32
|
-
const testCommandSpy = jest.spyOn(underTest, '
|
|
32
|
+
const testCommandSpy = jest.spyOn(underTest, 'fluentCommandExecutor');
|
|
33
33
|
yield underTest.click().customElement({
|
|
34
34
|
customImage: 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z/C/HgAGgwJ/lK3Q6wAAAABJRU5ErkJggg==',
|
|
35
35
|
imageCompareFormat: 'grayscale',
|
|
@@ -44,7 +44,7 @@ describe('DSL', () => {
|
|
|
44
44
|
}));
|
|
45
45
|
test('should call exec function with two custom element', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
46
46
|
const underTest = new TestCommand();
|
|
47
|
-
const testCommandSpy = jest.spyOn(underTest, '
|
|
47
|
+
const testCommandSpy = jest.spyOn(underTest, 'fluentCommandExecutor');
|
|
48
48
|
yield underTest.click().customElement({
|
|
49
49
|
customImage: 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z/C/HgAGgwJ/lK3Q6wAAAABJRU5ErkJggg==',
|
|
50
50
|
imageCompareFormat: 'grayscale',
|
|
@@ -3,6 +3,7 @@ import { UiControllerClient } from './ui-controller-client';
|
|
|
3
3
|
import { InferenceClient } from './inference-client';
|
|
4
4
|
import { Annotation } from '../core/annotation/annotation';
|
|
5
5
|
import { CustomElementJson } from '../core/model/test-case-dto/custom-element-json';
|
|
6
|
+
import { DetectedElement } from '../core/model/annotation-result/detected-element';
|
|
6
7
|
export declare class ExecutionRuntime {
|
|
7
8
|
private uiControllerClient;
|
|
8
9
|
private inferenceClient;
|
|
@@ -25,5 +26,6 @@ export declare class ExecutionRuntime {
|
|
|
25
26
|
private predictCommand;
|
|
26
27
|
annotateInteractively(): Promise<void>;
|
|
27
28
|
takeScreenshotIfImageisNotProvided(imagePath?: string): Promise<string>;
|
|
29
|
+
getDetectedElements(instruction: string, customElementJson?: CustomElementJson[]): Promise<DetectedElement[]>;
|
|
28
30
|
annotateImage(imagePath?: string, customElementJson?: CustomElementJson[]): Promise<Annotation>;
|
|
29
31
|
}
|
|
@@ -116,7 +116,7 @@ export class ExecutionRuntime {
|
|
|
116
116
|
annotateInteractively() {
|
|
117
117
|
return __awaiter(this, void 0, void 0, function* () {
|
|
118
118
|
const annotationResponse = yield this.annotateImage();
|
|
119
|
-
yield this.uiControllerClient.annotateInteractively(annotationResponse.
|
|
119
|
+
yield this.uiControllerClient.annotateInteractively(annotationResponse.detected_elements, annotationResponse.image);
|
|
120
120
|
});
|
|
121
121
|
}
|
|
122
122
|
takeScreenshotIfImageisNotProvided(imagePath) {
|
|
@@ -132,6 +132,16 @@ export class ExecutionRuntime {
|
|
|
132
132
|
return base64Image;
|
|
133
133
|
});
|
|
134
134
|
}
|
|
135
|
+
getDetectedElements(instruction, customElementJson) {
|
|
136
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
137
|
+
let customElements = [];
|
|
138
|
+
const base64Image = yield this.takeScreenshotIfImageisNotProvided();
|
|
139
|
+
if (customElementJson !== undefined) {
|
|
140
|
+
customElements = yield CustomElement.fromJsonListWithImagePathOrImage(customElementJson);
|
|
141
|
+
}
|
|
142
|
+
return this.inferenceClient.getDetectedElements(instruction, base64Image, customElements);
|
|
143
|
+
});
|
|
144
|
+
}
|
|
135
145
|
annotateImage(imagePath, customElementJson) {
|
|
136
146
|
return __awaiter(this, void 0, void 0, function* () {
|
|
137
147
|
let customElements = [];
|
|
@@ -2,6 +2,7 @@ import { HttpClientGot } from '../utils/http/http-client-got';
|
|
|
2
2
|
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
|
+
import { DetectedElement } from '../core/model/annotation-result/detected-element';
|
|
5
6
|
export declare class InferenceClient {
|
|
6
7
|
baseUrl: string;
|
|
7
8
|
httpClient: HttpClientGot;
|
|
@@ -11,6 +12,8 @@ export declare class InferenceClient {
|
|
|
11
12
|
constructor(baseUrl: string, httpClient: HttpClientGot, workspaceId?: string | undefined, apiVersion?: string);
|
|
12
13
|
isImageRequired(instruction: string): Promise<boolean>;
|
|
13
14
|
private resizeIfNeeded;
|
|
15
|
+
inference(customElements?: CustomElement[], image?: string, instruction?: string): Promise<ControlCommand | Annotation>;
|
|
14
16
|
predictControlCommand(instruction: string, customElements?: CustomElement[], image?: string): Promise<ControlCommand>;
|
|
17
|
+
getDetectedElements(instruction: string, image: string, customElements?: CustomElement[]): Promise<DetectedElement[]>;
|
|
15
18
|
predictImageAnnotation(image: string, customElements?: CustomElement[]): Promise<Annotation>;
|
|
16
19
|
}
|
|
@@ -8,11 +8,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import urljoin from 'url-join';
|
|
11
|
-
import { ControlCommand } from '../core/ui-control-commands';
|
|
11
|
+
import { ControlCommand, InferenceResponse } from '../core/ui-control-commands';
|
|
12
12
|
import { Annotation } from '../core/annotation/annotation';
|
|
13
13
|
import { resizeBase64ImageWithSameRatio } from '../utils/transformations';
|
|
14
|
+
import { InferenceResponseError } from './inference-response-error';
|
|
14
15
|
export class InferenceClient {
|
|
15
|
-
constructor(baseUrl, httpClient, workspaceId, apiVersion = '
|
|
16
|
+
constructor(baseUrl, httpClient, workspaceId, apiVersion = 'v3') {
|
|
16
17
|
this.baseUrl = baseUrl;
|
|
17
18
|
this.httpClient = httpClient;
|
|
18
19
|
this.workspaceId = workspaceId;
|
|
@@ -39,7 +40,7 @@ export class InferenceClient {
|
|
|
39
40
|
return resizeBase64ImageWithSameRatio(image);
|
|
40
41
|
});
|
|
41
42
|
}
|
|
42
|
-
|
|
43
|
+
inference(customElements = [], image, instruction) {
|
|
43
44
|
return __awaiter(this, void 0, void 0, function* () {
|
|
44
45
|
const resizedImage = yield this.resizeIfNeeded(customElements, image);
|
|
45
46
|
const httpBody = {
|
|
@@ -47,21 +48,36 @@ export class InferenceClient {
|
|
|
47
48
|
instruction,
|
|
48
49
|
customElements,
|
|
49
50
|
};
|
|
50
|
-
const url = urljoin(this.url, '
|
|
51
|
+
const url = urljoin(this.url, 'inference');
|
|
51
52
|
const httpResponse = yield this.httpClient.post(url, httpBody);
|
|
52
|
-
return
|
|
53
|
+
return InferenceResponse.fromJson(httpResponse, resizedImage.resizeRatio, image);
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
predictControlCommand(instruction, customElements = [], image) {
|
|
57
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
58
|
+
const inferenceResponse = yield this.inference(customElements, image, instruction);
|
|
59
|
+
if (!(inferenceResponse instanceof ControlCommand)) {
|
|
60
|
+
throw new InferenceResponseError('Internal Error. Can not execute command');
|
|
61
|
+
}
|
|
62
|
+
return inferenceResponse;
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
getDetectedElements(instruction, image, customElements = []) {
|
|
66
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
67
|
+
const inferenceResponse = yield this.inference(customElements, image, instruction);
|
|
68
|
+
if (!(inferenceResponse instanceof Annotation)) {
|
|
69
|
+
throw new InferenceResponseError('Internal Error. Unable to get the detected elements');
|
|
70
|
+
}
|
|
71
|
+
return inferenceResponse.detected_elements;
|
|
53
72
|
});
|
|
54
73
|
}
|
|
55
74
|
predictImageAnnotation(image, customElements = []) {
|
|
56
75
|
return __awaiter(this, void 0, void 0, function* () {
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
const url = urljoin(this.url, 'annotate', '?format=json');
|
|
63
|
-
const httpResponse = yield this.httpClient.post(url, httpBody);
|
|
64
|
-
return Annotation.fromJson(Object.assign(Object.assign({}, httpResponse), { image }), resizedImage.resizeRatio);
|
|
76
|
+
const inferenceResponse = yield this.inference(customElements, image);
|
|
77
|
+
if (!(inferenceResponse instanceof Annotation)) {
|
|
78
|
+
throw new InferenceResponseError('Internal Error. Can not execute annotation');
|
|
79
|
+
}
|
|
80
|
+
return inferenceResponse;
|
|
65
81
|
});
|
|
66
82
|
}
|
|
67
83
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { CustomElementJson } from '../core/model/test-case-dto';
|
|
2
|
-
import { Exec, Executable,
|
|
2
|
+
import { Exec, Executable, FluentFilters, ApiCommands } from './dsl';
|
|
3
3
|
import { UiControllerClientConnectionState } from './ui-controller-client-connection-state';
|
|
4
4
|
import { Annotation } from '../core/annotation/annotation';
|
|
5
5
|
import { AnnotationRequest } from '../core/model/annotation-result/annotation-interface';
|
|
6
6
|
import { ClientArgs } from './ui-controller-client-interface';
|
|
7
|
-
|
|
7
|
+
import { DetectedElement } from '../core/model/annotation-result/detected-element';
|
|
8
|
+
export declare class UiControlClient extends ApiCommands {
|
|
8
9
|
private httpClient;
|
|
9
10
|
private clientArgs;
|
|
10
11
|
private workspaceId?;
|
|
@@ -19,7 +20,8 @@ export declare class UiControlClient extends FluentCommand {
|
|
|
19
20
|
annotate(annotationRequest?: AnnotationRequest): Promise<Annotation>;
|
|
20
21
|
annotateInteractively(): Promise<void>;
|
|
21
22
|
private escapeSeparatorString;
|
|
22
|
-
|
|
23
|
+
fluentCommandExecutor(instruction: string, customElementJson?: CustomElementJson[]): Promise<void>;
|
|
24
|
+
getterExecutor(instruction: string, customElementJson?: CustomElementJson[]): Promise<DetectedElement[]>;
|
|
23
25
|
private secretText;
|
|
24
26
|
/**
|
|
25
27
|
* Types a text inside the filtered element.
|
|
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { CustomElement } from '../core/model/test-case-dto';
|
|
11
|
-
import {
|
|
11
|
+
import { ApiCommands, Separators, } from './dsl';
|
|
12
12
|
import { HttpClientGot } from '../utils/http/http-client-got';
|
|
13
13
|
import { UiControllerClient } from './ui-controller-client';
|
|
14
14
|
import { ExecutionRuntime } from './execution-runtime';
|
|
@@ -21,7 +21,7 @@ import { UiControlClientError } from './ui-control-client-error';
|
|
|
21
21
|
import { envCredentials } from './read-environment-credentials';
|
|
22
22
|
import { Analytics } from '../utils/analytics';
|
|
23
23
|
const getClientArgsWithDefaults = (clientArgs = {}) => (Object.assign({ uiControllerUrl: 'http://127.0.0.1:6769', inferenceServerUrl: 'https://inference.askui.com', annotationLevel: AnnotationLevel.DISABLED }, clientArgs));
|
|
24
|
-
export class UiControlClient extends
|
|
24
|
+
export class UiControlClient extends ApiCommands {
|
|
25
25
|
constructor(httpClient, clientArgs, workspaceId) {
|
|
26
26
|
super();
|
|
27
27
|
this.httpClient = httpClient;
|
|
@@ -93,7 +93,7 @@ export class UiControlClient extends FluentCommand {
|
|
|
93
93
|
escapeSeparatorString(instruction) {
|
|
94
94
|
return instruction.split(Separators.STRING).join('"');
|
|
95
95
|
}
|
|
96
|
-
|
|
96
|
+
fluentCommandExecutor(instruction, customElementJson = []) {
|
|
97
97
|
return __awaiter(this, void 0, void 0, function* () {
|
|
98
98
|
const { secretText } = this;
|
|
99
99
|
const customElements = yield CustomElement.fromJsonListWithImagePathOrImage(customElementJson);
|
|
@@ -114,6 +114,14 @@ export class UiControlClient extends FluentCommand {
|
|
|
114
114
|
}
|
|
115
115
|
});
|
|
116
116
|
}
|
|
117
|
+
getterExecutor(instruction, customElementJson = []) {
|
|
118
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
119
|
+
const customElements = yield CustomElement.fromJsonListWithImagePathOrImage(customElementJson);
|
|
120
|
+
const stringWithoutSeparators = this.escapeSeparatorString(instruction);
|
|
121
|
+
logger.debug(stringWithoutSeparators);
|
|
122
|
+
return this.executionRuntime.getDetectedElements(instruction, customElements);
|
|
123
|
+
});
|
|
124
|
+
}
|
|
117
125
|
/**
|
|
118
126
|
* Types a text inside the filtered element.
|
|
119
127
|
*
|
|
@@ -1,15 +1,46 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
1
10
|
import { Command } from 'commander';
|
|
2
11
|
import path from 'path';
|
|
3
12
|
import fs from 'fs-extra';
|
|
4
13
|
import { getPathToNodeModulesRoot } from '../utils/path';
|
|
14
|
+
import { logger } from './logger';
|
|
5
15
|
const createProgram = () => {
|
|
6
16
|
const program = new Command('askui');
|
|
7
17
|
program.usage('<command> [options]');
|
|
8
18
|
return program;
|
|
9
19
|
};
|
|
10
|
-
function
|
|
11
|
-
|
|
12
|
-
|
|
20
|
+
function replaceStringInFile(filePath, replace, replacement) {
|
|
21
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
try {
|
|
23
|
+
const data = yield fs.readFile(filePath, 'utf8');
|
|
24
|
+
const result = data.replace(replace, replacement);
|
|
25
|
+
yield fs.writeFile(filePath, result, 'utf8');
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
logger.error(`Could not replace '${replace}' with '${replacement}' in file '${path}'`);
|
|
29
|
+
logger.error(error.message);
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
function copyExampleProject(options) {
|
|
34
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
const exampleProjectPath = path.join('example_projects_templates', 'typescript_jest');
|
|
36
|
+
fs.copySync(path.join(getPathToNodeModulesRoot(), exampleProjectPath), '.');
|
|
37
|
+
if (options['workspaceId']) {
|
|
38
|
+
yield replaceStringInFile('./test/helper/jest.setup.ts', '<your workspace id>', options['workspaceId']);
|
|
39
|
+
}
|
|
40
|
+
if (options['accessToken']) {
|
|
41
|
+
yield replaceStringInFile('./test/helper/jest.setup.ts', '<your access token>', options['accessToken']);
|
|
42
|
+
}
|
|
43
|
+
});
|
|
13
44
|
}
|
|
14
45
|
export function init(argv) {
|
|
15
46
|
const args = argv || process.argv;
|
|
@@ -17,6 +48,11 @@ export function init(argv) {
|
|
|
17
48
|
program
|
|
18
49
|
.command('init')
|
|
19
50
|
.description('creates a typescript example project')
|
|
20
|
-
.
|
|
51
|
+
.option('-w, --workspace-id <value>', 'a workspace id')
|
|
52
|
+
.option('-a, --access-token <value>', 'an access token for the workspace with the id')
|
|
53
|
+
.usage('[-w workspace_id] [-a access_token]')
|
|
54
|
+
.action((opts) => __awaiter(this, void 0, void 0, function* () {
|
|
55
|
+
yield copyExampleProject(opts);
|
|
56
|
+
}));
|
|
21
57
|
return program.parse(args);
|
|
22
58
|
}
|
|
@@ -9,6 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
import got from 'got';
|
|
11
11
|
import { CookieJar } from 'tough-cookie';
|
|
12
|
+
import { logger } from '../../lib';
|
|
12
13
|
import { Credentials } from './credentials';
|
|
13
14
|
import { httpClientErrorHandler } from './custom-errors';
|
|
14
15
|
export class HttpClientGot {
|
|
@@ -33,7 +34,10 @@ export class HttpClientGot {
|
|
|
33
34
|
post(url, data) {
|
|
34
35
|
return __awaiter(this, void 0, void 0, function* () {
|
|
35
36
|
const options = this.injectHeadersAndCookies(url, { json: data, responseType: 'json', throwHttpErrors: false });
|
|
36
|
-
const { body, statusCode } = yield got.post(url, options);
|
|
37
|
+
const { body, statusCode, headers } = yield got.post(url, options);
|
|
38
|
+
if (headers['deprecation'] !== undefined) {
|
|
39
|
+
logger.warn(headers['deprecation']);
|
|
40
|
+
}
|
|
37
41
|
if (statusCode !== 200) {
|
|
38
42
|
throw httpClientErrorHandler(statusCode, JSON.stringify(body));
|
|
39
43
|
}
|
|
@@ -20,7 +20,12 @@ beforeAll(async () => {
|
|
|
20
20
|
|
|
21
21
|
await uiController.start();
|
|
22
22
|
|
|
23
|
-
aui = await UiControlClient.build(
|
|
23
|
+
aui = await UiControlClient.build({
|
|
24
|
+
credentials: {
|
|
25
|
+
workspaceId: '<your workspace id>',
|
|
26
|
+
token: '<your access token>',
|
|
27
|
+
},
|
|
28
|
+
});
|
|
24
29
|
|
|
25
30
|
await aui.connect();
|
|
26
31
|
});
|
package/dist/example_projects_templates/typescript_jest/test/my-first-askui-test-suite.test.ts
CHANGED
|
@@ -2,9 +2,14 @@ import { aui } from './helper/jest.setup';
|
|
|
2
2
|
|
|
3
3
|
describe('jest with askui', () => {
|
|
4
4
|
it('should click on text', async () => {
|
|
5
|
+
// Run this to see what askui annotates
|
|
6
|
+
await aui.annotateInteractively();
|
|
7
|
+
|
|
8
|
+
await aui.moveMouse(0, 0).exec();
|
|
5
9
|
await aui
|
|
6
10
|
.click()
|
|
7
11
|
.text()
|
|
12
|
+
.withText('Click on this text right here!')
|
|
8
13
|
.exec();
|
|
9
14
|
});
|
|
10
15
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "askui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.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 +0,0 @@
|
|
|
1
|
-
export {};
|