askui 0.14.0 → 0.16.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.
Files changed (31) hide show
  1. package/README.md +1 -2
  2. package/dist/cjs/execution/read-credentials.d.ts +3 -0
  3. package/dist/cjs/execution/read-credentials.js +24 -0
  4. package/dist/cjs/execution/read-environment-credentials.js +1 -1
  5. package/dist/cjs/execution/ui-control-client-dependency-builder.js +3 -3
  6. package/dist/cjs/execution/ui-control-client.d.ts +0 -16
  7. package/dist/cjs/execution/ui-control-client.js +0 -24
  8. package/dist/cjs/lib/interactive_cli/{add-script-package-json.d.ts → add-remove-script-package-json.d.ts} +1 -0
  9. package/dist/cjs/lib/interactive_cli/{add-script-package-json.js → add-remove-script-package-json.js} +21 -2
  10. package/dist/cjs/lib/interactive_cli/cli-options-interface.d.ts +2 -2
  11. package/dist/cjs/lib/interactive_cli/cli.js +35 -38
  12. package/dist/cjs/lib/interactive_cli/create-example-project.d.ts +2 -5
  13. package/dist/cjs/lib/interactive_cli/create-example-project.js +51 -78
  14. package/dist/cjs/lib/logger.d.ts +1 -7
  15. package/dist/esm/execution/read-credentials.d.ts +3 -0
  16. package/dist/esm/execution/read-credentials.js +20 -0
  17. package/dist/esm/execution/read-environment-credentials.js +1 -1
  18. package/dist/esm/execution/ui-control-client-dependency-builder.js +3 -3
  19. package/dist/esm/execution/ui-control-client.d.ts +0 -16
  20. package/dist/esm/execution/ui-control-client.js +0 -24
  21. package/dist/esm/lib/interactive_cli/{add-script-package-json.d.ts → add-remove-script-package-json.d.ts} +1 -0
  22. package/dist/esm/lib/interactive_cli/{add-script-package-json.js → add-remove-script-package-json.js} +19 -1
  23. package/dist/esm/lib/interactive_cli/cli-options-interface.d.ts +2 -2
  24. package/dist/esm/lib/interactive_cli/cli.js +35 -38
  25. package/dist/esm/lib/interactive_cli/create-example-project.d.ts +2 -5
  26. package/dist/esm/lib/interactive_cli/create-example-project.js +50 -77
  27. package/dist/esm/lib/logger.d.ts +1 -7
  28. package/dist/example_projects_templates/templates/askui-helper-windows.nj +1 -4
  29. package/dist/example_projects_templates/templates/askui-helper.nj +1 -4
  30. package/package.json +10 -10
  31. package/dist/example_projects_templates/configs/jasmine.config.json +0 -12
@@ -10,11 +10,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  import { HttpClientGot } from '../utils/http/http-client-got';
11
11
  import { UiControllerClient } from './ui-controller-client';
12
12
  import { InferenceClient } from './inference-client';
13
- import { envCredentials } from './read-environment-credentials';
14
13
  import { Analytics } from '../utils/analytics';
15
14
  import { envProxyAgents } from '../utils/proxy/proxy-builder';
16
15
  import { ExecutionRuntime } from './execution-runtime';
17
16
  import { StepReporter } from '../core/reporting';
17
+ import { readCredentials } from './read-credentials';
18
18
  export class UiControlClientDependencyBuilder {
19
19
  static buildHttpClient(clientArgs) {
20
20
  var _a;
@@ -47,9 +47,9 @@ export class UiControlClientDependencyBuilder {
47
47
  });
48
48
  }
