askui 0.11.6 → 0.12.1

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 (73) hide show
  1. package/dist/cjs/core/model/annotation-result/detected-element.d.ts +2 -1
  2. package/dist/cjs/core/model/annotation-result/detected-element.js +3 -2
  3. package/dist/cjs/core/reporting/default-step.js +4 -3
  4. package/dist/cjs/core/reporting/index.d.ts +0 -1
  5. package/dist/cjs/core/reporting/index.js +0 -1
  6. package/dist/cjs/core/reporting/snapshot-detail-level.d.ts +1 -0
  7. package/dist/cjs/core/reporting/snapshot-detail-level.js +8 -0
  8. package/dist/cjs/core/reporting/step-reporter.d.ts +7 -6
  9. package/dist/cjs/core/reporting/step-reporter.js +49 -34
  10. package/dist/cjs/execution/dsl.d.ts +3 -3
  11. package/dist/cjs/execution/dsl.js +12 -3
  12. package/dist/cjs/execution/ui-control-client-dependency-builder.d.ts +0 -1
  13. package/dist/cjs/execution/ui-control-client-dependency-builder.js +1 -13
  14. package/dist/cjs/execution/ui-controller-client-interface.d.ts +4 -6
  15. package/dist/esm/core/model/annotation-result/detected-element.d.ts +2 -1
  16. package/dist/esm/core/model/annotation-result/detected-element.js +3 -2
  17. package/dist/esm/core/reporting/default-step.js +4 -3
  18. package/dist/esm/core/reporting/index.d.ts +0 -1
  19. package/dist/esm/core/reporting/index.js +0 -1
  20. package/dist/esm/core/reporting/snapshot-detail-level.d.ts +1 -0
  21. package/dist/esm/core/reporting/snapshot-detail-level.js +6 -1
  22. package/dist/esm/core/reporting/step-reporter.d.ts +7 -6
  23. package/dist/esm/core/reporting/step-reporter.js +49 -34
  24. package/dist/esm/execution/dsl.d.ts +3 -3
  25. package/dist/esm/execution/dsl.js +12 -3
  26. package/dist/esm/execution/ui-control-client-dependency-builder.d.ts +0 -1
  27. package/dist/esm/execution/ui-control-client-dependency-builder.js +2 -14
  28. package/dist/esm/execution/ui-controller-client-interface.d.ts +4 -6
  29. package/package.json +3 -1
  30. package/dist/cjs/core/model/test-case-dto/custom-element-json.d.ts +0 -75
  31. package/dist/cjs/core/model/test-case-dto/custom-element-json.js +0 -2
  32. package/dist/cjs/core/model/test-case-dto/custom-element.d.ts +0 -21
  33. package/dist/cjs/core/model/test-case-dto/custom-element.js +0 -54
  34. package/dist/cjs/core/model/test-case-dto/index.d.ts +0 -3
  35. package/dist/cjs/core/model/test-case-dto/index.js +0 -5
  36. package/dist/cjs/core/model/test-case-dto/test-step.d.ts +0 -6
  37. package/dist/cjs/core/model/test-case-dto/test-step.js +0 -2
  38. package/dist/cjs/core/model/test-case-result-dto/index.d.ts +0 -2
  39. package/dist/cjs/core/model/test-case-result-dto/index.js +0 -7
  40. package/dist/cjs/core/model/test-case-result-dto/test-step-result-dto.d.ts +0 -9
  41. package/dist/cjs/core/model/test-case-result-dto/test-step-result-dto.js +0 -16
  42. package/dist/cjs/core/model/test-case-result-dto/test-step-state.d.ts +0 -4
  43. package/dist/cjs/core/model/test-case-result-dto/test-step-state.js +0 -8
  44. package/dist/cjs/core/reporting/default-reporter.d.ts +0 -10
  45. package/dist/cjs/core/reporting/default-reporter.js +0 -12
  46. package/dist/cjs/execution/annotation-level.d.ts +0 -5
  47. package/dist/cjs/execution/annotation-level.js +0 -9
  48. package/dist/cjs/execution/reporter.d.ts +0 -132
  49. package/dist/cjs/execution/reporter.js +0 -146
  50. package/dist/cjs/execution/ui-control-client-error.d.ts +0 -2
  51. package/dist/cjs/execution/ui-control-client-error.js +0 -6
  52. package/dist/esm/core/model/test-case-dto/custom-element-json.d.ts +0 -75
  53. package/dist/esm/core/model/test-case-dto/custom-element-json.js +0 -1
  54. package/dist/esm/core/model/test-case-dto/custom-element.d.ts +0 -21
  55. package/dist/esm/core/model/test-case-dto/custom-element.js +0 -50
  56. package/dist/esm/core/model/test-case-dto/index.d.ts +0 -3
  57. package/dist/esm/core/model/test-case-dto/index.js +0 -1
  58. package/dist/esm/core/model/test-case-dto/test-step.d.ts +0 -6
  59. package/dist/esm/core/model/test-case-dto/test-step.js +0 -1
  60. package/dist/esm/core/model/test-case-result-dto/index.d.ts +0 -2
  61. package/dist/esm/core/model/test-case-result-dto/index.js +0 -2
  62. package/dist/esm/core/model/test-case-result-dto/test-step-result-dto.d.ts +0 -9
  63. package/dist/esm/core/model/test-case-result-dto/test-step-result-dto.js +0 -12
  64. package/dist/esm/core/model/test-case-result-dto/test-step-state.d.ts +0 -4
  65. package/dist/esm/core/model/test-case-result-dto/test-step-state.js +0 -5
  66. package/dist/esm/core/reporting/default-reporter.d.ts +0 -10
  67. package/dist/esm/core/reporting/default-reporter.js +0 -9
  68. package/dist/esm/execution/annotation-level.d.ts +0 -5
  69. package/dist/esm/execution/annotation-level.js +0 -6
  70. package/dist/esm/execution/reporter.d.ts +0 -132
  71. package/dist/esm/execution/reporter.js +0 -142
  72. package/dist/esm/execution/ui-control-client-error.d.ts +0 -3
  73. package/dist/esm/execution/ui-control-client-error.js +0 -6
