@opentap/runner-client 2.18.0 → 2.19.0-alpha.1.10

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/lib/DTOs.d.ts CHANGED
@@ -1205,6 +1205,36 @@ export declare class TestPlanSettingsChangedEventArgs extends SessionEvent imple
1205
1205
  toJSON(data?: any): any;
1206
1206
  }
1207
1207
  export declare type ITestPlanSettingsChangedEventArgs = ISessionEvent;
1208
+ export interface IOnTestPlanRun {
1209
+ status?: string;
1210
+ userId?: string;
1211
+ }
1212
+ export declare class OnTestPlanRun implements IOnTestPlanRun {
1213
+ status?: string;
1214
+ userId?: string;
1215
+ constructor(data?: IOnTestPlanRun);
1216
+ init(_data?: any): void;
1217
+ static fromJS(data: any): OnTestPlanRun;
1218
+ toJSON(data?: any): any;
1219
+ }
1220
+ export interface IOnTestStepRun {
1221
+ status?: string;
1222
+ stepId?: string;
1223
+ parentRunId?: string;
1224
+ verdict?: string;
1225
+ duration?: string;
1226
+ }
1227
+ export declare class OnTestStepRun implements IOnTestStepRun {
1228
+ status?: string;
1229
+ stepId?: string;
1230
+ parentRunId?: string;
1231
+ verdict?: string;
1232
+ duration?: string;
1233
+ constructor(data?: IOnTestStepRun);
1234
+ init(_data?: any): void;
1235
+ static fromJS(data: any): OnTestStepRun;
1236
+ toJSON(data?: any): any;
1237
+ }
1208
1238
  export interface ITestStepRunEvent {
1209
1239
  parent?: string;
1210
1240
  testStepId?: string;
package/lib/DTOs.js CHANGED
@@ -3507,6 +3507,72 @@ var TestPlanSettingsChangedEventArgs = /** @class */ (function (_super) {
3507
3507
  return TestPlanSettingsChangedEventArgs;
3508
3508
  }(SessionEvent));
3509
3509
  export { TestPlanSettingsChangedEventArgs };
3510
+ var OnTestPlanRun = /** @class */ (function () {
3511
+ function OnTestPlanRun(data) {
3512
+ if (data) {
3513
+ for (var property in data) {
3514
+ if (Object.prototype.hasOwnProperty.call(data, property))
3515
+ this[property] = data[property];
3516
+ }
3517
+ }
3518
+ }
3519
+ OnTestPlanRun.prototype.init = function (_data) {
3520
+ if (_data) {
3521
+ this.status = _data['Status'];
3522
+ this.userId = _data['UserId'];
3523
+ }
3524
+ };
3525
+ OnTestPlanRun.fromJS = function (data) {
3526
+ data = typeof data === 'object' ? data : {};
3527
+ var result = new OnTestPlanRun();
3528
+ result.init(data);
3529
+ return result;
3530
+ };
3531
+ OnTestPlanRun.prototype.toJSON = function (data) {
3532
+ data = typeof data === 'object' ? data : {};
3533
+ data['Status'] = this.status;
3534
+ data['UserId'] = this.userId;
3535
+ return data;
3536
+ };
3537
+ return OnTestPlanRun;
3538
+ }());
3539
+ export { OnTestPlanRun };
3540
+ var OnTestStepRun = /** @class */ (function () {
3541
+ function OnTestStepRun(data) {
3542
+ if (data) {
3543
+ for (var property in data) {
3544
+ if (Object.prototype.hasOwnProperty.call(data, property))
3545
+ this[property] = data[property];
3546
+ }
3547
+ }
3548
+ }
3549
+ OnTestStepRun.prototype.init = function (_data) {
3550
+ if (_data) {
3551
+ this.status = _data['Status'];
3552
+ this.stepId = _data['StepId'];
3553
+ this.parentRunId = _data['ParentRunId'];
3554
+ this.verdict = _data['Verdict'];
3555
+ this.duration = _data['Duration'];
3556
+ }
3557
+ };
3558
+ OnTestStepRun.fromJS = function (data) {
3559
+ data = typeof data === 'object' ? data : {};
3560
+ var result = new OnTestStepRun();
3561
+ result.init(data);
3562
+ return result;
3563
+ };
3564
+ OnTestStepRun.prototype.toJSON = function (data) {
3565
+ data = typeof data === 'object' ? data : {};
3566
+ data['Status'] = this.status;
3567
+ data['StepId'] = this.stepId;
3568
+ data['ParentRunId'] = this.parentRunId;
3569
+ data['Verdict'] = this.verdict;
3570
+ data['Duration'] = this.duration;
3571
+ return data;
3572
+ };
3573
+ return OnTestStepRun;
3574
+ }());
3575
+ export { OnTestStepRun };
3510
3576
  var TestStepRunEvent = /** @class */ (function () {
3511
3577
  function TestStepRunEvent(data) {
3512
3578
  if (data) {
@@ -1,4 +1,4 @@
1
- import { BreakPoints, CommonContext, CommonSettings, DataGridControl, Image, Interaction, ListItemType, LogList, Parameter, RepositoryPackageDefinition, RepositoryPackageReference, Result, Resource, RunStatus, SessionEvent, Setting, TestPlan, TestRun, TestStepType, TestStepValidationError, WatchDog } from './DTOs';
1
+ import { BreakPoints, CommonContext, CommonSettings, DataGridControl, Image, Interaction, ListItemType, LogList, OnTestPlanRun, OnTestStepRun, Parameter, RepositoryPackageDefinition, RepositoryPackageReference, Resource, Result, RunStatus, SessionEvent, Setting, TestPlan, TestRun, TestStepType, TestStepValidationError, WatchDog } from './DTOs';
2
2
  import { ConnectionOptions, NatsError, Subscription, SubscriptionOptions } from 'nats.ws';
3
3
  import { BaseClient } from './BaseClient';
4
4
  export declare class SessionClient extends BaseClient {
@@ -23,6 +23,64 @@ export declare class SessionClient extends BaseClient {
23
23
  * @returns Subscription array: Result and Test Run subscriptions
24
24
  */
25
25
  connectSessionResults(resultHandler: (result: Result | undefined, err: NatsError | Error | null) => void, testRunHandler: (testRun: TestRun | undefined, err: NatsError | Error | null) => void, options?: SubscriptionOptions): [Subscription, Subscription];
26
+ /**
27
+ * @param testRunHandler Function to be called when test run or error is received
28
+ * @param options (optional) Subscription options
29
+ * @returns Subscription array: Result and Test Run subscriptions
30
+ */
31
+ connectTestRunEvents(testRunHandler: (testRun: TestRun | undefined, err: NatsError | Error | null) => void, options?: SubscriptionOptions): Subscription;
32
+ /**
33
+ * Connect to listen to the TestPlanRun events for the given test plan run ID.
34
+ * @param {string} testPlanRunId
35
+ * @param {(event:OnTestPlanRun|undefined,err:NatsError|Error|null)=>void} handler
36
+ * @param {SubscriptionOptions} options?
37
+ * @returns Subscription
38
+ */
39
+ connectTestPlanRunEvents(testPlanRunId: string, handler: (event: OnTestPlanRun | undefined, err: NatsError | Error | null) => void, options?: SubscriptionOptions): Subscription;
40
+ /**
41
+ * Connect to listen to the test plan run logs for the given test plan run ID
42
+ * @param {string} testPlanRunId
43
+ * @param {(logList:LogList|undefined,err:NatsError|Error|null)=>void} handler
44
+ * @param {SubscriptionOptions} options?
45
+ * @returns Subscription
46
+ */
47
+ connectTestPlanRunLogs(testPlanRunId: string, handler: (logList: LogList | undefined, err: NatsError | Error | null) => void, options?: SubscriptionOptions): Subscription;
48
+ /**
49
+ * Connect to listen to the test plan run parameter events for the given test plan run ID
50
+ * @param {string} testPlanRunId
51
+ * @param {(event:Parameter[]|undefined,err:NatsError|Error|null)=>void} handler
52
+ * @param {SubscriptionOptions} options?
53
+ * @returns Subscription
54
+ */
55
+ connectTestPlanRunParameterEvents(testPlanRunId: string, handler: (event: Parameter[] | undefined, err: NatsError | Error | null) => void, options?: SubscriptionOptions): Subscription;
56
+ /**
57
+ * Connect to listen to the test step run events for the given test step and test plan run ID
58
+ * @param {string} testPlanRunId
59
+ * @param {string} testStepRunId
60
+ * @param {(testRun:OnTestStepRun|undefined,err:NatsError|Error|null)=>void} handler
61
+ * @param {SubscriptionOptions} options?
62
+ * @returns Subscription
63
+ */
64
+ connectTestStepRunEvents(testPlanRunId: string, testStepRunId: string, handler: (testStepRunId: string | undefined, testRun: OnTestStepRun | undefined, err: NatsError | Error | null) => void, options?: SubscriptionOptions): Subscription;
65
+ /**
66
+ * Connect to listen to the test step run parameters for the given test step and test plan run ID
67
+ * @param {string} testPlanRunId
68
+ * @param {string} testStepRunId
69
+ * @param {(event:Parameter[]|undefined,err:NatsError|Error|null)=>void} handler
70
+ * @param {SubscriptionOptions} options?
71
+ * @returns Subscription
72
+ */
73
+ connectTestStepRunParameterEvents(testPlanRunId: string, testStepRunId: string, handler: (event: Parameter[] | undefined, err: NatsError | Error | null) => void, options?: SubscriptionOptions): Subscription;
74
+ /**
75
+ * Connect to listen to the test step run results for the given test step and test plan run ID
76
+ * @param {string} testPlanRunId
77
+ * @param {string} testStepRunId
78
+ * @param {string} resultName
79
+ * @param {(result:Result|undefined,err:NatsError|Error|null)=>void} handler
80
+ * @param {SubscriptionOptions} options?
81
+ * @returns Subscription
82
+ */
83
+ connectTestStepRunResults(testPlanRunId: string, testStepRunId: string, resultName: string, handler: (result: Result | undefined, err: NatsError | Error | null) => void, options?: SubscriptionOptions): Subscription;
26
84
  /**
27
85
  * Unsubscibe from session events
28
86
  */
@@ -24,7 +24,7 @@ var __assign = (this && this.__assign) || function () {
24
24
  };
25
25
  return __assign.apply(this, arguments);
26
26
  };
27
- import { BreakPoints, CommonContext, CommonSettings, DataGridControl, Image, Interaction, ListItemType, LogList, Result, RunStatus, SessionEvent, Setting, TestPlan, TestRun, TestStepType, TestStepValidationError, WatchDog, } from './DTOs';
27
+ import { BreakPoints, CommonContext, CommonSettings, DataGridControl, Image, Interaction, ListItemType, LogList, OnTestPlanRun, OnTestStepRun, Parameter, Result, RunStatus, SessionEvent, Setting, TestPlan, TestRun, TestStepType, TestStepValidationError, WatchDog, } from './DTOs';
28
28
  import { JSONCodec } from 'nats.ws';
29
29
  import { BaseClient } from './BaseClient';
30
30
  var SessionClient = /** @class */ (function (_super) {
@@ -120,6 +120,178 @@ var SessionClient = /** @class */ (function (_super) {
120
120
  } })),
121
121
  ];
122
122
  };
123
+ /**
124
+ * @param testRunHandler Function to be called when test run or error is received
125
+ * @param options (optional) Subscription options
126
+ * @returns Subscription array: Result and Test Run subscriptions
127
+ */
128
+ SessionClient.prototype.connectTestRunEvents = function (testRunHandler, options) {
129
+ return this.subscribe('OnTestRun', __assign(__assign({}, options), { callback: function (error, encodedMessage) {
130
+ if (error) {
131
+ testRunHandler(undefined, error);
132
+ return;
133
+ }
134
+ try {
135
+ var jsonCodec = JSONCodec();
136
+ var testRunJs = jsonCodec.decode(encodedMessage === null || encodedMessage === void 0 ? void 0 : encodedMessage.data);
137
+ var testRun = TestRun.fromJS(testRunJs);
138
+ testRunHandler(testRun, error);
139
+ }
140
+ catch (error) {
141
+ testRunHandler(undefined, error);
142
+ }
143
+ } }));
144
+ };
145
+ /**
146
+ * Connect to listen to the TestPlanRun events for the given test plan run ID.
147
+ * @param {string} testPlanRunId
148
+ * @param {(event:OnTestPlanRun|undefined,err:NatsError|Error|null)=>void} handler
149
+ * @param {SubscriptionOptions} options?
150
+ * @returns Subscription
151
+ */
152
+ SessionClient.prototype.connectTestPlanRunEvents = function (testPlanRunId, handler, options) {
153
+ return this.subscribe("PlanRun.".concat(testPlanRunId), __assign(__assign({}, options), { callback: function (error, encodedMessage) {
154
+ if (error) {
155
+ handler(undefined, error);
156
+ return;
157
+ }
158
+ try {
159
+ var jsonCodec = JSONCodec();
160
+ var onTestPlanRunJs = jsonCodec.decode(encodedMessage === null || encodedMessage === void 0 ? void 0 : encodedMessage.data);
161
+ var onTestPlanRun = OnTestPlanRun.fromJS(onTestPlanRunJs);
162
+ handler(onTestPlanRun, error);
163
+ }
164
+ catch (error) {
165
+ handler(undefined, error);
166
+ }
167
+ } }));
168
+ };
169
+ /**
170
+ * Connect to listen to the test plan run logs for the given test plan run ID
171
+ * @param {string} testPlanRunId
172
+ * @param {(logList:LogList|undefined,err:NatsError|Error|null)=>void} handler
173
+ * @param {SubscriptionOptions} options?
174
+ * @returns Subscription
175
+ */
176
+ SessionClient.prototype.connectTestPlanRunLogs = function (testPlanRunId, handler, options) {
177
+ return this.subscribe("PlanRun.".concat(testPlanRunId, ".Logs"), __assign(__assign({}, options), { callback: function (error, encodedMessage) {
178
+ if (error) {
179
+ handler(undefined, error);
180
+ return;
181
+ }
182
+ try {
183
+ var jsonCodec = JSONCodec();
184
+ var logListJson = jsonCodec.decode(encodedMessage === null || encodedMessage === void 0 ? void 0 : encodedMessage.data);
185
+ var logList = LogList.fromJS(logListJson);
186
+ handler(logList, error);
187
+ }
188
+ catch (error) {
189
+ handler(undefined, error);
190
+ }
191
+ } }));
192
+ };
193
+ /**
194
+ * Connect to listen to the test plan run parameter events for the given test plan run ID
195
+ * @param {string} testPlanRunId
196
+ * @param {(event:Parameter[]|undefined,err:NatsError|Error|null)=>void} handler
197
+ * @param {SubscriptionOptions} options?
198
+ * @returns Subscription
199
+ */
200
+ SessionClient.prototype.connectTestPlanRunParameterEvents = function (testPlanRunId, handler, options) {
201
+ return this.subscribe("PlanRun.".concat(testPlanRunId, ".Parameters"), __assign(__assign({}, options), { callback: function (error, encodedMessage) {
202
+ if (error) {
203
+ handler(undefined, error);
204
+ return;
205
+ }
206
+ try {
207
+ var jsonCodec = JSONCodec();
208
+ var parameterListJs = jsonCodec.decode(encodedMessage === null || encodedMessage === void 0 ? void 0 : encodedMessage.data);
209
+ var parameterList = parameterListJs.map(function (parameterJs) { return Parameter.fromJS(parameterJs); });
210
+ handler(parameterList, error);
211
+ }
212
+ catch (error) {
213
+ handler(undefined, error);
214
+ }
215
+ } }));
216
+ };
217
+ /**
218
+ * Connect to listen to the test step run events for the given test step and test plan run ID
219
+ * @param {string} testPlanRunId
220
+ * @param {string} testStepRunId
221
+ * @param {(testRun:OnTestStepRun|undefined,err:NatsError|Error|null)=>void} handler
222
+ * @param {SubscriptionOptions} options?
223
+ * @returns Subscription
224
+ */
225
+ SessionClient.prototype.connectTestStepRunEvents = function (testPlanRunId, testStepRunId, handler, options) {
226
+ return this.subscribe("PlanRun.".concat(testPlanRunId, ".StepRun.").concat(testStepRunId), __assign(__assign({}, options), { callback: function (error, encodedMessage) {
227
+ var _a;
228
+ if (error) {
229
+ handler(undefined, undefined, error);
230
+ return;
231
+ }
232
+ try {
233
+ var jsonCodec = JSONCodec();
234
+ var onTestStepRunJs = jsonCodec.decode(encodedMessage === null || encodedMessage === void 0 ? void 0 : encodedMessage.data);
235
+ var onTestStepRun = OnTestStepRun.fromJS(onTestStepRunJs);
236
+ var stepRunId = (_a = encodedMessage.subject.match(/\.StepRun\.(.+)$/)) === null || _a === void 0 ? void 0 : _a[1];
237
+ handler(stepRunId, onTestStepRun, error);
238
+ }
239
+ catch (error) {
240
+ handler(undefined, undefined, error);
241
+ }
242
+ } }));
243
+ };
244
+ /**
245
+ * Connect to listen to the test step run parameters for the given test step and test plan run ID
246
+ * @param {string} testPlanRunId
247
+ * @param {string} testStepRunId
248
+ * @param {(event:Parameter[]|undefined,err:NatsError|Error|null)=>void} handler
249
+ * @param {SubscriptionOptions} options?
250
+ * @returns Subscription
251
+ */
252
+ SessionClient.prototype.connectTestStepRunParameterEvents = function (testPlanRunId, testStepRunId, handler, options) {
253
+ return this.subscribe("PlanRun.".concat(testPlanRunId, ".StepRun.").concat(testStepRunId, ".Parameters"), __assign(__assign({}, options), { callback: function (error, encodedMessage) {
254
+ if (error) {
255
+ handler(undefined, error);
256
+ return;
257
+ }
258
+ try {
259
+ var jsonCodec = JSONCodec();
260
+ var parameterListJs = jsonCodec.decode(encodedMessage === null || encodedMessage === void 0 ? void 0 : encodedMessage.data);
261
+ var parameterList = parameterListJs.map(function (parameterJs) { return Parameter.fromJS(parameterJs); });
262
+ handler(parameterList, error);
263
+ }
264
+ catch (error) {
265
+ handler(undefined, error);
266
+ }
267
+ } }));
268
+ };
269
+ /**
270
+ * Connect to listen to the test step run results for the given test step and test plan run ID
271
+ * @param {string} testPlanRunId
272
+ * @param {string} testStepRunId
273
+ * @param {string} resultName
274
+ * @param {(result:Result|undefined,err:NatsError|Error|null)=>void} handler
275
+ * @param {SubscriptionOptions} options?
276
+ * @returns Subscription
277
+ */
278
+ SessionClient.prototype.connectTestStepRunResults = function (testPlanRunId, testStepRunId, resultName, handler, options) {
279
+ return this.subscribe("PlanRun.".concat(testPlanRunId, ".StepRun.").concat(testStepRunId, ".Result.").concat(resultName), __assign(__assign({}, options), { callback: function (error, encodedMessage) {
280
+ if (error) {
281
+ handler(undefined, error);
282
+ return;
283
+ }
284
+ try {
285
+ var jsonCodec = JSONCodec();
286
+ var resultJs = jsonCodec.decode(encodedMessage === null || encodedMessage === void 0 ? void 0 : encodedMessage.data);
287
+ var result = Result.fromJS(resultJs);
288
+ handler(result, error);
289
+ }
290
+ catch (error) {
291
+ handler(undefined, error);
292
+ }
293
+ } }));
294
+ };
123
295
  /**
124
296
  * Unsubscibe from session events
125
297
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opentap/runner-client",
3
- "version": "2.18.0",
3
+ "version": "2.19.0-alpha.1.10",
4
4
  "description": "This is the web client for the OpenTAP Runner.",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",