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/README.md
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
1
|
# tiposkripto
|
|
2
2
|
|
|
3
3
|
## the typescript implementation of testeranto
|
|
4
|
+
|
|
5
|
+
## Supported Patterns
|
|
6
|
+
|
|
7
|
+
1. **BDD (Behavior Driven Development)**: Given, When, Then (3 verbs) - fully implemented and production-ready
|
|
8
|
+
2. **TDT (Table-Driven Testing)**: Value, Should, Expected (3 verbs) - core classes implemented, integration in progress
|
|
9
|
+
3. **Describe-It Pattern (AAA/Arrange-Act-Assert)**: Describe, It (2 verbs) - core classes implemented, integration in progress
|
|
10
|
+
|
|
11
|
+
## Status
|
|
12
|
+
|
|
13
|
+
- BDD pattern is fully functional and production-ready (uses 3 verbs: Given, When, Then)
|
|
14
|
+
- TDT pattern has core classes (BaseValue, BaseShould, BaseExpected) and specification helpers (createTDTSpecification, Confirm) available (uses 3 verbs)
|
|
15
|
+
- Describe-It pattern (AAA) has core classes (BaseDescribe, BaseIt) and specification helpers (createDescribeItSpecification, DescribeIt) available (uses 2 verbs)
|
|
16
|
+
- BDD is recommended for production use; TDT and Describe-It patterns are available for experimentation
|
package/dist/module/Node.js
CHANGED
|
@@ -179,113 +179,6 @@ var BaseSetup = class {
|
|
|
179
179
|
}
|
|
180
180
|
};
|
|
181
181
|
|
|
182
|
-
// src/BaseAction.ts
|
|
183
|
-
var BaseAction = class {
|
|
184
|
-
constructor(name, actionCB) {
|
|
185
|
-
this.error = null;
|
|
186
|
-
this.artifacts = [];
|
|
187
|
-
this.name = name;
|
|
188
|
-
this.actionCB = actionCB;
|
|
189
|
-
}
|
|
190
|
-
addArtifact(path2) {
|
|
191
|
-
if (typeof path2 !== "string") {
|
|
192
|
-
throw new Error(
|
|
193
|
-
`[ARTIFACT ERROR] Expected string, got ${typeof path2}: ${JSON.stringify(
|
|
194
|
-
path2
|
|
195
|
-
)}`
|
|
196
|
-
);
|
|
197
|
-
}
|
|
198
|
-
const normalizedPath = path2.replace(/\\/g, "/");
|
|
199
|
-
this.artifacts.push(normalizedPath);
|
|
200
|
-
}
|
|
201
|
-
toObj() {
|
|
202
|
-
const obj = {
|
|
203
|
-
name: this.name,
|
|
204
|
-
status: this.status,
|
|
205
|
-
error: this.error ? `${this.error.name}: ${this.error.message}
|
|
206
|
-
${this.error.stack}` : null,
|
|
207
|
-
artifacts: this.artifacts
|
|
208
|
-
};
|
|
209
|
-
return obj;
|
|
210
|
-
}
|
|
211
|
-
async test(store, testResourceConfiguration, artifactory) {
|
|
212
|
-
try {
|
|
213
|
-
const result = await this.performAction(
|
|
214
|
-
store,
|
|
215
|
-
this.actionCB,
|
|
216
|
-
testResourceConfiguration,
|
|
217
|
-
artifactory
|
|
218
|
-
);
|
|
219
|
-
this.status = true;
|
|
220
|
-
return result;
|
|
221
|
-
} catch (e) {
|
|
222
|
-
this.status = false;
|
|
223
|
-
this.error = e;
|
|
224
|
-
throw e;
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
};
|
|
228
|
-
|
|
229
|
-
// src/BaseCheck.ts
|
|
230
|
-
var BaseCheck = class {
|
|
231
|
-
constructor(name, checkCB) {
|
|
232
|
-
this.artifacts = [];
|
|
233
|
-
this.name = name;
|
|
234
|
-
this.checkCB = checkCB;
|
|
235
|
-
this.error = false;
|
|
236
|
-
this.artifacts = [];
|
|
237
|
-
}
|
|
238
|
-
addArtifact(path2) {
|
|
239
|
-
if (typeof path2 !== "string") {
|
|
240
|
-
throw new Error(
|
|
241
|
-
`[ARTIFACT ERROR] Expected string, got ${typeof path2}: ${JSON.stringify(
|
|
242
|
-
path2
|
|
243
|
-
)}`
|
|
244
|
-
);
|
|
245
|
-
}
|
|
246
|
-
const normalizedPath = path2.replace(/\\/g, "/");
|
|
247
|
-
this.artifacts.push(normalizedPath);
|
|
248
|
-
}
|
|
249
|
-
toObj() {
|
|
250
|
-
const obj = {
|
|
251
|
-
name: this.name,
|
|
252
|
-
error: this.error,
|
|
253
|
-
artifacts: this.artifacts,
|
|
254
|
-
status: this.status
|
|
255
|
-
};
|
|
256
|
-
return obj;
|
|
257
|
-
}
|
|
258
|
-
async test(store, testResourceConfiguration, filepath, artifactory) {
|
|
259
|
-
const addArtifact = this.addArtifact.bind(this);
|
|
260
|
-
try {
|
|
261
|
-
const x = await this.verifyCheck(
|
|
262
|
-
store,
|
|
263
|
-
async (s) => {
|
|
264
|
-
try {
|
|
265
|
-
if (typeof this.checkCB === "function") {
|
|
266
|
-
const result = await this.checkCB(s);
|
|
267
|
-
return result;
|
|
268
|
-
} else {
|
|
269
|
-
return this.checkCB;
|
|
270
|
-
}
|
|
271
|
-
} catch (e) {
|
|
272
|
-
this.error = true;
|
|
273
|
-
throw e;
|
|
274
|
-
}
|
|
275
|
-
},
|
|
276
|
-
testResourceConfiguration,
|
|
277
|
-
artifactory
|
|
278
|
-
);
|
|
279
|
-
this.status = true;
|
|
280
|
-
return x;
|
|
281
|
-
} catch (e) {
|
|
282
|
-
this.status = false;
|
|
283
|
-
this.error = true;
|
|
284
|
-
throw e;
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
};
|
|
288
|
-
|
|
289
182
|
// src/BaseGiven.ts
|
|
290
183
|
var BaseGiven = class extends BaseSetup {
|
|
291
184
|
constructor(features, whens, thens, givenCB, initialValues) {
|
|
@@ -554,6 +447,53 @@ var BaseGiven = class extends BaseSetup {
|
|
|
554
447
|
}
|
|
555
448
|
};
|
|
556
449
|
|
|
450
|
+
// src/BaseAction.ts
|
|
451
|
+
var BaseAction = class {
|
|
452
|
+
constructor(name, actionCB) {
|
|
453
|
+
this.error = null;
|
|
454
|
+
this.artifacts = [];
|
|
455
|
+
this.name = name;
|
|
456
|
+
this.actionCB = actionCB;
|
|
457
|
+
}
|
|
458
|
+
addArtifact(path2) {
|
|
459
|
+
if (typeof path2 !== "string") {
|
|
460
|
+
throw new Error(
|
|
461
|
+
`[ARTIFACT ERROR] Expected string, got ${typeof path2}: ${JSON.stringify(
|
|
462
|
+
path2
|
|
463
|
+
)}`
|
|
464
|
+
);
|
|
465
|
+
}
|
|
466
|
+
const normalizedPath = path2.replace(/\\/g, "/");
|
|
467
|
+
this.artifacts.push(normalizedPath);
|
|
468
|
+
}
|
|
469
|
+
toObj() {
|
|
470
|
+
const obj = {
|
|
471
|
+
name: this.name,
|
|
472
|
+
status: this.status,
|
|
473
|
+
error: this.error ? `${this.error.name}: ${this.error.message}
|
|
474
|
+
${this.error.stack}` : null,
|
|
475
|
+
artifacts: this.artifacts
|
|
476
|
+
};
|
|
477
|
+
return obj;
|
|
478
|
+
}
|
|
479
|
+
async test(store, testResourceConfiguration, artifactory) {
|
|
480
|
+
try {
|
|
481
|
+
const result = await this.performAction(
|
|
482
|
+
store,
|
|
483
|
+
this.actionCB,
|
|
484
|
+
testResourceConfiguration,
|
|
485
|
+
artifactory
|
|
486
|
+
);
|
|
487
|
+
this.status = true;
|
|
488
|
+
return result;
|
|
489
|
+
} catch (e) {
|
|
490
|
+
this.status = false;
|
|
491
|
+
this.error = e;
|
|
492
|
+
throw e;
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
};
|
|
496
|
+
|
|
557
497
|
// src/BaseWhen.ts
|
|
558
498
|
var BaseWhen = class extends BaseAction {
|
|
559
499
|
constructor(name, whenCB) {
|
|
@@ -582,6 +522,66 @@ var BaseWhen = class extends BaseAction {
|
|
|
582
522
|
}
|
|
583
523
|
};
|
|
584
524
|
|
|
525
|
+
// src/BaseCheck.ts
|
|
526
|
+
var BaseCheck = class {
|
|
527
|
+
constructor(name, checkCB) {
|
|
528
|
+
this.artifacts = [];
|
|
529
|
+
this.name = name;
|
|
530
|
+
this.checkCB = checkCB;
|
|
531
|
+
this.error = false;
|
|
532
|
+
this.artifacts = [];
|
|
533
|
+
}
|
|
534
|
+
addArtifact(path2) {
|
|
535
|
+
if (typeof path2 !== "string") {
|
|
536
|
+
throw new Error(
|
|
537
|
+
`[ARTIFACT ERROR] Expected string, got ${typeof path2}: ${JSON.stringify(
|
|
538
|
+
path2
|
|
539
|
+
)}`
|
|
540
|
+
);
|
|
541
|
+
}
|
|
542
|
+
const normalizedPath = path2.replace(/\\/g, "/");
|
|
543
|
+
this.artifacts.push(normalizedPath);
|
|
544
|
+
}
|
|
545
|
+
toObj() {
|
|
546
|
+
const obj = {
|
|
547
|
+
name: this.name,
|
|
548
|
+
error: this.error,
|
|
549
|
+
artifacts: this.artifacts,
|
|
550
|
+
status: this.status
|
|
551
|
+
};
|
|
552
|
+
return obj;
|
|
553
|
+
}
|
|
554
|
+
async test(store, testResourceConfiguration, filepath, artifactory) {
|
|
555
|
+
const addArtifact = this.addArtifact.bind(this);
|
|
556
|
+
try {
|
|
557
|
+
const x = await this.verifyCheck(
|
|
558
|
+
store,
|
|
559
|
+
async (s) => {
|
|
560
|
+
try {
|
|
561
|
+
if (typeof this.checkCB === "function") {
|
|
562
|
+
const result = await this.checkCB(s);
|
|
563
|
+
return result;
|
|
564
|
+
} else {
|
|
565
|
+
return this.checkCB;
|
|
566
|
+
}
|
|
567
|
+
} catch (e) {
|
|
568
|
+
this.error = true;
|
|
569
|
+
throw e;
|
|
570
|
+
}
|
|
571
|
+
},
|
|
572
|
+
testResourceConfiguration,
|
|
573
|
+
artifactory
|
|
574
|
+
);
|
|
575
|
+
this.status = true;
|
|
576
|
+
return x;
|
|
577
|
+
} catch (e) {
|
|
578
|
+
this.status = false;
|
|
579
|
+
this.error = true;
|
|
580
|
+
throw e;
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
};
|
|
584
|
+
|
|
585
585
|
// src/BaseThen.ts
|
|
586
586
|
var BaseThen = class extends BaseCheck {
|
|
587
587
|
constructor(name, thenCB) {
|
|
@@ -900,7 +900,7 @@ var BaseTiposkripto = class {
|
|
|
900
900
|
}
|
|
901
901
|
const classySuites = Object.entries(testImplementation.suites).reduce(
|
|
902
902
|
(a, [key], index) => {
|
|
903
|
-
a[key] = (somestring,
|
|
903
|
+
a[key] = (somestring, setups) => {
|
|
904
904
|
const capturedFullAdapter = fullAdapter;
|
|
905
905
|
return new class extends BaseSuite {
|
|
906
906
|
afterAll(store, artifactory) {
|
|
@@ -924,15 +924,16 @@ var BaseTiposkripto = class {
|
|
|
924
924
|
async setup(s, artifactory, tr) {
|
|
925
925
|
return capturedFullAdapter.prepareAll?.(s, tr, artifactory) ?? s;
|
|
926
926
|
}
|
|
927
|
-
}(somestring, index,
|
|
927
|
+
}(somestring, index, setups, instance);
|
|
928
928
|
};
|
|
929
929
|
return a;
|
|
930
930
|
},
|
|
931
931
|
{}
|
|
932
932
|
);
|
|
933
|
-
const classyGivens =
|
|
934
|
-
|
|
935
|
-
|
|
933
|
+
const classyGivens = {};
|
|
934
|
+
if (testImplementation.givens) {
|
|
935
|
+
Object.entries(testImplementation.givens).forEach(([key, g]) => {
|
|
936
|
+
classyGivens[key] = (features, whens, thens, gcb, initialValues) => {
|
|
936
937
|
const safeFeatures = Array.isArray(features) ? [...features] : [];
|
|
937
938
|
const safeWhens = Array.isArray(whens) ? [...whens] : [];
|
|
938
939
|
const safeThens = Array.isArray(thens) ? [...thens] : [];
|
|
@@ -967,16 +968,14 @@ var BaseTiposkripto = class {
|
|
|
967
968
|
if (givenInstance.setParent) {
|
|
968
969
|
givenInstance.setParent(instance);
|
|
969
970
|
}
|
|
970
|
-
console.log(`[BaseTiposkripto] Set _parent for given instance`, givenInstance);
|
|
971
971
|
return givenInstance;
|
|
972
972
|
};
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
)
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
a[key] = (...payload) => {
|
|
973
|
+
});
|
|
974
|
+
}
|
|
975
|
+
const classyWhens = {};
|
|
976
|
+
if (testImplementation.whens) {
|
|
977
|
+
Object.entries(testImplementation.whens).forEach(([key, whEn]) => {
|
|
978
|
+
classyWhens[key] = (...payload) => {
|
|
980
979
|
const capturedFullAdapter = fullAdapter;
|
|
981
980
|
const whenInstance = new class extends BaseWhen {
|
|
982
981
|
async andWhen(store, whenCB, testResource, artifactory) {
|
|
@@ -990,44 +989,113 @@ var BaseTiposkripto = class {
|
|
|
990
989
|
}(`${key}: ${payload && payload.toString()}`, whEn(...payload));
|
|
991
990
|
return whenInstance;
|
|
992
991
|
};
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
)
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
a[key] = (...args) => {
|
|
992
|
+
});
|
|
993
|
+
}
|
|
994
|
+
const classyThens = {};
|
|
995
|
+
if (testImplementation.thens) {
|
|
996
|
+
Object.entries(testImplementation.thens).forEach(([key, thEn]) => {
|
|
997
|
+
classyThens[key] = (...args) => {
|
|
1000
998
|
const capturedFullAdapter = fullAdapter;
|
|
1001
999
|
const thenInstance = new class extends BaseThen {
|
|
1002
|
-
verifyCheck(store, checkCB, testResourceConfiguration2) {
|
|
1003
|
-
|
|
1004
|
-
}
|
|
1005
|
-
async butThen(store, thenCB, testResource, artifactory) {
|
|
1006
|
-
return await capturedFullAdapter.verify(
|
|
1000
|
+
verifyCheck(store, checkCB, testResourceConfiguration2, artifactory) {
|
|
1001
|
+
return capturedFullAdapter.verify(
|
|
1007
1002
|
store,
|
|
1008
|
-
|
|
1009
|
-
|
|
1003
|
+
checkCB,
|
|
1004
|
+
testResourceConfiguration2,
|
|
1010
1005
|
artifactory
|
|
1011
1006
|
);
|
|
1012
1007
|
}
|
|
1013
1008
|
}(`${key}: ${args && args.toString()}`, thEn(...args));
|
|
1014
1009
|
return thenInstance;
|
|
1015
1010
|
};
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
)
|
|
1011
|
+
});
|
|
1012
|
+
}
|
|
1013
|
+
const classyConfirms = {};
|
|
1014
|
+
if (testImplementation.confirms) {
|
|
1015
|
+
Object.entries(testImplementation.confirms).forEach(([key, val]) => {
|
|
1016
|
+
classyConfirms[key] = (features, tableRows, confirmCB, initialValues) => {
|
|
1017
|
+
return new BaseValue(
|
|
1018
|
+
features,
|
|
1019
|
+
tableRows,
|
|
1020
|
+
confirmCB,
|
|
1021
|
+
initialValues
|
|
1022
|
+
);
|
|
1023
|
+
};
|
|
1024
|
+
});
|
|
1025
|
+
}
|
|
1026
|
+
const classyValues = {};
|
|
1027
|
+
if (testImplementation.values) {
|
|
1028
|
+
Object.entries(testImplementation.values).forEach(([key, val]) => {
|
|
1029
|
+
classyValues[key] = (features, tableRows, confirmCB, initialValues) => {
|
|
1030
|
+
return new BaseValue(
|
|
1031
|
+
features,
|
|
1032
|
+
tableRows,
|
|
1033
|
+
confirmCB,
|
|
1034
|
+
initialValues
|
|
1035
|
+
);
|
|
1036
|
+
};
|
|
1037
|
+
});
|
|
1038
|
+
}
|
|
1039
|
+
const classyShoulds = {};
|
|
1040
|
+
if (testImplementation.shoulds) {
|
|
1041
|
+
Object.entries(testImplementation.shoulds).forEach(([key, shouldCB]) => {
|
|
1042
|
+
classyShoulds[key] = (...args) => {
|
|
1043
|
+
return new BaseShould(`${key}: ${args && args.toString()}`, shouldCB(...args));
|
|
1044
|
+
};
|
|
1045
|
+
});
|
|
1046
|
+
}
|
|
1047
|
+
const classyExpecteds = {};
|
|
1048
|
+
if (testImplementation.expecteds) {
|
|
1049
|
+
Object.entries(testImplementation.expecteds).forEach(([key, expectedCB]) => {
|
|
1050
|
+
classyExpecteds[key] = (...args) => {
|
|
1051
|
+
return new BaseExpected(`${key}: ${args && args.toString()}`, expectedCB(...args));
|
|
1052
|
+
};
|
|
1053
|
+
});
|
|
1054
|
+
}
|
|
1055
|
+
const classyDescribes = {};
|
|
1056
|
+
if (testImplementation.describes) {
|
|
1057
|
+
Object.entries(testImplementation.describes).forEach(([key, desc]) => {
|
|
1058
|
+
classyDescribes[key] = (features, its, describeCB, initialValues) => {
|
|
1059
|
+
return new BaseDescribe(
|
|
1060
|
+
features,
|
|
1061
|
+
its,
|
|
1062
|
+
describeCB,
|
|
1063
|
+
initialValues
|
|
1064
|
+
);
|
|
1065
|
+
};
|
|
1066
|
+
});
|
|
1067
|
+
}
|
|
1068
|
+
const classyIts = {};
|
|
1069
|
+
if (testImplementation.its) {
|
|
1070
|
+
Object.entries(testImplementation.its).forEach(([key, itCB]) => {
|
|
1071
|
+
classyIts[key] = (...args) => {
|
|
1072
|
+
return new BaseIt(`${key}: ${args && args.toString()}`, itCB(...args));
|
|
1073
|
+
};
|
|
1074
|
+
});
|
|
1075
|
+
}
|
|
1020
1076
|
this.suitesOverrides = classySuites;
|
|
1021
1077
|
this.givenOverrides = classyGivens;
|
|
1022
1078
|
this.whenOverrides = classyWhens;
|
|
1023
1079
|
this.thenOverrides = classyThens;
|
|
1080
|
+
this.valuesOverrides = classyValues;
|
|
1081
|
+
this.shouldsOverrides = classyShoulds;
|
|
1082
|
+
this.expectedsOverrides = classyExpecteds;
|
|
1083
|
+
this.describesOverrides = classyDescribes;
|
|
1084
|
+
this.itsOverrides = classyIts;
|
|
1085
|
+
this.confirmsOverrides = classyConfirms;
|
|
1024
1086
|
this.testResourceRequirement = testResourceRequirement;
|
|
1025
1087
|
this.testSpecification = testSpecification;
|
|
1026
1088
|
this.specs = testSpecification(
|
|
1027
1089
|
this.Suites(),
|
|
1028
1090
|
this.Given(),
|
|
1029
1091
|
this.When(),
|
|
1030
|
-
this.Then()
|
|
1092
|
+
this.Then(),
|
|
1093
|
+
this.Describe(),
|
|
1094
|
+
this.It(),
|
|
1095
|
+
this.Confirm(),
|
|
1096
|
+
this.Value(),
|
|
1097
|
+
this.Should(),
|
|
1098
|
+
this.Expect()
|
|
1031
1099
|
);
|
|
1032
1100
|
this.totalTests = this.calculateTotalTests();
|
|
1033
1101
|
this.testJobs = this.specs.map((suite) => {
|
|
@@ -1116,97 +1184,10 @@ var BaseTiposkripto = class {
|
|
|
1116
1184
|
const fullPath = `${basePathClean}/${pathClean}`;
|
|
1117
1185
|
console.log("[Artifactory] Full path:", fullPath);
|
|
1118
1186
|
this.writeFileSync(fullPath, payload);
|
|
1119
|
-
},
|
|
1120
|
-
screenshot: (filename, payload) => {
|
|
1121
|
-
let path2 = "";
|
|
1122
|
-
const basePath = this.testResourceConfiguration?.fs || "testeranto";
|
|
1123
|
-
console.log("[Artifactory Screenshot] Base path:", basePath);
|
|
1124
|
-
console.log("[Artifactory Screenshot] Context:", context);
|
|
1125
|
-
if (context.suiteIndex !== void 0) {
|
|
1126
|
-
path2 += `suite-${context.suiteIndex}/`;
|
|
1127
|
-
}
|
|
1128
|
-
if (context.givenKey) {
|
|
1129
|
-
path2 += `given-${context.givenKey}/`;
|
|
1130
|
-
}
|
|
1131
|
-
if (context.whenIndex !== void 0) {
|
|
1132
|
-
path2 += `when-${context.whenIndex} `;
|
|
1133
|
-
} else if (context.thenIndex !== void 0) {
|
|
1134
|
-
path2 += `then-${context.thenIndex} `;
|
|
1135
|
-
}
|
|
1136
|
-
path2 += filename;
|
|
1137
|
-
if (!path2.match(/\.[a-zA-Z0-9]+$/)) {
|
|
1138
|
-
path2 += ".png";
|
|
1139
|
-
}
|
|
1140
|
-
const basePathClean = basePath.replace(/\/$/, "");
|
|
1141
|
-
const pathClean = path2.replace(/^\//, "");
|
|
1142
|
-
const fullPath = `${basePathClean}/${pathClean}`;
|
|
1143
|
-
console.log("[Artifactory Screenshot] Full path:", fullPath);
|
|
1144
|
-
if (typeof this.screenshot === "function") {
|
|
1145
|
-
this.screenshot(fullPath, payload || "");
|
|
1146
|
-
} else {
|
|
1147
|
-
this.writeFileSync(fullPath, payload || "");
|
|
1148
|
-
}
|
|
1149
|
-
},
|
|
1150
|
-
openScreencast: async (filename) => {
|
|
1151
|
-
let path2 = "";
|
|
1152
|
-
const basePath = this.testResourceConfiguration?.fs || "testeranto";
|
|
1153
|
-
console.log("[Artifactory openScreencast] Base path:", basePath);
|
|
1154
|
-
console.log("[Artifactory openScreencast] Context:", context);
|
|
1155
|
-
if (context.suiteIndex !== void 0) {
|
|
1156
|
-
path2 += `suite-${context.suiteIndex}/`;
|
|
1157
|
-
}
|
|
1158
|
-
if (context.givenKey) {
|
|
1159
|
-
path2 += `given-${context.givenKey}/`;
|
|
1160
|
-
}
|
|
1161
|
-
if (context.whenIndex !== void 0) {
|
|
1162
|
-
path2 += `when-${context.whenIndex} `;
|
|
1163
|
-
} else if (context.thenIndex !== void 0) {
|
|
1164
|
-
path2 += `then-${context.thenIndex} `;
|
|
1165
|
-
}
|
|
1166
|
-
path2 += filename;
|
|
1167
|
-
if (!path2.match(/\.[a-zA-Z0-9]+$/)) {
|
|
1168
|
-
path2 += ".webm";
|
|
1169
|
-
}
|
|
1170
|
-
const basePathClean = basePath.replace(/\/$/, "");
|
|
1171
|
-
const pathClean = path2.replace(/^\//, "");
|
|
1172
|
-
const fullPath = `${basePathClean}/${pathClean}`;
|
|
1173
|
-
console.log("[Artifactory openScreencast] Full path:", fullPath);
|
|
1174
|
-
if (typeof this.openScreencast === "function") {
|
|
1175
|
-
await this.openScreencast(fullPath);
|
|
1176
|
-
} else {
|
|
1177
|
-
console.log("[Artifactory openScreencast] Method not available");
|
|
1178
|
-
}
|
|
1179
|
-
},
|
|
1180
|
-
closeScreencast: async (filename) => {
|
|
1181
|
-
let path2 = "";
|
|
1182
|
-
const basePath = this.testResourceConfiguration?.fs || "testeranto";
|
|
1183
|
-
console.log("[Artifactory closeScreencast] Base path:", basePath);
|
|
1184
|
-
console.log("[Artifactory closeScreencast] Context:", context);
|
|
1185
|
-
if (context.suiteIndex !== void 0) {
|
|
1186
|
-
path2 += `suite-${context.suiteIndex}/`;
|
|
1187
|
-
}
|
|
1188
|
-
if (context.givenKey) {
|
|
1189
|
-
path2 += `given-${context.givenKey}/`;
|
|
1190
|
-
}
|
|
1191
|
-
if (context.whenIndex !== void 0) {
|
|
1192
|
-
path2 += `when-${context.whenIndex} `;
|
|
1193
|
-
} else if (context.thenIndex !== void 0) {
|
|
1194
|
-
path2 += `then-${context.thenIndex} `;
|
|
1195
|
-
}
|
|
1196
|
-
path2 += filename;
|
|
1197
|
-
if (!path2.match(/\.[a-zA-Z0-9]+$/)) {
|
|
1198
|
-
path2 += ".webm";
|
|
1199
|
-
}
|
|
1200
|
-
const basePathClean = basePath.replace(/\/$/, "");
|
|
1201
|
-
const pathClean = path2.replace(/^\//, "");
|
|
1202
|
-
const fullPath = `${basePathClean}/${pathClean}`;
|
|
1203
|
-
console.log("[Artifactory closeScreencast] Full path:", fullPath);
|
|
1204
|
-
if (typeof this.closeScreencast === "function") {
|
|
1205
|
-
await this.closeScreencast(fullPath);
|
|
1206
|
-
} else {
|
|
1207
|
-
console.log("[Artifactory closeScreencast] Method not available");
|
|
1208
|
-
}
|
|
1209
1187
|
}
|
|
1188
|
+
// screenshot, openScreencast, and closeScreencast are only applicable to web runtime
|
|
1189
|
+
// They should be implemented in WebTiposkripto and will be added to the artifactory there
|
|
1190
|
+
// For non-web runtimes, these methods will not be available
|
|
1210
1191
|
};
|
|
1211
1192
|
}
|
|
1212
1193
|
async receiveTestResourceConfig(testResourceConfig) {
|
|
@@ -1238,6 +1219,24 @@ var BaseTiposkripto = class {
|
|
|
1238
1219
|
Then() {
|
|
1239
1220
|
return this.thenOverrides;
|
|
1240
1221
|
}
|
|
1222
|
+
Describe() {
|
|
1223
|
+
return this.describesOverrides || {};
|
|
1224
|
+
}
|
|
1225
|
+
It() {
|
|
1226
|
+
return this.itsOverrides || {};
|
|
1227
|
+
}
|
|
1228
|
+
Confirm() {
|
|
1229
|
+
return this.confirmsOverrides || {};
|
|
1230
|
+
}
|
|
1231
|
+
Value() {
|
|
1232
|
+
return this.valuesOverrides || {};
|
|
1233
|
+
}
|
|
1234
|
+
Should() {
|
|
1235
|
+
return this.shouldsOverrides || {};
|
|
1236
|
+
}
|
|
1237
|
+
Expect() {
|
|
1238
|
+
return this.expectedsOverrides || {};
|
|
1239
|
+
}
|
|
1241
1240
|
// Add a method to access test jobs which can be used by receiveTestResourceConfig
|
|
1242
1241
|
getTestJobs() {
|
|
1243
1242
|
return this.testJobs;
|
|
@@ -1280,6 +1279,8 @@ var NodeTiposkripto = class extends BaseTiposkripto {
|
|
|
1280
1279
|
}
|
|
1281
1280
|
fs.writeFileSync(filename, payload);
|
|
1282
1281
|
}
|
|
1282
|
+
// screenshot, openScreencast, and closeScreencast are not applicable to Node runtime
|
|
1283
|
+
// These methods are only for web runtime to capture visual artifacts in browser environments
|
|
1283
1284
|
};
|
|
1284
1285
|
var tiposkripto = async (input, testSpecification, testImplementation, testAdapter, testResourceRequirement = defaultTestResourceRequirement) => {
|
|
1285
1286
|
try {
|