49
49
  static getClientArgsWithDefaults(clientArgs) {
50
- var _a, _b, _c, _d;
50
+ var _a, _b, _c;
51
51
  return __awaiter(this, void 0, void 0, function* () {
52
- return Object.assign(Object.assign({}, clientArgs), { uiControllerUrl: (_a = clientArgs.uiControllerUrl) !== null && _a !== void 0 ? _a : 'http://127.0.0.1:6769', inferenceServerUrl: (_b = clientArgs.inferenceServerUrl) !== null && _b !== void 0 ? _b : 'https://inference.askui.com', credentials: (_c = clientArgs.credentials) !== null && _c !== void 0 ? _c : envCredentials(), proxyAgents: (_d = clientArgs.proxyAgents) !== null && _d !== void 0 ? _d : yield envProxyAgents() });
52
+ return Object.assign(Object.assign({}, clientArgs), { uiControllerUrl: (_a = clientArgs.uiControllerUrl) !== null && _a !== void 0 ? _a : 'http://127.0.0.1:6769', inferenceServerUrl: (_b = clientArgs.inferenceServerUrl) !== null && _b !== void 0 ? _b : 'https://inference.askui.com', credentials: readCredentials(clientArgs), proxyAgents: (_c = clientArgs.proxyAgents) !== null && _c !== void 0 ? _c : (yield envProxyAgents()) });
53
53
  });
54
54
  }
55
55
  }
