testeranto 0.62.0 → 0.73.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/README.md +38 -26
- package/dist/cjs-shim.js +2 -2
- package/dist/common/Node.js +14 -51
- package/dist/common/PM/index.js +71 -0
- package/dist/common/PM/main.js +361 -0
- package/dist/common/PM/node.js +176 -0
- package/dist/common/PM/web.js +174 -0
- package/dist/common/Project.js +121 -266
- package/dist/common/Puppeteer.js +109 -0
- package/dist/common/Reporter.js +119 -0
- package/dist/common/Scheduler.js +1 -0
- package/dist/common/SubPackages/puppeteer.js +3 -1
- package/dist/common/SubPackages/react-dom/component/web.js +98 -45
- package/dist/common/SubPackages/react-dom/jsx/web.js +15 -7
- package/dist/common/SubPackages/react-test-renderer/MemoExoticComponent/node.js +1 -1
- package/dist/common/SubPackages/react-test-renderer/component/index.js +0 -1
- package/dist/common/SubPackages/react-test-renderer/fc/web.js +1 -1
- package/dist/common/SubPackages/react-test-renderer/jsx/index.js +1 -3
- package/dist/common/SubPackages/react-test-renderer/jsx/web.js +1 -1
- package/dist/common/SubPackages/react-test-renderer/jsx-promised/index.js +1 -1
- package/dist/common/Types.js +2 -32
- package/dist/common/Web.js +25 -37
- package/dist/common/esbuildConfigs/index.js +5 -5
- package/dist/common/esbuildConfigs/node.js +17 -15
- package/dist/common/esbuildConfigs/report.js +12 -47
- package/dist/common/esbuildConfigs/tests.js +0 -1
- package/dist/common/esbuildConfigs/web.js +17 -12
- package/dist/common/lib/abstractBase.js +190 -35
- package/dist/common/lib/basebuilder.js +56 -29
- package/dist/common/lib/classBuilder.js +8 -5
- package/dist/common/lib/core.js +42 -17
- package/dist/common/lib/index.js +11 -8
- package/dist/common/lib/types.js +2 -0
- package/dist/common/preload.js +14 -28
- package/dist/common/puppeteerConfiger.js +24 -0
- package/dist/common/tsconfig.common.tsbuildinfo +1 -1
- package/dist/module/Node.js +14 -51
- package/dist/module/PM/index.js +67 -0
- package/dist/module/PM/main.js +331 -0
- package/dist/module/PM/node.js +168 -0
- package/dist/module/PM/web.js +167 -0
- package/dist/module/Project.js +122 -267
- package/dist/module/Puppeteer.js +104 -0
- package/dist/module/Reporter.js +114 -0
- package/dist/module/Scheduler.js +1 -0
- package/dist/module/SubPackages/puppeteer.js +3 -1
- package/dist/module/SubPackages/react/jsx/node.js +1 -1
- package/dist/module/SubPackages/react/jsx/web.js +1 -1
- package/dist/module/SubPackages/react-dom/component/node.js +2 -2
- package/dist/module/SubPackages/react-dom/component/web.js +98 -45
- package/dist/module/SubPackages/react-dom/jsx/web.js +17 -9
- package/dist/module/SubPackages/react-test-renderer/MemoExoticComponent/node.js +1 -1
- package/dist/module/SubPackages/react-test-renderer/component/index.js +0 -1
- package/dist/module/SubPackages/react-test-renderer/fc/web.js +1 -1
- package/dist/module/SubPackages/react-test-renderer/jsx/index.js +1 -3
- package/dist/module/SubPackages/react-test-renderer/jsx/web.js +1 -1
- package/dist/module/SubPackages/react-test-renderer/jsx-promised/index.js +1 -1
- package/dist/module/Types.js +3 -30
- package/dist/module/Web.js +26 -38
- package/dist/module/esbuildConfigs/index.js +5 -5
- package/dist/module/esbuildConfigs/node.js +17 -15
- package/dist/module/esbuildConfigs/report.js +11 -48
- package/dist/module/esbuildConfigs/tests.js +0 -1
- package/dist/module/esbuildConfigs/web.js +17 -12
- package/dist/module/lib/abstractBase.js +190 -35
- package/dist/module/lib/basebuilder.js +56 -29
- package/dist/module/lib/classBuilder.js +8 -5
- package/dist/module/lib/core.js +44 -19
- package/dist/module/lib/index.js +11 -8
- package/dist/module/preload.js +15 -27
- package/dist/module/puppeteerConfiger.js +19 -0
- package/dist/module/tsconfig.module.tsbuildinfo +1 -1
- package/dist/prebuild/Report.css +1616 -584
- package/dist/prebuild/Report.js +2635 -2506
- package/dist/types/Node.d.ts +3 -2
- package/dist/types/PM/index.d.ts +19 -0
- package/dist/types/PM/main.d.ts +28 -0
- package/dist/types/PM/node.d.ts +26 -0
- package/dist/types/PM/web.d.ts +24 -0
- package/dist/types/Project.d.ts +1 -2
- package/dist/types/Puppeteer.d.ts +1 -0
- package/dist/types/Reporter.d.ts +1 -0
- package/dist/types/Scheduler.d.ts +0 -0
- package/dist/types/SubPackages/puppeteer.d.ts +3 -3
- 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/index.d.ts +1 -1
- package/dist/types/SubPackages/react/jsx/node.d.ts +1 -1
- 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 +1 -1
- package/dist/types/SubPackages/react-dom/jsx/node.d.ts +1 -1
- package/dist/types/SubPackages/react-dom/jsx/web.d.ts +1 -1
- package/dist/types/SubPackages/react-test-renderer/MemoExoticComponent/node.d.ts +1 -1
- package/dist/types/SubPackages/react-test-renderer/component/index.d.ts +1 -1
- package/dist/types/SubPackages/react-test-renderer/component/node.d.ts +1 -1
- package/dist/types/SubPackages/react-test-renderer/component/web.d.ts +1 -1
- 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 -1
- package/dist/types/SubPackages/react-test-renderer/jsx/web.d.ts +3 -3
- package/dist/types/SubPackages/react-test-renderer/jsx-promised/index.d.ts +1 -1
- package/dist/types/SubPackages/react-test-renderer/jsx-promised/node.d.ts +1 -1
- package/dist/types/SubPackages/react-test-renderer/jsx-promised/web.d.ts +1 -1
- package/dist/types/Types.d.ts +19 -100
- package/dist/types/Web.d.ts +3 -2
- package/dist/types/esbuildConfigs/features.d.ts +1 -1
- package/dist/types/esbuildConfigs/index.d.ts +1 -1
- package/dist/types/esbuildConfigs/node.d.ts +1 -1
- package/dist/types/esbuildConfigs/report.d.ts +4 -0
- package/dist/types/esbuildConfigs/tests.d.ts +1 -1
- package/dist/types/esbuildConfigs/web.d.ts +1 -1
- package/dist/types/lib/abstractBase.d.ts +26 -24
- package/dist/types/lib/basebuilder.d.ts +10 -7
- package/dist/types/lib/classBuilder.d.ts +4 -3
- package/dist/types/lib/core.d.ts +5 -4
- package/dist/types/lib/index.d.ts +7 -5
- package/dist/types/lib/types.d.ts +62 -0
- package/dist/types/preload.d.ts +0 -1
- package/dist/types/puppeteerConfiger.d.ts +4 -0
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/package.json +6 -7
- package/src/Node.ts +30 -85
- package/src/PM/index.ts +102 -0
- package/src/PM/main.ts +420 -0
- package/src/PM/node.ts +515 -0
- package/src/PM/web.ts +497 -0
- package/src/Project.ts +183 -619
- package/src/Puppeteer.ts +131 -0
- package/src/Report.tsx +158 -44
- package/src/Reporter.ts +134 -0
- package/src/Scheduler.ts +0 -0
- package/src/SubPackages/puppeteer.ts +19 -14
- package/src/SubPackages/react/component/node.ts +20 -32
- package/src/SubPackages/react/component/web.ts +20 -30
- package/src/SubPackages/react/jsx/index.ts +13 -24
- package/src/SubPackages/react/jsx/node.ts +5 -8
- package/src/SubPackages/react/jsx/web.ts +10 -8
- package/src/SubPackages/react-dom/component/node.ts +17 -23
- package/src/SubPackages/react-dom/component/web.ts +134 -95
- package/src/SubPackages/react-dom/jsx/web.ts +41 -48
- package/src/SubPackages/react-test-renderer/MemoExoticComponent/node.ts +27 -37
- package/src/SubPackages/react-test-renderer/component/index.ts +16 -30
- package/src/SubPackages/react-test-renderer/component/node.ts +5 -11
- package/src/SubPackages/react-test-renderer/component/web.ts +5 -11
- package/src/SubPackages/react-test-renderer/fc/node.ts +36 -50
- package/src/SubPackages/react-test-renderer/fc/web.ts +37 -50
- package/src/SubPackages/react-test-renderer/jsx/index.ts +15 -21
- package/src/SubPackages/react-test-renderer/jsx/node.ts +6 -10
- package/src/SubPackages/react-test-renderer/jsx/web.ts +7 -7
- package/src/SubPackages/react-test-renderer/jsx-promised/index.ts +13 -16
- package/src/Types.ts +73 -307
- package/src/Web.ts +40 -81
- package/src/cjs-shim.js +2 -2
- package/src/esbuildConfigs/features.ts +3 -4
- package/src/esbuildConfigs/index.ts +8 -8
- package/src/esbuildConfigs/node.ts +21 -20
- package/src/esbuildConfigs/report.ts +15 -51
- package/src/esbuildConfigs/tests.ts +3 -9
- package/src/esbuildConfigs/web.ts +22 -20
- package/src/lib/abstractBase.ts +312 -164
- package/src/lib/basebuilder.ts +123 -127
- package/src/lib/classBuilder.ts +30 -48
- package/src/lib/core.ts +115 -84
- package/src/lib/index.ts +58 -56
- package/src/lib/types.ts +197 -0
- package/src/preload.ts +14 -30
- package/src/puppeteerConfiger.ts +26 -0
- package/src/web.html.ts +1 -1
- package/dist/common/NodeWriter.js +0 -56
- package/dist/common/electron.js +0 -196
- package/dist/common/lib/browser.js +0 -26
- package/dist/common/nodeWriterElectron.js +0 -55
- package/dist/module/NodeWriter.js +0 -50
- package/dist/module/electron.js +0 -191
- package/dist/module/lib/browser.js +0 -22
- package/dist/module/nodeWriterElectron.js +0 -52
- package/dist/types/NodeWriter.d.ts +0 -2
- package/dist/types/lib/browser.d.ts +0 -6
- package/dist/types/nodeWriterElectron.d.ts +0 -2
- package/src/NodeWriter.ts +0 -69
- package/src/electron.ts +0 -250
- package/src/lib/browser.ts +0 -34
- package/src/nodeWriterElectron.ts +0 -71
- package/yarn-error.log +0 -3144
- /package/dist/{types/electron.d.ts → module/lib/types.js} +0 -0
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import readline from "readline";
|
|
2
|
+
import fs from "fs";
|
|
3
|
+
import path from "path";
|
|
4
|
+
import { jsonc } from "jsonc";
|
|
5
|
+
import { PM_Main } from "./PM/main.js";
|
|
6
|
+
var mode = process.argv[2] === "-dev" ? "DEV" : "PROD";
|
|
7
|
+
const node2web = {};
|
|
8
|
+
const web2node = {};
|
|
9
|
+
const childProcesses = {};
|
|
10
|
+
readline.emitKeypressEvents(process.stdin);
|
|
11
|
+
if (process.stdin.isTTY)
|
|
12
|
+
process.stdin.setRawMode(true);
|
|
13
|
+
console.log("\n Puppeteer is running. Press 'q' to quit\n");
|
|
14
|
+
process.stdin.on("keypress", (str, key) => {
|
|
15
|
+
if (key.name === "q") {
|
|
16
|
+
process.exit();
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
const main = async () => {
|
|
20
|
+
const configs = jsonc.parse((await fs.readFileSync("./docs/testeranto.json")).toString());
|
|
21
|
+
const pm = new PM_Main(configs);
|
|
22
|
+
await pm.startPuppeteer({
|
|
23
|
+
waitForInitialPage: false,
|
|
24
|
+
executablePath: "/opt/homebrew/bin/chromium",
|
|
25
|
+
headless: true,
|
|
26
|
+
dumpio: true,
|
|
27
|
+
args: [
|
|
28
|
+
"--allow-file-access-from-files",
|
|
29
|
+
"--allow-running-insecure-content",
|
|
30
|
+
"--auto-open-devtools-for-tabs",
|
|
31
|
+
"--disable-dev-shm-usage",
|
|
32
|
+
"--disable-extensions",
|
|
33
|
+
"--disable-gpu",
|
|
34
|
+
"--disable-setuid-sandbox",
|
|
35
|
+
"--disable-site-isolation-trials",
|
|
36
|
+
"--disable-web-security",
|
|
37
|
+
"--disable-web-security",
|
|
38
|
+
"--no-first-run",
|
|
39
|
+
"--no-sandbox",
|
|
40
|
+
"--no-startup-window",
|
|
41
|
+
// "--no-zygote",
|
|
42
|
+
"--reduce-security-for-testing",
|
|
43
|
+
"--remote-allow-origins=*",
|
|
44
|
+
"--unsafely-treat-insecure-origin-as-secure=*",
|
|
45
|
+
// "--disable-features=IsolateOrigins",
|
|
46
|
+
// "--remote-allow-origins=ws://localhost:3234",
|
|
47
|
+
// "--single-process",
|
|
48
|
+
// "--unsafely-treat-insecure-origin-as-secure",
|
|
49
|
+
// "--unsafely-treat-insecure-origin-as-secure=ws://192.168.0.101:3234",
|
|
50
|
+
`--remote-debugging-port=3234`,
|
|
51
|
+
// "--disk-cache-dir=/dev/null",
|
|
52
|
+
// "--disk-cache-size=1",
|
|
53
|
+
// "--start-maximized",
|
|
54
|
+
],
|
|
55
|
+
}, ".");
|
|
56
|
+
const destinationOfRuntime = (f, r) => {
|
|
57
|
+
return path
|
|
58
|
+
.normalize(`${configs.buildDir}/${r}/${f}`)
|
|
59
|
+
.split(".")
|
|
60
|
+
.slice(0, -1)
|
|
61
|
+
.join(".");
|
|
62
|
+
};
|
|
63
|
+
configs.tests.forEach(([test, runtime, secondaryArtifacts]) => {
|
|
64
|
+
if (runtime === "node") {
|
|
65
|
+
pm.launchNode(test, destinationOfRuntime(test, "node"));
|
|
66
|
+
}
|
|
67
|
+
else if (runtime === "web") {
|
|
68
|
+
pm.launchWeb(test, destinationOfRuntime(test, "web"));
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
console.error("runtime makes no sense", runtime);
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
console.log("ready and watching for changes...", configs.buildDir);
|
|
75
|
+
fs.watch(configs.buildDir, {
|
|
76
|
+
recursive: true,
|
|
77
|
+
}, (eventType, changedFile) => {
|
|
78
|
+
if (changedFile) {
|
|
79
|
+
configs.tests.forEach(([test, runtime, secondaryArtifacts]) => {
|
|
80
|
+
if (eventType === "change" || eventType === "rename") {
|
|
81
|
+
if (changedFile ===
|
|
82
|
+
test
|
|
83
|
+
.replace("./", "node/")
|
|
84
|
+
.split(".")
|
|
85
|
+
.slice(0, -1)
|
|
86
|
+
.concat("mjs")
|
|
87
|
+
.join(".")) {
|
|
88
|
+
pm.launchNode(test, destinationOfRuntime(test, "node"));
|
|
89
|
+
}
|
|
90
|
+
if (changedFile ===
|
|
91
|
+
test
|
|
92
|
+
.replace("./", "web/")
|
|
93
|
+
.split(".")
|
|
94
|
+
.slice(0, -1)
|
|
95
|
+
.concat("mjs")
|
|
96
|
+
.join(".")) {
|
|
97
|
+
pm.launchWeb(test, destinationOfRuntime(test, "web"));
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
};
|
|
104
|
+
main();
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import readline from "readline";
|
|
2
|
+
import fs from "fs";
|
|
3
|
+
import { jsonc } from "jsonc";
|
|
4
|
+
import puppeteer from "puppeteer-core";
|
|
5
|
+
// import { PM_Main } from "./PM/main.js";
|
|
6
|
+
// var mode: "DEV" | "PROD" = process.argv[2] === "-dev" ? "DEV" : "PROD";
|
|
7
|
+
// const node2web: Record<string, string[]> = {};
|
|
8
|
+
// const web2node: Record<string, string[]> = {};
|
|
9
|
+
// const childProcesses: Record<string, "loaded" | "running" | "done"> = {};
|
|
10
|
+
readline.emitKeypressEvents(process.stdin);
|
|
11
|
+
if (process.stdin.isTTY)
|
|
12
|
+
process.stdin.setRawMode(true);
|
|
13
|
+
console.log("\n Puppeteer is running. Press 'q' to quit\n");
|
|
14
|
+
process.stdin.on("keypress", (str, key) => {
|
|
15
|
+
if (key.name === "q") {
|
|
16
|
+
process.exit();
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
const main = async () => {
|
|
20
|
+
const configs = jsonc.parse((await fs.readFileSync("./docs/testeranto.json")).toString());
|
|
21
|
+
// const pm = new PM_Main(configs);
|
|
22
|
+
// await puppeteer.launch(options);
|
|
23
|
+
const browser = await puppeteer.launch({
|
|
24
|
+
waitForInitialPage: false,
|
|
25
|
+
executablePath: "/opt/homebrew/bin/chromium",
|
|
26
|
+
headless: false,
|
|
27
|
+
args: [
|
|
28
|
+
"--allow-file-access-from-files",
|
|
29
|
+
"--allow-running-insecure-content",
|
|
30
|
+
// "--auto-open-devtools-for-tabs",
|
|
31
|
+
"--disable-dev-shm-usage",
|
|
32
|
+
"--disable-extensions",
|
|
33
|
+
"--disable-gpu",
|
|
34
|
+
"--disable-setuid-sandbox",
|
|
35
|
+
"--disable-site-isolation-trials",
|
|
36
|
+
"--disable-web-security",
|
|
37
|
+
"--disable-web-security",
|
|
38
|
+
"--no-first-run",
|
|
39
|
+
"--no-sandbox",
|
|
40
|
+
"--no-startup-window",
|
|
41
|
+
"--no-zygote",
|
|
42
|
+
"--reduce-security-for-testing",
|
|
43
|
+
"--remote-allow-origins=*",
|
|
44
|
+
// "--remote-allow-origins=ws://localhost:3234",
|
|
45
|
+
"--unsafely-treat-insecure-origin-as-secure=*",
|
|
46
|
+
// "--disable-features=IsolateOrigins",
|
|
47
|
+
// "--single-process",
|
|
48
|
+
// "--unsafely-treat-insecure-origin-as-secure",
|
|
49
|
+
// "--unsafely-treat-insecure-origin-as-secure=ws://192.168.0.101:3234",
|
|
50
|
+
// `--remote-debugging-port=3234`,
|
|
51
|
+
],
|
|
52
|
+
}
|
|
53
|
+
// "."
|
|
54
|
+
);
|
|
55
|
+
console.log("Creating new page...");
|
|
56
|
+
const page = await browser.newPage();
|
|
57
|
+
await page.setViewport({ width: 0, height: 0 });
|
|
58
|
+
console.log("Requesting url...");
|
|
59
|
+
await page.goto(`file://${process.cwd()}/docs/report.html`);
|
|
60
|
+
// const destinationOfRuntime = (f: string, r: IRunTime) => {
|
|
61
|
+
// return path
|
|
62
|
+
// .normalize(`${configs.buildDir}/${r}/${f}`)
|
|
63
|
+
// .split(".")
|
|
64
|
+
// .slice(0, -1)
|
|
65
|
+
// .join(".");
|
|
66
|
+
// };
|
|
67
|
+
// configs.tests.forEach(([test, runtime, secondaryArtifacts]) => {
|
|
68
|
+
// if (runtime === "node") {
|
|
69
|
+
// pm.launchNode(test, destinationOfRuntime(test, "node"));
|
|
70
|
+
// } else if (runtime === "web") {
|
|
71
|
+
// pm.launchWeb(test, destinationOfRuntime(test, "web"));
|
|
72
|
+
// } else {
|
|
73
|
+
// console.error("runtime makes no sense", runtime);
|
|
74
|
+
// }
|
|
75
|
+
// });
|
|
76
|
+
// console.log("ready and watching for changes...", configs.buildDir);
|
|
77
|
+
// fs.watch(
|
|
78
|
+
// configs.buildDir,
|
|
79
|
+
// {
|
|
80
|
+
// recursive: true,
|
|
81
|
+
// },
|
|
82
|
+
// (eventType, changedFile) => {
|
|
83
|
+
// if (changedFile) {
|
|
84
|
+
// configs.tests.forEach(([test, runtime, secondaryArtifacts]) => {
|
|
85
|
+
// if (eventType === "change" || eventType === "rename") {
|
|
86
|
+
// if (
|
|
87
|
+
// changedFile ===
|
|
88
|
+
// test
|
|
89
|
+
// .replace("./", "node/")
|
|
90
|
+
// .split(".")
|
|
91
|
+
// .slice(0, -1)
|
|
92
|
+
// .concat("mjs")
|
|
93
|
+
// .join(".")
|
|
94
|
+
// ) {
|
|
95
|
+
// pm.launchNode(test, destinationOfRuntime(test, "node"));
|
|
96
|
+
// }
|
|
97
|
+
// if (
|
|
98
|
+
// changedFile ===
|
|
99
|
+
// test
|
|
100
|
+
// .replace("./", "web/")
|
|
101
|
+
// .split(".")
|
|
102
|
+
// .slice(0, -1)
|
|
103
|
+
// .concat("mjs")
|
|
104
|
+
// .join(".")
|
|
105
|
+
// ) {
|
|
106
|
+
// pm.launchWeb(test, destinationOfRuntime(test, "web"));
|
|
107
|
+
// }
|
|
108
|
+
// }
|
|
109
|
+
// });
|
|
110
|
+
// }
|
|
111
|
+
// }
|
|
112
|
+
// );
|
|
113
|
+
};
|
|
114
|
+
main();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -2,7 +2,9 @@ import React from "react";
|
|
|
2
2
|
import Testeranto from "../Node.js";
|
|
3
3
|
export default (testInput, testSpecifications, testImplementations, testInterface) => {
|
|
4
4
|
return Testeranto(testInput, testSpecifications, testImplementations, Object.assign({ beforeAll(x) {
|
|
5
|
-
process.parentPort.postMessage(
|
|
5
|
+
// process.parentPort.postMessage(
|
|
6
|
+
// `/docs/web/src/ClassicalComponent/test.html`
|
|
7
|
+
// );
|
|
6
8
|
return x;
|
|
7
9
|
}, beforeEach: async () => {
|
|
8
10
|
return new Promise((resolve, rej) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Testeranto from "../../../Node.js";
|
|
2
|
-
import { testInterface as baseInterface } from "./index.js";
|
|
2
|
+
import { testInterface as baseInterface, } from "./index.js";
|
|
3
3
|
export default (testImplementations, testSpecifications, testInput, testInterface) => {
|
|
4
4
|
return Testeranto(testInput, testSpecifications, testImplementations, Object.assign(Object.assign({}, baseInterface), testInterface));
|
|
5
5
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Testeranto from "../../../Web.js";
|
|
2
|
-
import { testInterface as baseInterface } from "./index.js";
|
|
2
|
+
import { testInterface as baseInterface, } from "./index.js";
|
|
3
3
|
export default (testImplementations, testSpecifications, testInput, testInterface) => {
|
|
4
4
|
return Testeranto(testInput, testSpecifications, testImplementations, Object.assign(Object.assign({}, baseInterface), testInterface));
|
|
5
5
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createElement } from "react";
|
|
2
|
-
import { renderToStaticMarkup, renderToStaticNodeStream } from "react-dom/server";
|
|
3
|
-
import Stream from
|
|
2
|
+
import { renderToStaticMarkup, renderToStaticNodeStream, } from "react-dom/server";
|
|
3
|
+
import Stream from "stream";
|
|
4
4
|
import Testeranto from "../../../Node.js";
|
|
5
5
|
export { renderToStaticMarkup, renderToStaticNodeStream, Stream };
|
|
6
6
|
export default (testImplementations, testSpecifications, testInput) => {
|
|
@@ -2,54 +2,107 @@ import { createElement } from "react";
|
|
|
2
2
|
import ReactDom from "react-dom/client";
|
|
3
3
|
import Testeranto from "../../../Web.js";
|
|
4
4
|
export default (testInput, testSpecifications, testImplementations) => {
|
|
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 (initialProps, artificer) => {
|
|
17
|
+
console.log("mark5", initialProps);
|
|
18
|
+
return await new Promise((resolve, rej) => {
|
|
19
|
+
const htmlElement = document.getElementById("root");
|
|
20
|
+
if (htmlElement) {
|
|
21
|
+
const domRoot = ReactDom.createRoot(htmlElement);
|
|
22
|
+
// Ignore these type errors
|
|
23
|
+
domRoot.render(createElement(TesterantoComponent, Object.assign(Object.assign({}, initialProps), { done: (reactElement) => {
|
|
24
|
+
resolve({
|
|
25
|
+
htmlElement,
|
|
26
|
+
reactElement,
|
|
27
|
+
domRoot,
|
|
28
|
+
});
|
|
29
|
+
} }), []));
|
|
30
|
+
// resolve({ htmlElement });
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
},
|
|
34
|
+
// beforeEach: async (
|
|
35
|
+
// s,
|
|
36
|
+
// initializer,
|
|
37
|
+
// testResource,
|
|
38
|
+
// artificer,
|
|
39
|
+
// initialValues
|
|
40
|
+
// ): Promise<IStore> => {
|
|
41
|
+
// return new Promise((resolve, rej) => {
|
|
42
|
+
// console.log("beforeEach" + TesterantoComponent);
|
|
43
|
+
// // const domRoot = ReactDom.createRoot(htmlElement);
|
|
44
|
+
// // // Ignore these type errors
|
|
45
|
+
// // domRoot.render(
|
|
46
|
+
// // createElement(
|
|
47
|
+
// // TesterantoComponent,
|
|
48
|
+
// // {
|
|
49
|
+
// // ...initializer,
|
|
50
|
+
// // done: (reactElement) => {
|
|
51
|
+
// // resolve({
|
|
52
|
+
// // htmlElement,
|
|
53
|
+
// // reactElement,
|
|
54
|
+
// // domRoot,
|
|
55
|
+
// // });
|
|
56
|
+
// // },
|
|
57
|
+
// // },
|
|
58
|
+
// // []
|
|
59
|
+
// // )
|
|
60
|
+
// // );
|
|
61
|
+
// });
|
|
62
|
+
// },
|
|
63
|
+
andWhen: function (s, whenCB) {
|
|
64
|
+
return whenCB(s);
|
|
65
|
+
},
|
|
66
|
+
butThen: async function (s, thenCB) {
|
|
67
|
+
return thenCB(s);
|
|
68
|
+
},
|
|
69
|
+
afterEach: async function (store, ndx, artificer, utils) {
|
|
70
|
+
console.log("afterEach", store);
|
|
71
|
+
utils.writeFileSync("aftereachlog", store.toString());
|
|
72
|
+
const page = (await utils.browser.pages()).filter((x) => {
|
|
73
|
+
const parsedUrl = new URL(x.url());
|
|
74
|
+
parsedUrl.search = "";
|
|
75
|
+
const strippedUrl = parsedUrl.toString();
|
|
76
|
+
return (strippedUrl ===
|
|
77
|
+
"file:///Users/adam/Code/kokomoBay/docs/web/src/ClassicalComponent/react-dom/client.web.test.html");
|
|
78
|
+
// return true;
|
|
79
|
+
})[0];
|
|
80
|
+
const x = await page.screenshot({
|
|
81
|
+
path: "afterEachLog.jpg",
|
|
82
|
+
});
|
|
83
|
+
console.log("x", x);
|
|
84
|
+
// debugger;
|
|
85
|
+
// const div_root = document.getElementById("root");
|
|
86
|
+
// store.domRoot && store.domRoot.unmount(); //React 18
|
|
87
|
+
// store.remove();
|
|
88
|
+
// store.htmlElement.remove();
|
|
89
|
+
// store.htmlElement = document.createElement("root");
|
|
90
|
+
return store;
|
|
91
|
+
},
|
|
92
|
+
afterAll: async (store, artificer, utils) => {
|
|
93
|
+
// setTimeout(() => {
|
|
94
|
+
// console.log("This will run after 1 second");
|
|
95
|
+
// }, 1000); // 1000 milliseconds = 1 second
|
|
96
|
+
// store.htmlElement.remove();
|
|
97
|
+
// store.htmlElement = document.createElement("root");
|
|
98
|
+
return store;
|
|
99
|
+
},
|
|
100
|
+
});
|
|
5
101
|
document.addEventListener("DOMContentLoaded", function () {
|
|
6
102
|
const elem = document.getElementById("root");
|
|
7
103
|
if (elem) {
|
|
8
|
-
|
|
9
|
-
constructor(props) {
|
|
10
|
-
super(props);
|
|
11
|
-
this.done = props.done;
|
|
12
|
-
}
|
|
13
|
-
componentDidMount() {
|
|
14
|
-
super.componentDidMount && super.componentDidMount();
|
|
15
|
-
return this.done(this);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
return Testeranto(testInput, testSpecifications, testImplementations, {
|
|
19
|
-
beforeAll: async (initialProps, artificer) => {
|
|
20
|
-
console.log("mark5", initialProps);
|
|
21
|
-
return await new Promise((resolve, rej) => {
|
|
22
|
-
const elem = document.getElementById("root");
|
|
23
|
-
if (elem) {
|
|
24
|
-
resolve({ htmlElement: elem });
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
},
|
|
28
|
-
beforeEach: async ({ htmlElement }, initializer, testResource, artificer, initialValues) => {
|
|
29
|
-
return new Promise((resolve, rej) => {
|
|
30
|
-
// console.log("beforeEach" + JSON.stringify(initializer) + JSON.stringify(initialValues));
|
|
31
|
-
// Ignore these type errors
|
|
32
|
-
ReactDom.createRoot(htmlElement).render(createElement(TesterantoComponent, Object.assign(Object.assign({}, initializer.props), { done: (reactElement) => {
|
|
33
|
-
resolve({
|
|
34
|
-
htmlElement,
|
|
35
|
-
reactElement,
|
|
36
|
-
});
|
|
37
|
-
} }), []));
|
|
38
|
-
});
|
|
39
|
-
},
|
|
40
|
-
andWhen: function (s, whenCB) {
|
|
41
|
-
return whenCB(s);
|
|
42
|
-
},
|
|
43
|
-
butThen: async function (s) {
|
|
44
|
-
return s;
|
|
45
|
-
},
|
|
46
|
-
afterEach: async function (store, ndx, artificer) {
|
|
47
|
-
return {};
|
|
48
|
-
},
|
|
49
|
-
afterAll: (store, artificer) => {
|
|
50
|
-
return;
|
|
51
|
-
},
|
|
52
|
-
});
|
|
104
|
+
return t;
|
|
53
105
|
}
|
|
54
106
|
});
|
|
107
|
+
return t;
|
|
55
108
|
};
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import React, { useEffect, useRef
|
|
2
|
-
import { createPortal } from
|
|
1
|
+
import React, { useEffect, useRef } from "react";
|
|
2
|
+
import { createPortal } from "react-dom";
|
|
3
3
|
import Testeranto from "../../../Web.js";
|
|
4
4
|
export default (testImplementations, testSpecifications, testInput) => {
|
|
5
5
|
document.addEventListener("DOMContentLoaded", function () {
|
|
6
6
|
const rootElement = document.getElementById("root");
|
|
7
7
|
if (rootElement) {
|
|
8
|
-
const TesterantoComponent = function ({ done, innerComp }) {
|
|
8
|
+
const TesterantoComponent = function ({ done, innerComp, }) {
|
|
9
9
|
const myContainer = useRef(null);
|
|
10
10
|
useEffect(() => {
|
|
11
11
|
console.log("useEffect called", myContainer.current);
|
|
12
12
|
done(myContainer.current);
|
|
13
13
|
}, []);
|
|
14
|
-
return React.createElement(
|
|
14
|
+
return React.createElement("div", { ref: myContainer }, innerComp());
|
|
15
15
|
};
|
|
16
16
|
Testeranto(testInput, testSpecifications, testImplementations, {
|
|
17
17
|
beforeAll: async (input, artificer) => {
|
|
@@ -27,28 +27,36 @@ export default (testImplementations, testSpecifications, testInput) => {
|
|
|
27
27
|
process.nextTick(() => {
|
|
28
28
|
resolve(reactElement);
|
|
29
29
|
});
|
|
30
|
-
}
|
|
30
|
+
},
|
|
31
31
|
}), rootElement);
|
|
32
32
|
});
|
|
33
33
|
},
|
|
34
34
|
andWhen: function (s, whenCB) {
|
|
35
35
|
return new Promise((resolve, rej) => {
|
|
36
|
-
process.nextTick(() => {
|
|
36
|
+
process.nextTick(() => {
|
|
37
|
+
resolve(whenCB()(s));
|
|
38
|
+
});
|
|
37
39
|
});
|
|
38
40
|
},
|
|
39
41
|
butThen: async function (s) {
|
|
40
42
|
return new Promise((resolve, rej) => {
|
|
41
|
-
process.nextTick(() => {
|
|
43
|
+
process.nextTick(() => {
|
|
44
|
+
resolve(s);
|
|
45
|
+
});
|
|
42
46
|
});
|
|
43
47
|
},
|
|
44
48
|
afterEach: async function (store, ndx, artificer) {
|
|
45
49
|
return new Promise((resolve, rej) => {
|
|
46
|
-
process.nextTick(() => {
|
|
50
|
+
process.nextTick(() => {
|
|
51
|
+
resolve({});
|
|
52
|
+
});
|
|
47
53
|
});
|
|
48
54
|
},
|
|
49
55
|
afterAll: (store, artificer) => {
|
|
50
56
|
return new Promise((resolve, rej) => {
|
|
51
|
-
process.nextTick(() => {
|
|
57
|
+
process.nextTick(() => {
|
|
58
|
+
resolve({});
|
|
59
|
+
});
|
|
52
60
|
});
|
|
53
61
|
},
|
|
54
62
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import test from "../../../Node";
|
|
2
1
|
import React from "react";
|
|
3
2
|
import renderer, { act } from "react-test-renderer";
|
|
3
|
+
import test from "../../../Node";
|
|
4
4
|
export default (testImplementations, testSpecifications, testInput) => test(testInput, testSpecifications, testImplementations, {
|
|
5
5
|
beforeEach: function (CComponent, props) {
|
|
6
6
|
let component;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import test from "../../../Web.js";
|
|
2
1
|
import React from "react";
|
|
3
2
|
import renderer, { act } from "react-test-renderer";
|
|
3
|
+
import test from "../../../Web.js";
|
|
4
4
|
export default (testImplementations, testSpecifications, testInput) => test(testInput, testSpecifications, testImplementations, {
|
|
5
5
|
beforeEach: function (CComponent, props) {
|
|
6
6
|
return new Promise((res, rej) => {
|
|
@@ -3,11 +3,9 @@ import renderer, { act } from "react-test-renderer";
|
|
|
3
3
|
export const testInterface = {
|
|
4
4
|
butThen: async function (s, thenCB, tr) {
|
|
5
5
|
console.log("butThen", thenCB.toString());
|
|
6
|
-
// debugger
|
|
7
6
|
return thenCB(s);
|
|
8
7
|
},
|
|
9
8
|
beforeEach: function (CComponent, props) {
|
|
10
|
-
console.log("ASDASDx");
|
|
11
9
|
let component;
|
|
12
10
|
act(() => {
|
|
13
11
|
component = renderer.create(React.createElement(CComponent, props, []));
|
|
@@ -17,5 +15,5 @@ export const testInterface = {
|
|
|
17
15
|
andWhen: async function (renderer, whenCB) {
|
|
18
16
|
await act(() => whenCB(renderer));
|
|
19
17
|
return renderer;
|
|
20
|
-
}
|
|
18
|
+
},
|
|
21
19
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { testInterface } from "./index.js";
|
|
2
1
|
import test from "../../../Web.js";
|
|
2
|
+
import { testInterface } from "./index.js";
|
|
3
3
|
export default (testImplementations, testSpecifications, testInput, testInterface2 = testInterface) => {
|
|
4
4
|
return test(testInput, testSpecifications, testImplementations, testInterface2);
|
|
5
5
|
};
|
package/dist/module/Types.js
CHANGED
|
@@ -1,30 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
//
|
|
3
|
-
//
|
|
4
|
-
// // ...options,
|
|
5
|
-
// // path: "dist/" + (options ? options : { path: "" }).path,
|
|
6
|
-
// // });
|
|
7
|
-
// // }
|
|
8
|
-
// }
|
|
9
|
-
export class TBrowser {
|
|
10
|
-
constructor(browser) {
|
|
11
|
-
this.browser = browser;
|
|
12
|
-
}
|
|
13
|
-
pages() {
|
|
14
|
-
return new Promise(async (res, rej) => {
|
|
15
|
-
res((await this.browser.pages()).map((p) => {
|
|
16
|
-
// const handler = {
|
|
17
|
-
// apply: function (target, thisArg, argumentsList) {
|
|
18
|
-
// console.log('screenshot was called with ' + JSON.stringify(argumentsList));
|
|
19
|
-
// const x: ScreenshotOptions = argumentsList[0]
|
|
20
|
-
// x.path = "./dist/" + x.path;
|
|
21
|
-
// console.log('x.path' + x.path, target, thisArg);
|
|
22
|
-
// return target(...argumentsList);
|
|
23
|
-
// }
|
|
24
|
-
// };
|
|
25
|
-
// p.screenshot = new Proxy(p.screenshot, handler);
|
|
26
|
-
return p;
|
|
27
|
-
}));
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
}
|
|
1
|
+
export {};
|
|
2
|
+
// export type ITTestShape = {
|
|
3
|
+
// };
|
package/dist/module/Web.js
CHANGED
|
@@ -1,47 +1,35 @@
|
|
|
1
|
+
import { PM_Web } from "./PM/web";
|
|
1
2
|
import Testeranto from "./lib/core.js";
|
|
2
|
-
import { defaultTestResourceRequirement } from "./lib/index.js";
|
|
3
|
-
const remote = require('@electron/remote');
|
|
3
|
+
import { defaultTestResourceRequirement, } from "./lib/index.js";
|
|
4
4
|
class WebTesteranto extends Testeranto {
|
|
5
5
|
constructor(input, testSpecification, testImplementation, testResourceRequirement, testInterface) {
|
|
6
|
-
super(input, testSpecification, testImplementation, testResourceRequirement,
|
|
7
|
-
if (process.argv[2]) {
|
|
8
|
-
const testResourceArg = decodeURIComponent(new URLSearchParams(location.search).get('requesting') || '');
|
|
9
|
-
try {
|
|
10
|
-
const partialTestResource = JSON.parse(testResourceArg);
|
|
11
|
-
this.receiveTestResourceConfig(this.testJobs[0], partialTestResource);
|
|
12
|
-
}
|
|
13
|
-
catch (e) {
|
|
14
|
-
console.error(e);
|
|
15
|
-
// process.exit(-1);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
else {
|
|
19
|
-
// no-op
|
|
20
|
-
}
|
|
21
|
-
const requesting = new URLSearchParams(location.search).get('requesting');
|
|
22
|
-
if (requesting) {
|
|
23
|
-
const testResourceArg = decodeURIComponent(requesting);
|
|
24
|
-
try {
|
|
25
|
-
const partialTestResource = JSON.parse(testResourceArg);
|
|
26
|
-
console.log("initial test resource", partialTestResource);
|
|
27
|
-
this.receiveTestResourceConfig(this.testJobs[0], partialTestResource);
|
|
28
|
-
}
|
|
29
|
-
catch (e) {
|
|
30
|
-
console.error(e);
|
|
31
|
-
// process.exit(-1);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
// const t: ITestJob = this.testJobs[0];
|
|
6
|
+
super(input, testSpecification, testImplementation, testResourceRequirement, testInterface);
|
|
35
7
|
}
|
|
36
|
-
async receiveTestResourceConfig(
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
8
|
+
async receiveTestResourceConfig(partialTestResource) {
|
|
9
|
+
const t = partialTestResource; //JSON.parse(partialTestResource);
|
|
10
|
+
const pm = new PM_Web(t);
|
|
11
|
+
const { failed, artifacts, logPromise } = await this.testJobs[0].receiveTestResourceConfig(pm);
|
|
12
|
+
console.log("test is done, awaiting test result write to fs");
|
|
13
|
+
pm.customclose();
|
|
14
|
+
// Promise.all([...artifacts, logPromise]).then(async () => {
|
|
15
|
+
// console.log("hello world");
|
|
16
|
+
// pm.customclose();
|
|
17
|
+
// // we can't close the window becuase we might be taking a screenshot
|
|
18
|
+
// // window.close();
|
|
19
|
+
// // console.log(
|
|
20
|
+
// // "(window as any).browser",
|
|
21
|
+
// // JSON.stringify(await (window as any).browser)
|
|
22
|
+
// // );
|
|
23
|
+
// // var currentWindow = (await (window as any).browser).getCurrentWindow();
|
|
24
|
+
// // window.close();
|
|
25
|
+
// // var customWindow = window.open("", "_blank", "");
|
|
26
|
+
// // customWindow.close();
|
|
27
|
+
// // this.puppetMaster.browser.page
|
|
28
|
+
// // window["customclose"]();
|
|
29
|
+
// // console.log("goodbye", window["customclose"]());
|
|
30
|
+
// });
|
|
42
31
|
}
|
|
43
32
|
}
|
|
44
|
-
;
|
|
45
33
|
export default async (input, testSpecification, testImplementation, testInterface, testResourceRequirement = defaultTestResourceRequirement) => {
|
|
46
34
|
return new WebTesteranto(input, testSpecification, testImplementation, testResourceRequirement, testInterface);
|
|
47
35
|
};
|