askui 0.13.0 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/dist/cjs/execution/ui-control-client.d.ts +86 -5
  2. package/dist/cjs/execution/ui-control-client.js +141 -0
  3. package/dist/cjs/lib/interactive_cli/create-example-project.d.ts +1 -1
  4. package/dist/cjs/lib/interactive_cli/create-example-project.js +6 -4
  5. package/dist/esm/execution/ui-control-client.d.ts +86 -5
  6. package/dist/esm/execution/ui-control-client.js +141 -0
  7. package/dist/esm/lib/interactive_cli/create-example-project.d.ts +1 -1
  8. package/dist/esm/lib/interactive_cli/create-example-project.js +6 -4
  9. package/package.json +4 -4
  10. package/dist/cjs/core/model/test-case-dto/custom-element-json.d.ts +0 -75
  11. package/dist/cjs/core/model/test-case-dto/custom-element-json.js +0 -2
  12. package/dist/cjs/core/model/test-case-dto/custom-element.d.ts +0 -21
  13. package/dist/cjs/core/model/test-case-dto/custom-element.js +0 -54
  14. package/dist/cjs/core/model/test-case-dto/index.d.ts +0 -3
  15. package/dist/cjs/core/model/test-case-dto/index.js +0 -5
  16. package/dist/cjs/core/model/test-case-dto/test-step.d.ts +0 -6
  17. package/dist/cjs/core/model/test-case-dto/test-step.js +0 -2
  18. package/dist/cjs/core/model/test-case-result-dto/index.d.ts +0 -2
  19. package/dist/cjs/core/model/test-case-result-dto/index.js +0 -7
  20. package/dist/cjs/core/model/test-case-result-dto/test-step-result-dto.d.ts +0 -9
  21. package/dist/cjs/core/model/test-case-result-dto/test-step-result-dto.js +0 -16
  22. package/dist/cjs/core/model/test-case-result-dto/test-step-state.d.ts +0 -4
  23. package/dist/cjs/core/model/test-case-result-dto/test-step-state.js +0 -8
  24. package/dist/cjs/core/reporting/default-reporter.d.ts +0 -10
  25. package/dist/cjs/core/reporting/default-reporter.js +0 -12
  26. package/dist/cjs/execution/annotation-level.d.ts +0 -5
  27. package/dist/cjs/execution/annotation-level.js +0 -9
  28. package/dist/cjs/execution/ui-control-client-error.d.ts +0 -2
  29. package/dist/cjs/execution/ui-control-client-error.js +0 -6
  30. package/dist/cjs/lib/copy-example-project.d.ts +0 -2
  31. package/dist/cjs/lib/copy-example-project.js +0 -65
  32. package/dist/cjs/lib/interactive_cli/replace-string-in-file.d.ts +0 -1
  33. package/dist/cjs/lib/interactive_cli/replace-string-in-file.js +0 -31
  34. package/dist/esm/core/model/test-case-dto/custom-element-json.d.ts +0 -75
  35. package/dist/esm/core/model/test-case-dto/custom-element-json.js +0 -1
  36. package/dist/esm/core/model/test-case-dto/custom-element.d.ts +0 -21
  37. package/dist/esm/core/model/test-case-dto/custom-element.js +0 -50
  38. package/dist/esm/core/model/test-case-dto/index.d.ts +0 -3
  39. package/dist/esm/core/model/test-case-dto/index.js +0 -1
  40. package/dist/esm/core/model/test-case-dto/test-step.d.ts +0 -6
  41. package/dist/esm/core/model/test-case-dto/test-step.js +0 -1
  42. package/dist/esm/core/model/test-case-result-dto/index.d.ts +0 -2
  43. package/dist/esm/core/model/test-case-result-dto/index.js +0 -2
  44. package/dist/esm/core/model/test-case-result-dto/test-step-result-dto.d.ts +0 -9
  45. package/dist/esm/core/model/test-case-result-dto/test-step-result-dto.js +0 -12
  46. package/dist/esm/core/model/test-case-result-dto/test-step-state.d.ts +0 -4
  47. package/dist/esm/core/model/test-case-result-dto/test-step-state.js +0 -5
  48. package/dist/esm/core/reporting/default-reporter.d.ts +0 -10
  49. package/dist/esm/core/reporting/default-reporter.js +0 -9
  50. package/dist/esm/execution/annotation-level.d.ts +0 -5
  51. package/dist/esm/execution/annotation-level.js +0 -6
  52. package/dist/esm/execution/ui-control-client-error.d.ts +0 -2
  53. package/dist/esm/execution/ui-control-client-error.js +0 -2
  54. package/dist/esm/lib/copy-example-project.d.ts +0 -2
  55. package/dist/esm/lib/copy-example-project.js +0 -58
  56. package/dist/esm/lib/interactive_cli/replace-string-in-file.d.ts +0 -1
  57. package/dist/esm/lib/interactive_cli/replace-string-in-file.js +0 -24
  58. package/dist/example_projects_templates/typescript/.eslintignore +0 -1
  59. package/dist/example_projects_templates/typescript/.eslintrc.json +0 -20
  60. package/dist/example_projects_templates/typescript/askui_example/helpers/askui-helper.ts +0 -39
  61. package/dist/example_projects_templates/typescript_jest/test/README.md +0 -21
  62. package/dist/example_projects_templates/typescript_jest/test/helper/jest.setup.ts +0 -51
  63. package/dist/example_projects_templates/typescript_jest/test/jest.config.ts +0 -13
  64. package/dist/example_projects_templates/typescript_jest/test/my-first-askui-test-suite.test.ts +0 -21
  65. package/dist/example_projects_templates/typescript_jest/tsconfig.json +0 -7