@@ -141,22 +141,6 @@ export declare class UiControlClient extends ApiCommands {
141
141
  * @param {string} description
142
142
  */
143
143
  clickIcon(description: string): Promise<void>;
144
- /**
145
- * Drags element1 to element2.
146
- *
147
- * Both must be a `moveMouse()` or `moveMouseTo()`
148
- * instruction as in the example below.
149
- *
150
- * Usage example:
151
- * dragTo(
152
- * aui.moveMouseTo().text('AskUI'),
153
- * aui.moveMouseTo().text('UI Automation')
154
- * )
155
- *
156
- * @param {Executable} element1
157
- * @param {Executable} element2
158
- */
159
- dragTo(element1: Executable, element2: Executable): Promise<void>;
160
144
  /**
161
145
  * Wait until an AskUICommand does not fail.
162
146
  *
@@ -304,30 +304,6 @@ export class UiControlClient extends ApiCommands {
304
304
  yield this.click().icon().matching(description).exec();
305
305
  });
306
306
  }
307
- /**
308
- * Drags element1 to element2.
309
- *
310
- * Both must be a `moveMouse()` or `moveMouseTo()`
311
- * instruction as in the example below.
312
- *
313
- * Usage example:
314
- * dragTo(
315
- * aui.moveMouseTo().text('AskUI'),
316
- * aui.moveMouseTo().text('UI Automation')
317
- * )
318
- *
319
- * @param {Executable} element1
320
- * @param {Executable} element2
321
- */
322
- dragTo(element1, element2) {
323
- return __awaiter(this, void 0, void 0, function* () {
324
- yield element1.exec();
325
- yield this.mouseLeftClick().exec();
326
- yield this.mouseToggleDown().exec();
327
- yield element2.exec();
328
- yield this.mouseToggleUp().exec();
329
- });
330
- }
331
307
  /**
332
308
  * Wait until an AskUICommand does not fail.
333
309
  *
@@ -1 +1,2 @@
1
1
  export declare function addScript(filePath: string, name: string, command: string): Promise<void>;
2
+ export declare function removeScript(filePath: string, name: string): Promise<void>;
@@ -24,7 +24,25 @@ export function addScript(filePath, name, command) {
24
24
  yield fs.writeFile(filePath, jsonString, 'utf8');
25
25
  }
26
26
  catch (error) {
27
- logger.error(`Could write script '${command}' in file '${filePath}'`);
27
+ logger.error(`Could not write script '${command}' in file '${filePath}'`);
28
+ logger.error(error.message);
29
+ }
30
+ });
31
+ }
32
+ export function removeScript(filePath, name) {
33
+ return __awaiter(this, void 0, void 0, function* () {
34
+ try {
35
+ const data = yield fs.readFile(filePath, 'utf8');
36
+ const jsonData = JSON.parse(data);
37
+ if (jsonData.scripts === undefined) {
38
+ return;
39
+ }
40
+ delete jsonData.scripts[name];
41
+ const jsonString = JSON.stringify(jsonData, null, 2);
42
+ yield fs.writeFile(filePath, jsonString, 'utf8');
43
+ }
44
+ catch (error) {
45
+ logger.error(`Could not remove script '${name}' in file '${filePath}'`);
28
46
  logger.error(error.message);
29
47
  }
30
48
  });
@@ -1,8 +1,8 @@
1
1
  export interface CliOptions {
2
+ skipCredentials: boolean;
2
3
  operatingSystem: 'windows' | 'linux' | 'macos';
3
4
  workspaceId: string;
4
5
  accessToken: string;
5
- testFramework: 'jasmine' | 'jest';
6
- usingProxy: boolean;
6
+ testFramework: 'jest';
7
7
  typescriptConfig: boolean;
8
8
  }
@@ -9,65 +9,65 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  };
10
10
  import inquirer from 'inquirer';
11
11
  import { Command, Option } from 'commander';
12
+ import fs from 'fs-extra';
12
13
  import { CreateExampleProject } from './create-example-project';
13
- const nonEmpty = (subject) => (input) => (input.trim().length > 0) || `${subject} is required.`;
14
+ const nonEmpty = (subject) => (input) => input.trim().length > 0 || `${subject} is required.`;
14
15
  const questions = [
15
16
  {
16
17
  type: 'list',
17
18
  name: 'testFramework',
18
- message: 'Which framework do you prefer',
19
- choices: ['jest', 'jasmine'],
19
+ message: 'Which framework do you prefer?:',
20
+ choices: ['jest'],
20
21
  },
21
22
  {
22
23
  type: 'input',
23
24
  name: 'workspaceId',
24
- message: 'Your workspace id',
25
+ message: 'Your workspace id:',
25
26
  validate: nonEmpty('workspace id'),
27
+ when: (answers) => !answers.skipCredentials,
26
28
  },
27
29
  {
28
30
  type: 'password',
29
31
  name: 'accessToken',
30
- message: 'Your access token',
32
+ message: 'Your access token:',
31
33
  mask: '*',
32
34
  validate: nonEmpty('access token'),
33
- },
34
- {
35
- type: 'confirm',
36
- name: 'usingProxy',
37
- message: 'Are you using a proxy?',
38
- default: false,
35
+ when: (answers) => !answers.skipCredentials,
39
36
  },
40
37
  {
41
38
  type: 'confirm',
42
39
  name: 'typescriptConfig',
43
- message: 'Do you want to add the tsconfig.json file? This action will overwrite the file if it exists. Default True ',
44
- default: true,
40
+ message: 'Do you want to overwrite the tsconfig.json file? Default No:',
41
+ default: false,
42
+ when: (_answers) => fs.existsSync('tsconfig.json'),
45
43
  },
46
44
  ];
47
45
  const options = [
48
46
  {
49
47
  option: '-f, --test-framework <value>',
50
- choices: ['jasmine', 'jest'],
51
- description: 'the test framework to use',
48
+ choices: ['jest'],
49
+ description: 'the test framework to use.',
50
+ default: 'jest',
52
51
  },
53
52
  {
54
- option: '-w, --workspace-id <value>',
53
+ option: '-sc, --skip-credentials',
55
54
  choices: [],
56
- description: 'a workspace id',
55
+ description: 'skip the credentials setup.',
56
+ default: false,
57
57
  },
58
58
  {
59
- option: '-a, --access-token <value>',
59
+ option: '-w, --workspace-id <value>',
60
60
  choices: [],
61
- description: 'an access token for the workspace with the id',
61
+ description: 'a workspace id.',
62
62
  },
63
63
  {
64
- option: '-p, --using-proxy <value>',
65
- choices: ['true', 'false'],
66
- description: 'use a proxy',
64
+ option: '-a, --access-token <value>',
65
+ choices: [],
66
+ description: 'an access token for the workspace with the id.',
67
67
  },
68
68
  {
69
- option: '-t, --typescript-config <value>',
70
- choices: ['true', 'false'],
69
+ option: '-t, --typescript-config',
70
+ choices: [],
71
71
  description: 'overwrite tsconfig.json flag',
72
72
  },
73
73
  ];
@@ -80,29 +80,26 @@ export function init(argv) {
80
80
  const args = argv || process.argv;
81
81
  const program = createProgram();
82
82
  const programInit = program.command('init');
83
- programInit.description('Creates a askui example project');
83
+ // To Ensure Backwards Compatibility
84
+ programInit.allowUnknownOption(true);
85
+ programInit.description('Creates an AskUI example project:');
84
86
  // Loop through the options object and register each option with the program
85
87
  options.forEach((opt) => {
86
88
  const tempOption = new Option(opt.option, opt.description);
87
89
  if (opt.choices.length > 0) {
88
90
  tempOption.choices(opt.choices);
89
91
  }
92
+ if (opt.default) {
93
+ tempOption.default(opt.default);
94
+ }
90
95
  programInit.addOption(tempOption);
91
96
  });
92
- programInit.usage('[-f test_framework] [-w workspace_id] [-a access_token] [-p boolean] [-t boolean]');
93
- programInit
94
- .action((_opts) => __awaiter(this, void 0, void 0, function* () {
97
+ programInit.usage('[options]');
98
+ programInit.action((_opts) => __awaiter(this, void 0, void 0, function* () {
95
99
  const userAnswers = programInit.opts();
96
- // Check which options are missing and prompt the user for them
97
- const missingOptions = questions.filter((entry) => !(entry.name in userAnswers));
98
- if (missingOptions.length > 0) {
99
- inquirer.prompt(missingOptions).then((answers) => __awaiter(this, void 0, void 0, function* () {
100
- yield new CreateExampleProject(Object.assign(Object.assign({}, userAnswers), answers)).createExampleProject();
101
- }));
102
- }
103
- else {
104
- yield new CreateExampleProject(userAnswers).createExampleProject();
105
- }
100
+ inquirer.prompt(questions, userAnswers).then((answers) => __awaiter(this, void 0, void 0, function* () {
101
+ yield new CreateExampleProject(Object.assign(Object.assign({}, userAnswers), answers)).createExampleProject();
102
+ }));
106
103
  }));
107
104
  return program.parse(args);
108
105
  }
@@ -4,8 +4,7 @@ export declare class CreateExampleProject {
4
4
  private distexampleFolderPath;
5
5
  private exampleFolderName;
6
6
  private baseDirPath;
7
- private proxyDocUrl;
8
- private remoteDeviceControllerUrl;
7
+ private askUIControllerUrl;
9
8
  private helperTemplateConfig;
10
9
  constructor(cliOptions: CliOptions);
11
10
  private copyTemplateProject;
@@ -16,11 +15,9 @@ export declare class CreateExampleProject {
16
15
  private addESLintRunCommand;
17
16
  private createAskUIHelperFromTemplate;
18
17
  private setupTestFrameWork;
19
- private installTestFrameworkPackages;
18
+ private static installTestFrameworkPackages;
20
19
  private addUserCredentials;
21
20
  private copyESLintConfigFiles;
22
21
  private copyTsConfigFile;
23
- private installProxy;
24
- private normalizeCliOptions;
25
22
  createExampleProject(): Promise<void>;
26
23
  }
@@ -15,15 +15,14 @@ import Listr from 'listr';
15
15
  import chalk from 'chalk';
16
16
  import nunjucks from 'nunjucks';
17
17
  import { getPathToNodeModulesRoot } from '../../utils/path';
18
- import { addScript } from './add-script-package-json';
18
+ import { addScript, removeScript } from './add-remove-script-package-json';
19
19
  export class CreateExampleProject {
20
20
  constructor(cliOptions) {
21
21
  this.cliOptions = cliOptions;
22
22
  this.baseDirPath = process.cwd();
23
23
  this.exampleFolderName = 'askui_example';
24
24
  this.distexampleFolderPath = path.join(this.baseDirPath, this.exampleFolderName);
25
- this.proxyDocUrl = 'https://docs.askui.com/docs/general/Troubleshooting/proxy';
26
- this.remoteDeviceControllerUrl = 'https://docs.askui.com/docs/api/Remote-Device-Controller';
25
+ this.askUIControllerUrl = 'https://docs.askui.com/docs/general/Components/AskUI-Controller';
27
26
  this.helperTemplateConfig = {};
28
27
  }
29
28
  copyTemplateProject() {
@@ -58,7 +57,11 @@ export class CreateExampleProject {
58
57
  },
59
58
  {
60
59
  title: 'Install askui dependency',
61
- task: () => __awaiter(this, void 0, void 0, function* () { return runCommand('npm i -D askui '); }),
60
+ task: () => __awaiter(this, void 0, void 0, function* () {
61
+ yield runCommand('npm init -y');
62
+ yield removeScript(`${this.baseDirPath}/package.json`, 'test');
63
+ yield runCommand('npm i -D askui ');
64
+ }),
62
65
  },
63
66
  ];
64
67
  });
@@ -67,38 +70,33 @@ export class CreateExampleProject {
67
70
  return __awaiter(this, void 0, void 0, function* () {
68
71
  const frameworkConfigs = {
69
72
  jest: 'jest.config.ts',
70
- jasmine: 'jasmine.config.json',
71
73
  };
72
- const configFilePath = path.join(getPathToNodeModulesRoot(), 'example_projects_templates', 'configs', frameworkConfigs[this.cliOptions.testFramework]);
73
- yield fs.copyFile(configFilePath, path.join(this.distexampleFolderPath, frameworkConfigs[this.cliOptions.testFramework]));
74
+ const configFilePath = path.join(getPathToNodeModulesRoot(), 'example_projects_templates', 'configs', frameworkConfigs.jest);
75
+ yield fs.copyFile(configFilePath, path.join(this.distexampleFolderPath, frameworkConfigs.jest));
74
76
  });
75
77
  }
76
78
  addTestFrameWorkTimeout() {
77
79
  return __awaiter(this, void 0, void 0, function* () {
78
80
  const frameworkTimeoutstring = {
79
81
  jest: 'jest.setTimeout(60 * 1000 * 60);',
80
- jasmine: 'jasmine.DEFAULT_TIMEOUT_INTERVAL = 60 * 1000 * 60;',
81
82
  };
82
- this.helperTemplateConfig['timeout_placeholder'] = frameworkTimeoutstring[this.cliOptions.testFramework];
83
+ this.helperTemplateConfig['timeout_placeholder'] = frameworkTimeoutstring.jest;
83
84
  });
84
85
  }
85
86
  addReporterConfig() {
86
87
  return __awaiter(this, void 0, void 0, function* () {
87
- if (this.cliOptions.testFramework === 'jest') {
88
- this.helperTemplateConfig['allure_stepreporter_import'] = "import { AskUIAllureStepReporter } from '@askui/askui-reporters';";
89
- this.helperTemplateConfig['reporter_placeholder'] = 'reporter: new AskUIAllureStepReporter(),';
90
- this.helperTemplateConfig['allure_stepreporter_attach_video'] = `const video = await aui.readVideoRecording();
88
+ this.helperTemplateConfig['allure_stepreporter_import'] = "import { AskUIAllureStepReporter } from '@askui/askui-reporters';";
89
+ this.helperTemplateConfig['reporter_placeholder'] = 'reporter: new AskUIAllureStepReporter(),';
90
+ this.helperTemplateConfig['allure_stepreporter_attach_video'] = `const video = await aui.readVideoRecording();
91
91
  await AskUIAllureStepReporter.attachVideo(video);`;
92
- }
93
92
  });
94
93
  }
95
94
  addAskuiRunCommand() {
96
95
  return __awaiter(this, void 0, void 0, function* () {
97
96
  const frameworkExecutionCommand = {
98
97
  jest: `jest --config ./${this.exampleFolderName}/jest.config.ts --runInBand`,
99
- jasmine: `jasmine --config=${this.exampleFolderName}/jasmine.config.json`,
100
98
  };
101
- yield addScript(`${this.baseDirPath}/package.json`, 'askui', frameworkExecutionCommand[this.cliOptions.testFramework]);
99
+ yield addScript(`${this.baseDirPath}/package.json`, 'askui', frameworkExecutionCommand.jest);
102
100
  });
103
101
  }
104
102
  addESLintRunCommand() {
@@ -141,8 +139,8 @@ export class CreateExampleProject {
141
139
  task: () => __awaiter(this, void 0, void 0, function* () {
142
140
  return new Listr([
143
141
  {
144
- title: `Install ${this.cliOptions.testFramework}`,
145
- task: () => __awaiter(this, void 0, void 0, function* () { return this.installTestFrameworkPackages(); }),
142
+ title: 'Install jest',
143
+ task: () => __awaiter(this, void 0, void 0, function* () { return CreateExampleProject.installTestFrameworkPackages(); }),
146
144
  },
147
145
  {
148
146
  title: 'Copy config file',
@@ -153,7 +151,7 @@ export class CreateExampleProject {
153
151
  task: () => __awaiter(this, void 0, void 0, function* () { return this.addTestFrameWorkTimeout(); }),
154
152
  },
155
153
  {
156
- title: 'Add reporter (only Jest)',
154
+ title: 'Add reporter',
157
155
  task: () => __awaiter(this, void 0, void 0, function* () { return this.addReporterConfig(); }),
158
156
  },
159
157
  {
@@ -169,33 +167,29 @@ export class CreateExampleProject {
169
167
  }];
170
168
  });
171
169
  }
172
- installTestFrameworkPackages() {
170
+ static installTestFrameworkPackages() {
173
171
  return __awaiter(this, void 0, void 0, function* () {
174
172
  const runCommand = promisify(exec);
175
- const frameworkDepencies = {
176
- jest: 'npm i -D @askui/askui-reporters typescript ts-node @types/jest ts-jest jest @askui/jest-allure-circus eslint @typescript-eslint/parser @typescript-eslint/eslint-plugin eslint-plugin-import eslint-plugin-askui',
177
- jasmine: 'npm i -D @askui/askui-reporters typescript ts-node @types/jasmine jasmine @typescript-eslint/parser @typescript-eslint/eslint-plugin eslint-plugin-import eslint-plugin-askui',
173
+ const frameworkDependencies = {
174
+ jest: 'npm i -D @askui/askui-reporters typescript ts-node @types/jest ts-jest jest @askui/jest-allure-circus eslint @typescript-eslint/parser @typescript-eslint/eslint-plugin eslint-plugin-import eslint-plugin-askui hpagent',
178
175
  };
179
- yield runCommand(frameworkDepencies[this.cliOptions.testFramework]);
176
+ yield runCommand(frameworkDependencies.jest);
180
177
  });
181
178
  }
182
179
  addUserCredentials() {
183
180
  return __awaiter(this, void 0, void 0, function* () {
184
- return [{
181
+ return [
182
+ {
185
183
  title: 'Add user credentials',
184
+ enabled: () => !this.cliOptions.skipCredentials,
186
185
  task: () => __awaiter(this, void 0, void 0, function* () {
187
- return new Listr([
188
- {
189
- title: 'Add workspace id ',
190
- task: () => __awaiter(this, void 0, void 0, function* () { this.helperTemplateConfig['workspace_id'] = this.cliOptions.workspaceId; }),
191
- },
192
- {
193
- title: 'Add access token',
194
- task: () => __awaiter(this, void 0, void 0, function* () { this.helperTemplateConfig['access_token'] = this.cliOptions.accessToken; }),
195
- },
196
- ]);
186
+ this.helperTemplateConfig['credentials'] = ` credentials: {
187
+ workspaceId: '${this.cliOptions.workspaceId}',
188
+ token: '${this.cliOptions.accessToken}',
189
+ },`;
197
190
  }),
198
- }];
191
+ },
192
+ ];
199
193
  });
200
194
  }
201
195
  copyESLintConfigFiles() {
@@ -220,68 +214,47 @@ export class CreateExampleProject {
220
214
  },
221
215
  ]);
222
216
  }),
223
- }];
217
+ },
218
+ ];
224
219
  });
225
220
  }
226
221
  copyTsConfigFile() {
227
222
  return __awaiter(this, void 0, void 0, function* () {
228
223
  const tsConfigFilePath = path.join('example_projects_templates', 'typescript', 'tsconfig.json');
229
- return [{
224
+ const tsConfigTargetFilePath = path.join(this.baseDirPath, 'tsconfig.json');
225
+ return [
226
+ {
230
227
  title: 'Copy ts config file',
231
- enabled: () => this.cliOptions.typescriptConfig,
228
+ enabled: () => this.cliOptions.typescriptConfig || !fs.existsSync(tsConfigTargetFilePath),
232
229
  task: () => __awaiter(this, void 0, void 0, function* () {
233
- return fs.copyFile(path.join(getPathToNodeModulesRoot(), tsConfigFilePath), path.join(this.baseDirPath, 'tsconfig.json'));
230
+ return fs.copyFile(path.join(getPathToNodeModulesRoot(), tsConfigFilePath), tsConfigTargetFilePath);
234
231
  }),
235
- }];
236
- });
237
- }
238
- installProxy() {
239
- return __awaiter(this, void 0, void 0, function* () {
240
- const runCommand = promisify(exec);
241
- return [{
242
- title: 'Install Proxy',
243
- enabled: () => this.cliOptions.usingProxy,
244
- task: () => __awaiter(this, void 0, void 0, function* () { return runCommand('npm install --save-dev hpagent '); }),
245
- }];
232
+ },
233
+ ];
246
234
  });
247
235
  }
248
- normalizeCliOptions() {
249
- let useProxy = this.cliOptions.usingProxy;
250
- if (typeof useProxy !== 'boolean') {
251
- useProxy = (useProxy === 'true');
252
- }
253
- this.cliOptions.usingProxy = useProxy;
254
- let { typescriptConfig } = this.cliOptions;
255
- if (typeof typescriptConfig !== 'boolean') {
256
- typescriptConfig = (typescriptConfig === 'true');
257
- }
258
- this.cliOptions.typescriptConfig = typescriptConfig;
259
- }
260
236
  createExampleProject() {
261
237
  return __awaiter(this, void 0, void 0, function* () {
262
238
  const tasks = new Listr();
263
- this.normalizeCliOptions();
264
239
  tasks.add([
265
- ...yield this.copyTemplateProject(),
266
- ...yield this.setupTestFrameWork(),
267
- ...yield this.copyESLintConfigFiles(),
268
- ...yield this.copyTsConfigFile(),
269
- ...yield this.addUserCredentials(),
270
- ...yield this.createAskUIHelperFromTemplate(),
271
- ...yield this.installProxy(),
240
+ ...(yield this.copyTemplateProject()),
241
+ ...(yield this.setupTestFrameWork()),
242
+ ...(yield this.copyESLintConfigFiles()),
243
+ ...(yield this.copyTsConfigFile()),
244
+ ...(yield this.addUserCredentials()),
245
+ ...(yield this.createAskUIHelperFromTemplate()),
272
246
  ]);
273
247
  yield tasks.run();
274
248
  /* eslint-disable no-console */
275
- if (this.cliOptions.usingProxy) {
276
- console.log(chalk.redBright('Since you are using a Proxy. Please don\'t forget to configure it!'));
277
- console.log(chalk.gray(`You can find more information under ${this.proxyDocUrl}`));
278
- }
279
249
  console.log(chalk.greenBright('\nCongratulations!'));
280
250
  console.log(`askui example was created under ${chalk.gray(this.distexampleFolderPath)}`);
281
251
  if (this.cliOptions.operatingSystem === 'windows') {
282
- console.log(chalk.redBright(`\nPlease install and start the Remote Device Controller: ${this.remoteDeviceControllerUrl}\n`));
252
+ console.log(chalk.redBright(`\nPlease make sure the AskUI Controller is running: ${this.askUIControllerUrl}\n`));
253
+ console.log(`You can start your automation with this command ${chalk.green('AskUI-RunProject')}`);
254
+ }
255
+ else {
256
+ console.log(`You can start your automation with this command ${chalk.green('npm run askui')}`);
283
257
  }
284
- console.log(`You can start your automation with this command ${chalk.green('npm run askui')}`);
285
258
  /* eslint-enable no-console */
286
259
  });
