testeranto.tiposkripto 0.2.22 → 0.3.2
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/README.md +13 -0
- package/dist/module/Node.js +230 -229
- package/dist/module/Web.js +317 -229
- package/dist/module/index.js +467 -349
- package/dist/types/lib/tiposkripto/src/BaseAction.d.ts +2 -2
- package/dist/types/lib/tiposkripto/src/BaseCheck.d.ts +2 -2
- package/dist/types/lib/tiposkripto/src/BaseDescribe.d.ts +26 -0
- package/dist/types/lib/tiposkripto/src/BaseExpected.d.ts +25 -0
- package/dist/types/lib/tiposkripto/src/BaseGiven.d.ts +11 -2
- package/dist/types/lib/tiposkripto/src/BaseIt.d.ts +23 -0
- package/dist/types/lib/tiposkripto/src/BaseSetup.d.ts +2 -2
- package/dist/types/lib/tiposkripto/src/BaseShould.d.ts +25 -0
- package/dist/types/lib/tiposkripto/src/BaseThen.d.ts +10 -2
- package/dist/types/lib/tiposkripto/src/BaseTiposkripto.d.ts +14 -6
- package/dist/types/lib/tiposkripto/src/BaseValue.d.ts +27 -0
- package/dist/types/lib/tiposkripto/src/BaseWhen.d.ts +10 -2
- package/dist/types/lib/tiposkripto/src/CoreTypes.d.ts +1 -1
- package/dist/types/lib/tiposkripto/src/Web.d.ts +11 -0
- package/dist/types/lib/tiposkripto/src/index.d.ts +44 -57
- package/dist/types/lib/tiposkripto/src/types.d.ts +5 -6
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/package.json +1 -1
package/dist/module/Web.js
CHANGED
|
@@ -175,113 +175,6 @@ var BaseSetup = class {
|
|
|
175
175
|
}
|
|
176
176
|
};
|
|
177
177
|
|
|
178
|
-
// src/BaseAction.ts
|
|
179
|
-
var BaseAction = class {
|
|
180
|
-
constructor(name, actionCB) {
|
|
181
|
-
this.error = null;
|
|
182
|
-
this.artifacts = [];
|
|
183
|
-
this.name = name;
|
|
184
|
-
this.actionCB = actionCB;
|
|
185
|
-
}
|
|
186
|
-
addArtifact(path) {
|
|
187
|
-
if (typeof path !== "string") {
|
|
188
|
-
throw new Error(
|
|
189
|
-
`[ARTIFACT ERROR] Expected string, got ${typeof path}: ${JSON.stringify(
|
|
190
|
-
path
|
|
191
|
-
)}`
|
|
192
|
-
);
|
|
193
|
-
}
|
|
194
|
-
const normalizedPath = path.replace(/\\/g, "/");
|
|
195
|
-
this.artifacts.push(normalizedPath);
|
|
196
|
-
}
|
|
197
|
-
toObj() {
|
|
198
|
-
const obj = {
|
|
199
|
-
name: this.name,
|
|
200
|
-
status: this.status,
|
|
201
|
-
error: this.error ? `${this.error.name}: ${this.error.message}
|
|
202
|
-
${this.error.stack}` : null,
|
|
203
|
-
artifacts: this.artifacts
|
|
204
|
-
};
|
|
205
|
-
return obj;
|
|
206
|
-
}
|
|
207
|
-
async test(store, testResourceConfiguration, artifactory) {
|
|
208
|
-
try {
|
|
209
|
-
const result = await this.performAction(
|
|
210
|
-
store,
|
|
211
|
-
this.actionCB,
|
|
212
|
-
testResourceConfiguration,
|
|
213
|
-
artifactory
|
|
214
|
-
);
|
|
215
|
-
this.status = true;
|
|
216
|
-
return result;
|
|
217
|
-
} catch (e) {
|
|
218
|
-
this.status = false;
|
|
219
|
-
this.error = e;
|
|
220
|
-
throw e;
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
};
|
|
224
|
-
|
|
225
|
-
// src/BaseCheck.ts
|
|
226
|
-
var BaseCheck = class {
|
|
227
|
-
constructor(name, checkCB) {
|
|
228
|
-
this.artifacts = [];
|
|
229
|
-
this.name = name;
|
|
230
|
-
this.checkCB = checkCB;
|
|
231
|
-
this.error = false;
|
|
232
|
-
this.artifacts = [];
|
|
233
|
-
}
|
|
234
|
-
addArtifact(path) {
|
|
235
|
-
if (typeof path !== "string") {
|
|
236
|
-
throw new Error(
|
|
237
|
-
`[ARTIFACT ERROR] Expected string, got ${typeof path}: ${JSON.stringify(
|
|
238
|
-
path
|
|
239
|
-
)}`
|
|
240
|
-
);
|
|
241
|
-
}
|
|
242
|
-
const normalizedPath = path.replace(/\\/g, "/");
|
|
243
|
-
this.artifacts.push(normalizedPath);
|
|
244
|
-
}
|
|
245
|
-
toObj() {
|
|
246
|
-
const obj = {
|
|
247
|
-
name: this.name,
|
|
248
|
-
error: this.error,
|
|
249
|
-
artifacts: this.artifacts,
|
|
250
|
-
status: this.status
|
|
251
|
-
};
|
|
252
|
-
return obj;
|
|
253
|
-
}
|
|
254
|
-
async test(store, testResourceConfiguration, filepath, artifactory) {
|
|
255
|
-
const addArtifact = this.addArtifact.bind(this);
|
|
256
|
-
try {
|
|
257
|
-
const x = await this.verifyCheck(
|
|
258
|
-
store,
|
|
259
|
-
async (s) => {
|
|
260
|
-
try {
|
|
261
|
-
if (typeof this.checkCB === "function") {
|
|
262
|
-
const result = await this.checkCB(s);
|
|
263
|
-
return result;
|
|
264
|
-
} else {
|
|
265
|
-
return this.checkCB;
|
|
266
|
-
}
|
|
267
|
-
} catch (e) {
|
|
268
|
-
this.error = true;
|
|
269
|
-
throw e;
|
|
270
|
-
}
|
|
271
|
-
},
|
|
272
|
-
testResourceConfiguration,
|
|
273
|
-
artifactory
|
|
274
|
-
);
|
|
275
|
-
this.status = true;
|
|
276
|
-
return x;
|
|
277
|
-
} catch (e) {
|
|
278
|
-
this.status = false;
|
|
279
|
-
this.error = true;
|
|
280
|
-
throw e;
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
};
|
|
284
|
-
|
|
285
178
|
// src/BaseGiven.ts
|
|
286
179
|
var BaseGiven = class extends BaseSetup {
|
|
287
180
|
constructor(features, whens, thens, givenCB, initialValues) {
|
|
@@ -550,6 +443,53 @@ var BaseGiven = class extends BaseSetup {
|
|
|
550
443
|
}
|
|
551
444
|
};
|
|
552
445
|
|
|
446
|
+
// src/BaseAction.ts
|
|
447
|
+
var BaseAction = class {
|
|
448
|
+
constructor(name, actionCB) {
|
|
449
|
+
this.error = null;
|
|
450
|
+
this.artifacts = [];
|
|
451
|
+
this.name = name;
|
|
452
|
+
this.actionCB = actionCB;
|
|
453
|
+
}
|
|
454
|
+
addArtifact(path) {
|
|
455
|
+
if (typeof path !== "string") {
|
|
456
|
+
throw new Error(
|
|
457
|
+
`[ARTIFACT ERROR] Expected string, got ${typeof path}: ${JSON.stringify(
|
|
458
|
+
path
|
|
459
|
+
)}`
|
|
460
|
+
);
|
|
461
|
+
}
|
|
462
|
+
const normalizedPath = path.replace(/\\/g, "/");
|
|
463
|
+
this.artifacts.push(normalizedPath);
|
|
464
|
+
}
|
|
465
|
+
toObj() {
|
|
466
|
+
const obj = {
|
|
467
|
+
name: this.name,
|
|
468
|
+
status: this.status,
|
|
469
|
+
error: this.error ? `${this.error.name}: ${this.error.message}
|
|
470
|
+
${this.error.stack}` : null,
|
|
471
|
+
artifacts: this.artifacts
|
|
472
|
+
};
|
|
473
|
+
return obj;
|
|
474
|
+
}
|
|
475
|
+
async test(store, testResourceConfiguration, artifactory) {
|
|
476
|
+
try {
|
|
477
|
+
const result = await this.performAction(
|
|
478
|
+
store,
|
|
479
|
+
this.actionCB,
|
|
480
|
+
testResourceConfiguration,
|
|
481
|
+
artifactory
|
|
482
|
+
);
|
|
483
|
+
this.status = true;
|
|
484
|
+
return result;
|
|
485
|
+
} catch (e) {
|
|
486
|
+
this.status = false;
|
|
487
|
+
this.error = e;
|
|
488
|
+
throw e;
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
};
|
|
492
|
+
|
|
553
493
|
// src/BaseWhen.ts
|
|
554
494
|
var BaseWhen = class extends BaseAction {
|
|
555
495
|
constructor(name, whenCB) {
|
|
@@ -578,6 +518,66 @@ var BaseWhen = class extends BaseAction {
|
|
|
578
518
|
}
|
|
579
519
|
};
|
|
580
520
|
|
|
521
|
+
// src/BaseCheck.ts
|
|
522
|
+
var BaseCheck = class {
|
|
523
|
+
constructor(name, checkCB) {
|
|
524
|
+
this.artifacts = [];
|
|
525
|
+
this.name = name;
|
|
526
|
+
this.checkCB = checkCB;
|
|
527
|
+
this.error = false;
|
|
528
|
+
this.artifacts = [];
|
|
529
|
+
}
|
|
530
|
+
addArtifact(path) {
|
|
531
|
+
if (typeof path !== "string") {
|
|
532
|
+
throw new Error(
|
|
533
|
+
`[ARTIFACT ERROR] Expected string, got ${typeof path}: ${JSON.stringify(
|
|
534
|
+
path
|
|
535
|
+
)}`
|
|
536
|
+
);
|
|
537
|
+
}
|
|
538
|
+
const normalizedPath = path.replace(/\\/g, "/");
|
|
539
|
+
this.artifacts.push(normalizedPath);
|
|
540
|
+
}
|
|
541
|
+
toObj() {
|
|
542
|
+
const obj = {
|
|
543
|
+
name: this.name,
|
|
544
|
+
error: this.error,
|
|
545
|
+
artifacts: this.artifacts,
|
|
546
|
+
status: this.status
|
|
547
|
+
};
|
|
548
|
+
return obj;
|
|
549
|
+
}
|
|
550
|
+
async test(store, testResourceConfiguration, filepath, artifactory) {
|
|
551
|
+
const addArtifact = this.addArtifact.bind(this);
|
|
552
|
+
try {
|
|
553
|
+
const x = await this.verifyCheck(
|
|
554
|
+
store,
|
|
555
|
+
async (s) => {
|
|
556
|
+
try {
|
|
557
|
+
if (typeof this.checkCB === "function") {
|
|
558
|
+
const result = await this.checkCB(s);
|
|
559
|
+
return result;
|
|
560
|
+
} else {
|
|
561
|
+
return this.checkCB;
|
|
562
|
+
}
|
|
563
|
+
} catch (e) {
|
|
564
|
+
this.error = true;
|
|
565
|
+
throw e;
|
|
566
|
+
}
|
|
567
|
+
},
|
|
568
|
+
testResourceConfiguration,
|
|
569
|
+
artifactory
|
|
570
|
+
);
|
|
571
|
+
this.status = true;
|
|
572
|
+
return x;
|
|
573
|
+
} catch (e) {
|
|
574
|
+
this.status = false;
|
|
575
|
+
this.error = true;
|
|
576
|
+
throw e;
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
};
|
|
580
|
+
|
|
581
581
|
// src/BaseThen.ts
|
|
582
582
|
var BaseThen = class extends BaseCheck {
|
|
583
583
|
constructor(name, thenCB) {
|
|
@@ -896,7 +896,7 @@ var BaseTiposkripto = class {
|
|
|
896
896
|
}
|
|
897
897
|
const classySuites = Object.entries(testImplementation.suites).reduce(
|
|
898
898
|
(a, [key], index) => {
|
|
899
|
-
a[key] = (somestring,
|
|
899
|
+
a[key] = (somestring, setups) => {
|
|
900
900
|
const capturedFullAdapter = fullAdapter;
|
|
901
901
|
return new class extends BaseSuite {
|
|
902
902
|
afterAll(store, artifactory) {
|
|
@@ -920,15 +920,16 @@ var BaseTiposkripto = class {
|
|
|
920
920
|
async setup(s, artifactory, tr) {
|
|
921
921
|
return capturedFullAdapter.prepareAll?.(s, tr, artifactory) ?? s;
|
|
922
922
|
}
|
|
923
|
-
}(somestring, index,
|
|
923
|
+
}(somestring, index, setups, instance);
|
|
924
924
|
};
|
|
925
925
|
return a;
|
|
926
926
|
},
|
|
927
927
|
{}
|
|
928
928
|
);
|
|
929
|
-
const classyGivens =
|
|
930
|
-
|
|
931
|
-
|
|
929
|
+
const classyGivens = {};
|
|
930
|
+
if (testImplementation.givens) {
|
|
931
|
+
Object.entries(testImplementation.givens).forEach(([key, g]) => {
|
|
932
|
+
classyGivens[key] = (features, whens, thens, gcb, initialValues) => {
|
|
932
933
|
const safeFeatures = Array.isArray(features) ? [...features] : [];
|
|
933
934
|
const safeWhens = Array.isArray(whens) ? [...whens] : [];
|
|
934
935
|
const safeThens = Array.isArray(thens) ? [...thens] : [];
|
|
@@ -963,16 +964,14 @@ var BaseTiposkripto = class {
|
|
|
963
964
|
if (givenInstance.setParent) {
|
|
964
965
|
givenInstance.setParent(instance);
|
|
965
966
|
}
|
|
966
|
-
console.log(`[BaseTiposkripto] Set _parent for given instance`, givenInstance);
|
|
967
967
|
return givenInstance;
|
|
968
968
|
};
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
)
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
a[key] = (...payload) => {
|
|
969
|
+
});
|
|
970
|
+
}
|
|
971
|
+
const classyWhens = {};
|
|
972
|
+
if (testImplementation.whens) {
|
|
973
|
+
Object.entries(testImplementation.whens).forEach(([key, whEn]) => {
|
|
974
|
+
classyWhens[key] = (...payload) => {
|
|
976
975
|
const capturedFullAdapter = fullAdapter;
|
|
977
976
|
const whenInstance = new class extends BaseWhen {
|
|
978
977
|
async andWhen(store, whenCB, testResource, artifactory) {
|
|
@@ -986,44 +985,113 @@ var BaseTiposkripto = class {
|
|
|
986
985
|
}(`${key}: ${payload && payload.toString()}`, whEn(...payload));
|
|
987
986
|
return whenInstance;
|
|
988
987
|
};
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
)
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
a[key] = (...args) => {
|
|
988
|
+
});
|
|
989
|
+
}
|
|
990
|
+
const classyThens = {};
|
|
991
|
+
if (testImplementation.thens) {
|
|
992
|
+
Object.entries(testImplementation.thens).forEach(([key, thEn]) => {
|
|
993
|
+
classyThens[key] = (...args) => {
|
|
996
994
|
const capturedFullAdapter = fullAdapter;
|
|
997
995
|
const thenInstance = new class extends BaseThen {
|
|
998
|
-
verifyCheck(store, checkCB, testResourceConfiguration2) {
|
|
999
|
-
|
|
1000
|
-
}
|
|
1001
|
-
async butThen(store, thenCB, testResource, artifactory) {
|
|
1002
|
-
return await capturedFullAdapter.verify(
|
|
996
|
+
verifyCheck(store, checkCB, testResourceConfiguration2, artifactory) {
|
|
997
|
+
return capturedFullAdapter.verify(
|
|
1003
998
|
store,
|
|
1004
|
-
|
|
1005
|
-
|
|
999
|
+
checkCB,
|
|
1000
|
+
testResourceConfiguration2,
|
|
1006
1001
|
artifactory
|
|
1007
1002
|
);
|
|
1008
1003
|
}
|
|
1009
1004
|
}(`${key}: ${args && args.toString()}`, thEn(...args));
|
|
1010
1005
|
return thenInstance;
|
|
1011
1006
|
};
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
)
|
|
1007
|
+
});
|
|
1008
|
+
}
|
|
1009
|
+
const classyConfirms = {};
|
|
1010
|
+
if (testImplementation.confirms) {
|
|
1011
|
+
Object.entries(testImplementation.confirms).forEach(([key, val]) => {
|
|
1012
|
+
classyConfirms[key] = (features, tableRows, confirmCB, initialValues) => {
|
|
1013
|
+
return new BaseValue(
|
|
1014
|
+
features,
|
|
1015
|
+
tableRows,
|
|
1016
|
+
confirmCB,
|
|
1017
|
+
initialValues
|
|
1018
|
+
);
|
|
1019
|
+
};
|
|
1020
|
+
});
|
|
1021
|
+
}
|
|
1022
|
+
const classyValues = {};
|
|
1023
|
+
if (testImplementation.values) {
|
|
1024
|
+
Object.entries(testImplementation.values).forEach(([key, val]) => {
|
|
1025
|
+
classyValues[key] = (features, tableRows, confirmCB, initialValues) => {
|
|
1026
|
+
return new BaseValue(
|
|
1027
|
+
features,
|
|
1028
|
+
tableRows,
|
|
1029
|
+
confirmCB,
|
|
1030
|
+
initialValues
|
|
1031
|
+
);
|
|
1032
|
+
};
|
|
1033
|
+
});
|
|
1034
|
+
}
|
|
1035
|
+
const classyShoulds = {};
|
|
1036
|
+
if (testImplementation.shoulds) {
|
|
1037
|
+
Object.entries(testImplementation.shoulds).forEach(([key, shouldCB]) => {
|
|
1038
|
+
classyShoulds[key] = (...args) => {
|
|
1039
|
+
return new BaseShould(`${key}: ${args && args.toString()}`, shouldCB(...args));
|
|
1040
|
+
};
|
|
1041
|
+
});
|
|
1042
|
+
}
|
|
1043
|
+
const classyExpecteds = {};
|
|
1044
|
+
if (testImplementation.expecteds) {
|
|
1045
|
+
Object.entries(testImplementation.expecteds).forEach(([key, expectedCB]) => {
|
|
1046
|
+
classyExpecteds[key] = (...args) => {
|
|
1047
|
+
return new BaseExpected(`${key}: ${args && args.toString()}`, expectedCB(...args));
|
|
1048
|
+
};
|
|
1049
|
+
});
|
|
1050
|
+
}
|
|
1051
|
+
const classyDescribes = {};
|
|
1052
|
+
if (testImplementation.describes) {
|
|
1053
|
+
Object.entries(testImplementation.describes).forEach(([key, desc]) => {
|
|
1054
|
+
classyDescribes[key] = (features, its, describeCB, initialValues) => {
|
|
1055
|
+
return new BaseDescribe(
|
|
1056
|
+
features,
|
|
1057
|
+
its,
|
|
1058
|
+
describeCB,
|
|
1059
|
+
initialValues
|
|
1060
|
+
);
|
|
1061
|
+
};
|
|
1062
|
+
});
|
|
1063
|
+
}
|
|
1064
|
+
const classyIts = {};
|
|
1065
|
+
if (testImplementation.its) {
|
|
1066
|
+
Object.entries(testImplementation.its).forEach(([key, itCB]) => {
|
|
1067
|
+
classyIts[key] = (...args) => {
|
|
1068
|
+
return new BaseIt(`${key}: ${args && args.toString()}`, itCB(...args));
|
|
1069
|
+
};
|
|
1070
|
+
});
|
|
1071
|
+
}
|
|
1016
1072
|
this.suitesOverrides = classySuites;
|
|
1017
1073
|
this.givenOverrides = classyGivens;
|
|
1018
1074
|
this.whenOverrides = classyWhens;
|
|
1019
1075
|
this.thenOverrides = classyThens;
|
|
1076
|
+
this.valuesOverrides = classyValues;
|
|
1077
|
+
this.shouldsOverrides = classyShoulds;
|
|
1078
|
+
this.expectedsOverrides = classyExpecteds;
|
|
1079
|
+
this.describesOverrides = classyDescribes;
|
|
1080
|
+
this.itsOverrides = classyIts;
|
|
1081
|
+
this.confirmsOverrides = classyConfirms;
|
|
1020
1082
|
this.testResourceRequirement = testResourceRequirement;
|
|
1021
1083
|
this.testSpecification = testSpecification;
|
|
1022
1084
|
this.specs = testSpecification(
|
|
1023
1085
|
this.Suites(),
|
|
1024
1086
|
this.Given(),
|
|
1025
1087
|
this.When(),
|
|
1026
|
-
this.Then()
|
|
1088
|
+
this.Then(),
|
|
1089
|
+
this.Describe(),
|
|
1090
|
+
this.It(),
|
|
1091
|
+
this.Confirm(),
|
|
1092
|
+
this.Value(),
|
|
1093
|
+
this.Should(),
|
|
1094
|
+
this.Expect()
|
|
1027
1095
|
);
|
|
1028
1096
|
this.totalTests = this.calculateTotalTests();
|
|
1029
1097
|
this.testJobs = this.specs.map((suite) => {
|
|
@@ -1112,97 +1180,10 @@ var BaseTiposkripto = class {
|
|
|
1112
1180
|
const fullPath = `${basePathClean}/${pathClean}`;
|
|
1113
1181
|
console.log("[Artifactory] Full path:", fullPath);
|
|
1114
1182
|
this.writeFileSync(fullPath, payload);
|
|
1115
|
-
},
|
|
1116
|
-
screenshot: (filename, payload) => {
|
|
1117
|
-
let path = "";
|
|
1118
|
-
const basePath = this.testResourceConfiguration?.fs || "testeranto";
|
|
1119
|
-
console.log("[Artifactory Screenshot] Base path:", basePath);
|
|
1120
|
-
console.log("[Artifactory Screenshot] Context:", context);
|
|
1121
|
-
if (context.suiteIndex !== void 0) {
|
|
1122
|
-
path += `suite-${context.suiteIndex}/`;
|
|
1123
|
-
}
|
|
1124
|
-
if (context.givenKey) {
|
|
1125
|
-
path += `given-${context.givenKey}/`;
|
|
1126
|
-
}
|
|
1127
|
-
if (context.whenIndex !== void 0) {
|
|
1128
|
-
path += `when-${context.whenIndex} `;
|
|
1129
|
-
} else if (context.thenIndex !== void 0) {
|
|
1130
|
-
path += `then-${context.thenIndex} `;
|
|
1131
|
-
}
|
|
1132
|
-
path += filename;
|
|
1133
|
-
if (!path.match(/\.[a-zA-Z0-9]+$/)) {
|
|
1134
|
-
path += ".png";
|
|
1135
|
-
}
|
|
1136
|
-
const basePathClean = basePath.replace(/\/$/, "");
|
|
1137
|
-
const pathClean = path.replace(/^\//, "");
|
|
1138
|
-
const fullPath = `${basePathClean}/${pathClean}`;
|
|
1139
|
-
console.log("[Artifactory Screenshot] Full path:", fullPath);
|
|
1140
|
-
if (typeof this.screenshot === "function") {
|
|
1141
|
-
this.screenshot(fullPath, payload || "");
|
|
1142
|
-
} else {
|
|
1143
|
-
this.writeFileSync(fullPath, payload || "");
|
|
1144
|
-
}
|
|
1145
|
-
},
|
|
1146
|
-
openScreencast: async (filename) => {
|
|
1147
|
-
let path = "";
|
|
1148
|
-
const basePath = this.testResourceConfiguration?.fs || "testeranto";
|
|
1149
|
-
console.log("[Artifactory openScreencast] Base path:", basePath);
|
|
1150
|
-
console.log("[Artifactory openScreencast] Context:", context);
|
|
1151
|
-
if (context.suiteIndex !== void 0) {
|
|
1152
|
-
path += `suite-${context.suiteIndex}/`;
|
|
1153
|
-
}
|
|
1154
|
-
if (context.givenKey) {
|
|
1155
|
-
path += `given-${context.givenKey}/`;
|
|
1156
|
-
}
|
|
1157
|
-
if (context.whenIndex !== void 0) {
|
|
1158
|
-
path += `when-${context.whenIndex} `;
|
|
1159
|
-
} else if (context.thenIndex !== void 0) {
|
|
1160
|
-
path += `then-${context.thenIndex} `;
|
|
1161
|
-
}
|
|
1162
|
-
path += filename;
|
|
1163
|
-
if (!path.match(/\.[a-zA-Z0-9]+$/)) {
|
|
1164
|
-
path += ".webm";
|
|
1165
|
-
}
|
|
1166
|
-
const basePathClean = basePath.replace(/\/$/, "");
|
|
1167
|
-
const pathClean = path.replace(/^\//, "");
|
|
1168
|
-
const fullPath = `${basePathClean}/${pathClean}`;
|
|
1169
|
-
console.log("[Artifactory openScreencast] Full path:", fullPath);
|
|
1170
|
-
if (typeof this.openScreencast === "function") {
|
|
1171
|
-
await this.openScreencast(fullPath);
|
|
1172
|
-
} else {
|
|
1173
|
-
console.log("[Artifactory openScreencast] Method not available");
|
|
1174
|
-
}
|
|
1175
|
-
},
|
|
1176
|
-
closeScreencast: async (filename) => {
|
|
1177
|
-
let path = "";
|
|
1178
|
-
const basePath = this.testResourceConfiguration?.fs || "testeranto";
|
|
1179
|
-
console.log("[Artifactory closeScreencast] Base path:", basePath);
|
|
1180
|
-
console.log("[Artifactory closeScreencast] Context:", context);
|
|
1181
|
-
if (context.suiteIndex !== void 0) {
|
|
1182
|
-
path += `suite-${context.suiteIndex}/`;
|
|
1183
|
-
}
|
|
1184
|
-
if (context.givenKey) {
|
|
1185
|
-
path += `given-${context.givenKey}/`;
|
|
1186
|
-
}
|
|
1187
|
-
if (context.whenIndex !== void 0) {
|
|
1188
|
-
path += `when-${context.whenIndex} `;
|
|
1189
|
-
} else if (context.thenIndex !== void 0) {
|
|
1190
|
-
path += `then-${context.thenIndex} `;
|
|
1191
|
-
}
|
|
1192
|
-
path += filename;
|
|
1193
|
-
if (!path.match(/\.[a-zA-Z0-9]+$/)) {
|
|
1194
|
-
path += ".webm";
|
|
1195
|
-
}
|
|
1196
|
-
const basePathClean = basePath.replace(/\/$/, "");
|
|
1197
|
-
const pathClean = path.replace(/^\//, "");
|
|
1198
|
-
const fullPath = `${basePathClean}/${pathClean}`;
|
|
1199
|
-
console.log("[Artifactory closeScreencast] Full path:", fullPath);
|
|
1200
|
-
if (typeof this.closeScreencast === "function") {
|
|
1201
|
-
await this.closeScreencast(fullPath);
|
|
1202
|
-
} else {
|
|
1203
|
-
console.log("[Artifactory closeScreencast] Method not available");
|
|
1204
|
-
}
|
|
1205
1183
|
}
|
|
1184
|
+
// screenshot, openScreencast, and closeScreencast are only applicable to web runtime
|
|
1185
|
+
// They should be implemented in WebTiposkripto and will be added to the artifactory there
|
|
1186
|
+
// For non-web runtimes, these methods will not be available
|
|
1206
1187
|
};
|
|
1207
1188
|
}
|
|
1208
1189
|
async receiveTestResourceConfig(testResourceConfig) {
|
|
@@ -1234,6 +1215,24 @@ var BaseTiposkripto = class {
|
|
|
1234
1215
|
Then() {
|
|
1235
1216
|
return this.thenOverrides;
|
|
1236
1217
|
}
|
|
1218
|
+
Describe() {
|
|
1219
|
+
return this.describesOverrides || {};
|
|
1220
|
+
}
|
|
1221
|
+
It() {
|
|
1222
|
+
return this.itsOverrides || {};
|
|
1223
|
+
}
|
|
1224
|
+
Confirm() {
|
|
1225
|
+
return this.confirmsOverrides || {};
|
|
1226
|
+
}
|
|
1227
|
+
Value() {
|
|
1228
|
+
return this.valuesOverrides || {};
|
|
1229
|
+
}
|
|
1230
|
+
Should() {
|
|
1231
|
+
return this.shouldsOverrides || {};
|
|
1232
|
+
}
|
|
1233
|
+
Expect() {
|
|
1234
|
+
return this.expectedsOverrides || {};
|
|
1235
|
+
}
|
|
1237
1236
|
// Add a method to access test jobs which can be used by receiveTestResourceConfig
|
|
1238
1237
|
getTestJobs() {
|
|
1239
1238
|
return this.testJobs;
|
|
@@ -1331,6 +1330,8 @@ var WebTiposkripto = class extends BaseTiposkripto {
|
|
|
1331
1330
|
console.error("Not in browser environment");
|
|
1332
1331
|
}
|
|
1333
1332
|
}
|
|
1333
|
+
// screenshot, openScreencast, and closeScreencast are only applicable to web runtime
|
|
1334
|
+
// These methods capture visual artifacts in browser environments
|
|
1334
1335
|
screenshot(filename, payload) {
|
|
1335
1336
|
console.log("screenshot", filename, payload);
|
|
1336
1337
|
if (isBrowser) {
|
|
@@ -1370,6 +1371,93 @@ var WebTiposkripto = class extends BaseTiposkripto {
|
|
|
1370
1371
|
console.error("Not in browser environment");
|
|
1371
1372
|
}
|
|
1372
1373
|
}
|
|
1374
|
+
// Override createArtifactory to add web-specific methods
|
|
1375
|
+
createArtifactory(context = {}) {
|
|
1376
|
+
const baseArtifactory = super.createArtifactory(context);
|
|
1377
|
+
return {
|
|
1378
|
+
...baseArtifactory,
|
|
1379
|
+
// screenshot, openScreencast, and closeScreencast are only applicable to web runtime
|
|
1380
|
+
// They capture visual artifacts in browser environments
|
|
1381
|
+
screenshot: (filename, payload) => {
|
|
1382
|
+
let path = "";
|
|
1383
|
+
const basePath = this.testResourceConfiguration?.fs || "testeranto";
|
|
1384
|
+
console.log("[Artifactory Screenshot] Base path:", basePath);
|
|
1385
|
+
console.log("[Artifactory Screenshot] Context:", context);
|
|
1386
|
+
if (context.suiteIndex !== void 0) {
|
|
1387
|
+
path += `suite-${context.suiteIndex}/`;
|
|
1388
|
+
}
|
|
1389
|
+
if (context.givenKey) {
|
|
1390
|
+
path += `given-${context.givenKey}/`;
|
|
1391
|
+
}
|
|
1392
|
+
if (context.whenIndex !== void 0) {
|
|
1393
|
+
path += `when-${context.whenIndex} `;
|
|
1394
|
+
} else if (context.thenIndex !== void 0) {
|
|
1395
|
+
path += `then-${context.thenIndex} `;
|
|
1396
|
+
}
|
|
1397
|
+
path += filename;
|
|
1398
|
+
if (!path.match(/\.[a-zA-Z0-9]+$/)) {
|
|
1399
|
+
path += ".png";
|
|
1400
|
+
}
|
|
1401
|
+
const basePathClean = basePath.replace(/\/$/, "");
|
|
1402
|
+
const pathClean = path.replace(/^\//, "");
|
|
1403
|
+
const fullPath = `${basePathClean}/${pathClean}`;
|
|
1404
|
+
console.log("[Artifactory Screenshot] Full path:", fullPath);
|
|
1405
|
+
this.screenshot(fullPath, payload || "");
|
|
1406
|
+
},
|
|
1407
|
+
openScreencast: async (filename) => {
|
|
1408
|
+
let path = "";
|
|
1409
|
+
const basePath = this.testResourceConfiguration?.fs || "testeranto";
|
|
1410
|
+
console.log("[Artifactory openScreencast] Base path:", basePath);
|
|
1411
|
+
console.log("[Artifactory openScreencast] Context:", context);
|
|
1412
|
+
if (context.suiteIndex !== void 0) {
|
|
1413
|
+
path += `suite-${context.suiteIndex}/`;
|
|
1414
|
+
}
|
|
1415
|
+
if (context.givenKey) {
|
|
1416
|
+
path += `given-${context.givenKey}/`;
|
|
1417
|
+
}
|
|
1418
|
+
if (context.whenIndex !== void 0) {
|
|
1419
|
+
path += `when-${context.whenIndex} `;
|
|
1420
|
+
} else if (context.thenIndex !== void 0) {
|
|
1421
|
+
path += `then-${context.thenIndex} `;
|
|
1422
|
+
}
|
|
1423
|
+
path += filename;
|
|
1424
|
+
if (!path.match(/\.[a-zA-Z0-9]+$/)) {
|
|
1425
|
+
path += ".webm";
|
|
1426
|
+
}
|
|
1427
|
+
const basePathClean = basePath.replace(/\/$/, "");
|
|
1428
|
+
const pathClean = path.replace(/^\//, "");
|
|
1429
|
+
const fullPath = `${basePathClean}/${pathClean}`;
|
|
1430
|
+
console.log("[Artifactory openScreencast] Full path:", fullPath);
|
|
1431
|
+
await this.openScreencast(fullPath);
|
|
1432
|
+
},
|
|
1433
|
+
closeScreencast: async (filename) => {
|
|
1434
|
+
let path = "";
|
|
1435
|
+
const basePath = this.testResourceConfiguration?.fs || "testeranto";
|
|
1436
|
+
console.log("[Artifactory closeScreencast] Base path:", basePath);
|
|
1437
|
+
console.log("[Artifactory closeScreencast] Context:", context);
|
|
1438
|
+
if (context.suiteIndex !== void 0) {
|
|
1439
|
+
path += `suite-${context.suiteIndex}/`;
|
|
1440
|
+
}
|
|
1441
|
+
if (context.givenKey) {
|
|
1442
|
+
path += `given-${context.givenKey}/`;
|
|
1443
|
+
}
|
|
1444
|
+
if (context.whenIndex !== void 0) {
|
|
1445
|
+
path += `when-${context.whenIndex} `;
|
|
1446
|
+
} else if (context.thenIndex !== void 0) {
|
|
1447
|
+
path += `then-${context.thenIndex} `;
|
|
1448
|
+
}
|
|
1449
|
+
path += filename;
|
|
1450
|
+
if (!path.match(/\.[a-zA-Z0-9]+$/)) {
|
|
1451
|
+
path += ".webm";
|
|
1452
|
+
}
|
|
1453
|
+
const basePathClean = basePath.replace(/\/$/, "");
|
|
1454
|
+
const pathClean = path.replace(/^\//, "");
|
|
1455
|
+
const fullPath = `${basePathClean}/${pathClean}`;
|
|
1456
|
+
console.log("[Artifactory closeScreencast] Full path:", fullPath);
|
|
1457
|
+
await this.closeScreencast(fullPath);
|
|
1458
|
+
}
|
|
1459
|
+
};
|
|
1460
|
+
}
|
|
1373
1461
|
};
|
|
1374
1462
|
var tiposkripto = async (input, testSpecification, testImplementation, testAdapter, testResourceRequirement = defaultTestResourceRequirement) => {
|
|
1375
1463
|
try {
|