testeranto 0.111.0 → 0.112.0
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/dist/common/Init.js +68 -0
- package/dist/common/Node.js +27 -0
- package/dist/common/PM/index.js +7 -0
- package/dist/common/PM/main.js +1176 -0
- package/dist/common/PM/node.js +128 -0
- package/dist/common/PM/web.js +121 -0
- package/dist/common/ReportServer.js +22 -0
- package/dist/common/SubPackages/react/component/node.js +19 -0
- package/dist/common/SubPackages/react/component/web.js +19 -0
- package/dist/common/SubPackages/react/jsx/index.js +21 -0
- package/dist/common/SubPackages/react/jsx/node.js +10 -0
- package/dist/common/SubPackages/react/jsx/web.js +10 -0
- package/dist/common/SubPackages/react-dom/component/node.js +88 -0
- package/dist/common/SubPackages/react-dom/component/web.js +67 -0
- package/dist/common/SubPackages/react-dom/jsx/index.js +2 -0
- package/dist/common/SubPackages/react-dom/jsx/node.js +39 -0
- package/dist/common/SubPackages/react-dom/jsx/web.js +128 -0
- package/dist/common/SubPackages/react-test-renderer/MemoExoticComponent/node.js +54 -0
- package/dist/common/SubPackages/react-test-renderer/component/index.js +2 -0
- package/dist/common/SubPackages/react-test-renderer/component/interface.js +70 -0
- package/dist/common/SubPackages/react-test-renderer/component/node.js +8 -0
- package/dist/common/SubPackages/react-test-renderer/component/web.js +8 -0
- package/dist/common/SubPackages/react-test-renderer/fc/node.js +60 -0
- package/dist/common/SubPackages/react-test-renderer/fc/web.js +60 -0
- package/dist/common/SubPackages/react-test-renderer/jsx/index.js +67 -0
- package/dist/common/SubPackages/react-test-renderer/jsx/node.js +10 -0
- package/dist/common/SubPackages/react-test-renderer/jsx/web.js +10 -0
- package/dist/common/SubPackages/react-test-renderer/jsx-promised/index.js +52 -0
- package/dist/common/SubPackages/react-test-renderer/jsx-promised/node.js +10 -0
- package/dist/common/SubPackages/react-test-renderer/jsx-promised/web.js +10 -0
- package/dist/common/Types.js +2 -0
- package/dist/common/Web.js +49 -0
- package/dist/common/build.js +222 -0
- package/dist/common/defaultConfig.js +20 -0
- package/dist/common/esbuildConfigs/eslint-formatter-testeranto.js +6 -0
- package/dist/common/esbuildConfigs/featuresPlugin.js +39 -0
- package/dist/common/esbuildConfigs/index.js +21 -0
- package/dist/common/esbuildConfigs/inputFilesPlugin.js +27 -0
- package/dist/common/esbuildConfigs/node.js +37 -0
- package/dist/common/esbuildConfigs/web.js +50 -0
- package/dist/common/init-docs.js +53 -0
- package/dist/common/lib/abstractBase.js +329 -0
- package/dist/common/lib/basebuilder.js +98 -0
- package/dist/common/lib/classBuilder.js +40 -0
- package/dist/common/lib/core.js +117 -0
- package/dist/common/lib/index.js +21 -0
- package/dist/common/lib/types.js +2 -0
- package/dist/common/package.json +3 -0
- package/dist/common/puppeteerConfiger.js +24 -0
- package/dist/common/run.js +62 -0
- package/dist/common/tsconfig.common.tsbuildinfo +1 -0
- package/dist/common/utils.js +43 -0
- package/dist/common/web.html.js +22 -0
- package/dist/module/Footer.js +4 -0
- package/dist/module/Init.js +63 -0
- package/dist/module/Node.js +20 -0
- package/dist/module/PM/index.js +3 -0
- package/dist/module/PM/main.js +1136 -0
- package/dist/module/PM/node.js +121 -0
- package/dist/module/PM/web.js +117 -0
- package/dist/module/ReportClient.js +97 -0
- package/dist/module/ReportServer.js +17 -0
- package/dist/module/SubPackages/react/component/node.js +14 -0
- package/dist/module/SubPackages/react/component/web.js +14 -0
- package/dist/module/SubPackages/react/jsx/index.js +15 -0
- package/dist/module/SubPackages/react/jsx/node.js +5 -0
- package/dist/module/SubPackages/react/jsx/web.js +5 -0
- package/dist/module/SubPackages/react-dom/component/node.js +80 -0
- package/dist/module/SubPackages/react-dom/component/web.js +62 -0
- package/dist/module/SubPackages/react-dom/jsx/index.js +1 -0
- package/dist/module/SubPackages/react-dom/jsx/node.js +31 -0
- package/dist/module/SubPackages/react-dom/jsx/web.js +90 -0
- package/dist/module/SubPackages/react-test-renderer/MemoExoticComponent/node.js +16 -0
- package/dist/module/SubPackages/react-test-renderer/component/index.js +1 -0
- package/dist/module/SubPackages/react-test-renderer/component/interface.js +31 -0
- package/dist/module/SubPackages/react-test-renderer/component/node.js +3 -0
- package/dist/module/SubPackages/react-test-renderer/component/web.js +3 -0
- package/dist/module/SubPackages/react-test-renderer/fc/node.js +22 -0
- package/dist/module/SubPackages/react-test-renderer/fc/web.js +22 -0
- package/dist/module/SubPackages/react-test-renderer/jsx/index.js +28 -0
- package/dist/module/SubPackages/react-test-renderer/jsx/node.js +5 -0
- package/dist/module/SubPackages/react-test-renderer/jsx/web.js +5 -0
- package/dist/module/SubPackages/react-test-renderer/jsx-promised/index.js +16 -0
- package/dist/module/SubPackages/react-test-renderer/jsx-promised/node.js +5 -0
- package/dist/module/SubPackages/react-test-renderer/jsx-promised/web.js +5 -0
- package/dist/module/TestReport.js +91 -0
- package/dist/module/Types.js +1 -0
- package/dist/module/Web.js +42 -0
- package/dist/module/build.js +184 -0
- package/dist/module/defaultConfig.js +18 -0
- package/dist/module/esbuildConfigs/eslint-formatter-testeranto.js +3 -0
- package/dist/module/esbuildConfigs/featuresPlugin.js +34 -0
- package/dist/module/esbuildConfigs/index.js +19 -0
- package/dist/module/esbuildConfigs/inputFilesPlugin.js +22 -0
- package/dist/module/esbuildConfigs/node.js +32 -0
- package/dist/module/esbuildConfigs/web.js +45 -0
- package/dist/module/init-docs.js +15 -0
- package/dist/module/lib/abstractBase.js +321 -0
- package/dist/module/lib/basebuilder.js +94 -0
- package/dist/module/lib/classBuilder.js +36 -0
- package/dist/module/lib/core.js +114 -0
- package/dist/module/lib/index.js +17 -0
- package/dist/module/lib/types.js +1 -0
- package/dist/module/package.json +3 -0
- package/dist/module/puppeteerConfiger.js +19 -0
- package/dist/module/run.js +24 -0
- package/dist/module/tsconfig.module.tsbuildinfo +1 -0
- package/dist/module/utils.js +29 -0
- package/dist/module/web.html.js +20 -0
- package/dist/prebuild/ReportClient.css +11367 -0
- package/dist/prebuild/ReportClient.js +24641 -0
- package/dist/prebuild/ReportServer.mjs +16 -0
- package/dist/prebuild/TestReport.css +11367 -0
- package/dist/prebuild/TestReport.js +27484 -0
- package/dist/prebuild/build.mjs +376 -0
- package/dist/prebuild/esbuildConfigs/eslint-formatter-testeranto.mjs +9 -0
- package/dist/prebuild/init-docs.mjs +104 -0
- package/dist/prebuild/run.mjs +1153 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types/Init.d.ts +2 -0
- package/dist/types/Node.d.ts +12 -0
- package/dist/types/PM/index.d.ts +34 -0
- package/dist/types/PM/main.d.ts +66 -0
- package/dist/types/PM/node.d.ts +40 -0
- package/dist/types/PM/web.d.ts +38 -0
- package/dist/types/ReportServer.d.ts +1 -0
- package/dist/types/SubPackages/react/component/node.d.ts +7 -0
- package/dist/types/SubPackages/react/component/web.d.ts +7 -0
- package/dist/types/SubPackages/react/jsx/index.d.ts +12 -0
- package/dist/types/SubPackages/react/jsx/node.d.ts +4 -0
- package/dist/types/SubPackages/react/jsx/web.d.ts +4 -0
- package/dist/types/SubPackages/react-dom/component/node.d.ts +11 -0
- package/dist/types/SubPackages/react-dom/component/web.d.ts +20 -0
- package/dist/types/SubPackages/react-dom/jsx/index.d.ts +6 -0
- package/dist/types/SubPackages/react-dom/jsx/node.d.ts +7 -0
- package/dist/types/SubPackages/react-dom/jsx/web.d.ts +5 -0
- package/dist/types/SubPackages/react-test-renderer/MemoExoticComponent/node.d.ts +6 -0
- package/dist/types/SubPackages/react-test-renderer/component/index.d.ts +13 -0
- package/dist/types/SubPackages/react-test-renderer/component/interface.d.ts +9 -0
- package/dist/types/SubPackages/react-test-renderer/component/node.d.ts +4 -0
- package/dist/types/SubPackages/react-test-renderer/component/web.d.ts +4 -0
- package/dist/types/SubPackages/react-test-renderer/fc/node.d.ts +8 -0
- package/dist/types/SubPackages/react-test-renderer/fc/web.d.ts +9 -0
- package/dist/types/SubPackages/react-test-renderer/jsx/index.d.ts +16 -0
- package/dist/types/SubPackages/react-test-renderer/jsx/node.d.ts +9 -0
- package/dist/types/SubPackages/react-test-renderer/jsx/web.d.ts +9 -0
- package/dist/types/SubPackages/react-test-renderer/jsx-promised/index.d.ts +15 -0
- package/dist/types/SubPackages/react-test-renderer/jsx-promised/node.d.ts +5 -0
- package/dist/types/SubPackages/react-test-renderer/jsx-promised/web.d.ts +5 -0
- package/dist/types/Types.d.ts +61 -0
- package/dist/types/Web.d.ts +9 -0
- package/dist/types/build.d.ts +1 -0
- package/dist/types/defaultConfig.d.ts +3 -0
- package/dist/types/esbuildConfigs/eslint-formatter-testeranto.d.ts +2 -0
- package/dist/types/esbuildConfigs/featuresPlugin.d.ts +5 -0
- package/dist/types/esbuildConfigs/index.d.ts +4 -0
- package/dist/types/esbuildConfigs/inputFilesPlugin.d.ts +6 -0
- package/dist/types/esbuildConfigs/node.d.ts +4 -0
- package/dist/types/esbuildConfigs/web.d.ts +4 -0
- package/dist/types/init-docs.d.ts +1 -0
- package/dist/types/lib/abstractBase.d.ts +110 -0
- package/dist/types/lib/basebuilder.d.ts +27 -0
- package/dist/types/lib/classBuilder.d.ts +7 -0
- package/dist/types/lib/core.d.ts +7 -0
- package/dist/types/lib/index.d.ts +83 -0
- package/dist/types/lib/types.d.ts +14 -0
- package/dist/types/puppeteerConfiger.d.ts +4 -0
- package/dist/types/run.d.ts +1 -0
- package/dist/types/tsconfig.types.tsbuildinfo +1 -0
- package/dist/types/utils.d.ts +15 -0
- package/dist/types/web.html.d.ts +2 -0
- package/package.json +1 -1
- package/src/PM/main.ts +25 -57
- package/src/ReportClient.tsx +43 -41
- package/src/run.ts +8 -5
- package/src/utils.ts +10 -0
- package/tsc.log +8 -8
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import { PM } from "./index.js";
|
|
4
|
+
const fPaths = [];
|
|
5
|
+
export class PM_Node extends PM {
|
|
6
|
+
constructor(t) {
|
|
7
|
+
super();
|
|
8
|
+
this.server = {};
|
|
9
|
+
this.testResourceConfiguration = t;
|
|
10
|
+
}
|
|
11
|
+
waitForSelector(p, s) {
|
|
12
|
+
return globalThis["waitForSelector"](p, s);
|
|
13
|
+
}
|
|
14
|
+
closePage(p) {
|
|
15
|
+
return globalThis["closePage"](p);
|
|
16
|
+
}
|
|
17
|
+
goto(cdpPage, url) {
|
|
18
|
+
return globalThis["goto"](cdpPage.mainFrame()._id, url);
|
|
19
|
+
}
|
|
20
|
+
newPage() {
|
|
21
|
+
return globalThis["newPage"]();
|
|
22
|
+
}
|
|
23
|
+
$(selector) {
|
|
24
|
+
throw new Error("Method not implemented.");
|
|
25
|
+
}
|
|
26
|
+
isDisabled(selector) {
|
|
27
|
+
throw new Error("Method not implemented.");
|
|
28
|
+
}
|
|
29
|
+
getAttribute(selector, attribute) {
|
|
30
|
+
throw new Error("Method not implemented.");
|
|
31
|
+
}
|
|
32
|
+
getValue(selector) {
|
|
33
|
+
throw new Error("Method not implemented.");
|
|
34
|
+
}
|
|
35
|
+
focusOn(selector) {
|
|
36
|
+
throw new Error("Method not implemented.");
|
|
37
|
+
}
|
|
38
|
+
typeInto(value) {
|
|
39
|
+
throw new Error("Method not implemented.");
|
|
40
|
+
}
|
|
41
|
+
page() {
|
|
42
|
+
return globalThis["page"]();
|
|
43
|
+
}
|
|
44
|
+
click(selector) {
|
|
45
|
+
return globalThis["click"](selector);
|
|
46
|
+
}
|
|
47
|
+
screencast(opts, page) {
|
|
48
|
+
return globalThis["screencast"](Object.assign(Object.assign({}, opts), { path: this.testResourceConfiguration.fs + "/" + opts.path }), page.mainFrame()._id, this.testResourceConfiguration.name);
|
|
49
|
+
}
|
|
50
|
+
screencastStop(p) {
|
|
51
|
+
return globalThis["screencastStop"](p);
|
|
52
|
+
}
|
|
53
|
+
customScreenShot(opts, cdpPage) {
|
|
54
|
+
return globalThis["customScreenShot"](Object.assign(Object.assign({}, opts), { path: this.testResourceConfiguration.fs + "/" + opts.path }), cdpPage.mainFrame()._id, this.testResourceConfiguration.name);
|
|
55
|
+
}
|
|
56
|
+
existsSync(destFolder) {
|
|
57
|
+
return globalThis["existsSync"](this.testResourceConfiguration.fs + "/" + destFolder);
|
|
58
|
+
}
|
|
59
|
+
mkdirSync() {
|
|
60
|
+
return globalThis["mkdirSync"](this.testResourceConfiguration.fs + "/");
|
|
61
|
+
}
|
|
62
|
+
write(writeObject, contents) {
|
|
63
|
+
return globalThis["write"](writeObject.uid, contents);
|
|
64
|
+
}
|
|
65
|
+
writeFileSync(filepath, contents) {
|
|
66
|
+
return globalThis["writeFileSync"](this.testResourceConfiguration.fs + "/" + filepath, contents, this.testResourceConfiguration.name);
|
|
67
|
+
}
|
|
68
|
+
createWriteStream(filepath) {
|
|
69
|
+
return globalThis["createWriteStream"](this.testResourceConfiguration.fs + "/" + filepath, this.testResourceConfiguration.name);
|
|
70
|
+
}
|
|
71
|
+
end(writeObject) {
|
|
72
|
+
return globalThis["end"](writeObject.uid);
|
|
73
|
+
}
|
|
74
|
+
customclose() {
|
|
75
|
+
globalThis["customclose"](this.testResourceConfiguration.fs, this.testResourceConfiguration.name);
|
|
76
|
+
}
|
|
77
|
+
testArtiFactoryfileWriter(tLog, callback) {
|
|
78
|
+
return (fPath, value) => {
|
|
79
|
+
callback(new Promise((res, rej) => {
|
|
80
|
+
tLog("testArtiFactory =>", fPath);
|
|
81
|
+
const cleanPath = path.resolve(fPath);
|
|
82
|
+
fPaths.push(cleanPath.replace(process.cwd(), ``));
|
|
83
|
+
const targetDir = cleanPath.split("/").slice(0, -1).join("/");
|
|
84
|
+
fs.mkdir(targetDir, { recursive: true }, async (error) => {
|
|
85
|
+
if (error) {
|
|
86
|
+
console.error(`❗️testArtiFactory failed`, targetDir, error);
|
|
87
|
+
}
|
|
88
|
+
fs.writeFileSync(path.resolve(targetDir.split("/").slice(0, -1).join("/"), "manifest"), fPaths.join(`\n`), {
|
|
89
|
+
encoding: "utf-8",
|
|
90
|
+
});
|
|
91
|
+
if (Buffer.isBuffer(value)) {
|
|
92
|
+
fs.writeFileSync(fPath, value, "binary");
|
|
93
|
+
res();
|
|
94
|
+
}
|
|
95
|
+
else if (`string` === typeof value) {
|
|
96
|
+
fs.writeFileSync(fPath, value.toString(), {
|
|
97
|
+
encoding: "utf-8",
|
|
98
|
+
});
|
|
99
|
+
res();
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
/* @ts-ignore:next-line */
|
|
103
|
+
const pipeStream = value;
|
|
104
|
+
const myFile = fs.createWriteStream(fPath);
|
|
105
|
+
pipeStream.pipe(myFile);
|
|
106
|
+
pipeStream.on("close", () => {
|
|
107
|
+
myFile.close();
|
|
108
|
+
res();
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
}));
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
// launch(options?: PuppeteerLaunchOptions): Promise<Browser>;
|
|
116
|
+
startPuppeteer(options) {
|
|
117
|
+
// return puppeteer.connect(options).then((b) => {
|
|
118
|
+
// this.browser = b;
|
|
119
|
+
// });
|
|
120
|
+
}
|
|
121
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { PM } from "./index.js";
|
|
2
|
+
export class PM_Web extends PM {
|
|
3
|
+
constructor(t) {
|
|
4
|
+
super();
|
|
5
|
+
this.server = {};
|
|
6
|
+
this.testResourceConfiguration = t;
|
|
7
|
+
}
|
|
8
|
+
waitForSelector(p, s) {
|
|
9
|
+
return window["waitForSelector"](p, s);
|
|
10
|
+
}
|
|
11
|
+
screencast(opts) {
|
|
12
|
+
return window["screencast"](Object.assign(Object.assign({}, opts), { path: this.testResourceConfiguration.fs + "/" + opts.path }), this.testResourceConfiguration.name);
|
|
13
|
+
}
|
|
14
|
+
screencastStop(recorder) {
|
|
15
|
+
return window["screencastStop"](recorder);
|
|
16
|
+
}
|
|
17
|
+
closePage(p) {
|
|
18
|
+
return window["closePage"](p);
|
|
19
|
+
}
|
|
20
|
+
goto(p, url) {
|
|
21
|
+
return window["goto"](p, url);
|
|
22
|
+
}
|
|
23
|
+
newPage() {
|
|
24
|
+
return window["newPage"]();
|
|
25
|
+
}
|
|
26
|
+
$(selector) {
|
|
27
|
+
return window["$"](selector);
|
|
28
|
+
}
|
|
29
|
+
isDisabled(selector) {
|
|
30
|
+
return window["isDisabled"](selector);
|
|
31
|
+
}
|
|
32
|
+
getAttribute(selector, attribute) {
|
|
33
|
+
return window["getValue"](selector, attribute);
|
|
34
|
+
}
|
|
35
|
+
getValue(selector) {
|
|
36
|
+
return window["getValue"](selector);
|
|
37
|
+
}
|
|
38
|
+
focusOn(selector) {
|
|
39
|
+
return window["focusOn"](selector);
|
|
40
|
+
}
|
|
41
|
+
typeInto(value) {
|
|
42
|
+
return window["typeInto"](value);
|
|
43
|
+
}
|
|
44
|
+
page() {
|
|
45
|
+
return window["page"]();
|
|
46
|
+
}
|
|
47
|
+
click(selector) {
|
|
48
|
+
return window["click"](selector);
|
|
49
|
+
}
|
|
50
|
+
customScreenShot(opts) {
|
|
51
|
+
return window["customScreenShot"](Object.assign(Object.assign({}, opts), { path: this.testResourceConfiguration.fs + "/" + opts.path }), this.testResourceConfiguration.name);
|
|
52
|
+
}
|
|
53
|
+
existsSync(destFolder) {
|
|
54
|
+
return window["existsSync"](destFolder);
|
|
55
|
+
}
|
|
56
|
+
mkdirSync(x) {
|
|
57
|
+
return window["mkdirSync"](this.testResourceConfiguration.fs + "/");
|
|
58
|
+
}
|
|
59
|
+
write(writeObject, contents) {
|
|
60
|
+
return window["write"](writeObject.uid, contents);
|
|
61
|
+
}
|
|
62
|
+
writeFileSync(filepath, contents) {
|
|
63
|
+
return window["writeFileSync"](this.testResourceConfiguration.fs + "/" + filepath, contents, this.testResourceConfiguration.name);
|
|
64
|
+
}
|
|
65
|
+
createWriteStream(filepath) {
|
|
66
|
+
return window["createWriteStream"](this.testResourceConfiguration.fs + "/" + filepath, this.testResourceConfiguration.name);
|
|
67
|
+
}
|
|
68
|
+
end(writeObject) {
|
|
69
|
+
return window["end"](writeObject.uid);
|
|
70
|
+
}
|
|
71
|
+
customclose() {
|
|
72
|
+
window["customclose"](this.testResourceConfiguration.fs, this.testResourceConfiguration.name);
|
|
73
|
+
}
|
|
74
|
+
testArtiFactoryfileWriter(tLog, callback) {
|
|
75
|
+
return (fPath, value) => {
|
|
76
|
+
callback(new Promise((res, rej) => {
|
|
77
|
+
tLog("testArtiFactory =>", fPath);
|
|
78
|
+
// const cleanPath = path.resolve(fPath);
|
|
79
|
+
// fPaths.push(cleanPath.replace(process.cwd(), ``));
|
|
80
|
+
// const targetDir = cleanPath.split("/").slice(0, -1).join("/");
|
|
81
|
+
// fs.mkdir(targetDir, { recursive: true }, async (error) => {
|
|
82
|
+
// if (error) {
|
|
83
|
+
// console.error(`❗️testArtiFactory failed`, targetDir, error);
|
|
84
|
+
// }
|
|
85
|
+
// fs.writeFileSync(
|
|
86
|
+
// path.resolve(
|
|
87
|
+
// targetDir.split("/").slice(0, -1).join("/"),
|
|
88
|
+
// "manifest"
|
|
89
|
+
// ),
|
|
90
|
+
// fPaths.join(`\n`),
|
|
91
|
+
// {
|
|
92
|
+
// encoding: "utf-8",
|
|
93
|
+
// }
|
|
94
|
+
// );
|
|
95
|
+
// if (Buffer.isBuffer(value)) {
|
|
96
|
+
// fs.writeFileSync(fPath, value, "binary");
|
|
97
|
+
// res();
|
|
98
|
+
// } else if (`string` === typeof value) {
|
|
99
|
+
// fs.writeFileSync(fPath, value.toString(), {
|
|
100
|
+
// encoding: "utf-8",
|
|
101
|
+
// });
|
|
102
|
+
// res();
|
|
103
|
+
// } else {
|
|
104
|
+
// /* @ts-ignore:next-line */
|
|
105
|
+
// const pipeStream: PassThrough = value;
|
|
106
|
+
// const myFile = fs.createWriteStream(fPath);
|
|
107
|
+
// pipeStream.pipe(myFile);
|
|
108
|
+
// pipeStream.on("close", () => {
|
|
109
|
+
// myFile.close();
|
|
110
|
+
// res();
|
|
111
|
+
// });
|
|
112
|
+
// }
|
|
113
|
+
// });
|
|
114
|
+
}));
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import ReactDom from "react-dom/client";
|
|
2
|
+
import React, { useEffect, useState } from "react";
|
|
3
|
+
import 'bootstrap/dist/css/bootstrap.min.css';
|
|
4
|
+
import "./style.css";
|
|
5
|
+
import { Footer } from "./Footer";
|
|
6
|
+
import { Table } from "react-bootstrap";
|
|
7
|
+
const BigBoard = () => {
|
|
8
|
+
const [configs, setConfigs] = useState();
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
(async () => {
|
|
11
|
+
fetch('/kokomoBay/docs/testeranto.json')
|
|
12
|
+
.then(response => response.json())
|
|
13
|
+
.then(json => {
|
|
14
|
+
setConfigs(json);
|
|
15
|
+
})
|
|
16
|
+
.catch(error => console.error(error));
|
|
17
|
+
})();
|
|
18
|
+
}, []);
|
|
19
|
+
const [bigBoard, setBigBoard] = useState({});
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
(async () => {
|
|
22
|
+
fetch('/kokomoBay/docs/summary.json')
|
|
23
|
+
.then(response => response.json())
|
|
24
|
+
.then(json => {
|
|
25
|
+
setBigBoard(json);
|
|
26
|
+
})
|
|
27
|
+
.catch(error => console.error(error));
|
|
28
|
+
})();
|
|
29
|
+
}, []);
|
|
30
|
+
// const [staticAnalysis, setStaticAnalysis] = useState<Record<string, string>>({});
|
|
31
|
+
// useEffect(() => {
|
|
32
|
+
// (async () => {
|
|
33
|
+
// let accumulator = {};
|
|
34
|
+
// for (const t of (configs || { tests: [] as ITestTypes[] }).tests) {
|
|
35
|
+
// accumulator[t[0]] = await (await fetch(`/kokomoBay/docs/${t[1]}/${t[0].split(".").slice(0, -1).join(".")}/lint_errors.txt`)).text()
|
|
36
|
+
// }
|
|
37
|
+
// setStaticAnalysis(accumulator);
|
|
38
|
+
// })();
|
|
39
|
+
// }, [configs, bigBoard]);
|
|
40
|
+
// const [typeErrors, setTypeErrors] = useState<Record<string, string>>({});
|
|
41
|
+
// useEffect(() => {
|
|
42
|
+
// (async () => {
|
|
43
|
+
// let accumulator = {};
|
|
44
|
+
// for (const t of (configs || { tests: [] as ITestTypes[] }).tests) {
|
|
45
|
+
// accumulator[t[0]] = await (await fetch(`/kokomoBay/docs/${t[1]}/${t[0].split(".").slice(0, -1).join(".")}/type_errors.txt`)).text()
|
|
46
|
+
// }
|
|
47
|
+
// setTypeErrors(accumulator);
|
|
48
|
+
// })();
|
|
49
|
+
// }, [configs, bigBoard]);
|
|
50
|
+
// const [bddErrors, setBddErrors] = useState<Record<string, string>>({});
|
|
51
|
+
// useEffect(() => {
|
|
52
|
+
// (async () => {
|
|
53
|
+
// let accumulator = {};
|
|
54
|
+
// for (const t of (configs || { tests: [] as ITestTypes[] }).tests) {
|
|
55
|
+
// accumulator[t[0]] = await (await fetch(`/kokomoBay/docs/${t[1]}/${t[0].split(".").slice(0, -1).join(".")}/bdd_errors.txt`)).text()
|
|
56
|
+
// }
|
|
57
|
+
// setBddErrors(accumulator);
|
|
58
|
+
// })();
|
|
59
|
+
// }, [configs, bigBoard]);
|
|
60
|
+
if (!configs) {
|
|
61
|
+
return React.createElement("div", null, "loading...");
|
|
62
|
+
}
|
|
63
|
+
const collated = configs.tests.map((c) => {
|
|
64
|
+
return Object.assign(Object.assign({}, bigBoard[c[0]]), { name: c[0], runTime: c[1], tr: c[2], sidecars: c[3], staticAnalysis: bigBoard[c[0]].staticErrors, typeErrors: bigBoard[c[0]].typeErrors, bddErrors: bigBoard[c[0]].runTimeError, prompt: bigBoard[c[0]].prompt });
|
|
65
|
+
});
|
|
66
|
+
return React.createElement("div", null,
|
|
67
|
+
React.createElement(Table, { striped: true, bordered: true, hover: true },
|
|
68
|
+
React.createElement("thead", null,
|
|
69
|
+
React.createElement("tr", null,
|
|
70
|
+
React.createElement("th", null),
|
|
71
|
+
React.createElement("th", null, "platform"),
|
|
72
|
+
React.createElement("th", null, "BDD errors"),
|
|
73
|
+
React.createElement("th", null, "Lint errors"),
|
|
74
|
+
React.createElement("th", null, "Type errors"),
|
|
75
|
+
React.createElement("th", null, "prompt"))),
|
|
76
|
+
React.createElement("tbody", null, ...collated.map((c) => {
|
|
77
|
+
return React.createElement("tr", null,
|
|
78
|
+
React.createElement("td", null, c.name),
|
|
79
|
+
React.createElement("td", null, c.runTime),
|
|
80
|
+
React.createElement("td", null,
|
|
81
|
+
React.createElement("a", { href: `${c.runTime}/${c.name.split(".").slice(0, -1).join(".")}/littleBoard.html` }, c.bddErrors)),
|
|
82
|
+
React.createElement("td", null,
|
|
83
|
+
React.createElement("a", { href: `${c.runTime}/${c.name.split(".").slice(0, -1).join(".")}/lint_errors.json` }, c.staticAnalysis)),
|
|
84
|
+
React.createElement("td", null,
|
|
85
|
+
React.createElement("a", { href: `${c.runTime}/${c.name.split(".").slice(0, -1).join(".")}/type_errors.txt` }, c.typeErrors)),
|
|
86
|
+
React.createElement("td", null,
|
|
87
|
+
React.createElement("pre", null, c.prompt)));
|
|
88
|
+
}))),
|
|
89
|
+
React.createElement(Footer, null));
|
|
90
|
+
};
|
|
91
|
+
document.addEventListener("DOMContentLoaded", function () {
|
|
92
|
+
const elem = document.getElementById("root");
|
|
93
|
+
if (elem) {
|
|
94
|
+
ReactDom.createRoot(elem).render(React.createElement(BigBoard, {}, []));
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
console.log("hello BigBoard!");
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import staticServer from "node-static";
|
|
2
|
+
import http from "http";
|
|
3
|
+
const main = async () => {
|
|
4
|
+
process.chdir("../"); // Navigate one level up
|
|
5
|
+
const fileServer = new staticServer.Server(".", {});
|
|
6
|
+
http
|
|
7
|
+
.createServer(function (request, response) {
|
|
8
|
+
request
|
|
9
|
+
.addListener("end", function () {
|
|
10
|
+
fileServer.serve(request, response);
|
|
11
|
+
})
|
|
12
|
+
.resume();
|
|
13
|
+
})
|
|
14
|
+
.listen(8080);
|
|
15
|
+
console.log("Server running on port 8080");
|
|
16
|
+
};
|
|
17
|
+
main();
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Testeranto from "../../../Node.js";
|
|
3
|
+
export default (testImplementations, testSpecifications, testInput) => {
|
|
4
|
+
return Testeranto(testInput, testSpecifications, testImplementations, {
|
|
5
|
+
beforeEach: async () => {
|
|
6
|
+
return new Promise((resolve, rej) => {
|
|
7
|
+
resolve(React.createElement(testInput, {}, []));
|
|
8
|
+
});
|
|
9
|
+
},
|
|
10
|
+
andWhen: function (s, whenCB) {
|
|
11
|
+
return whenCB()(s);
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Testeranto from "../../../Web.js";
|
|
3
|
+
export default (testImplementations, testSpecifications, testInput) => {
|
|
4
|
+
return Testeranto(testInput, testSpecifications, testImplementations, {
|
|
5
|
+
beforeEach: async () => {
|
|
6
|
+
return new Promise((resolve, rej) => {
|
|
7
|
+
resolve(React.createElement(testInput, {}, []));
|
|
8
|
+
});
|
|
9
|
+
},
|
|
10
|
+
andWhen: function (s, whenCB) {
|
|
11
|
+
return whenCB()(s);
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export const testInterface = {
|
|
3
|
+
andWhen: async (s, whenCB) => {
|
|
4
|
+
await whenCB(s());
|
|
5
|
+
return new Promise((resolve, rej) => {
|
|
6
|
+
resolve(React.createElement(s));
|
|
7
|
+
});
|
|
8
|
+
},
|
|
9
|
+
butThen: async (subject, thenCB) => {
|
|
10
|
+
await thenCB(subject());
|
|
11
|
+
return new Promise((resolve, rej) => {
|
|
12
|
+
resolve(React.createElement(subject));
|
|
13
|
+
});
|
|
14
|
+
},
|
|
15
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import Testeranto from "../../../Node.js";
|
|
2
|
+
import { testInterface as baseInterface, } from "./index.js";
|
|
3
|
+
export default (testImplementations, testSpecifications, testInput, testInterface = baseInterface) => {
|
|
4
|
+
return Testeranto(testInput, testSpecifications, testImplementations, testInterface);
|
|
5
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import Testeranto from "../../../Web.js";
|
|
2
|
+
import { testInterface as baseInterface, } from "./index.js";
|
|
3
|
+
export default (testImplementations, testSpecifications, testInput, testInterface) => {
|
|
4
|
+
return Testeranto(testInput, testSpecifications, testImplementations, Object.assign(Object.assign({}, baseInterface), testInterface));
|
|
5
|
+
};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { createElement } from "react";
|
|
2
|
+
import { renderToStaticMarkup, renderToStaticNodeStream, } from "react-dom/server";
|
|
3
|
+
import Stream from "stream";
|
|
4
|
+
import Testeranto from "../../../Node.js";
|
|
5
|
+
export { renderToStaticMarkup, renderToStaticNodeStream, Stream };
|
|
6
|
+
export default (testImplementations, testSpecifications, testInput) => {
|
|
7
|
+
return Testeranto(testInput, testSpecifications, testImplementations, {
|
|
8
|
+
beforeEach: async () => {
|
|
9
|
+
return new Promise((resolve, rej) => {
|
|
10
|
+
resolve(createElement(testInput));
|
|
11
|
+
});
|
|
12
|
+
},
|
|
13
|
+
andWhen: async function (s, whenCB) {
|
|
14
|
+
return whenCB(s);
|
|
15
|
+
},
|
|
16
|
+
butThen: async function (s) {
|
|
17
|
+
return s;
|
|
18
|
+
},
|
|
19
|
+
afterEach: async function () {
|
|
20
|
+
return {};
|
|
21
|
+
},
|
|
22
|
+
afterAll: () => {
|
|
23
|
+
return;
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
// type IInput = typeof React.Component;
|
|
28
|
+
// type InitialState = unknown;
|
|
29
|
+
// type IWhenShape = any;
|
|
30
|
+
// type IThenShape = any;
|
|
31
|
+
// type ISelection = string;
|
|
32
|
+
// type IStore = string;
|
|
33
|
+
// type ISubject = string
|
|
34
|
+
// export default <ITestShape extends ITTestShape>(
|
|
35
|
+
// testImplementations: ITestImplementation<
|
|
36
|
+
// InitialState,
|
|
37
|
+
// ISelection,
|
|
38
|
+
// IWhenShape,
|
|
39
|
+
// IThenShape,
|
|
40
|
+
// ITestShape
|
|
41
|
+
// >,
|
|
42
|
+
// testSpecifications: ITestSpecification<
|
|
43
|
+
// ITestShape,
|
|
44
|
+
// ISubject,
|
|
45
|
+
// IStore,
|
|
46
|
+
// ISelection,
|
|
47
|
+
// IThenShape
|
|
48
|
+
// >,
|
|
49
|
+
// testInput: IInput
|
|
50
|
+
// ) => {
|
|
51
|
+
// return Testeranto<
|
|
52
|
+
// ITestShape,
|
|
53
|
+
// IInput,
|
|
54
|
+
// ISubject,
|
|
55
|
+
// IStore,
|
|
56
|
+
// ISelection,
|
|
57
|
+
// IThenShape,
|
|
58
|
+
// IWhenShape,
|
|
59
|
+
// InitialState
|
|
60
|
+
// >(
|
|
61
|
+
// testInput,
|
|
62
|
+
// testSpecifications,
|
|
63
|
+
// testImplementations,
|
|
64
|
+
// {
|
|
65
|
+
// beforeEach: async (
|
|
66
|
+
// element,
|
|
67
|
+
// ndx,
|
|
68
|
+
// testResource,
|
|
69
|
+
// artificer
|
|
70
|
+
// ): Promise<IStore> => {
|
|
71
|
+
// return new Promise((resolve, rej) => {
|
|
72
|
+
// resolve(ReactDOMServer.renderToStaticMarkup(element));
|
|
73
|
+
// });
|
|
74
|
+
// },
|
|
75
|
+
// andWhen: function (s: IStore, whenCB): Promise<ISelection> {
|
|
76
|
+
// throw new Error(`"andWhens" are not permitted`);
|
|
77
|
+
// }
|
|
78
|
+
// },
|
|
79
|
+
// )
|
|
80
|
+
// };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { createElement } from "react";
|
|
2
|
+
import ReactDom from "react-dom/client";
|
|
3
|
+
import Testeranto from "../../../Web.js";
|
|
4
|
+
export default (testInput, testSpecifications, testImplementations, testInterface) => {
|
|
5
|
+
class TesterantoComponent extends testInput {
|
|
6
|
+
constructor(props) {
|
|
7
|
+
super(props);
|
|
8
|
+
this.done = props.done;
|
|
9
|
+
}
|
|
10
|
+
componentDidMount() {
|
|
11
|
+
super.componentDidMount && super.componentDidMount();
|
|
12
|
+
return this.done(this);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
const t = Testeranto(testInput, testSpecifications, testImplementations, {
|
|
16
|
+
beforeAll: async (subject, artificer) => {
|
|
17
|
+
return await new Promise((resolve, rej) => {
|
|
18
|
+
const htmlElement = document.getElementById("root");
|
|
19
|
+
if (htmlElement) {
|
|
20
|
+
const domRoot = ReactDom.createRoot(htmlElement);
|
|
21
|
+
resolve({ domRoot, htmlElement });
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
},
|
|
25
|
+
beforeEach: async ({ domRoot, htmlElement }, initialValues, testResource, artificer) => {
|
|
26
|
+
return new Promise(async (resolve, rej) => {
|
|
27
|
+
domRoot.render(createElement(TesterantoComponent, Object.assign(Object.assign({}, initialValues), { done: (reactElement) => {
|
|
28
|
+
resolve({
|
|
29
|
+
htmlElement,
|
|
30
|
+
reactElement,
|
|
31
|
+
domRoot,
|
|
32
|
+
});
|
|
33
|
+
} }), []));
|
|
34
|
+
});
|
|
35
|
+
},
|
|
36
|
+
andWhen: async function (s, whenCB) {
|
|
37
|
+
return whenCB(s);
|
|
38
|
+
},
|
|
39
|
+
butThen: async function (s, thenCB) {
|
|
40
|
+
return thenCB(s);
|
|
41
|
+
},
|
|
42
|
+
afterEach: (testInterface === null || testInterface === void 0 ? void 0 : testInterface.afterEach) ||
|
|
43
|
+
async function (store, ndx, utils) {
|
|
44
|
+
return store;
|
|
45
|
+
},
|
|
46
|
+
afterAll: async (store, utils) => {
|
|
47
|
+
// setTimeout(() => {
|
|
48
|
+
// console.log("This will run after 1 second");
|
|
49
|
+
// }, 1000); // 1000 milliseconds = 1 second
|
|
50
|
+
// store.htmlElement.remove();
|
|
51
|
+
// store.htmlElement = document.createElement("root");
|
|
52
|
+
return store;
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
document.addEventListener("DOMContentLoaded", function () {
|
|
56
|
+
const elem = document.getElementById("root");
|
|
57
|
+
if (elem) {
|
|
58
|
+
return t;
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
return t;
|
|
62
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { createElement } from "react";
|
|
2
|
+
import { renderToStaticMarkup, renderToStaticNodeStream, } from "react-dom/server";
|
|
3
|
+
import Stream from "stream";
|
|
4
|
+
import Testeranto from "../../../Node.js";
|
|
5
|
+
export { renderToStaticMarkup, renderToStaticNodeStream, Stream };
|
|
6
|
+
export default (testImplementations, testSpecifications, testInput) => {
|
|
7
|
+
return Testeranto(testInput, testSpecifications, testImplementations, {
|
|
8
|
+
beforeAll: async (prototype, artificer) => {
|
|
9
|
+
return await new Promise((resolve, rej) => {
|
|
10
|
+
resolve(null);
|
|
11
|
+
});
|
|
12
|
+
},
|
|
13
|
+
beforeEach: async () => {
|
|
14
|
+
return new Promise((resolve, rej) => {
|
|
15
|
+
resolve(createElement(testInput));
|
|
16
|
+
});
|
|
17
|
+
},
|
|
18
|
+
andWhen: async function (s, whenCB) {
|
|
19
|
+
return s;
|
|
20
|
+
},
|
|
21
|
+
butThen: async function (s) {
|
|
22
|
+
return s;
|
|
23
|
+
},
|
|
24
|
+
afterEach: async function (store, ndx, artificer) {
|
|
25
|
+
return {};
|
|
26
|
+
},
|
|
27
|
+
afterAll: (store, artificer) => {
|
|
28
|
+
return;
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
};
|