287
260
  }
@@ -1,8 +1,2 @@
1
- declare const logger: import("pino").Logger<{
2
- name: string;
3
- level: string;
4
- customLevels: {
5
- verbose: number;
6
- };
7
- }>;
1
+ declare const logger: import("pino").Logger<"verbose">;
8
2
  export { logger };
@@ -9,10 +9,7 @@ let aui: UiControlClient;
9
9
 
10
10
  beforeAll(async () => {
11
11
  aui = await UiControlClient.build({
12
- credentials: {
13
- workspaceId: '{{ workspace_id}}',
14
- token: '{{ access_token }}',
15
- },
12
+ {{ credentials }}
16
13
  {{ reporter_placeholder }}
17
14
  });
18
15
 
@@ -21,10 +21,7 @@ beforeAll(async () => {
21
21
  await uiController.start();
22
22
 
23
23
  aui = await UiControlClient.build({
24
- credentials: {
25
- workspaceId: '{{ workspace_id}}',
26
- token: '{{ access_token }}',
27
- },
24
+ {{ credentials }}
28
25
  {{ reporter_placeholder }}
29
26
  });
30
27
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "askui",
3
- "version": "0.14.0",
3
+ "version": "0.16.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",
@@ -59,9 +59,9 @@
59
59
  "listr": "0.14.3",
60
60
  "lodash": "^4.17.21",
61
61
  "node-machine-id": "1.1.12",
62
- "nunjucks": "^3.2.4",
63
- "pino": "7.8.1",
64
- "pino-pretty": "7.5.3",
62
+ "nunjucks": "3.2.4",
63
+ "pino": "8.19.0",
64
+ "pino-pretty": "10.3.1",
65
65
  "tough-cookie": "^4.1.3",
66
66
  "url-join": "4.0.1",
67
67
  "wait-port": "0.2.9",
@@ -69,24 +69,24 @@
69
69
  "yup": "0.32.11"
70
70
  },
71
71
  "devDependencies": {
72
+ "@types/url-join": "4.0.1",
72
73
  "@types/fs-extra": "9.0.13",
73
74
  "@types/inquirer": "9.0.3",
74
- "@types/jest": "27.4.0",
75
+ "@types/jest": "29.5.12",
75
76
  "@types/jsdom": "20.0.0",
76
- "@types/listr": "0.14.4",
77
+ "@types/listr": "0.14.9",
77
78
  "@types/node": "17.0.10",
78
- "@types/nunjucks": "^3.2.5",
79
+ "@types/nunjucks": "3.2.5",
79
80
  "@types/sharp": "0.30.4",
80
- "@types/url-join": "4.0.1",
81
81
  "@types/webrtc": "0.0.30",
82
82
  "@types/ws": "7.4.4",
83
83
  "hpagent": "^1.2.0",
84
- "jest": "28.1.1",
84
+ "jest": "29.7.0",
85
85
  "jest-extended": "^4.0.1",
86
86
  "proxy": "^1.0.2",
87
87
  "proxy-agent": "^6.3.1",
88
88
  "shx": "0.3.4",
89
- "ts-jest": "28.0.4",
89
+ "ts-jest": "29.1.2",
90
90
  "typescript": "4.5.4"
91
91
  },
92
92
  "lint-staged": {
@@ -1,12 +0,0 @@
1
- {
2
- "spec_dir": "askui_example",
3
- "spec_files": [
4
- "**/*[sS]pec.ts",
5
- "**/*[tT]est.ts"
6
- ],
7
- "helpers": [
8
- "../node_modules/ts-node/register/type-check.js",
9
- "./helpers/askui-helper.ts"
10
- ],
11
- "random": false
12
- }