testeranto 0.75.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 +6 -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
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const fs_1 = __importDefault(require("fs"));
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
exports.default = (platform, entryPoints) => {
|
|
9
|
+
return {
|
|
10
|
+
name: "metafileWriter",
|
|
11
|
+
setup(build) {
|
|
12
|
+
build.onEnd((result) => {
|
|
13
|
+
if (result.errors.length === 0) {
|
|
14
|
+
entryPoints.forEach((entryPoint) => {
|
|
15
|
+
const filePath = path_1.default.join("./docs/", platform, entryPoint.split(".").slice(0, -1).join("."), `inputFiles.json`);
|
|
16
|
+
const dirName = path_1.default.dirname(filePath);
|
|
17
|
+
if (!fs_1.default.existsSync(dirName)) {
|
|
18
|
+
fs_1.default.mkdirSync(dirName, { recursive: true });
|
|
19
|
+
}
|
|
20
|
+
fs_1.default.writeFileSync(filePath, JSON.stringify(Object.keys(Object.keys(result.metafile.outputs)
|
|
21
|
+
.filter((s) => {
|
|
22
|
+
if (!result.metafile.outputs[s].entryPoint) {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
return (path_1.default.resolve(result.metafile.outputs[s].entryPoint) ===
|
|
26
|
+
path_1.default.resolve(entryPoint));
|
|
27
|
+
})
|
|
28
|
+
.reduce((mm, el) => {
|
|
29
|
+
mm.push(result.metafile.outputs[el].inputs);
|
|
30
|
+
return mm;
|
|
31
|
+
}, [])[0])
|
|
32
|
+
.filter((f) => {
|
|
33
|
+
const regex = /^src\/.*/g;
|
|
34
|
+
const matches = f.match(regex);
|
|
35
|
+
const passes = (matches === null || matches === void 0 ? void 0 : matches.length) === 1;
|
|
36
|
+
return passes;
|
|
37
|
+
})
|
|
38
|
+
.filter((f) => {
|
|
39
|
+
const regex = /.*\.test\..*/g;
|
|
40
|
+
const matches = f.match(regex);
|
|
41
|
+
const passes = (matches === null || matches === void 0 ? void 0 : matches.length) === 1;
|
|
42
|
+
return !passes;
|
|
43
|
+
})));
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
};
|
|
@@ -4,8 +4,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const index_js_1 = __importDefault(require("./index.js"));
|
|
7
|
+
const inputFilesPlugin_1 = __importDefault(require("./inputFilesPlugin"));
|
|
7
8
|
exports.default = (config, entryPoints) => {
|
|
8
|
-
return Object.assign(Object.assign({}, (0, index_js_1.default)(config)), { splitting: true, outdir: config.outdir + "/node", inject: [`./node_modules/testeranto/dist/cjs-shim.js`], supported: {
|
|
9
|
+
return Object.assign(Object.assign({}, (0, index_js_1.default)(config)), { splitting: true, outdir: config.outdir + "/node", inject: [`./node_modules/testeranto/dist/cjs-shim.js`], metafile: true, supported: {
|
|
9
10
|
"dynamic-import": true,
|
|
10
11
|
}, define: {
|
|
11
12
|
"process.env.FLUENTFFMPEG_COV": "0",
|
|
@@ -20,6 +21,7 @@ exports.default = (config, entryPoints) => {
|
|
|
20
21
|
...config.externals,
|
|
21
22
|
], entryPoints: [...entryPoints], plugins: [
|
|
22
23
|
...(config.nodePlugins || []),
|
|
24
|
+
(0, inputFilesPlugin_1.default)("node", entryPoints),
|
|
23
25
|
{
|
|
24
26
|
name: "rebuild-notify",
|
|
25
27
|
setup(build) {
|
|
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const path_1 = __importDefault(require("path"));
|
|
7
7
|
const index_js_1 = __importDefault(require("./index.js"));
|
|
8
|
+
const inputFilesPlugin_js_1 = __importDefault(require("./inputFilesPlugin.js"));
|
|
8
9
|
exports.default = (config, entryPoints) => {
|
|
9
10
|
return Object.assign(Object.assign({}, (0, index_js_1.default)(config)), {
|
|
10
11
|
// inject: ["./node_modules/testeranto/dist/cjs-shim.js"],
|
|
@@ -14,7 +15,7 @@ exports.default = (config, entryPoints) => {
|
|
|
14
15
|
// splitting: true,
|
|
15
16
|
outdir: config.outdir + "/web", alias: {
|
|
16
17
|
react: path_1.default.resolve("./node_modules/react"),
|
|
17
|
-
}, external: [
|
|
18
|
+
}, metafile: true, external: [
|
|
18
19
|
"testeranto.json",
|
|
19
20
|
"features.test.ts",
|
|
20
21
|
// "url",
|
|
@@ -38,6 +39,7 @@ exports.default = (config, entryPoints) => {
|
|
|
38
39
|
"dns",
|
|
39
40
|
], platform: "browser", entryPoints: [...entryPoints], plugins: [
|
|
40
41
|
...(config.webPlugins || []),
|
|
42
|
+
(0, inputFilesPlugin_js_1.default)("node", entryPoints),
|
|
41
43
|
{
|
|
42
44
|
name: "rebuild-notify",
|
|
43
45
|
setup(build) {
|
|
@@ -34,7 +34,62 @@ class BaseSuite {
|
|
|
34
34
|
const sNdx = this.index;
|
|
35
35
|
const sName = this.name;
|
|
36
36
|
for (const [gNdx, g] of Object.entries(this.givens)) {
|
|
37
|
-
const
|
|
37
|
+
const beforeAllProxy = new Proxy(pm, {
|
|
38
|
+
get(target, prop, receiver) {
|
|
39
|
+
if (prop === "writeFileSync") {
|
|
40
|
+
return (fp, contents) => target[prop](`suite-${sNdx}/beforeAll/${fp}`, contents);
|
|
41
|
+
}
|
|
42
|
+
if (prop === "browser") {
|
|
43
|
+
return new Proxy(target[prop], {
|
|
44
|
+
get(bTarget, bProp, bReceiver) {
|
|
45
|
+
if (bProp === "pages") {
|
|
46
|
+
return async () => {
|
|
47
|
+
return bTarget.pages().then((pages) => {
|
|
48
|
+
return pages.map((page) => {
|
|
49
|
+
return new Proxy(page, {
|
|
50
|
+
get(pTarget, pProp, pReciever) {
|
|
51
|
+
if (pProp === "screenshot") {
|
|
52
|
+
return async (x) => {
|
|
53
|
+
return pm.customScreenShot(Object.assign(Object.assign({}, x), { path: `${testResourceConfiguration.fs}/suite-${sNdx}/beforeAll` +
|
|
54
|
+
"/" +
|
|
55
|
+
x.path }), page);
|
|
56
|
+
// return await window["custom-screenshot"]({
|
|
57
|
+
// ...x,
|
|
58
|
+
// path:
|
|
59
|
+
// `${testResourceConfiguration.fs}/suite-${sNdx}/afterAll` +
|
|
60
|
+
// "/" +
|
|
61
|
+
// x.path,
|
|
62
|
+
// });
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
else if (pProp === "mainFrame") {
|
|
66
|
+
return () => pTarget[pProp]();
|
|
67
|
+
}
|
|
68
|
+
else if (pProp === "close") {
|
|
69
|
+
return () => pTarget[pProp]();
|
|
70
|
+
}
|
|
71
|
+
// else if (pProp === "mainFrame") {
|
|
72
|
+
// return () => target[pProp](...arguments);
|
|
73
|
+
// }
|
|
74
|
+
else {
|
|
75
|
+
return Reflect.get(...arguments);
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
// return (await target.pages()).map((page) => {
|
|
82
|
+
// return new Proxy(page, handler2);
|
|
83
|
+
// });
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
return Reflect.get(...arguments);
|
|
90
|
+
},
|
|
91
|
+
});
|
|
92
|
+
const subject = await this.setup(input, suiteArtifactory, testResourceConfiguration, beforeAllProxy);
|
|
38
93
|
const giver = this.givens[gNdx];
|
|
39
94
|
try {
|
|
40
95
|
this.store = await giver.give(subject, gNdx, testResourceConfiguration, this.assertThat, suiteArtifactory, tLog, pm, sNdx);
|
|
@@ -61,17 +116,24 @@ class BaseSuite {
|
|
|
61
116
|
get(pTarget, pProp, pReciever) {
|
|
62
117
|
if (pProp === "screenshot") {
|
|
63
118
|
return async (x) => {
|
|
64
|
-
|
|
65
|
-
// "custom-screenshot-MARK-afterAllProxy",
|
|
66
|
-
// // arguments,
|
|
67
|
-
// // x,
|
|
68
|
-
// window["custom-screenshot"].toString()
|
|
69
|
-
// );
|
|
70
|
-
return await window["custom-screenshot"](Object.assign(Object.assign({}, x), { path: `${testResourceConfiguration.fs}/suite-${sNdx}/afterAll` +
|
|
119
|
+
return pm.customScreenShot(Object.assign(Object.assign({}, x), { path: `${testResourceConfiguration.fs}/suite-${sNdx}/afterAll` +
|
|
71
120
|
"/" +
|
|
72
121
|
x.path }));
|
|
122
|
+
// return await window["custom-screenshot"]({
|
|
123
|
+
// ...x,
|
|
124
|
+
// path:
|
|
125
|
+
// `${testResourceConfiguration.fs}/suite-${sNdx}/afterAll` +
|
|
126
|
+
// "/" +
|
|
127
|
+
// x.path,
|
|
128
|
+
// });
|
|
73
129
|
};
|
|
74
130
|
}
|
|
131
|
+
else if (pProp === "mainFrame") {
|
|
132
|
+
return () => pTarget[pProp]();
|
|
133
|
+
}
|
|
134
|
+
else if (pProp === "close") {
|
|
135
|
+
return () => pTarget[pProp]();
|
|
136
|
+
}
|
|
75
137
|
// else if (pProp === "mainFrame") {
|
|
76
138
|
// return () => target[pProp](...arguments);
|
|
77
139
|
// }
|
|
@@ -162,7 +224,6 @@ class BaseGiven {
|
|
|
162
224
|
const beforeEachProxy = new Proxy(pm, {
|
|
163
225
|
get(target, prop, receiver) {
|
|
164
226
|
if (prop === "writeFileSync") {
|
|
165
|
-
console.log("beforeEachProx", arguments, target[prop]);
|
|
166
227
|
return (fp, contents) => target[prop](`suite-${suiteNdx}/given-${key}/when/beforeEach/${fp}`, contents);
|
|
167
228
|
}
|
|
168
229
|
return Reflect.get(...arguments);
|
|
@@ -172,8 +233,8 @@ class BaseGiven {
|
|
|
172
233
|
for (const [whenNdx, whenStep] of this.whens.entries()) {
|
|
173
234
|
await whenStep.test(this.store, testResourceConfiguration, tLog, pm, `suite-${suiteNdx}/given-${key}/when/${whenNdx}`);
|
|
174
235
|
}
|
|
175
|
-
for (const thenStep of this.thens) {
|
|
176
|
-
const t = await thenStep.test(this.store, testResourceConfiguration, tLog, pm);
|
|
236
|
+
for (const [thenNdx, thenStep] of this.thens.entries()) {
|
|
237
|
+
const t = await thenStep.test(this.store, testResourceConfiguration, tLog, pm, `suite-${suiteNdx}/given-${key}/then-${thenNdx}`);
|
|
177
238
|
tester(t);
|
|
178
239
|
}
|
|
179
240
|
}
|
|
@@ -218,12 +279,34 @@ class BaseGiven {
|
|
|
218
279
|
// "custom-screenshot-MARK-afterEachProxy",
|
|
219
280
|
// window["custom-screenshot"].toString()
|
|
220
281
|
// );
|
|
221
|
-
return
|
|
282
|
+
return pm.customScreenShot(Object.assign(Object.assign({}, x), { path: `${testResourceConfiguration.fs}/suite-${suiteNdx}/given-${key}/afterEach` +
|
|
222
283
|
"/" +
|
|
223
|
-
x.path }));
|
|
284
|
+
x.path }), page);
|
|
285
|
+
// return await pTarget[pProp]({
|
|
286
|
+
// ...x,
|
|
287
|
+
// path:
|
|
288
|
+
// `${testResourceConfiguration.fs}/suite-${suiteNdx}/given-${key}/afterEach` +
|
|
289
|
+
// "/" +
|
|
290
|
+
// x.path,
|
|
291
|
+
// });
|
|
224
292
|
};
|
|
225
293
|
}
|
|
226
|
-
|
|
294
|
+
else if (pProp === "mainFrame") {
|
|
295
|
+
return () => pTarget[pProp]();
|
|
296
|
+
// return target[pProp];
|
|
297
|
+
// return Reflect.get(...arguments);
|
|
298
|
+
}
|
|
299
|
+
else if (pProp === "exposeFunction") {
|
|
300
|
+
// return Reflect.get(target, prop, receiver);
|
|
301
|
+
return (...a) => pTarget[pProp](...a);
|
|
302
|
+
// return target[pProp];
|
|
303
|
+
}
|
|
304
|
+
else if (pProp === "removeExposedFunction") {
|
|
305
|
+
// return Reflect.get(target, prop, receiver);
|
|
306
|
+
return pTarget[pProp].bind(pTarget);
|
|
307
|
+
// return target[pProp];
|
|
308
|
+
}
|
|
309
|
+
// else if (pProp === "#frameManager") {
|
|
227
310
|
// return () => target[pProp](...arguments);
|
|
228
311
|
// }
|
|
229
312
|
else {
|
|
@@ -271,11 +354,69 @@ class BaseWhen {
|
|
|
271
354
|
const andWhenProxy = new Proxy(pm, {
|
|
272
355
|
get(target, prop, receiver) {
|
|
273
356
|
if (prop === "writeFileSync") {
|
|
274
|
-
console.log("andWhenProxy", arguments, target[prop]);
|
|
275
357
|
return (fp, contents) =>
|
|
276
358
|
// target[prop](`${key}/andWhen/${fp}`, contents);
|
|
277
359
|
target[prop](`${key}/andWhen/${fp}`, contents);
|
|
278
360
|
}
|
|
361
|
+
/////////////////////
|
|
362
|
+
if (prop === "browser") {
|
|
363
|
+
return new Proxy(target[prop], {
|
|
364
|
+
get(bTarget, bProp, bReceiver) {
|
|
365
|
+
if (bProp === "pages") {
|
|
366
|
+
return async () => {
|
|
367
|
+
return bTarget.pages().then((pages) => {
|
|
368
|
+
return pages.map((page) => {
|
|
369
|
+
return new Proxy(page, {
|
|
370
|
+
get(pTarget, pProp, pReciever) {
|
|
371
|
+
if (pProp === "screenshot") {
|
|
372
|
+
return async (x) => {
|
|
373
|
+
// console.log(
|
|
374
|
+
// "custom-screenshot-MARK-afterEachProxy",
|
|
375
|
+
// window["custom-screenshot"].toString()
|
|
376
|
+
// );
|
|
377
|
+
return pm.customScreenShot(Object.assign(Object.assign({}, x), { path: `${testResourceConfiguration.fs}/${key}/afterEach` +
|
|
378
|
+
"/" +
|
|
379
|
+
x.path }), page);
|
|
380
|
+
// return await pTarget[pProp]({
|
|
381
|
+
// ...x,
|
|
382
|
+
// path:
|
|
383
|
+
// `${testResourceConfiguration.fs}/suite-${suiteNdx}/given-${key}/afterEach` +
|
|
384
|
+
// "/" +
|
|
385
|
+
// x.path,
|
|
386
|
+
// });
|
|
387
|
+
};
|
|
388
|
+
}
|
|
389
|
+
else if (pProp === "mainFrame") {
|
|
390
|
+
return () => pTarget[pProp]();
|
|
391
|
+
// return target[pProp];
|
|
392
|
+
// return Reflect.get(...arguments);
|
|
393
|
+
}
|
|
394
|
+
else if (pProp === "exposeFunction") {
|
|
395
|
+
// return Reflect.get(target, prop, receiver);
|
|
396
|
+
return pTarget[pProp].bind(pTarget);
|
|
397
|
+
// return target[pProp];
|
|
398
|
+
}
|
|
399
|
+
else if (pProp === "removeExposedFunction") {
|
|
400
|
+
// return Reflect.get(target, prop, receiver);
|
|
401
|
+
return pTarget[pProp].bind(pTarget);
|
|
402
|
+
// return target[pProp];
|
|
403
|
+
}
|
|
404
|
+
else {
|
|
405
|
+
return Reflect.get(...arguments);
|
|
406
|
+
}
|
|
407
|
+
},
|
|
408
|
+
});
|
|
409
|
+
});
|
|
410
|
+
});
|
|
411
|
+
// return (await target.pages()).map((page) => {
|
|
412
|
+
// return new Proxy(page, handler2);
|
|
413
|
+
// });
|
|
414
|
+
};
|
|
415
|
+
}
|
|
416
|
+
},
|
|
417
|
+
});
|
|
418
|
+
}
|
|
419
|
+
///////////////////////
|
|
279
420
|
return Reflect.get(...arguments);
|
|
280
421
|
},
|
|
281
422
|
});
|
|
@@ -301,10 +442,74 @@ class BaseThen {
|
|
|
301
442
|
error: this.error,
|
|
302
443
|
};
|
|
303
444
|
}
|
|
304
|
-
async test(store, testResourceConfiguration, tLog, pm) {
|
|
445
|
+
async test(store, testResourceConfiguration, tLog, pm, filepath) {
|
|
305
446
|
tLog(" Then:", this.name);
|
|
306
447
|
try {
|
|
307
|
-
const
|
|
448
|
+
const butThenProxy = new Proxy(pm, {
|
|
449
|
+
get(target, prop, receiver) {
|
|
450
|
+
if (prop === "writeFileSync") {
|
|
451
|
+
return (fp, contents) => target[prop](`${filepath}/${fp}`, contents);
|
|
452
|
+
}
|
|
453
|
+
if (prop === "browser") {
|
|
454
|
+
return new Proxy(target[prop], {
|
|
455
|
+
get(bTarget, bProp, bReceiver) {
|
|
456
|
+
if (bProp === "pages") {
|
|
457
|
+
return async () => {
|
|
458
|
+
return bTarget.pages().then((pages) => {
|
|
459
|
+
return pages.map((page) => {
|
|
460
|
+
return new Proxy(page, {
|
|
461
|
+
get(pTarget, pProp, pReciever) {
|
|
462
|
+
if (pProp === "screenshot") {
|
|
463
|
+
return async (x) => {
|
|
464
|
+
return pm.customScreenShot(Object.assign(Object.assign({}, x), { path: `${testResourceConfiguration.fs}/${filepath}/butThen` +
|
|
465
|
+
"/" +
|
|
466
|
+
x.path }), page);
|
|
467
|
+
// return await window["custom-screenshot"]({
|
|
468
|
+
// ...x,
|
|
469
|
+
// path:
|
|
470
|
+
// `${testResourceConfiguration.fs}/suite-${sNdx}/afterAll` +
|
|
471
|
+
// "/" +
|
|
472
|
+
// x.path,
|
|
473
|
+
// });
|
|
474
|
+
};
|
|
475
|
+
}
|
|
476
|
+
else if (pProp === "close") {
|
|
477
|
+
return () => pTarget[pProp]();
|
|
478
|
+
}
|
|
479
|
+
else if (pProp === "mainFrame") {
|
|
480
|
+
return () => pTarget[pProp]();
|
|
481
|
+
}
|
|
482
|
+
else if (pProp === "exposeFunction") {
|
|
483
|
+
// return Reflect.get(target, prop, receiver);
|
|
484
|
+
return (...a) => pTarget[pProp](...a);
|
|
485
|
+
// return target[pProp];
|
|
486
|
+
}
|
|
487
|
+
else if (pProp === "removeExposedFunction") {
|
|
488
|
+
// return Reflect.get(target, prop, receiver);
|
|
489
|
+
return pTarget[pProp].bind(pTarget);
|
|
490
|
+
// return target[pProp];
|
|
491
|
+
}
|
|
492
|
+
else {
|
|
493
|
+
return Reflect.get(...arguments);
|
|
494
|
+
}
|
|
495
|
+
},
|
|
496
|
+
});
|
|
497
|
+
});
|
|
498
|
+
});
|
|
499
|
+
// return (await target.pages()).map((page) => {
|
|
500
|
+
// return new Proxy(page, handler2);
|
|
501
|
+
// });
|
|
502
|
+
};
|
|
503
|
+
}
|
|
504
|
+
},
|
|
505
|
+
});
|
|
506
|
+
}
|
|
507
|
+
return Reflect.get(...arguments);
|
|
508
|
+
},
|
|
509
|
+
});
|
|
510
|
+
const x = await this.butThen(store, this.thenCB, testResourceConfiguration, butThenProxy
|
|
511
|
+
// pm
|
|
512
|
+
);
|
|
308
513
|
return x;
|
|
309
514
|
}
|
|
310
515
|
catch (e) {
|
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BaseBuilder = void 0;
|
|
4
4
|
class BaseBuilder {
|
|
5
|
-
constructor(input, suitesOverrides, givenOverides, whenOverides, thenOverides, checkOverides, testResourceRequirement, testSpecification
|
|
6
|
-
// puppetMaster: PM
|
|
7
|
-
) {
|
|
5
|
+
constructor(input, suitesOverrides, givenOverides, whenOverides, thenOverides, checkOverides, testResourceRequirement, testSpecification) {
|
|
8
6
|
this.input = input;
|
|
9
7
|
this.artifacts = [];
|
|
10
8
|
this.artifacts = [];
|
|
@@ -15,12 +13,9 @@ class BaseBuilder {
|
|
|
15
13
|
this.thenOverides = thenOverides;
|
|
16
14
|
this.checkOverides = checkOverides;
|
|
17
15
|
this.testSpecification = testSpecification;
|
|
18
|
-
// this.puppetMaster = puppetMaster;
|
|
19
16
|
this.specs = testSpecification(this.Suites(), this.Given(), this.When(), this.Then(), this.Check());
|
|
20
17
|
this.testJobs = this.specs.map((suite) => {
|
|
21
|
-
const suiteRunner = (suite) => async (
|
|
22
|
-
// testResourceConfiguration: ITTestResourceConfiguration,
|
|
23
|
-
puppetMaster, tLog) => {
|
|
18
|
+
const suiteRunner = (suite) => async (puppetMaster, tLog) => {
|
|
24
19
|
await puppetMaster.startPuppeteer({
|
|
25
20
|
browserWSEndpoint: puppetMaster.testResourceConfiguration.browserWSEndpoint,
|
|
26
21
|
}, puppetMaster.testResourceConfiguration.fs);
|
|
@@ -31,44 +26,15 @@ class BaseBuilder {
|
|
|
31
26
|
const runner = suiteRunner(suite);
|
|
32
27
|
return {
|
|
33
28
|
test: suite,
|
|
34
|
-
// testResourceRequirement,
|
|
35
29
|
toObj: () => {
|
|
36
30
|
return suite.toObj();
|
|
37
31
|
},
|
|
38
32
|
runner,
|
|
39
|
-
receiveTestResourceConfig: async function (
|
|
40
|
-
|
|
41
|
-
// name: "",
|
|
42
|
-
// fs: ".",
|
|
43
|
-
// ports: [],
|
|
44
|
-
// browserWSEndpoint: "",
|
|
45
|
-
// },
|
|
46
|
-
puppetMaster) {
|
|
47
|
-
// console.log(
|
|
48
|
-
// `testResourceConfiguration! ${JSON.stringify(
|
|
49
|
-
// testResourceConfiguration,
|
|
50
|
-
// null,
|
|
51
|
-
// 2
|
|
52
|
-
// )}`
|
|
53
|
-
// );
|
|
54
|
-
// console.log("puppetMaster", puppetMaster);
|
|
55
|
-
await puppetMaster
|
|
56
|
-
.mkdirSync();
|
|
57
|
-
// if (!puppetMaster.existsSync(destFolder)) {
|
|
58
|
-
// puppetMaster.mkdirSync(destFolder, { recursive: true });
|
|
59
|
-
// }
|
|
60
|
-
// puppetMaster.writeFileSync(
|
|
61
|
-
// // puppetMaster.testResourceConfiguration.fs + `/tests.json`,
|
|
62
|
-
// `tests.json`,
|
|
63
|
-
// JSON.stringify(this.toObj(), null, 2)
|
|
64
|
-
// );
|
|
33
|
+
receiveTestResourceConfig: async function (puppetMaster) {
|
|
34
|
+
await puppetMaster.mkdirSync();
|
|
65
35
|
const logFilePath = "log.txt";
|
|
66
|
-
// puppetMaster.testResourceConfiguration.fs + `/log.txt`;
|
|
67
36
|
const access = await puppetMaster.createWriteStream(logFilePath);
|
|
68
|
-
// console.log("access", access);
|
|
69
37
|
const tLog = (...l) => {
|
|
70
|
-
// access.write(`${l.toString()}\n`);
|
|
71
|
-
// console.log("tLog", l);
|
|
72
38
|
puppetMaster.write(access, `${l.toString()}\n`);
|
|
73
39
|
};
|
|
74
40
|
const suiteDone = await runner(puppetMaster, tLog);
|
|
@@ -3,9 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ClassBuilder = void 0;
|
|
4
4
|
const basebuilder_js_1 = require("./basebuilder.js");
|
|
5
5
|
class ClassBuilder extends basebuilder_js_1.BaseBuilder {
|
|
6
|
-
constructor(testImplementation, testSpecification, input, suiteKlasser, givenKlasser, whenKlasser, thenKlasser, checkKlasser, testResourceRequirement
|
|
7
|
-
// puppetMaster: PM
|
|
8
|
-
) {
|
|
6
|
+
constructor(testImplementation, testSpecification, input, suiteKlasser, givenKlasser, whenKlasser, thenKlasser, checkKlasser, testResourceRequirement) {
|
|
9
7
|
const classySuites = Object.entries(testImplementation.suites).reduce((a, [key], index) => {
|
|
10
8
|
a[key] = (somestring, givens, checks) => {
|
|
11
9
|
return new suiteKlasser.prototype.constructor(somestring, index, givens, checks);
|
package/dist/common/lib/core.js
CHANGED
|
@@ -4,9 +4,7 @@ const index_js_1 = require("./index.js");
|
|
|
4
4
|
const abstractBase_js_1 = require("./abstractBase.js");
|
|
5
5
|
const classBuilder_js_1 = require("./classBuilder.js");
|
|
6
6
|
class Testeranto extends classBuilder_js_1.ClassBuilder {
|
|
7
|
-
constructor(input, testSpecification, testImplementation, testResourceRequirement = index_js_1.defaultTestResourceRequirement, testInterface
|
|
8
|
-
// puppetMaster: PM
|
|
9
|
-
) {
|
|
7
|
+
constructor(input, testSpecification, testImplementation, testResourceRequirement = index_js_1.defaultTestResourceRequirement, testInterface) {
|
|
10
8
|
const fullTestInterface = (0, index_js_1.DefaultTestInterface)(testInterface);
|
|
11
9
|
super(testImplementation, testSpecification, input, class extends abstractBase_js_1.BaseSuite {
|
|
12
10
|
afterAll(store, artifactory, pm) {
|
|
@@ -53,8 +51,8 @@ class Testeranto extends classBuilder_js_1.ClassBuilder {
|
|
|
53
51
|
return await fullTestInterface.andWhen(store, whenCB, testResource, pm);
|
|
54
52
|
}
|
|
55
53
|
}, class Then extends abstractBase_js_1.BaseThen {
|
|
56
|
-
async butThen(store, thenCB, testResourceConfiguration) {
|
|
57
|
-
return await fullTestInterface.butThen(store, thenCB, testResourceConfiguration);
|
|
54
|
+
async butThen(store, thenCB, testResourceConfiguration, pm) {
|
|
55
|
+
return await fullTestInterface.butThen(store, thenCB, testResourceConfiguration, pm);
|
|
58
56
|
}
|
|
59
57
|
}, class Check extends abstractBase_js_1.BaseCheck {
|
|
60
58
|
constructor(name, features, checkCallback, whens, thens, initialValues) {
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.RoomSchema = exports.HuddleSchema = exports.chatCatMessageSchema = exports.channelsFeature = exports.featuresSchema = exports.ganttSchema = exports.kanbanSchema = exports.userSchema = void 0;
|
|
7
|
+
const mongoose_1 = __importDefault(require("mongoose"));
|
|
8
|
+
exports.userSchema = new mongoose_1.default.Schema({
|
|
9
|
+
email: String,
|
|
10
|
+
channels: [{ type: mongoose_1.default.Schema.Types.ObjectId, ref: "Channel" }],
|
|
11
|
+
dmgroups: [{ type: mongoose_1.default.Schema.Types.ObjectId, ref: "Dmgroup" }],
|
|
12
|
+
});
|
|
13
|
+
exports.userSchema.virtual("features", {
|
|
14
|
+
ref: "Feature",
|
|
15
|
+
localField: "_id",
|
|
16
|
+
foreignField: "owner",
|
|
17
|
+
});
|
|
18
|
+
exports.kanbanSchema = new mongoose_1.default.Schema({
|
|
19
|
+
title: String,
|
|
20
|
+
});
|
|
21
|
+
exports.ganttSchema = new mongoose_1.default.Schema({
|
|
22
|
+
name: String,
|
|
23
|
+
type: String,
|
|
24
|
+
start: Date,
|
|
25
|
+
end: Date,
|
|
26
|
+
});
|
|
27
|
+
exports.featuresSchema = new mongoose_1.default.Schema({
|
|
28
|
+
title: String,
|
|
29
|
+
state: String,
|
|
30
|
+
});
|
|
31
|
+
exports.channelsFeature = new mongoose_1.default.Schema({});
|
|
32
|
+
exports.chatCatMessageSchema = new mongoose_1.default.Schema({
|
|
33
|
+
user: {
|
|
34
|
+
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
35
|
+
ref: "User",
|
|
36
|
+
required: true,
|
|
37
|
+
},
|
|
38
|
+
room: {
|
|
39
|
+
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
40
|
+
ref: "ChatCatRoom",
|
|
41
|
+
required: true,
|
|
42
|
+
maxlength: 100,
|
|
43
|
+
},
|
|
44
|
+
timestamp: {
|
|
45
|
+
type: Date,
|
|
46
|
+
default: Date.now(),
|
|
47
|
+
},
|
|
48
|
+
text: {
|
|
49
|
+
type: String,
|
|
50
|
+
maxlength: 1000,
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
exports.HuddleSchema = new mongoose_1.default.Schema({});
|
|
54
|
+
exports.RoomSchema = new mongoose_1.default.Schema({
|
|
55
|
+
name: { type: String, required: true },
|
|
56
|
+
});
|