@@ -1,142 +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
- // retries could be modeled as totally new steps only that we set the retry no at the beginning, it is undefined if there is no retry or 0 --> user could filter out the retries for the report and has to get the last retry to find out when the step actually ended and the snapshot at that point in time
11
- // Where do I save the error of the first step, what state does the first step have?
12
- // We could point back from retry to original step, but then we have to save the original step in the retry step, which is not nice
13
- // retry should be handled like completely new step but the state of the whole state is not failed --> if a passed step can have an error, then this is fine
14
- // how do we determine if it is erroneous or failed?
15
- class askuiStep {
16
- constructor(instruction) {
17
- this.instruction = instruction;
18
- this.runs = [];
19
- }
20
- get status() {
21
- var _a, _b;
22
- return (_b = (_a = this.lastRun) === null || _a === void 0 ? void 0 : _a.status) !== null && _b !== void 0 ? _b : 'pending';
23
- }
24
- get begin() {
25
- var _a;
26
- return (_a = this.firstRun) === null || _a === void 0 ? void 0 : _a.begin;
27
- }
28
- get end() {
29
- var _a;
30
- return (_a = this.lastRun) === null || _a === void 0 ? void 0 : _a.end;
31
- }
32
- get error() {
33
- var _a;
34
- return (_a = this.lastRun) === null || _a === void 0 ? void 0 : _a.error;
35
- }
36
- get retries() {
37
- var _a, _b;
38
- return (_b = (_a = this.runs) === null || _a === void 0 ? void 0 : _a.slice(1)) !== null && _b !== void 0 ? _b : [];
39
- }
40
- get retryCount() {
41
- var _a, _b;
42
- return (_b = (_a = this.retries) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
43
- }
44
- get firstRun() {
45
- var _a;
46
- return (_a = this.runs) === null || _a === void 0 ? void 0 : _a[0];
47
- }
48
- get lastRun() {
49
- var _a;
50
- return (_a = this.runs) === null || _a === void 0 ? void 0 : _a[this.runs.length - 1];
51
- }
52
- get flaky() {
53
- return this.retryCount > 0;
54
- }
55
- get duration() {
56
- if (this.begin !== undefined && this.end !== undefined) {
57
- return this.end.createdAt.getTime() - this.begin.createdAt.getTime();
58
- }
59
- return undefined;
60
- }
61
- onBegin(snapshot) {
62
- this.runs = [...this.runs, {
63
- status: 'running',
64
- begin: snapshot,
65
- }];
66
- return this;
67
- }
68
- onRetry(snapshot, error) {
69
- this.onEnd(snapshot, error);
70
- this.onBegin(snapshot);
71
- return this;
72
- }
73
- onEnd(snapshot, error) {
74
- this.runs = [...this.runs.slice(0, -1), Object.assign(Object.assign({}, this.lastRun), { status: this.determineLastRunStatus(error), end: snapshot, error, duration: snapshot.createdAt.getTime() - this.lastRun.begin.createdAt.getTime() })];
75
- return this;
76
- }
77
- determineLastRunStatus(error) {
78
- if (error !== undefined) {
79
- return 'failed';
80
- }
81
- return 'passed';
82
- }
83
- }
84
- export const DEFAULT_REPORTER = {
85
- config: {
86
- withScreenshots: 'onFailure',
87
- withDetectedElements: 'onFailure',
88
- },
89
- onStepBegin: (_step) => {
90
- return Promise.resolve();
91
- },
92
- onStepRetry: (_step) => {
93
- return Promise.resolve();
94
- },
95
- onStepEnd: (_step) => {
96
- return Promise.resolve();
97
- },
98
- };
99
- export class StepReporter {
100
- constructor(reporter) {
101
- this.reporter = reporter;
102
- }
103
- get config() {
104
- return this.reporter.config;
105
- }
106
- resetStep(instruction) {
107
- this.currentStep = new askuiStep(instruction);
108
- }
109
- onStepBegin(snapshot) {
110
- var _a, _b;
111
- return __awaiter(this, void 0, void 0, function* () {
112
- if (this.currentStep === undefined)
113
- throw new Error('Cannot begin step if step is undefined.');
114
- if (this.currentStep.status !== 'pending')
115
- throw new Error('Cannot begin step that is not pending.');
116
- this.currentStep.onBegin(snapshot);
117
- yield ((_b = (_a = this.reporter).onStepBegin) === null || _b === void 0 ? void 0 : _b.call(_a, this.currentStep));
118
- });
119
- }
120
- onStepRetry(snapshot, error) {
121
- var _a, _b;
122
- return __awaiter(this, void 0, void 0, function* () {
123
- if (this.currentStep === undefined)
124
- throw new Error('Cannot retry step if step is undefined.');
125
- if (this.currentStep.status !== 'running')
126
- throw new Error('Cannot retry step that has not been running.');
127
- this.currentStep.onRetry(snapshot, error);
128
- yield ((_b = (_a = this.reporter).onStepRetry) === null || _b === void 0 ? void 0 : _b.call(_a, this.currentStep));
129
- });
130
- }
131
- onStepEnd(snapshot, error) {
132
- var _a, _b;
133
- return __awaiter(this, void 0, void 0, function* () {
134
- if (this.currentStep === undefined)
135
- throw new Error('Cannot end step if step is undefined.');
136
- if (this.currentStep.status !== 'running')
137
- throw new Error('Cannot end step that has not been running.');
138
- this.currentStep.onEnd(snapshot, error);
139
- yield ((_b = (_a = this.reporter).onStepEnd) === null || _b === void 0 ? void 0 : _b.call(_a, this.currentStep));
140
- });
141
- }
142
- }
@@ -1,3 +0,0 @@
1
- export declare class UiControlClientError extends Error {
2
- constructor(message: string);
3
- }
@@ -1,6 +0,0 @@
1
- export class UiControlClientError extends Error {
2
- constructor(message) {
3
- super(message);
4
- this.name = 'UiControlClientError';
5
- }
6
- }