askui 0.20.5 → 0.20.7
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/lib/interactive_cli/cli.js +0 -32
- package/dist/cjs/lib/interactive_cli/create-example-project.d.ts +0 -1
- package/dist/cjs/lib/interactive_cli/create-example-project.js +5 -32
- package/dist/cjs/lib/ui-controller.d.ts +4 -0
- package/dist/cjs/lib/ui-controller.js +4 -0
- package/dist/esm/lib/interactive_cli/cli.js +0 -32
- package/dist/esm/lib/interactive_cli/create-example-project.d.ts +0 -1
- package/dist/esm/lib/interactive_cli/create-example-project.js +5 -32
- package/dist/esm/lib/ui-controller.d.ts +4 -0
- package/dist/esm/lib/ui-controller.js +4 -0
- package/dist/example_projects_templates/templates/askui-helper.nj +2 -17
- package/dist/example_projects_templates/typescript/gitignore +24 -0
- package/package.json +1 -1
- package/dist/example_projects_templates/templates/askui-helper-windows.nj +0 -36
|
@@ -17,7 +17,6 @@ const inquirer_1 = __importDefault(require("inquirer"));
|
|
|
17
17
|
const commander_1 = require("commander");
|
|
18
18
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
19
19
|
const create_example_project_1 = require("./create-example-project");
|
|
20
|
-
const nonEmpty = (subject) => (input) => input.trim().length > 0 || `${subject} is required.`;
|
|
21
20
|
/* eslint-disable sort-keys */
|
|
22
21
|
const questions = [
|
|
23
22
|
{
|
|
@@ -26,21 +25,6 @@ const questions = [
|
|
|
26
25
|
message: 'Which framework do you prefer?:',
|
|
27
26
|
choices: ['jest'],
|
|
28
27
|
},
|
|
29
|
-
{
|
|
30
|
-
type: 'input',
|
|
31
|
-
name: 'workspaceId',
|
|
32
|
-
message: 'Your workspace id:',
|
|
33
|
-
validate: nonEmpty('workspace id'),
|
|
34
|
-
when: (answers) => !answers.skipCredentials,
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
type: 'password',
|
|
38
|
-
name: 'accessToken',
|
|
39
|
-
message: 'Your access token:',
|
|
40
|
-
mask: '*',
|
|
41
|
-
validate: nonEmpty('access token'),
|
|
42
|
-
when: (answers) => !answers.skipCredentials,
|
|
43
|
-
},
|
|
44
28
|
{
|
|
45
29
|
type: 'confirm',
|
|
46
30
|
name: 'typescriptConfig',
|
|
@@ -57,22 +41,6 @@ const options = [
|
|
|
57
41
|
description: 'the test framework to use.',
|
|
58
42
|
option: '-f, --test-framework <value>',
|
|
59
43
|
},
|
|
60
|
-
{
|
|
61
|
-
choices: [],
|
|
62
|
-
default: false,
|
|
63
|
-
description: 'skip the credentials setup.',
|
|
64
|
-
option: '-sc, --skip-credentials',
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
choices: [],
|
|
68
|
-
description: 'a workspace id.',
|
|
69
|
-
option: '-w, --workspace-id <value>',
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
choices: [],
|
|
73
|
-
description: 'an access token for the workspace with the id.',
|
|
74
|
-
option: '-a, --access-token <value>',
|
|
75
|
-
},
|
|
76
44
|
{
|
|
77
45
|
choices: [],
|
|
78
46
|
default: 'askui_example',
|
|
@@ -18,7 +18,6 @@ export declare class CreateExampleProject {
|
|
|
18
18
|
private createAskUIHelperFromTemplate;
|
|
19
19
|
private setupTestFrameWork;
|
|
20
20
|
private static installTestFrameworkPackages;
|
|
21
|
-
private addUserCredentials;
|
|
22
21
|
private copyESLintConfigFiles;
|
|
23
22
|
private copyGitignore;
|
|
24
23
|
private copyTsConfigFile;
|
|
@@ -30,7 +30,7 @@ class CreateExampleProject {
|
|
|
30
30
|
this.projectRootDirectoryPath = process.cwd();
|
|
31
31
|
this.automationsDirectoryName = this.getAutomationsDirectoryName();
|
|
32
32
|
this.automationsDirectoryPath = path_1.default.join(this.projectRootDirectoryPath, this.automationsDirectoryName);
|
|
33
|
-
this.askUIControllerUrl = 'https://docs.askui.com/docs/
|
|
33
|
+
this.askUIControllerUrl = 'https://docs.askui.com/docs/suite/Components/AskUI-Development-Environment#askui-startcontroller-command';
|
|
34
34
|
this.helperTemplateConfig = {};
|
|
35
35
|
}
|
|
36
36
|
getAutomationsDirectoryName() {
|
|
@@ -131,10 +131,7 @@ class CreateExampleProject {
|
|
|
131
131
|
title: 'Create askui-helper.ts ',
|
|
132
132
|
task: () => __awaiter(this, void 0, void 0, function* () {
|
|
133
133
|
const askuiHelperTemplateFilePath = path_1.default.join((0, path_2.getPathToNodeModulesRoot)(), 'example_projects_templates', 'templates');
|
|
134
|
-
|
|
135
|
-
if (this.cliOptions.operatingSystem === 'windows') {
|
|
136
|
-
templateFileName = 'askui-helper-windows.nj';
|
|
137
|
-
}
|
|
134
|
+
const templateFileName = 'askui-helper.nj';
|
|
138
135
|
nunjucks_1.default.configure(askuiHelperTemplateFilePath, { autoescape: false });
|
|
139
136
|
const result = nunjucks_1.default.render(templateFileName, this.helperTemplateConfig);
|
|
140
137
|
const filePath = path_1.default.join(this.automationsDirectoryPath, 'helpers', 'askui-helper.ts');
|
|
@@ -193,24 +190,6 @@ class CreateExampleProject {
|
|
|
193
190
|
yield runCommand(frameworkDependencies.jest);
|
|
194
191
|
});
|
|
195
192
|
}
|
|
196
|
-
addUserCredentials() {
|
|
197
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
198
|
-
return [
|
|
199
|
-
{
|
|
200
|
-
/* eslint-disable sort-keys */
|
|
201
|
-
title: 'Add user credentials',
|
|
202
|
-
enabled: () => !this.cliOptions.skipCredentials,
|
|
203
|
-
task: () => __awaiter(this, void 0, void 0, function* () {
|
|
204
|
-
this.helperTemplateConfig['credentials'] = ` credentials: {
|
|
205
|
-
workspaceId: '${this.cliOptions.workspaceId}',
|
|
206
|
-
token: '${this.cliOptions.accessToken}',
|
|
207
|
-
},`;
|
|
208
|
-
}),
|
|
209
|
-
},
|
|
210
|
-
/* eslint-enable */
|
|
211
|
-
];
|
|
212
|
-
});
|
|
213
|
-
}
|
|
214
193
|
copyESLintConfigFiles() {
|
|
215
194
|
return __awaiter(this, void 0, void 0, function* () {
|
|
216
195
|
const esLintRcFilePath = path_1.default.join('example_projects_templates', 'typescript', '.eslintrc.json-template');
|
|
@@ -239,7 +218,7 @@ class CreateExampleProject {
|
|
|
239
218
|
}
|
|
240
219
|
copyGitignore() {
|
|
241
220
|
return __awaiter(this, void 0, void 0, function* () {
|
|
242
|
-
const gitignoreFilePath = path_1.default.join('example_projects_templates', 'typescript', '
|
|
221
|
+
const gitignoreFilePath = path_1.default.join('example_projects_templates', 'typescript', 'gitignore');
|
|
243
222
|
return [{
|
|
244
223
|
title: 'Copy .gitignore',
|
|
245
224
|
task: () => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -282,20 +261,14 @@ class CreateExampleProject {
|
|
|
282
261
|
...(yield this.copyESLintConfigFiles()),
|
|
283
262
|
...(yield this.copyGitignore()),
|
|
284
263
|
...(yield this.copyTsConfigFile()),
|
|
285
|
-
...(yield this.addUserCredentials()),
|
|
286
264
|
...(yield this.createAskUIHelperFromTemplate()),
|
|
287
265
|
]);
|
|
288
266
|
yield tasks.run();
|
|
289
267
|
/* eslint-disable no-console */
|
|
290
268
|
console.log(chalk_1.default.greenBright('\nCongratulations!'));
|
|
291
269
|
console.log(`askui example was created under ${chalk_1.default.gray(this.automationsDirectoryPath)}`);
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
console.log(`You can start your automation with this command ${chalk_1.default.green('AskUI-RunProject')}`);
|
|
295
|
-
}
|
|
296
|
-
else {
|
|
297
|
-
console.log(`You can start your automation with this command ${chalk_1.default.green('npm run askui')}`);
|
|
298
|
-
}
|
|
270
|
+
console.log(chalk_1.default.redBright(`\nPlease make sure the AskUI Controller is running: ${this.askUIControllerUrl}\n`));
|
|
271
|
+
console.log(`You can start your automation with this command ${chalk_1.default.green('AskUI-RunProject')}`);
|
|
299
272
|
/* eslint-enable no-console */
|
|
300
273
|
});
|
|
301
274
|
}
|
|
@@ -14,6 +14,10 @@ const ui_controller_darwin_1 = require("./ui-controller-darwin");
|
|
|
14
14
|
const ui_controller_linux_1 = require("./ui-controller-linux");
|
|
15
15
|
const ui_controller_win32_1 = require("./ui-controller-win32");
|
|
16
16
|
const download_binaries_1 = require("./download-binaries");
|
|
17
|
+
/**
|
|
18
|
+
* @deprecated Will be removed soon because the AskUI Controller
|
|
19
|
+
* gets started as an operating system service.
|
|
20
|
+
*/
|
|
17
21
|
class UiController {
|
|
18
22
|
constructor(args) {
|
|
19
23
|
this.args = args;
|
|
@@ -11,7 +11,6 @@ import inquirer from 'inquirer';
|
|
|
11
11
|
import { Command, Option } from 'commander';
|
|
12
12
|
import fs from 'fs-extra';
|
|
13
13
|
import { CreateExampleProject } from './create-example-project';
|
|
14
|
-
const nonEmpty = (subject) => (input) => input.trim().length > 0 || `${subject} is required.`;
|
|
15
14
|
/* eslint-disable sort-keys */
|
|
16
15
|
const questions = [
|
|
17
16
|
{
|
|
@@ -20,21 +19,6 @@ const questions = [
|
|
|
20
19
|
message: 'Which framework do you prefer?:',
|
|
21
20
|
choices: ['jest'],
|
|
22
21
|
},
|
|
23
|
-
{
|
|
24
|
-
type: 'input',
|
|
25
|
-
name: 'workspaceId',
|
|
26
|
-
message: 'Your workspace id:',
|
|
27
|
-
validate: nonEmpty('workspace id'),
|
|
28
|
-
when: (answers) => !answers.skipCredentials,
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
type: 'password',
|
|
32
|
-
name: 'accessToken',
|
|
33
|
-
message: 'Your access token:',
|
|
34
|
-
mask: '*',
|
|
35
|
-
validate: nonEmpty('access token'),
|
|
36
|
-
when: (answers) => !answers.skipCredentials,
|
|
37
|
-
},
|
|
38
22
|
{
|
|
39
23
|
type: 'confirm',
|
|
40
24
|
name: 'typescriptConfig',
|
|
@@ -51,22 +35,6 @@ const options = [
|
|
|
51
35
|
description: 'the test framework to use.',
|
|
52
36
|
option: '-f, --test-framework <value>',
|
|
53
37
|
},
|
|
54
|
-
{
|
|
55
|
-
choices: [],
|
|
56
|
-
default: false,
|
|
57
|
-
description: 'skip the credentials setup.',
|
|
58
|
-
option: '-sc, --skip-credentials',
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
choices: [],
|
|
62
|
-
description: 'a workspace id.',
|
|
63
|
-
option: '-w, --workspace-id <value>',
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
choices: [],
|
|
67
|
-
description: 'an access token for the workspace with the id.',
|
|
68
|
-
option: '-a, --access-token <value>',
|
|
69
|
-
},
|
|
70
38
|
{
|
|
71
39
|
choices: [],
|
|
72
40
|
default: 'askui_example',
|
|
@@ -18,7 +18,6 @@ export declare class CreateExampleProject {
|
|
|
18
18
|
private createAskUIHelperFromTemplate;
|
|
19
19
|
private setupTestFrameWork;
|
|
20
20
|
private static installTestFrameworkPackages;
|
|
21
|
-
private addUserCredentials;
|
|
22
21
|
private copyESLintConfigFiles;
|
|
23
22
|
private copyGitignore;
|
|
24
23
|
private copyTsConfigFile;
|
|
@@ -24,7 +24,7 @@ export class CreateExampleProject {
|
|
|
24
24
|
this.projectRootDirectoryPath = process.cwd();
|
|
25
25
|
this.automationsDirectoryName = this.getAutomationsDirectoryName();
|
|
26
26
|
this.automationsDirectoryPath = path.join(this.projectRootDirectoryPath, this.automationsDirectoryName);
|
|
27
|
-
this.askUIControllerUrl = 'https://docs.askui.com/docs/
|
|
27
|
+
this.askUIControllerUrl = 'https://docs.askui.com/docs/suite/Components/AskUI-Development-Environment#askui-startcontroller-command';
|
|
28
28
|
this.helperTemplateConfig = {};
|
|
29
29
|
}
|
|
30
30
|
getAutomationsDirectoryName() {
|
|
@@ -125,10 +125,7 @@ export class CreateExampleProject {
|
|
|
125
125
|
title: 'Create askui-helper.ts ',
|
|
126
126
|
task: () => __awaiter(this, void 0, void 0, function* () {
|
|
127
127
|
const askuiHelperTemplateFilePath = path.join(getPathToNodeModulesRoot(), 'example_projects_templates', 'templates');
|
|
128
|
-
|
|
129
|
-
if (this.cliOptions.operatingSystem === 'windows') {
|
|
130
|
-
templateFileName = 'askui-helper-windows.nj';
|
|
131
|
-
}
|
|
128
|
+
const templateFileName = 'askui-helper.nj';
|
|
132
129
|
nunjucks.configure(askuiHelperTemplateFilePath, { autoescape: false });
|
|
133
130
|
const result = nunjucks.render(templateFileName, this.helperTemplateConfig);
|
|
134
131
|
const filePath = path.join(this.automationsDirectoryPath, 'helpers', 'askui-helper.ts');
|
|
@@ -187,24 +184,6 @@ export class CreateExampleProject {
|
|
|
187
184
|
yield runCommand(frameworkDependencies.jest);
|
|
188
185
|
});
|
|
189
186
|
}
|
|
190
|
-
addUserCredentials() {
|
|
191
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
192
|
-
return [
|
|
193
|
-
{
|
|
194
|
-
/* eslint-disable sort-keys */
|
|
195
|
-
title: 'Add user credentials',
|
|
196
|
-
enabled: () => !this.cliOptions.skipCredentials,
|
|
197
|
-
task: () => __awaiter(this, void 0, void 0, function* () {
|
|
198
|
-
this.helperTemplateConfig['credentials'] = ` credentials: {
|
|
199
|
-
workspaceId: '${this.cliOptions.workspaceId}',
|
|
200
|
-
token: '${this.cliOptions.accessToken}',
|
|
201
|
-
},`;
|
|
202
|
-
}),
|
|
203
|
-
},
|
|
204
|
-
/* eslint-enable */
|
|
205
|
-
];
|
|
206
|
-
});
|
|
207
|
-
}
|
|
208
187
|
copyESLintConfigFiles() {
|
|
209
188
|
return __awaiter(this, void 0, void 0, function* () {
|
|
210
189
|
const esLintRcFilePath = path.join('example_projects_templates', 'typescript', '.eslintrc.json-template');
|
|
@@ -233,7 +212,7 @@ export class CreateExampleProject {
|
|
|
233
212
|
}
|
|
234
213
|
copyGitignore() {
|
|
235
214
|
return __awaiter(this, void 0, void 0, function* () {
|
|
236
|
-
const gitignoreFilePath = path.join('example_projects_templates', 'typescript', '
|
|
215
|
+
const gitignoreFilePath = path.join('example_projects_templates', 'typescript', 'gitignore');
|
|
237
216
|
return [{
|
|
238
217
|
title: 'Copy .gitignore',
|
|
239
218
|
task: () => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -276,20 +255,14 @@ export class CreateExampleProject {
|
|
|
276
255
|
...(yield this.copyESLintConfigFiles()),
|
|
277
256
|
...(yield this.copyGitignore()),
|
|
278
257
|
...(yield this.copyTsConfigFile()),
|
|
279
|
-
...(yield this.addUserCredentials()),
|
|
280
258
|
...(yield this.createAskUIHelperFromTemplate()),
|
|
281
259
|
]);
|
|
282
260
|
yield tasks.run();
|
|
283
261
|
/* eslint-disable no-console */
|
|
284
262
|
console.log(chalk.greenBright('\nCongratulations!'));
|
|
285
263
|
console.log(`askui example was created under ${chalk.gray(this.automationsDirectoryPath)}`);
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
console.log(`You can start your automation with this command ${chalk.green('AskUI-RunProject')}`);
|
|
289
|
-
}
|
|
290
|
-
else {
|
|
291
|
-
console.log(`You can start your automation with this command ${chalk.green('npm run askui')}`);
|
|
292
|
-
}
|
|
264
|
+
console.log(chalk.redBright(`\nPlease make sure the AskUI Controller is running: ${this.askUIControllerUrl}\n`));
|
|
265
|
+
console.log(`You can start your automation with this command ${chalk.green('AskUI-RunProject')}`);
|
|
293
266
|
/* eslint-enable no-console */
|
|
294
267
|
});
|
|
295
268
|
}
|
|
@@ -11,6 +11,10 @@ import { UiControllerDarwin } from './ui-controller-darwin';
|
|
|
11
11
|
import { UiControllerLinux } from './ui-controller-linux';
|
|
12
12
|
import { UiControllerWin32 } from './ui-controller-win32';
|
|
13
13
|
import { platform } from './download-binaries';
|
|
14
|
+
/**
|
|
15
|
+
* @deprecated Will be removed soon because the AskUI Controller
|
|
16
|
+
* gets started as an operating system service.
|
|
17
|
+
*/
|
|
14
18
|
export class UiController {
|
|
15
19
|
constructor(args) {
|
|
16
20
|
this.args = args;
|
|
@@ -1,27 +1,14 @@
|
|
|
1
|
-
import { UiControlClient
|
|
1
|
+
import { UiControlClient } from 'askui';
|
|
2
2
|
{{ allure_stepreporter_import }}
|
|
3
3
|
|
|
4
|
-
// Server for controlling the operating system
|
|
5
|
-
let uiController: UiController;
|
|
6
|
-
|
|
7
4
|
// Client is necessary to use the askui API
|
|
5
|
+
// eslint-disable-next-line import/no-mutable-exports
|
|
8
6
|
let aui: UiControlClient;
|
|
9
7
|
|
|
10
8
|
{{ timeout_placeholder }}
|
|
11
9
|
|
|
12
10
|
beforeAll(async () => {
|
|
13
|
-
uiController = new UiController({
|
|
14
|
-
/**
|
|
15
|
-
* Select the display you want to run your tests on, display 0 is your main display;
|
|
16
|
-
* ignore if you have only one display
|
|
17
|
-
*/
|
|
18
|
-
display: 0,
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
await uiController.start();
|
|
22
|
-
|
|
23
11
|
aui = await UiControlClient.build({
|
|
24
|
-
{{ credentials }}
|
|
25
12
|
{{ reporter_placeholder }}
|
|
26
13
|
});
|
|
27
14
|
|
|
@@ -43,8 +30,6 @@ afterEach(async () => {
|
|
|
43
30
|
|
|
44
31
|
afterAll(async () => {
|
|
45
32
|
aui.disconnect();
|
|
46
|
-
|
|
47
|
-
await uiController.stop();
|
|
48
33
|
});
|
|
49
34
|
|
|
50
35
|
export { aui };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
allure-results/
|
|
2
|
+
report/
|
|
3
|
+
xray-report/
|
|
4
|
+
|
|
5
|
+
.env
|
|
6
|
+
.vscode
|
|
7
|
+
|
|
8
|
+
# Dangerous (may contain secrets)
|
|
9
|
+
.npmrc
|
|
10
|
+
|
|
11
|
+
# Dependencies
|
|
12
|
+
/node_modules
|
|
13
|
+
|
|
14
|
+
# Caches
|
|
15
|
+
.npm
|
|
16
|
+
.eslintcache
|
|
17
|
+
|
|
18
|
+
# Misc
|
|
19
|
+
.DS_Store
|
|
20
|
+
|
|
21
|
+
# Logs
|
|
22
|
+
npm-debug.log*
|
|
23
|
+
yarn-debug.log*
|
|
24
|
+
yarn-error.log*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "askui",
|
|
3
|
-
"version": "0.20.
|
|
3
|
+
"version": "0.20.7",
|
|
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,36 +0,0 @@
|
|
|
1
|
-
import { UiControlClient } from 'askui';
|
|
2
|
-
{{ allure_stepreporter_import }}
|
|
3
|
-
|
|
4
|
-
// Client is necessary to use the askui API
|
|
5
|
-
// eslint-disable-next-line import/no-mutable-exports
|
|
6
|
-
let aui: UiControlClient;
|
|
7
|
-
|
|
8
|
-
{{ timeout_placeholder }}
|
|
9
|
-
|
|
10
|
-
beforeAll(async () => {
|
|
11
|
-
aui = await UiControlClient.build({
|
|
12
|
-
{{ credentials }}
|
|
13
|
-
{{ reporter_placeholder }}
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
await aui.connect();
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
beforeEach(async () => {
|
|
20
|
-
/* Uncomment to enable video recording
|
|
21
|
-
await aui.startVideoRecording();
|
|
22
|
-
*/
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
afterEach(async () => {
|
|
26
|
-
/* Uncomment to enable video recording
|
|
27
|
-
await aui.stopVideoRecording();
|
|
28
|
-
{{ allure_stepreporter_attach_video }}
|
|
29
|
-
*/
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
afterAll(async () => {
|
|
33
|
-
aui.disconnect();
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
export { aui };
|