@@ -1,5 +0,0 @@
1
- export declare enum AnnotationLevel {
2
- DISABLED = "disabled",
3
- ON_FAILURE = "onFailure",
4
- ALL = "all"
5
- }
@@ -1,6 +0,0 @@
1
- export var AnnotationLevel;
2
- (function (AnnotationLevel) {
3
- AnnotationLevel["DISABLED"] = "disabled";
4
- AnnotationLevel["ON_FAILURE"] = "onFailure";
5
- AnnotationLevel["ALL"] = "all";
6
- })(AnnotationLevel || (AnnotationLevel = {}));
@@ -1,2 +0,0 @@
1
- export declare class UiControlClientError extends Error {
2
- }
@@ -1,2 +0,0 @@
1
- export class UiControlClientError extends Error {
2
- }
@@ -1,2 +0,0 @@
1
- import { Command } from 'commander';
2
- export declare function init(argv: string[]): Command;
@@ -1,58 +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 { Command } from 'commander';
11
- import path from 'path';
12
- import fs from 'fs-extra';
13
- import { getPathToNodeModulesRoot } from '../utils/path';
14
- import { logger } from './logger';
15
- const createProgram = () => {
16
- const program = new Command('askui');
17
- program.usage('<command> [options]');
18
- return program;
19
- };
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
- });
44
- }
45
- export function init(argv) {
46
- const args = argv || process.argv;
47
- const program = createProgram();
48
- program
49
- .command('init')
50
- .description('creates a typescript example project')
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
- }));
57
- return program.parse(args);
58
- }
@@ -1 +0,0 @@
1
- export declare function replaceStringInFile(filePath: string, replace: string, replacement: string): Promise<void>;
@@ -1,24 +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 fs from 'fs-extra';
11
- import { logger } from '../logger';
12
- export function replaceStringInFile(filePath, replace, replacement) {
13
- return __awaiter(this, void 0, void 0, function* () {
14
- try {
15
- const data = yield fs.readFile(filePath, 'utf8');
16
- const result = data.replace(replace, replacement);
17
- yield fs.writeFile(filePath, result, 'utf8');
18
- }
19
- catch (error) {
20
- logger.error(`Could not replace '${replace}' with '${replacement}' in file '${filePath}'`);
21
- logger.error(error.message);
22
- }
23
- });
24
- }
@@ -1 +0,0 @@
1
- node_modules
@@ -1,20 +0,0 @@
1
- {
2
- "env": {
3
- "browser": true,
4
- "es2021": true
5
- },
6
- "extends": [
7
- ],
8
- "parser": "@typescript-eslint/parser",
9
- "parserOptions": {
10
- "ecmaVersion": "latest",
11
- "sourceType": "module"
12
- },
13
- "plugins": [
14
- "import",
15
- "askui"
16
- ],
17
- "rules": {
18
- "askui/no-missing-askui-exec": "error"
19
- }
20
- }
@@ -1,39 +0,0 @@
1
- import { UiControlClient, UiController } from 'askui';
2
-
3
- // Server for controlling the operating system
4
- let uiController: UiController;
5
-
6
- // Client is necessary to use the askui API
7
- // eslint-disable-next-line import/no-mutable-exports
8
- let aui: UiControlClient;
9
-
10
- // timeout_placeholder
11
-
12
- 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
- aui = await UiControlClient.build({
24
- credentials: {
25
- workspaceId: '<your workspace id>',
26
- token: '<your access token>',
27
- },
28
- });
29
-
30
- await aui.connect();
31
- });
32
-
33
- afterAll(async () => {
34
- aui.close();
35
-
36
- await uiController.stop();
37
- });
38
-
39
- export { aui };
@@ -1,21 +0,0 @@
1
- # AskUI First Run
2
- Example of using the askui SDK.
3
- The lib helps to control the operating system with
4
- commands.
5
- Using Jest as runner framework to execute all your
6
- AskUI workflows.
7
-
8
- ## Installation of Jest and Typescript
9
-
10
- Use following command to set up Jest:
11
- ```shell
12
- npm i -D jest @types/jest ts-jest typescript
13
- ```
14
-
15
- ## How to execute the example
16
-
17
- This can be executed with the following command:
18
- ```shell
19
- npx jest --config ./test/jest.config.ts
20
- ```
21
-
@@ -1,51 +0,0 @@
1
- import { UiControlClient, UiController } from 'askui';
2
- import { AskUIAllureStepReporter } from '@askui/askui-reporters';
3
-
4
- // Server for controlling the operating system
5
- let uiController: UiController;
6
-
7
- // Client is necessary to use the askui API
8
- // eslint-disable-next-line import/no-mutable-exports
9
- let aui: UiControlClient;
10
-
11
- jest.setTimeout(60 * 1000 * 60);
12
-
13
- beforeAll(async () => {
14
- uiController = new UiController({
15
- /**
16
- * Select the display you want to run your tests on, display 0 is your main display;
17
- * ignore if you have only one display
18
- */
19
- display: 0,
20
- });
21
-
22
- await uiController.start();
23
-
24
- aui = await UiControlClient.build({
25
- credentials: {
26
- workspaceId: '<your workspace id>',
27
- token: '<your access token>',
28
- },
29
- reporter: new AskUIAllureStepReporter(),
30
- });
31
-
32
- await aui.connect();
33
- });
34
-
35
- beforeEach(async () => {
36
- await aui.startVideoRecording();
37
- });
38
-
39
- afterEach(async () => {
40
- await aui.stopVideoRecording();
41
- const video = await aui.readVideoRecording();
42
- AskUIAllureStepReporter.attachVideo(video);
43
- });
44
-
45
- afterAll(async () => {
46
- aui.disconnect();
47
-
48
- await uiController.stop();
49
- });
50
-
51
- export { aui };
@@ -1,13 +0,0 @@
1
- import type { Config } from '@jest/types';
2
-
3
- const config: Config.InitialOptions = {
4
- preset: 'ts-jest',
5
- testEnvironment: '@askui/jest-allure-circus',
6
- setupFilesAfterEnv: ['./helper/jest.setup.ts'],
7
- sandboxInjectedGlobals: [
8
- 'Math',
9
- ],
10
- };
11
-
12
- // eslint-disable-next-line import/no-default-export
13
- export default config;
@@ -1,21 +0,0 @@
1
- import { aui } from './helper/jest.setup';
2
-
3
- describe('jest with askui', () => {
4
- it('should generate an (interactive) annotation', async () => {
5
- // For Windows users:
6
- // Use annotate() to create an annotated HTML file
7
- // of your screen that is saved under <project_root>/report
8
- await aui.annotate();
9
-
10
- // Uncomment for macOS and Linux
11
- // Delete the lines above to not trigger annotate()
12
- // await aui.annotateInteractively();
13
- });
14
-
15
- it('should click on my element', async () => {
16
- await aui
17
- .click();
18
- // <INSERT YOUR COPIED ELEMENT DESCRIPTION HERE AND UNCOMMENT THIS AND THE NEXT LINE>
19
- // .exec();
20
- });
21
- });
@@ -1,7 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "module": "CommonJS",
4
- "esModuleInterop": true,
5
- "moduleResolution": "node"
6
- }
7
- }