@opentap/runner-client 2.0.0-alpha.1.1 → 2.0.0-alpha.2.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.
- package/lib/BaseClient.d.ts +1 -1
- package/lib/BaseClient.js +3 -1
- package/lib/DTOs.d.ts +24 -0
- package/lib/DTOs.js +123 -58
- package/lib/SessionClient.d.ts +6 -1
- package/lib/SessionClient.js +16 -0
- package/package.json +1 -1
package/lib/BaseClient.d.ts
CHANGED
|
@@ -65,7 +65,7 @@ export declare class BaseClient {
|
|
|
65
65
|
* @param options (optional)
|
|
66
66
|
* @returns Promise of an object
|
|
67
67
|
*/
|
|
68
|
-
protected requestChunked<T>(subject: string, replySubject: string, payload: any, options?: RequestOptions, isFullSubject?: boolean): Promise<T>;
|
|
68
|
+
protected requestChunked<T>(subject: string, replySubject: string, payload: any, options?: RequestOptions, isFullSubject?: boolean, rawResponse?: boolean): Promise<T>;
|
|
69
69
|
/**
|
|
70
70
|
* Check if the the response is an error from the server.
|
|
71
71
|
* @param {any} response
|
package/lib/BaseClient.js
CHANGED
|
@@ -265,7 +265,7 @@ var BaseClient = /** @class */ (function () {
|
|
|
265
265
|
* @param options (optional)
|
|
266
266
|
* @returns Promise of an object
|
|
267
267
|
*/
|
|
268
|
-
BaseClient.prototype.requestChunked = function (subject, replySubject, payload, options, isFullSubject) {
|
|
268
|
+
BaseClient.prototype.requestChunked = function (subject, replySubject, payload, options, isFullSubject, rawResponse) {
|
|
269
269
|
return __awaiter(this, void 0, void 0, function () {
|
|
270
270
|
var fileSize;
|
|
271
271
|
var _this = this;
|
|
@@ -308,6 +308,8 @@ var BaseClient = /** @class */ (function () {
|
|
|
308
308
|
}).then(function (byteArray) {
|
|
309
309
|
if (byteArray.length !== fileSize)
|
|
310
310
|
return Promise.reject("Unexpected response size. Expected ".concat(fileSize, " bytes, but got ").concat(byteArray.length, "."));
|
|
311
|
+
if (rawResponse)
|
|
312
|
+
return Promise.resolve(byteArray);
|
|
311
313
|
var jsonCodec = JSONCodec();
|
|
312
314
|
var response = jsonCodec.decode(byteArray);
|
|
313
315
|
return _this.isErrorResponse(response) ? Promise.reject(ErrorResponse.fromJS(response)) : Promise.resolve(response);
|
package/lib/DTOs.d.ts
CHANGED
|
@@ -418,6 +418,30 @@ export declare class PasswordControl extends Setting implements IPasswordControl
|
|
|
418
418
|
export interface IPasswordControl extends ISetting {
|
|
419
419
|
password?: string | undefined;
|
|
420
420
|
}
|
|
421
|
+
export declare class PictureControl extends Setting implements IPictureControl {
|
|
422
|
+
description?: string | undefined;
|
|
423
|
+
mimeType?: string | undefined;
|
|
424
|
+
resource?: Resource | undefined;
|
|
425
|
+
constructor(data?: IPictureControl);
|
|
426
|
+
init(_data?: any): void;
|
|
427
|
+
static fromJS(data: any): PictureControl;
|
|
428
|
+
toJSON(data?: any): any;
|
|
429
|
+
}
|
|
430
|
+
export interface IPictureControl extends ISetting {
|
|
431
|
+
description?: string | undefined;
|
|
432
|
+
mimeType?: string | undefined;
|
|
433
|
+
resource?: Resource | undefined;
|
|
434
|
+
}
|
|
435
|
+
export declare class Resource implements IResource {
|
|
436
|
+
source?: string | undefined;
|
|
437
|
+
constructor(data?: IResource);
|
|
438
|
+
init(_data?: any): void;
|
|
439
|
+
static fromJS(data: any): Resource;
|
|
440
|
+
toJSON(data?: any): any;
|
|
441
|
+
}
|
|
442
|
+
export interface IResource {
|
|
443
|
+
source?: string | undefined;
|
|
444
|
+
}
|
|
421
445
|
export declare class TestPlanRequest implements ITestPlanRequest {
|
|
422
446
|
properties?: string[] | null | undefined;
|
|
423
447
|
subject?: string | undefined;
|
package/lib/DTOs.js
CHANGED
|
@@ -506,6 +506,11 @@ var Setting = /** @class */ (function (_super) {
|
|
|
506
506
|
result_12.init(data);
|
|
507
507
|
return result_12;
|
|
508
508
|
}
|
|
509
|
+
if (data['ControlType'] === 'PictureControl') {
|
|
510
|
+
var result_13 = new PictureControl();
|
|
511
|
+
result_13.init(data);
|
|
512
|
+
return result_13;
|
|
513
|
+
}
|
|
509
514
|
var result = new Setting();
|
|
510
515
|
result.init(data);
|
|
511
516
|
return result;
|
|
@@ -997,9 +1002,9 @@ var TextBoxControl = /** @class */ (function (_super) {
|
|
|
997
1002
|
TextBoxControl.fromJS = function (data) {
|
|
998
1003
|
data = typeof data === 'object' ? data : {};
|
|
999
1004
|
if (data['ControlType'] === 'ComboBoxControl') {
|
|
1000
|
-
var
|
|
1001
|
-
|
|
1002
|
-
return
|
|
1005
|
+
var result_14 = new ComboBoxControl();
|
|
1006
|
+
result_14.init(data);
|
|
1007
|
+
return result_14;
|
|
1003
1008
|
}
|
|
1004
1009
|
var result = new TextBoxControl();
|
|
1005
1010
|
result.init(data);
|
|
@@ -1238,6 +1243,66 @@ var PasswordControl = /** @class */ (function (_super) {
|
|
|
1238
1243
|
return PasswordControl;
|
|
1239
1244
|
}(Setting));
|
|
1240
1245
|
export { PasswordControl };
|
|
1246
|
+
var PictureControl = /** @class */ (function (_super) {
|
|
1247
|
+
__extends(PictureControl, _super);
|
|
1248
|
+
function PictureControl(data) {
|
|
1249
|
+
var _this = _super.call(this, data) || this;
|
|
1250
|
+
_this._discriminator = 'PictureControl';
|
|
1251
|
+
return _this;
|
|
1252
|
+
}
|
|
1253
|
+
PictureControl.prototype.init = function (_data) {
|
|
1254
|
+
_super.prototype.init.call(this, _data);
|
|
1255
|
+
if (_data) {
|
|
1256
|
+
this.description = _data['Description'];
|
|
1257
|
+
this.mimeType = _data['MimeType'];
|
|
1258
|
+
this.resource = _data['Resource'] ? Resource.fromJS(_data['Resource']) : undefined;
|
|
1259
|
+
}
|
|
1260
|
+
};
|
|
1261
|
+
PictureControl.fromJS = function (data) {
|
|
1262
|
+
data = typeof data === 'object' ? data : {};
|
|
1263
|
+
var result = new PictureControl();
|
|
1264
|
+
result.init(data);
|
|
1265
|
+
return result;
|
|
1266
|
+
};
|
|
1267
|
+
PictureControl.prototype.toJSON = function (data) {
|
|
1268
|
+
data = typeof data === 'object' ? data : {};
|
|
1269
|
+
data['Description'] = this.description;
|
|
1270
|
+
data['MimeType'] = this.mimeType;
|
|
1271
|
+
data['Resource'] = this.resource ? this.resource.toJSON() : undefined;
|
|
1272
|
+
_super.prototype.toJSON.call(this, data);
|
|
1273
|
+
return data;
|
|
1274
|
+
};
|
|
1275
|
+
return PictureControl;
|
|
1276
|
+
}(Setting));
|
|
1277
|
+
export { PictureControl };
|
|
1278
|
+
var Resource = /** @class */ (function () {
|
|
1279
|
+
function Resource(data) {
|
|
1280
|
+
if (data) {
|
|
1281
|
+
for (var property in data) {
|
|
1282
|
+
if (Object.prototype.hasOwnProperty.call(data, property))
|
|
1283
|
+
this[property] = data[property];
|
|
1284
|
+
}
|
|
1285
|
+
}
|
|
1286
|
+
}
|
|
1287
|
+
Resource.prototype.init = function (_data) {
|
|
1288
|
+
if (_data) {
|
|
1289
|
+
this.source = _data['Source'];
|
|
1290
|
+
}
|
|
1291
|
+
};
|
|
1292
|
+
Resource.fromJS = function (data) {
|
|
1293
|
+
data = typeof data === 'object' ? data : {};
|
|
1294
|
+
var result = new Resource();
|
|
1295
|
+
result.init(data);
|
|
1296
|
+
return result;
|
|
1297
|
+
};
|
|
1298
|
+
Resource.prototype.toJSON = function (data) {
|
|
1299
|
+
data = typeof data === 'object' ? data : {};
|
|
1300
|
+
data['Source'] = this.source;
|
|
1301
|
+
return data;
|
|
1302
|
+
};
|
|
1303
|
+
return Resource;
|
|
1304
|
+
}());
|
|
1305
|
+
export { Resource };
|
|
1241
1306
|
var TestPlanRequest = /** @class */ (function () {
|
|
1242
1307
|
function TestPlanRequest() {
|
|
1243
1308
|
}
|
|
@@ -1572,40 +1637,40 @@ var SessionEventArgs = /** @class */ (function () {
|
|
|
1572
1637
|
SessionEventArgs.fromJS = function (data) {
|
|
1573
1638
|
data = typeof data === 'object' ? data : {};
|
|
1574
1639
|
if (data['SessionEventType'] === 'SessionStartInitiated') {
|
|
1575
|
-
var
|
|
1576
|
-
result_14.init(data);
|
|
1577
|
-
return result_14;
|
|
1578
|
-
}
|
|
1579
|
-
if (data['SessionEventType'] === 'SessionStarted') {
|
|
1580
|
-
var result_15 = new SessionStarted();
|
|
1640
|
+
var result_15 = new SessionStartInitiated();
|
|
1581
1641
|
result_15.init(data);
|
|
1582
1642
|
return result_15;
|
|
1583
1643
|
}
|
|
1584
|
-
if (data['SessionEventType'] === '
|
|
1585
|
-
var result_16 = new
|
|
1644
|
+
if (data['SessionEventType'] === 'SessionStarted') {
|
|
1645
|
+
var result_16 = new SessionStarted();
|
|
1586
1646
|
result_16.init(data);
|
|
1587
1647
|
return result_16;
|
|
1588
1648
|
}
|
|
1589
|
-
if (data['SessionEventType'] === '
|
|
1590
|
-
var result_17 = new
|
|
1649
|
+
if (data['SessionEventType'] === 'SessionStartFailed') {
|
|
1650
|
+
var result_17 = new SessionStartFailed();
|
|
1591
1651
|
result_17.init(data);
|
|
1592
1652
|
return result_17;
|
|
1593
1653
|
}
|
|
1594
|
-
if (data['SessionEventType'] === '
|
|
1595
|
-
var result_18 = new
|
|
1654
|
+
if (data['SessionEventType'] === 'SessionShutdownInitiated') {
|
|
1655
|
+
var result_18 = new SessionShutdownInitiated();
|
|
1596
1656
|
result_18.init(data);
|
|
1597
1657
|
return result_18;
|
|
1598
1658
|
}
|
|
1599
|
-
if (data['SessionEventType'] === '
|
|
1600
|
-
var result_19 = new
|
|
1659
|
+
if (data['SessionEventType'] === 'SessionShutdown') {
|
|
1660
|
+
var result_19 = new SessionShutdown();
|
|
1601
1661
|
result_19.init(data);
|
|
1602
1662
|
return result_19;
|
|
1603
1663
|
}
|
|
1604
|
-
if (data['SessionEventType'] === '
|
|
1605
|
-
var result_20 = new
|
|
1664
|
+
if (data['SessionEventType'] === 'SessionShutdownFailed') {
|
|
1665
|
+
var result_20 = new SessionShutdownFailed();
|
|
1606
1666
|
result_20.init(data);
|
|
1607
1667
|
return result_20;
|
|
1608
1668
|
}
|
|
1669
|
+
if (data['SessionEventType'] === 'SessionInactivityLimitHit') {
|
|
1670
|
+
var result_21 = new SessionInactivityLimitHit();
|
|
1671
|
+
result_21.init(data);
|
|
1672
|
+
return result_21;
|
|
1673
|
+
}
|
|
1609
1674
|
var result = new SessionEventArgs();
|
|
1610
1675
|
result.init(data);
|
|
1611
1676
|
return result;
|
|
@@ -1817,20 +1882,20 @@ var ImageEventArgs = /** @class */ (function () {
|
|
|
1817
1882
|
ImageEventArgs.fromJS = function (data) {
|
|
1818
1883
|
data = typeof data === 'object' ? data : {};
|
|
1819
1884
|
if (data['ImageEventType'] === 'ImageCreating') {
|
|
1820
|
-
var
|
|
1821
|
-
result_21.init(data);
|
|
1822
|
-
return result_21;
|
|
1823
|
-
}
|
|
1824
|
-
if (data['ImageEventType'] === 'ImageCreated') {
|
|
1825
|
-
var result_22 = new ImageCreated();
|
|
1885
|
+
var result_22 = new ImageCreating();
|
|
1826
1886
|
result_22.init(data);
|
|
1827
1887
|
return result_22;
|
|
1828
1888
|
}
|
|
1829
|
-
if (data['ImageEventType'] === '
|
|
1830
|
-
var result_23 = new
|
|
1889
|
+
if (data['ImageEventType'] === 'ImageCreated') {
|
|
1890
|
+
var result_23 = new ImageCreated();
|
|
1831
1891
|
result_23.init(data);
|
|
1832
1892
|
return result_23;
|
|
1833
1893
|
}
|
|
1894
|
+
if (data['ImageEventType'] === 'ImageCreationFailed') {
|
|
1895
|
+
var result_24 = new ImageCreationFailed();
|
|
1896
|
+
result_24.init(data);
|
|
1897
|
+
return result_24;
|
|
1898
|
+
}
|
|
1834
1899
|
var result = new ImageEventArgs();
|
|
1835
1900
|
result.init(data);
|
|
1836
1901
|
return result;
|
|
@@ -2240,9 +2305,9 @@ var TestStep = /** @class */ (function () {
|
|
|
2240
2305
|
TestStep.fromJS = function (data) {
|
|
2241
2306
|
data = typeof data === 'object' ? data : {};
|
|
2242
2307
|
if (data['TestStepTypeOrInstance'] === 'TestStepType') {
|
|
2243
|
-
var
|
|
2244
|
-
|
|
2245
|
-
return
|
|
2308
|
+
var result_25 = new TestStepType();
|
|
2309
|
+
result_25.init(data);
|
|
2310
|
+
return result_25;
|
|
2246
2311
|
}
|
|
2247
2312
|
var result = new TestStep();
|
|
2248
2313
|
result.init(data);
|
|
@@ -2901,70 +2966,70 @@ var SessionEvent = /** @class */ (function () {
|
|
|
2901
2966
|
SessionEvent.fromJS = function (data) {
|
|
2902
2967
|
data = typeof data === 'object' ? data : {};
|
|
2903
2968
|
if (data['discriminator'] === 'SessionTimeoutEventArgs') {
|
|
2904
|
-
var
|
|
2905
|
-
result_25.init(data);
|
|
2906
|
-
return result_25;
|
|
2907
|
-
}
|
|
2908
|
-
if (data['discriminator'] === 'StartingEventArgs') {
|
|
2909
|
-
var result_26 = new StartingEventArgs();
|
|
2969
|
+
var result_26 = new SessionTimeoutEventArgs();
|
|
2910
2970
|
result_26.init(data);
|
|
2911
2971
|
return result_26;
|
|
2912
2972
|
}
|
|
2913
|
-
if (data['discriminator'] === '
|
|
2914
|
-
var result_27 = new
|
|
2973
|
+
if (data['discriminator'] === 'StartingEventArgs') {
|
|
2974
|
+
var result_27 = new StartingEventArgs();
|
|
2915
2975
|
result_27.init(data);
|
|
2916
2976
|
return result_27;
|
|
2917
2977
|
}
|
|
2918
|
-
if (data['discriminator'] === '
|
|
2919
|
-
var result_28 = new
|
|
2978
|
+
if (data['discriminator'] === 'StartedEventArgs') {
|
|
2979
|
+
var result_28 = new StartedEventArgs();
|
|
2920
2980
|
result_28.init(data);
|
|
2921
2981
|
return result_28;
|
|
2922
2982
|
}
|
|
2923
|
-
if (data['discriminator'] === '
|
|
2924
|
-
var result_29 = new
|
|
2983
|
+
if (data['discriminator'] === 'StoppingEventArgs') {
|
|
2984
|
+
var result_29 = new StoppingEventArgs();
|
|
2925
2985
|
result_29.init(data);
|
|
2926
2986
|
return result_29;
|
|
2927
2987
|
}
|
|
2928
|
-
if (data['discriminator'] === '
|
|
2929
|
-
var result_30 = new
|
|
2988
|
+
if (data['discriminator'] === 'StoppedEventArgs') {
|
|
2989
|
+
var result_30 = new StoppedEventArgs();
|
|
2930
2990
|
result_30.init(data);
|
|
2931
2991
|
return result_30;
|
|
2932
2992
|
}
|
|
2933
|
-
if (data['discriminator'] === '
|
|
2934
|
-
var result_31 = new
|
|
2993
|
+
if (data['discriminator'] === 'TestPlanChangeEventArgs') {
|
|
2994
|
+
var result_31 = new TestPlanChangeEventArgs();
|
|
2935
2995
|
result_31.init(data);
|
|
2936
2996
|
return result_31;
|
|
2937
2997
|
}
|
|
2938
|
-
if (data['discriminator'] === '
|
|
2939
|
-
var result_32 = new
|
|
2998
|
+
if (data['discriminator'] === 'TestPlanExecutionStateChangedEventArgs') {
|
|
2999
|
+
var result_32 = new TestPlanExecutionStateChangedEventArgs();
|
|
2940
3000
|
result_32.init(data);
|
|
2941
3001
|
return result_32;
|
|
2942
3002
|
}
|
|
2943
|
-
if (data['discriminator'] === '
|
|
2944
|
-
var result_33 = new
|
|
3003
|
+
if (data['discriminator'] === 'SettingsChangedEventArgs') {
|
|
3004
|
+
var result_33 = new SettingsChangedEventArgs();
|
|
2945
3005
|
result_33.init(data);
|
|
2946
3006
|
return result_33;
|
|
2947
3007
|
}
|
|
2948
|
-
if (data['discriminator'] === '
|
|
2949
|
-
var result_34 = new
|
|
3008
|
+
if (data['discriminator'] === 'TestStepChangeEventArgs') {
|
|
3009
|
+
var result_34 = new TestStepChangeEventArgs();
|
|
2950
3010
|
result_34.init(data);
|
|
2951
3011
|
return result_34;
|
|
2952
3012
|
}
|
|
2953
|
-
if (data['discriminator'] === '
|
|
2954
|
-
var result_35 = new
|
|
3013
|
+
if (data['discriminator'] === 'BreakEventArgs') {
|
|
3014
|
+
var result_35 = new BreakEventArgs();
|
|
2955
3015
|
result_35.init(data);
|
|
2956
3016
|
return result_35;
|
|
2957
3017
|
}
|
|
2958
|
-
if (data['discriminator'] === '
|
|
2959
|
-
var result_36 = new
|
|
3018
|
+
if (data['discriminator'] === 'UserInputRequestEventArgs') {
|
|
3019
|
+
var result_36 = new UserInputRequestEventArgs();
|
|
2960
3020
|
result_36.init(data);
|
|
2961
3021
|
return result_36;
|
|
2962
3022
|
}
|
|
2963
|
-
if (data['discriminator'] === '
|
|
2964
|
-
var result_37 = new
|
|
3023
|
+
if (data['discriminator'] === 'UserInputRequestCompletedEventArgs') {
|
|
3024
|
+
var result_37 = new UserInputRequestCompletedEventArgs();
|
|
2965
3025
|
result_37.init(data);
|
|
2966
3026
|
return result_37;
|
|
2967
3027
|
}
|
|
3028
|
+
if (data['discriminator'] === 'TestPlanSettingsChangedEventArgs') {
|
|
3029
|
+
var result_38 = new TestPlanSettingsChangedEventArgs();
|
|
3030
|
+
result_38.init(data);
|
|
3031
|
+
return result_38;
|
|
3032
|
+
}
|
|
2968
3033
|
var result = new SessionEvent();
|
|
2969
3034
|
result.init(data);
|
|
2970
3035
|
return result;
|
package/lib/SessionClient.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BreakPoints, CommonContext, CommonSettings, DataGridControl, Image, Interaction, ListItemType, LogList, Parameter, RepositoryPackageDefinition, RepositoryPackageReference, Result, RunStatus, SessionEvent, Setting, TestPlan, TestRun, TestStepType, TestStepValidationError, WatchDog } from './DTOs';
|
|
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';
|
|
2
2
|
import { ConnectionOptions, NatsError, Subscription, SubscriptionOptions } from 'nats.ws';
|
|
3
3
|
import { BaseClient } from './BaseClient';
|
|
4
4
|
export declare class SessionClient extends BaseClient {
|
|
@@ -86,6 +86,11 @@ export declare class SessionClient extends BaseClient {
|
|
|
86
86
|
* @return Test plan retrieved
|
|
87
87
|
*/
|
|
88
88
|
getTestPlanXML(): Promise<string>;
|
|
89
|
+
/**
|
|
90
|
+
* Returns the resource in a base64 encoded string
|
|
91
|
+
* @return The resource pointed to by `resource`
|
|
92
|
+
*/
|
|
93
|
+
downloadResource(resource: Resource): Promise<Uint8Array>;
|
|
89
94
|
/**
|
|
90
95
|
* Load test plan using a test plan TapPackage from a repository
|
|
91
96
|
* @param {RepositoryPackageDefinition} packageReference
|
package/lib/SessionClient.js
CHANGED
|
@@ -209,6 +209,22 @@ var SessionClient = /** @class */ (function (_super) {
|
|
|
209
209
|
var replySubject = "_INBOX.".concat(uuidv4());
|
|
210
210
|
return this.requestChunked('GetTestPlanXML', replySubject, replySubject).then(this.success()).catch(this.error());
|
|
211
211
|
};
|
|
212
|
+
/**
|
|
213
|
+
* Returns the resource in a base64 encoded string
|
|
214
|
+
* @return The resource pointed to by `resource`
|
|
215
|
+
*/
|
|
216
|
+
SessionClient.prototype.downloadResource = function (resource) {
|
|
217
|
+
var _a;
|
|
218
|
+
var runnerResourcePrefix = 'subject://';
|
|
219
|
+
if (!((_a = resource.source) === null || _a === void 0 ? void 0 : _a.startsWith(runnerResourcePrefix))) {
|
|
220
|
+
return Promise.reject('The source of the provided resource is not a nats subject.');
|
|
221
|
+
}
|
|
222
|
+
var replySubject = "_INBOX.".concat(uuidv4());
|
|
223
|
+
var subject = resource.source.slice(runnerResourcePrefix.length);
|
|
224
|
+
return this.requestChunked(subject, replySubject, replySubject, undefined, true, true)
|
|
225
|
+
.then(this.success())
|
|
226
|
+
.catch(this.error());
|
|
227
|
+
};
|
|
212
228
|
/**
|
|
213
229
|
* Load test plan using a test plan TapPackage from a repository
|
|
214
230
|
* @param {RepositoryPackageDefinition} packageReference
|