testeranto 0.74.0 → 0.79.3
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 +25 -24
- package/devBot.dockerfile +12 -0
- package/dist/common/Node.js +1 -0
- package/dist/common/PM/index.js +0 -64
- package/dist/common/PM/main.js +278 -7
- package/dist/common/PM/node.js +4 -0
- package/dist/common/PM/web.js +3 -0
- package/dist/common/Project.js +6 -2
- package/dist/common/Puppeteer.js +12 -17
- package/dist/common/Reporter.js +1 -8
- package/dist/common/SubPackages/react-dom/component/web.js +5 -25
- package/dist/common/SubPackages/react-dom/jsx/web.js +80 -55
- package/dist/common/SubPackages/react-test-renderer/component/index.js +0 -86
- package/dist/common/SubPackages/react-test-renderer/component/interface.js +68 -0
- package/dist/common/SubPackages/react-test-renderer/component/node.js +2 -2
- package/dist/common/SubPackages/react-test-renderer/component/web.js +2 -2
- package/dist/common/TaskManBackEnd.js +156 -0
- package/dist/common/Types.js +0 -2
- package/dist/common/esbuildConfigs/index.js +1 -0
- package/dist/common/esbuildConfigs/inputFilesPlugin.js +49 -0
- package/dist/common/esbuildConfigs/node.js +3 -1
- package/dist/common/esbuildConfigs/web.js +3 -1
- package/dist/common/lib/abstractBase.js +222 -17
- package/dist/common/lib/basebuilder.js +4 -38
- package/dist/common/lib/classBuilder.js +1 -3
- package/dist/common/lib/core.js +3 -5
- package/dist/common/mongooseSchemas.js +56 -0
- package/dist/common/tsconfig.common.tsbuildinfo +1 -1
- package/dist/common/utils.js +16 -0
- package/dist/module/ExampleTab.js +112 -0
- package/dist/module/Node.js +1 -0
- package/dist/module/PM/index.js +0 -64
- package/dist/module/PM/main.js +278 -7
- package/dist/module/PM/node.js +4 -0
- package/dist/module/PM/web.js +3 -0
- package/dist/module/Project.js +6 -2
- package/dist/module/Puppeteer.js +12 -17
- package/dist/module/Reporter.js +1 -8
- package/dist/module/SubPackages/react-dom/component/web.js +5 -25
- package/dist/module/SubPackages/react-dom/jsx/web.js +80 -55
- package/dist/module/SubPackages/react-test-renderer/component/index.js +1 -59
- package/dist/module/SubPackages/react-test-renderer/component/interface.js +39 -0
- package/dist/module/SubPackages/react-test-renderer/component/node.js +1 -1
- package/dist/module/SubPackages/react-test-renderer/component/web.js +1 -1
- package/dist/module/TaskManBackEnd.js +151 -0
- package/dist/module/TaskManFrontEnd.js +600 -0
- package/dist/module/Types.js +0 -2
- package/dist/module/esbuildConfigs/index.js +1 -0
- package/dist/module/esbuildConfigs/inputFilesPlugin.js +44 -0
- package/dist/module/esbuildConfigs/node.js +3 -1
- package/dist/module/esbuildConfigs/web.js +3 -1
- package/dist/module/lib/abstractBase.js +222 -17
- package/dist/module/lib/basebuilder.js +4 -38
- package/dist/module/lib/classBuilder.js +1 -3
- package/dist/module/lib/core.js +3 -5
- package/dist/module/mongooseSchemas.js +50 -0
- package/dist/module/tsconfig.module.tsbuildinfo +1 -1
- package/dist/module/utils.js +9 -0
- package/dist/prebuild/Report.js +117 -36
- package/dist/prebuild/TaskManBackEnd.mjs +185 -0
- package/dist/prebuild/TaskManFrontEnd.css +12301 -0
- package/dist/prebuild/TaskManFrontEnd.js +81737 -0
- package/dist/types/Node.d.ts +1 -1
- package/dist/types/PM/index.d.ts +2 -1
- package/dist/types/PM/main.d.ts +8 -3
- package/dist/types/PM/node.d.ts +2 -0
- package/dist/types/PM/web.d.ts +1 -0
- package/dist/types/SubPackages/puppeteer.d.ts +1 -1
- package/dist/types/SubPackages/react/component/node.d.ts +1 -1
- package/dist/types/SubPackages/react/component/web.d.ts +1 -1
- package/dist/types/SubPackages/react/jsx/node.d.ts +2 -2
- package/dist/types/SubPackages/react/jsx/web.d.ts +2 -2
- package/dist/types/SubPackages/react-dom/component/node.d.ts +2 -2
- package/dist/types/SubPackages/react-dom/component/web.d.ts +8 -2
- package/dist/types/SubPackages/react-dom/jsx/node.d.ts +2 -2
- package/dist/types/SubPackages/react-dom/jsx/web.d.ts +2 -2
- package/dist/types/SubPackages/react-test-renderer/MemoExoticComponent/node.d.ts +2 -2
- package/dist/types/SubPackages/react-test-renderer/component/index.d.ts +0 -7
- package/dist/types/SubPackages/react-test-renderer/component/interface.d.ts +9 -0
- package/dist/types/SubPackages/react-test-renderer/component/node.d.ts +1 -2
- package/dist/types/SubPackages/react-test-renderer/component/web.d.ts +1 -2
- package/dist/types/SubPackages/react-test-renderer/fc/node.d.ts +1 -1
- package/dist/types/SubPackages/react-test-renderer/fc/web.d.ts +1 -1
- package/dist/types/SubPackages/react-test-renderer/jsx/node.d.ts +1 -2
- package/dist/types/SubPackages/react-test-renderer/jsx/web.d.ts +1 -2
- package/dist/types/SubPackages/react-test-renderer/jsx-promised/node.d.ts +1 -2
- package/dist/types/SubPackages/react-test-renderer/jsx-promised/web.d.ts +1 -2
- package/dist/types/TaskManBackEnd.d.ts +1 -0
- package/dist/types/Types.d.ts +19 -19
- package/dist/types/Web.d.ts +1 -1
- package/dist/types/esbuildConfigs/inputFilesPlugin.d.ts +5 -0
- package/dist/types/lib/abstractBase.d.ts +8 -8
- package/dist/types/lib/basebuilder.d.ts +1 -1
- package/dist/types/lib/classBuilder.d.ts +1 -1
- package/dist/types/lib/core.d.ts +1 -1
- package/dist/types/lib/index.d.ts +5 -5
- package/dist/types/lib/types.d.ts +15 -13
- package/dist/types/mongooseSchemas.d.ts +124 -0
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/dist/types/utils.d.ts +2 -0
- package/docker-compose-dev.yml +9 -0
- package/docker-compose-prod.yml +18 -0
- package/package.json +20 -7
- package/src/ExampleTab.tsx +219 -0
- package/src/Node.ts +31 -2
- package/src/PM/index.ts +6 -83
- package/src/PM/main.ts +389 -11
- package/src/PM/node.ts +6 -0
- package/src/PM/web.ts +4 -0
- package/src/Project.ts +10 -2
- package/src/Puppeteer.ts +16 -17
- package/src/Report.tsx +17 -40
- package/src/Reporter.ts +1 -9
- package/src/SubPackages/react-dom/component/web.ts +10 -30
- package/src/SubPackages/react-dom/jsx/web.ts +111 -74
- package/src/SubPackages/react-test-renderer/component/index.ts +0 -66
- package/src/SubPackages/react-test-renderer/component/interface.ts +48 -0
- package/src/SubPackages/react-test-renderer/component/node.ts +2 -1
- package/src/SubPackages/react-test-renderer/component/web.ts +2 -1
- package/src/TaskManBackEnd.ts +200 -0
- package/src/TaskManFrontEnd.tsx +1222 -0
- package/src/Types.ts +136 -28
- package/src/Web.ts +32 -2
- package/src/esbuildConfigs/index.ts +1 -0
- package/src/esbuildConfigs/inputFilesPlugin.ts +65 -0
- package/src/esbuildConfigs/node.ts +3 -1
- package/src/esbuildConfigs/web.ts +4 -0
- package/src/lib/abstractBase.ts +337 -34
- package/src/lib/basebuilder.ts +17 -52
- package/src/lib/classBuilder.ts +14 -2
- package/src/lib/core.ts +18 -7
- package/src/lib/index.ts +115 -7
- package/src/lib/types.ts +143 -35
- package/src/mongooseSchemas.ts +105 -0
- package/src/utils.ts +15 -0
- package/yarn-error.log +3144 -0
package/src/lib/abstractBase.ts
CHANGED
|
@@ -1,15 +1,41 @@
|
|
|
1
1
|
import { IBaseTest } from "../Types";
|
|
2
|
-
|
|
3
|
-
import { ITTestResourceConfiguration, ITestArtifactory, ITLog } from ".";
|
|
4
2
|
import { PM } from "../PM/index.js";
|
|
5
|
-
// import { IUtils } from "./types";
|
|
6
3
|
|
|
7
|
-
|
|
8
|
-
string,
|
|
9
|
-
BaseGiven<ITestShape>
|
|
10
|
-
>;
|
|
4
|
+
import { ITTestResourceConfiguration, ITestArtifactory, ITLog } from ".";
|
|
11
5
|
|
|
12
|
-
export
|
|
6
|
+
export type IGivens<
|
|
7
|
+
ITestShape extends IBaseTest<
|
|
8
|
+
unknown,
|
|
9
|
+
unknown,
|
|
10
|
+
unknown,
|
|
11
|
+
unknown,
|
|
12
|
+
unknown,
|
|
13
|
+
unknown,
|
|
14
|
+
unknown,
|
|
15
|
+
Record<string, any>,
|
|
16
|
+
Record<string, any>,
|
|
17
|
+
Record<string, any>,
|
|
18
|
+
Record<string, any>,
|
|
19
|
+
Record<string, any>
|
|
20
|
+
>
|
|
21
|
+
> = Record<string, BaseGiven<ITestShape>>;
|
|
22
|
+
|
|
23
|
+
export abstract class BaseSuite<
|
|
24
|
+
ITestShape extends IBaseTest<
|
|
25
|
+
unknown,
|
|
26
|
+
unknown,
|
|
27
|
+
unknown,
|
|
28
|
+
unknown,
|
|
29
|
+
unknown,
|
|
30
|
+
unknown,
|
|
31
|
+
unknown,
|
|
32
|
+
Record<string, any>,
|
|
33
|
+
Record<string, any>,
|
|
34
|
+
Record<string, any>,
|
|
35
|
+
Record<string, any>,
|
|
36
|
+
Record<string, any>
|
|
37
|
+
>
|
|
38
|
+
> {
|
|
13
39
|
name: string;
|
|
14
40
|
givens: IGivens<ITestShape>;
|
|
15
41
|
checks: BaseCheck<ITestShape>[];
|
|
@@ -75,11 +101,76 @@ export abstract class BaseSuite<ITestShape extends IBaseTest> {
|
|
|
75
101
|
const sName = this.name;
|
|
76
102
|
|
|
77
103
|
for (const [gNdx, g] of Object.entries(this.givens)) {
|
|
104
|
+
const beforeAllProxy = new Proxy(pm, {
|
|
105
|
+
get(target, prop, receiver) {
|
|
106
|
+
if (prop === "writeFileSync") {
|
|
107
|
+
return (fp, contents) =>
|
|
108
|
+
target[prop](`suite-${sNdx}/beforeAll/${fp}`, contents);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
if (prop === "browser") {
|
|
112
|
+
return new Proxy(target[prop], {
|
|
113
|
+
get(bTarget, bProp, bReceiver) {
|
|
114
|
+
if (bProp === "pages") {
|
|
115
|
+
return async () => {
|
|
116
|
+
return bTarget.pages().then((pages) => {
|
|
117
|
+
return pages.map((page) => {
|
|
118
|
+
return new Proxy(page, {
|
|
119
|
+
get(pTarget, pProp, pReciever) {
|
|
120
|
+
if (pProp === "screenshot") {
|
|
121
|
+
return async (x) => {
|
|
122
|
+
return pm.customScreenShot(
|
|
123
|
+
{
|
|
124
|
+
...x,
|
|
125
|
+
path:
|
|
126
|
+
`${testResourceConfiguration.fs}/suite-${sNdx}/beforeAll` +
|
|
127
|
+
"/" +
|
|
128
|
+
x.path,
|
|
129
|
+
},
|
|
130
|
+
page
|
|
131
|
+
);
|
|
132
|
+
// return await window["custom-screenshot"]({
|
|
133
|
+
// ...x,
|
|
134
|
+
// path:
|
|
135
|
+
// `${testResourceConfiguration.fs}/suite-${sNdx}/afterAll` +
|
|
136
|
+
// "/" +
|
|
137
|
+
// x.path,
|
|
138
|
+
// });
|
|
139
|
+
};
|
|
140
|
+
} else if (pProp === "mainFrame") {
|
|
141
|
+
return () => pTarget[pProp]();
|
|
142
|
+
} else if (pProp === "close") {
|
|
143
|
+
return () => pTarget[pProp]();
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// else if (pProp === "mainFrame") {
|
|
147
|
+
// return () => target[pProp](...arguments);
|
|
148
|
+
// }
|
|
149
|
+
else {
|
|
150
|
+
return Reflect.get(...arguments);
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
});
|
|
154
|
+
});
|
|
155
|
+
});
|
|
156
|
+
// return (await target.pages()).map((page) => {
|
|
157
|
+
// return new Proxy(page, handler2);
|
|
158
|
+
// });
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
return Reflect.get(...arguments);
|
|
166
|
+
},
|
|
167
|
+
});
|
|
168
|
+
|
|
78
169
|
const subject = await this.setup(
|
|
79
170
|
input,
|
|
80
171
|
suiteArtifactory,
|
|
81
172
|
testResourceConfiguration,
|
|
82
|
-
|
|
173
|
+
beforeAllProxy
|
|
83
174
|
);
|
|
84
175
|
|
|
85
176
|
const giver = this.givens[gNdx];
|
|
@@ -119,21 +210,27 @@ export abstract class BaseSuite<ITestShape extends IBaseTest> {
|
|
|
119
210
|
get(pTarget, pProp, pReciever) {
|
|
120
211
|
if (pProp === "screenshot") {
|
|
121
212
|
return async (x) => {
|
|
122
|
-
|
|
123
|
-
// "custom-screenshot-MARK-afterAllProxy",
|
|
124
|
-
// // arguments,
|
|
125
|
-
// // x,
|
|
126
|
-
// window["custom-screenshot"].toString()
|
|
127
|
-
// );
|
|
128
|
-
return await window["custom-screenshot"]({
|
|
213
|
+
return pm.customScreenShot({
|
|
129
214
|
...x,
|
|
130
215
|
path:
|
|
131
216
|
`${testResourceConfiguration.fs}/suite-${sNdx}/afterAll` +
|
|
132
217
|
"/" +
|
|
133
218
|
x.path,
|
|
134
219
|
});
|
|
220
|
+
// return await window["custom-screenshot"]({
|
|
221
|
+
// ...x,
|
|
222
|
+
// path:
|
|
223
|
+
// `${testResourceConfiguration.fs}/suite-${sNdx}/afterAll` +
|
|
224
|
+
// "/" +
|
|
225
|
+
// x.path,
|
|
226
|
+
// });
|
|
135
227
|
};
|
|
228
|
+
} else if (pProp === "mainFrame") {
|
|
229
|
+
return () => pTarget[pProp]();
|
|
230
|
+
} else if (pProp === "close") {
|
|
231
|
+
return () => pTarget[pProp]();
|
|
136
232
|
}
|
|
233
|
+
|
|
137
234
|
// else if (pProp === "mainFrame") {
|
|
138
235
|
// return () => target[pProp](...arguments);
|
|
139
236
|
// }
|
|
@@ -196,7 +293,22 @@ export abstract class BaseSuite<ITestShape extends IBaseTest> {
|
|
|
196
293
|
}
|
|
197
294
|
}
|
|
198
295
|
|
|
199
|
-
export abstract class BaseGiven<
|
|
296
|
+
export abstract class BaseGiven<
|
|
297
|
+
ITestShape extends IBaseTest<
|
|
298
|
+
unknown,
|
|
299
|
+
unknown,
|
|
300
|
+
unknown,
|
|
301
|
+
unknown,
|
|
302
|
+
unknown,
|
|
303
|
+
unknown,
|
|
304
|
+
unknown,
|
|
305
|
+
Record<string, any>,
|
|
306
|
+
Record<string, any>,
|
|
307
|
+
Record<string, any>,
|
|
308
|
+
Record<string, any>,
|
|
309
|
+
Record<string, any>
|
|
310
|
+
>
|
|
311
|
+
> {
|
|
200
312
|
name: string;
|
|
201
313
|
features: string[];
|
|
202
314
|
whens: BaseWhen<ITestShape>[];
|
|
@@ -276,7 +388,6 @@ export abstract class BaseGiven<ITestShape extends IBaseTest> {
|
|
|
276
388
|
const beforeEachProxy = new Proxy(pm, {
|
|
277
389
|
get(target, prop, receiver) {
|
|
278
390
|
if (prop === "writeFileSync") {
|
|
279
|
-
console.log("beforeEachProx", arguments, target[prop]);
|
|
280
391
|
return (fp, contents) =>
|
|
281
392
|
target[prop](
|
|
282
393
|
`suite-${suiteNdx}/given-${key}/when/beforeEach/${fp}`,
|
|
@@ -306,12 +417,13 @@ export abstract class BaseGiven<ITestShape extends IBaseTest> {
|
|
|
306
417
|
);
|
|
307
418
|
}
|
|
308
419
|
|
|
309
|
-
for (const thenStep of this.thens) {
|
|
420
|
+
for (const [thenNdx, thenStep] of this.thens.entries()) {
|
|
310
421
|
const t = await thenStep.test(
|
|
311
422
|
this.store,
|
|
312
423
|
testResourceConfiguration,
|
|
313
424
|
tLog,
|
|
314
|
-
pm
|
|
425
|
+
pm,
|
|
426
|
+
`suite-${suiteNdx}/given-${key}/then-${thenNdx}`
|
|
315
427
|
);
|
|
316
428
|
tester(t);
|
|
317
429
|
}
|
|
@@ -365,16 +477,39 @@ export abstract class BaseGiven<ITestShape extends IBaseTest> {
|
|
|
365
477
|
// window["custom-screenshot"].toString()
|
|
366
478
|
// );
|
|
367
479
|
|
|
368
|
-
return
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
480
|
+
return pm.customScreenShot(
|
|
481
|
+
{
|
|
482
|
+
...x,
|
|
483
|
+
path:
|
|
484
|
+
`${testResourceConfiguration.fs}/suite-${suiteNdx}/given-${key}/afterEach` +
|
|
485
|
+
"/" +
|
|
486
|
+
x.path,
|
|
487
|
+
},
|
|
488
|
+
page
|
|
489
|
+
);
|
|
490
|
+
|
|
491
|
+
// return await pTarget[pProp]({
|
|
492
|
+
// ...x,
|
|
493
|
+
// path:
|
|
494
|
+
// `${testResourceConfiguration.fs}/suite-${suiteNdx}/given-${key}/afterEach` +
|
|
495
|
+
// "/" +
|
|
496
|
+
// x.path,
|
|
497
|
+
// });
|
|
375
498
|
};
|
|
499
|
+
} else if (pProp === "mainFrame") {
|
|
500
|
+
return () => pTarget[pProp]();
|
|
501
|
+
// return target[pProp];
|
|
502
|
+
// return Reflect.get(...arguments);
|
|
503
|
+
} else if (pProp === "exposeFunction") {
|
|
504
|
+
// return Reflect.get(target, prop, receiver);
|
|
505
|
+
return (...a) => pTarget[pProp](...a);
|
|
506
|
+
// return target[pProp];
|
|
507
|
+
} else if (pProp === "removeExposedFunction") {
|
|
508
|
+
// return Reflect.get(target, prop, receiver);
|
|
509
|
+
return pTarget[pProp].bind(pTarget);
|
|
510
|
+
// return target[pProp];
|
|
376
511
|
}
|
|
377
|
-
// else if (pProp === "
|
|
512
|
+
// else if (pProp === "#frameManager") {
|
|
378
513
|
// return () => target[pProp](...arguments);
|
|
379
514
|
// }
|
|
380
515
|
else {
|
|
@@ -446,12 +581,78 @@ export abstract class BaseWhen<ITestShape extends IBaseTest> {
|
|
|
446
581
|
const andWhenProxy = new Proxy(pm, {
|
|
447
582
|
get(target, prop, receiver) {
|
|
448
583
|
if (prop === "writeFileSync") {
|
|
449
|
-
console.log("andWhenProxy", arguments, target[prop]);
|
|
450
584
|
return (fp, contents) =>
|
|
451
585
|
// target[prop](`${key}/andWhen/${fp}`, contents);
|
|
452
586
|
target[prop](`${key}/andWhen/${fp}`, contents);
|
|
453
587
|
}
|
|
454
588
|
|
|
589
|
+
/////////////////////
|
|
590
|
+
|
|
591
|
+
if (prop === "browser") {
|
|
592
|
+
return new Proxy(target[prop], {
|
|
593
|
+
get(bTarget, bProp, bReceiver) {
|
|
594
|
+
if (bProp === "pages") {
|
|
595
|
+
return async () => {
|
|
596
|
+
return bTarget.pages().then((pages) => {
|
|
597
|
+
return pages.map((page) => {
|
|
598
|
+
return new Proxy(page, {
|
|
599
|
+
get(pTarget, pProp, pReciever) {
|
|
600
|
+
if (pProp === "screenshot") {
|
|
601
|
+
return async (x) => {
|
|
602
|
+
// console.log(
|
|
603
|
+
// "custom-screenshot-MARK-afterEachProxy",
|
|
604
|
+
// window["custom-screenshot"].toString()
|
|
605
|
+
// );
|
|
606
|
+
|
|
607
|
+
return pm.customScreenShot(
|
|
608
|
+
{
|
|
609
|
+
...x,
|
|
610
|
+
path:
|
|
611
|
+
`${testResourceConfiguration.fs}/${key}/afterEach` +
|
|
612
|
+
"/" +
|
|
613
|
+
x.path,
|
|
614
|
+
},
|
|
615
|
+
page
|
|
616
|
+
);
|
|
617
|
+
|
|
618
|
+
// return await pTarget[pProp]({
|
|
619
|
+
// ...x,
|
|
620
|
+
// path:
|
|
621
|
+
// `${testResourceConfiguration.fs}/suite-${suiteNdx}/given-${key}/afterEach` +
|
|
622
|
+
// "/" +
|
|
623
|
+
// x.path,
|
|
624
|
+
// });
|
|
625
|
+
};
|
|
626
|
+
} else if (pProp === "mainFrame") {
|
|
627
|
+
return () => pTarget[pProp]();
|
|
628
|
+
// return target[pProp];
|
|
629
|
+
// return Reflect.get(...arguments);
|
|
630
|
+
} else if (pProp === "exposeFunction") {
|
|
631
|
+
// return Reflect.get(target, prop, receiver);
|
|
632
|
+
return pTarget[pProp].bind(pTarget);
|
|
633
|
+
// return target[pProp];
|
|
634
|
+
} else if (pProp === "removeExposedFunction") {
|
|
635
|
+
// return Reflect.get(target, prop, receiver);
|
|
636
|
+
return pTarget[pProp].bind(pTarget);
|
|
637
|
+
// return target[pProp];
|
|
638
|
+
} else {
|
|
639
|
+
return Reflect.get(...arguments);
|
|
640
|
+
}
|
|
641
|
+
},
|
|
642
|
+
});
|
|
643
|
+
});
|
|
644
|
+
});
|
|
645
|
+
// return (await target.pages()).map((page) => {
|
|
646
|
+
// return new Proxy(page, handler2);
|
|
647
|
+
// });
|
|
648
|
+
};
|
|
649
|
+
}
|
|
650
|
+
},
|
|
651
|
+
});
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
///////////////////////
|
|
655
|
+
|
|
455
656
|
return Reflect.get(...arguments);
|
|
456
657
|
},
|
|
457
658
|
});
|
|
@@ -470,7 +671,22 @@ export abstract class BaseWhen<ITestShape extends IBaseTest> {
|
|
|
470
671
|
}
|
|
471
672
|
}
|
|
472
673
|
|
|
473
|
-
export abstract class BaseThen<
|
|
674
|
+
export abstract class BaseThen<
|
|
675
|
+
ITestShape extends IBaseTest<
|
|
676
|
+
unknown,
|
|
677
|
+
unknown,
|
|
678
|
+
unknown,
|
|
679
|
+
unknown,
|
|
680
|
+
unknown,
|
|
681
|
+
unknown,
|
|
682
|
+
unknown,
|
|
683
|
+
Record<string, any>,
|
|
684
|
+
Record<string, any>,
|
|
685
|
+
Record<string, any>,
|
|
686
|
+
Record<string, any>,
|
|
687
|
+
Record<string, any>
|
|
688
|
+
>
|
|
689
|
+
> {
|
|
474
690
|
public name: string;
|
|
475
691
|
thenCB: (storeState: ITestShape["iselection"]) => ITestShape["then"];
|
|
476
692
|
error: boolean;
|
|
@@ -494,21 +710,93 @@ export abstract class BaseThen<ITestShape extends IBaseTest> {
|
|
|
494
710
|
abstract butThen(
|
|
495
711
|
store: ITestShape["istore"],
|
|
496
712
|
thenCB,
|
|
497
|
-
testResourceConfiguration
|
|
713
|
+
testResourceConfiguration: ITTestResourceConfiguration,
|
|
714
|
+
pm: PM
|
|
498
715
|
): Promise<ITestShape["iselection"]>;
|
|
499
716
|
|
|
500
717
|
async test(
|
|
501
718
|
store: ITestShape["istore"],
|
|
502
719
|
testResourceConfiguration,
|
|
503
720
|
tLog: ITLog,
|
|
504
|
-
pm: PM
|
|
721
|
+
pm: PM,
|
|
722
|
+
filepath: string
|
|
505
723
|
): Promise<ITestShape["then"] | undefined> {
|
|
506
724
|
tLog(" Then:", this.name);
|
|
507
725
|
try {
|
|
726
|
+
const butThenProxy = new Proxy(pm, {
|
|
727
|
+
get(target, prop, receiver) {
|
|
728
|
+
if (prop === "writeFileSync") {
|
|
729
|
+
return (fp, contents) =>
|
|
730
|
+
target[prop](`${filepath}/${fp}`, contents);
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
if (prop === "browser") {
|
|
734
|
+
return new Proxy(target[prop], {
|
|
735
|
+
get(bTarget, bProp, bReceiver) {
|
|
736
|
+
if (bProp === "pages") {
|
|
737
|
+
return async () => {
|
|
738
|
+
return bTarget.pages().then((pages) => {
|
|
739
|
+
return pages.map((page) => {
|
|
740
|
+
return new Proxy(page, {
|
|
741
|
+
get(pTarget, pProp, pReciever) {
|
|
742
|
+
if (pProp === "screenshot") {
|
|
743
|
+
return async (x) => {
|
|
744
|
+
return pm.customScreenShot(
|
|
745
|
+
{
|
|
746
|
+
...x,
|
|
747
|
+
path:
|
|
748
|
+
`${testResourceConfiguration.fs}/${filepath}/butThen` +
|
|
749
|
+
"/" +
|
|
750
|
+
x.path,
|
|
751
|
+
},
|
|
752
|
+
page
|
|
753
|
+
);
|
|
754
|
+
// return await window["custom-screenshot"]({
|
|
755
|
+
// ...x,
|
|
756
|
+
// path:
|
|
757
|
+
// `${testResourceConfiguration.fs}/suite-${sNdx}/afterAll` +
|
|
758
|
+
// "/" +
|
|
759
|
+
// x.path,
|
|
760
|
+
// });
|
|
761
|
+
};
|
|
762
|
+
} else if (pProp === "close") {
|
|
763
|
+
return () => pTarget[pProp]();
|
|
764
|
+
} else if (pProp === "mainFrame") {
|
|
765
|
+
return () => pTarget[pProp]();
|
|
766
|
+
} else if (pProp === "exposeFunction") {
|
|
767
|
+
// return Reflect.get(target, prop, receiver);
|
|
768
|
+
return (...a) => pTarget[pProp](...a);
|
|
769
|
+
// return target[pProp];
|
|
770
|
+
} else if (pProp === "removeExposedFunction") {
|
|
771
|
+
// return Reflect.get(target, prop, receiver);
|
|
772
|
+
return pTarget[pProp].bind(pTarget);
|
|
773
|
+
// return target[pProp];
|
|
774
|
+
} else {
|
|
775
|
+
return Reflect.get(...arguments);
|
|
776
|
+
}
|
|
777
|
+
},
|
|
778
|
+
});
|
|
779
|
+
});
|
|
780
|
+
});
|
|
781
|
+
// return (await target.pages()).map((page) => {
|
|
782
|
+
// return new Proxy(page, handler2);
|
|
783
|
+
// });
|
|
784
|
+
};
|
|
785
|
+
}
|
|
786
|
+
},
|
|
787
|
+
});
|
|
788
|
+
}
|
|
789
|
+
|
|
790
|
+
return Reflect.get(...arguments);
|
|
791
|
+
},
|
|
792
|
+
});
|
|
793
|
+
|
|
508
794
|
const x = await this.butThen(
|
|
509
795
|
store,
|
|
510
796
|
this.thenCB,
|
|
511
|
-
testResourceConfiguration
|
|
797
|
+
testResourceConfiguration,
|
|
798
|
+
butThenProxy
|
|
799
|
+
// pm
|
|
512
800
|
);
|
|
513
801
|
return x;
|
|
514
802
|
} catch (e) {
|
|
@@ -519,7 +807,22 @@ export abstract class BaseThen<ITestShape extends IBaseTest> {
|
|
|
519
807
|
}
|
|
520
808
|
}
|
|
521
809
|
|
|
522
|
-
export abstract class BaseCheck<
|
|
810
|
+
export abstract class BaseCheck<
|
|
811
|
+
ITestShape extends IBaseTest<
|
|
812
|
+
unknown,
|
|
813
|
+
unknown,
|
|
814
|
+
unknown,
|
|
815
|
+
unknown,
|
|
816
|
+
unknown,
|
|
817
|
+
unknown,
|
|
818
|
+
unknown,
|
|
819
|
+
Record<string, any>,
|
|
820
|
+
Record<string, any>,
|
|
821
|
+
Record<string, any>,
|
|
822
|
+
Record<string, any>,
|
|
823
|
+
Record<string, any>
|
|
824
|
+
>
|
|
825
|
+
> {
|
|
523
826
|
name: string;
|
|
524
827
|
features: string[];
|
|
525
828
|
checkCB: (whens, thens) => any;
|
package/src/lib/basebuilder.ts
CHANGED
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
import { PassThrough } from "stream";
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
ITTestResourceRequest,
|
|
5
|
-
ITestJob,
|
|
6
|
-
ITLog,
|
|
7
|
-
ILogWriter,
|
|
8
|
-
ITTestResourceConfiguration,
|
|
9
|
-
} from ".";
|
|
3
|
+
import { ITTestResourceRequest, ITestJob, ITLog } from ".";
|
|
10
4
|
import { IBaseTest, ITestSpecification } from "../Types.js";
|
|
11
5
|
|
|
12
6
|
import {
|
|
@@ -15,9 +9,7 @@ import {
|
|
|
15
9
|
IWhenKlasser,
|
|
16
10
|
IThenKlasser,
|
|
17
11
|
ICheckKlasser,
|
|
18
|
-
// IUtils,
|
|
19
12
|
} from "./types.js";
|
|
20
|
-
|
|
21
13
|
import {
|
|
22
14
|
BaseCheck,
|
|
23
15
|
BaseSuite,
|
|
@@ -28,7 +20,20 @@ import {
|
|
|
28
20
|
import { PM } from "../PM/index.js";
|
|
29
21
|
|
|
30
22
|
export abstract class BaseBuilder<
|
|
31
|
-
ITestShape extends IBaseTest
|
|
23
|
+
ITestShape extends IBaseTest<
|
|
24
|
+
unknown,
|
|
25
|
+
unknown,
|
|
26
|
+
unknown,
|
|
27
|
+
unknown,
|
|
28
|
+
unknown,
|
|
29
|
+
unknown,
|
|
30
|
+
unknown,
|
|
31
|
+
Record<string, any>,
|
|
32
|
+
Record<string, any>,
|
|
33
|
+
Record<string, any>,
|
|
34
|
+
Record<string, any>,
|
|
35
|
+
Record<string, any>
|
|
36
|
+
>,
|
|
32
37
|
SuiteExtensions,
|
|
33
38
|
GivenExtensions,
|
|
34
39
|
WhenExtensions,
|
|
@@ -59,7 +64,6 @@ export abstract class BaseBuilder<
|
|
|
59
64
|
checkOverides: Record<keyof CheckExtensions, ICheckKlasser<ITestShape>>,
|
|
60
65
|
testResourceRequirement: ITTestResourceRequest,
|
|
61
66
|
testSpecification: any
|
|
62
|
-
// puppetMaster: PM
|
|
63
67
|
) {
|
|
64
68
|
this.artifacts = [];
|
|
65
69
|
this.testResourceRequirement = testResourceRequirement;
|
|
@@ -69,7 +73,6 @@ export abstract class BaseBuilder<
|
|
|
69
73
|
this.thenOverides = thenOverides;
|
|
70
74
|
this.checkOverides = checkOverides;
|
|
71
75
|
this.testSpecification = testSpecification;
|
|
72
|
-
// this.puppetMaster = puppetMaster;
|
|
73
76
|
|
|
74
77
|
this.specs = testSpecification(
|
|
75
78
|
this.Suites(),
|
|
@@ -83,7 +86,6 @@ export abstract class BaseBuilder<
|
|
|
83
86
|
const suiteRunner =
|
|
84
87
|
(suite: BaseSuite<ITestShape>) =>
|
|
85
88
|
async (
|
|
86
|
-
// testResourceConfiguration: ITTestResourceConfiguration,
|
|
87
89
|
puppetMaster: PM,
|
|
88
90
|
tLog: ITLog
|
|
89
91
|
): Promise<BaseSuite<ITestShape>> => {
|
|
@@ -114,7 +116,6 @@ export abstract class BaseBuilder<
|
|
|
114
116
|
|
|
115
117
|
return {
|
|
116
118
|
test: suite,
|
|
117
|
-
// testResourceRequirement,
|
|
118
119
|
|
|
119
120
|
toObj: () => {
|
|
120
121
|
return suite.toObj();
|
|
@@ -122,48 +123,12 @@ export abstract class BaseBuilder<
|
|
|
122
123
|
|
|
123
124
|
runner,
|
|
124
125
|
|
|
125
|
-
receiveTestResourceConfig: async function (
|
|
126
|
-
|
|
127
|
-
// name: "",
|
|
128
|
-
// fs: ".",
|
|
129
|
-
// ports: [],
|
|
130
|
-
// browserWSEndpoint: "",
|
|
131
|
-
// },
|
|
132
|
-
puppetMaster: PM
|
|
133
|
-
) {
|
|
134
|
-
// console.log(
|
|
135
|
-
// `testResourceConfiguration! ${JSON.stringify(
|
|
136
|
-
// testResourceConfiguration,
|
|
137
|
-
// null,
|
|
138
|
-
// 2
|
|
139
|
-
// )}`
|
|
140
|
-
// );
|
|
141
|
-
// console.log("puppetMaster", puppetMaster);
|
|
142
|
-
|
|
143
|
-
await puppetMaster
|
|
144
|
-
.mkdirSync
|
|
145
|
-
// ""
|
|
146
|
-
// puppetMaster.testResourceConfiguration.fs + "/"
|
|
147
|
-
();
|
|
148
|
-
// if (!puppetMaster.existsSync(destFolder)) {
|
|
149
|
-
// puppetMaster.mkdirSync(destFolder, { recursive: true });
|
|
150
|
-
// }
|
|
151
|
-
|
|
152
|
-
// puppetMaster.writeFileSync(
|
|
153
|
-
// // puppetMaster.testResourceConfiguration.fs + `/tests.json`,
|
|
154
|
-
// `tests.json`,
|
|
155
|
-
// JSON.stringify(this.toObj(), null, 2)
|
|
156
|
-
// );
|
|
126
|
+
receiveTestResourceConfig: async function (puppetMaster: PM) {
|
|
127
|
+
await puppetMaster.mkdirSync();
|
|
157
128
|
|
|
158
129
|
const logFilePath = "log.txt";
|
|
159
|
-
// puppetMaster.testResourceConfiguration.fs + `/log.txt`;
|
|
160
|
-
|
|
161
130
|
const access = await puppetMaster.createWriteStream(logFilePath);
|
|
162
|
-
|
|
163
|
-
// console.log("access", access);
|
|
164
131
|
const tLog = (...l: string[]) => {
|
|
165
|
-
// access.write(`${l.toString()}\n`);
|
|
166
|
-
// console.log("tLog", l);
|
|
167
132
|
puppetMaster.write(access, `${l.toString()}\n`);
|
|
168
133
|
};
|
|
169
134
|
|
package/src/lib/classBuilder.ts
CHANGED
|
@@ -17,7 +17,20 @@ import { PM } from "../PM/index.js";
|
|
|
17
17
|
import { ITTestResourceRequest } from "./index.js";
|
|
18
18
|
|
|
19
19
|
export abstract class ClassBuilder<
|
|
20
|
-
ITestShape extends IBaseTest
|
|
20
|
+
ITestShape extends IBaseTest<
|
|
21
|
+
unknown,
|
|
22
|
+
unknown,
|
|
23
|
+
unknown,
|
|
24
|
+
unknown,
|
|
25
|
+
unknown,
|
|
26
|
+
unknown,
|
|
27
|
+
unknown,
|
|
28
|
+
Record<string, any>,
|
|
29
|
+
Record<string, any>,
|
|
30
|
+
Record<string, any>,
|
|
31
|
+
Record<string, any>,
|
|
32
|
+
Record<string, any>
|
|
33
|
+
>
|
|
21
34
|
> extends BaseBuilder<ITestShape, any, any, any, any, any> {
|
|
22
35
|
constructor(
|
|
23
36
|
testImplementation: ITestImplementation<ITestShape, any>,
|
|
@@ -29,7 +42,6 @@ export abstract class ClassBuilder<
|
|
|
29
42
|
thenKlasser: IThenKlasser<ITestShape>,
|
|
30
43
|
checkKlasser: ICheckKlasser<ITestShape>,
|
|
31
44
|
testResourceRequirement: ITTestResourceRequest
|
|
32
|
-
// puppetMaster: PM
|
|
33
45
|
) {
|
|
34
46
|
const classySuites = Object.entries(testImplementation.suites).reduce(
|
|
35
47
|
(a, [key], index) => {
|
package/src/lib/core.ts
CHANGED
|
@@ -8,11 +8,8 @@ import {
|
|
|
8
8
|
import { ITestInterface } from "./types.js";
|
|
9
9
|
import {
|
|
10
10
|
DefaultTestInterface,
|
|
11
|
-
ILogWriter,
|
|
12
|
-
ITTestResourceConfiguration,
|
|
13
11
|
ITTestResourceRequest,
|
|
14
12
|
ITestArtifactory,
|
|
15
|
-
ITestJob,
|
|
16
13
|
defaultTestResourceRequirement,
|
|
17
14
|
} from "./index.js";
|
|
18
15
|
import {
|
|
@@ -26,7 +23,20 @@ import { ClassBuilder } from "./classBuilder.js";
|
|
|
26
23
|
import { PM } from "../PM/index";
|
|
27
24
|
|
|
28
25
|
export default abstract class Testeranto<
|
|
29
|
-
ITestShape extends IBaseTest
|
|
26
|
+
ITestShape extends IBaseTest<
|
|
27
|
+
unknown,
|
|
28
|
+
unknown,
|
|
29
|
+
unknown,
|
|
30
|
+
unknown,
|
|
31
|
+
unknown,
|
|
32
|
+
unknown,
|
|
33
|
+
unknown,
|
|
34
|
+
Record<string, any>,
|
|
35
|
+
Record<string, any>,
|
|
36
|
+
Record<string, any>,
|
|
37
|
+
Record<string, any>,
|
|
38
|
+
Record<string, any>
|
|
39
|
+
>
|
|
30
40
|
> extends ClassBuilder<ITestShape> {
|
|
31
41
|
constructor(
|
|
32
42
|
input: ITestShape["iinput"],
|
|
@@ -34,7 +44,6 @@ export default abstract class Testeranto<
|
|
|
34
44
|
testImplementation: ITestImplementation<ITestShape>,
|
|
35
45
|
testResourceRequirement: ITTestResourceRequest = defaultTestResourceRequirement,
|
|
36
46
|
testInterface: Partial<ITestInterface<ITestShape>>
|
|
37
|
-
// puppetMaster: PM
|
|
38
47
|
) {
|
|
39
48
|
const fullTestInterface = DefaultTestInterface(testInterface);
|
|
40
49
|
super(
|
|
@@ -146,12 +155,14 @@ export default abstract class Testeranto<
|
|
|
146
155
|
async butThen(
|
|
147
156
|
store: any,
|
|
148
157
|
thenCB,
|
|
149
|
-
testResourceConfiguration
|
|
158
|
+
testResourceConfiguration: any,
|
|
159
|
+
pm: PM
|
|
150
160
|
): Promise<ITestShape["iselection"]> {
|
|
151
161
|
return await fullTestInterface.butThen(
|
|
152
162
|
store,
|
|
153
163
|
thenCB,
|
|
154
|
-
testResourceConfiguration
|
|
164
|
+
testResourceConfiguration,
|
|
165
|
+
pm
|
|
155
166
|
);
|
|
156
167
|
}
|
|
157
168
|
} as any,
|