testeranto 0.74.0 → 0.79.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/.eslintrc.js +5 -2
- package/Bundle.Dockerfile +52 -0
- package/README.md +25 -24
- package/build-tests.ts +16 -0
- package/dist/common/build-tests.js +38 -0
- package/dist/common/init-docs.js +8 -0
- package/dist/common/run-tests.js +34 -0
- package/dist/common/src/Aider.js +96 -0
- package/dist/common/src/Init.js +10 -0
- package/dist/common/{Node.js → src/Node.js} +1 -0
- package/dist/common/src/PM/index.js +7 -0
- package/dist/common/{PM → src/PM}/main.js +287 -10
- package/dist/common/{PM → src/PM}/node.js +4 -0
- package/dist/common/{PM → src/PM}/web.js +3 -0
- package/dist/common/{Project.js → src/Project.js} +15 -57
- package/dist/common/{Puppeteer.js → src/Puppeteer.js} +65 -26
- package/dist/common/{SubPackages → src/SubPackages}/react-dom/component/web.js +5 -25
- package/dist/common/src/SubPackages/react-dom/jsx/web.js +117 -0
- package/dist/common/{SubPackages/react-test-renderer/component/index.js → src/SubPackages/react-test-renderer/component/interface.js} +0 -20
- package/dist/common/{SubPackages → src/SubPackages}/react-test-renderer/component/node.js +2 -2
- package/dist/common/{SubPackages → src/SubPackages}/react-test-renderer/component/web.js +2 -2
- package/dist/common/{Types.js → src/Types.js} +0 -2
- package/dist/common/{esbuildConfigs → src/esbuildConfigs}/index.js +1 -0
- package/dist/common/src/esbuildConfigs/inputFilesPlugin.js +52 -0
- package/dist/common/{esbuildConfigs → src/esbuildConfigs}/node.js +5 -1
- package/dist/common/src/esbuildConfigs/report.js +14 -0
- package/dist/common/{esbuildConfigs → src/esbuildConfigs}/web.js +3 -1
- package/dist/common/src/lib/abstractBase.js +581 -0
- package/dist/common/{lib → src/lib}/basebuilder.js +12 -38
- package/dist/common/{lib → src/lib}/classBuilder.js +1 -3
- package/dist/common/{lib → src/lib}/core.js +3 -5
- package/dist/common/src/lib/types.js +2 -0
- package/dist/common/src/utils.js +16 -0
- package/dist/common/testeranto.js +15 -0
- package/dist/common/tsconfig.common.tsbuildinfo +1 -1
- package/dist/module/build-tests.js +10 -0
- package/dist/module/init-docs.js +3 -0
- package/dist/module/run-tests.js +6 -0
- package/dist/module/src/Aider.js +89 -0
- package/dist/module/src/Init.js +5 -0
- package/dist/module/{Node.js → src/Node.js} +1 -0
- package/dist/module/src/PM/index.js +3 -0
- package/dist/module/src/PM/main.js +617 -0
- package/dist/module/{PM → src/PM}/node.js +4 -0
- package/dist/module/{PM → src/PM}/web.js +3 -0
- package/dist/module/{Project.js → src/Project.js} +15 -57
- package/dist/module/{Puppeteer.js → src/Puppeteer.js} +65 -26
- package/dist/module/{SubPackages → src/SubPackages}/react-dom/component/web.js +5 -25
- package/dist/module/src/SubPackages/react-dom/jsx/web.js +89 -0
- package/dist/module/{SubPackages/react-test-renderer/component/index.js → src/SubPackages/react-test-renderer/component/interface.js} +0 -20
- package/dist/module/{SubPackages → src/SubPackages}/react-test-renderer/component/node.js +1 -1
- package/dist/module/{SubPackages → src/SubPackages}/react-test-renderer/component/web.js +1 -1
- package/dist/module/{esbuildConfigs → src/esbuildConfigs}/index.js +1 -0
- package/dist/module/src/esbuildConfigs/inputFilesPlugin.js +47 -0
- package/dist/module/{esbuildConfigs → src/esbuildConfigs}/node.js +5 -1
- package/dist/module/src/esbuildConfigs/report.js +14 -0
- package/dist/module/{esbuildConfigs → src/esbuildConfigs}/web.js +3 -1
- package/dist/module/src/lib/abstractBase.js +573 -0
- package/dist/module/{lib → src/lib}/basebuilder.js +12 -38
- package/dist/module/{lib → src/lib}/classBuilder.js +1 -3
- package/dist/module/{lib → src/lib}/core.js +3 -5
- package/dist/module/src/utils.js +9 -0
- package/dist/module/testeranto.js +13 -0
- package/dist/module/tsconfig.module.tsbuildinfo +1 -1
- package/dist/types/build-tests.d.ts +3 -0
- package/dist/types/init-docs.d.ts +2 -0
- package/dist/types/run-tests.d.ts +2 -0
- package/dist/types/src/Aider.d.ts +1 -0
- package/dist/types/src/Init.d.ts +2 -0
- package/dist/types/src/Node.d.ts +6 -0
- package/dist/types/{PM → src/PM}/index.d.ts +3 -2
- package/dist/types/{PM → src/PM}/main.d.ts +8 -3
- package/dist/types/{PM → src/PM}/node.d.ts +2 -0
- package/dist/types/{PM → src/PM}/web.d.ts +1 -0
- package/dist/types/{Project.d.ts → src/Project.d.ts} +1 -1
- package/dist/types/src/Puppeteer.d.ts +2 -0
- package/dist/types/src/SubPackages/puppeteer.d.ts +6 -0
- package/dist/types/{SubPackages → src/SubPackages}/react/component/node.d.ts +1 -1
- package/dist/types/{SubPackages → src/SubPackages}/react/component/web.d.ts +1 -1
- package/dist/types/src/SubPackages/react/jsx/node.d.ts +4 -0
- package/dist/types/src/SubPackages/react/jsx/web.d.ts +4 -0
- package/dist/types/{SubPackages → src/SubPackages}/react-dom/component/node.d.ts +2 -2
- package/dist/types/src/SubPackages/react-dom/component/web.d.ts +11 -0
- package/dist/types/src/SubPackages/react-dom/jsx/node.d.ts +6 -0
- package/dist/types/src/SubPackages/react-dom/jsx/web.d.ts +5 -0
- package/dist/types/src/SubPackages/react-test-renderer/MemoExoticComponent/node.d.ts +5 -0
- package/dist/types/{SubPackages → src/SubPackages}/react-test-renderer/component/index.d.ts +0 -7
- package/dist/types/src/SubPackages/react-test-renderer/component/interface.d.ts +9 -0
- package/dist/types/{SubPackages → src/SubPackages}/react-test-renderer/component/node.d.ts +1 -2
- package/dist/types/src/SubPackages/react-test-renderer/component/web.d.ts +3 -0
- package/dist/types/{SubPackages → src/SubPackages}/react-test-renderer/fc/node.d.ts +1 -1
- package/dist/types/{SubPackages → src/SubPackages}/react-test-renderer/fc/web.d.ts +1 -1
- package/dist/types/{SubPackages → src/SubPackages}/react-test-renderer/jsx/node.d.ts +1 -2
- package/dist/types/{SubPackages → src/SubPackages}/react-test-renderer/jsx/web.d.ts +1 -2
- package/dist/types/src/SubPackages/react-test-renderer/jsx-promised/node.d.ts +4 -0
- package/dist/types/src/SubPackages/react-test-renderer/jsx-promised/web.d.ts +4 -0
- package/dist/types/src/Types.d.ts +51 -0
- package/dist/types/src/Web.d.ts +6 -0
- package/dist/types/src/esbuildConfigs/inputFilesPlugin.d.ts +5 -0
- package/dist/types/{lib → src/lib}/abstractBase.d.ts +8 -8
- package/dist/types/{lib → src/lib}/basebuilder.d.ts +1 -1
- package/dist/types/{lib → src/lib}/classBuilder.d.ts +1 -1
- package/dist/types/{lib → src/lib}/core.d.ts +1 -1
- package/dist/types/{lib → src/lib}/index.d.ts +5 -5
- package/dist/types/{lib → src/lib}/types.d.ts +15 -15
- package/dist/types/src/utils.d.ts +2 -0
- package/dist/types/testeranto.d.ts +16 -0
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/docker-compose.yml +37 -0
- package/init-docs.ts +5 -0
- package/package.json +72 -25
- package/run-tests.ts +9 -0
- package/src/Aider.ts +125 -0
- package/src/Init.ts +20 -0
- package/src/Node.ts +31 -2
- package/src/PM/index.ts +7 -84
- package/src/PM/main.ts +400 -16
- package/src/PM/node.ts +6 -0
- package/src/PM/web.ts +4 -0
- package/src/Project.ts +33 -84
- package/src/Puppeteer.ts +115 -62
- package/src/SubPackages/react-dom/component/web.ts +10 -30
- package/src/SubPackages/react-dom/jsx/web.ts +110 -76
- 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/Types.ts +138 -29
- package/src/Web.ts +32 -2
- package/src/esbuildConfigs/index.ts +1 -0
- package/src/esbuildConfigs/inputFilesPlugin.ts +67 -0
- package/src/esbuildConfigs/node.ts +4 -2
- package/src/esbuildConfigs/report.ts +13 -13
- package/src/esbuildConfigs/web.ts +4 -0
- package/src/lib/abstractBase.ts +366 -36
- package/src/lib/basebuilder.ts +26 -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 -37
- package/src/utils.ts +15 -0
- package/testeranto.ts +13 -0
- package/tsconfig.common.json +12 -4
- package/tsconfig.json +9 -3
- package/tsconfig.module.json +2 -3
- package/tsconfig.types.json +1 -2
- package/dist/common/Features.js +0 -84
- package/dist/common/PM/index.js +0 -71
- package/dist/common/Reporter.js +0 -119
- package/dist/common/Scheduler.js +0 -1
- package/dist/common/SubPackages/react-dom/jsx/web.js +0 -93
- package/dist/common/esbuildConfigs/report.js +0 -13
- package/dist/common/lib/abstractBase.js +0 -348
- package/dist/common/preload.js +0 -15
- package/dist/common/report.html.js +0 -31
- package/dist/module/Features.js +0 -73
- package/dist/module/PM/index.js +0 -67
- package/dist/module/PM/main.js +0 -340
- package/dist/module/Reporter.js +0 -114
- package/dist/module/Scheduler.js +0 -1
- package/dist/module/SubPackages/react-dom/jsx/web.js +0 -65
- package/dist/module/Types.js +0 -3
- package/dist/module/esbuildConfigs/report.js +0 -11
- package/dist/module/lib/abstractBase.js +0 -340
- package/dist/module/preload.js +0 -15
- package/dist/module/report.html.js +0 -29
- package/dist/prebuild/Report.css +0 -11358
- package/dist/prebuild/Report.js +0 -37585
- package/dist/types/Features.d.ts +0 -68
- package/dist/types/Node.d.ts +0 -6
- package/dist/types/SubPackages/puppeteer.d.ts +0 -6
- package/dist/types/SubPackages/react/jsx/node.d.ts +0 -4
- package/dist/types/SubPackages/react/jsx/web.d.ts +0 -4
- package/dist/types/SubPackages/react-dom/component/web.d.ts +0 -5
- package/dist/types/SubPackages/react-dom/jsx/node.d.ts +0 -6
- package/dist/types/SubPackages/react-dom/jsx/web.d.ts +0 -5
- package/dist/types/SubPackages/react-test-renderer/MemoExoticComponent/node.d.ts +0 -5
- package/dist/types/SubPackages/react-test-renderer/component/web.d.ts +0 -4
- package/dist/types/SubPackages/react-test-renderer/jsx-promised/node.d.ts +0 -5
- package/dist/types/SubPackages/react-test-renderer/jsx-promised/web.d.ts +0 -5
- package/dist/types/Types.d.ts +0 -50
- package/dist/types/Web.d.ts +0 -6
- package/dist/types/esbuildConfigs/report.d.ts +0 -4
- package/dist/types/preload.d.ts +0 -0
- package/dist/types/report.html.d.ts +0 -2
- package/electronBuild.ts +0 -32
- package/src/Features.ts +0 -118
- package/src/Report.tsx +0 -521
- package/src/Reporter.ts +0 -134
- package/src/Scheduler.ts +0 -0
- package/src/preload.ts +0 -17
- package/src/report.html.ts +0 -29
- package/tests/Rectangle.test.ts +0 -189
- /package/dist/common/{SubPackages → src/SubPackages}/puppeteer.js +0 -0
- /package/dist/common/{SubPackages → src/SubPackages}/react/component/node.js +0 -0
- /package/dist/common/{SubPackages → src/SubPackages}/react/component/web.js +0 -0
- /package/dist/common/{SubPackages → src/SubPackages}/react/jsx/index.js +0 -0
- /package/dist/common/{SubPackages → src/SubPackages}/react/jsx/node.js +0 -0
- /package/dist/common/{SubPackages → src/SubPackages}/react/jsx/web.js +0 -0
- /package/dist/common/{SubPackages → src/SubPackages}/react-dom/component/node.js +0 -0
- /package/dist/common/{SubPackages → src/SubPackages}/react-dom/jsx/index.js +0 -0
- /package/dist/common/{SubPackages → src/SubPackages}/react-dom/jsx/node.js +0 -0
- /package/dist/common/{SubPackages → src/SubPackages}/react-test-renderer/MemoExoticComponent/node.js +0 -0
- /package/dist/common/{lib/types.js → src/SubPackages/react-test-renderer/component/index.js} +0 -0
- /package/dist/common/{SubPackages → src/SubPackages}/react-test-renderer/fc/node.js +0 -0
- /package/dist/common/{SubPackages → src/SubPackages}/react-test-renderer/fc/web.js +0 -0
- /package/dist/common/{SubPackages → src/SubPackages}/react-test-renderer/jsx/index.js +0 -0
- /package/dist/common/{SubPackages → src/SubPackages}/react-test-renderer/jsx/node.js +0 -0
- /package/dist/common/{SubPackages → src/SubPackages}/react-test-renderer/jsx/web.js +0 -0
- /package/dist/common/{SubPackages → src/SubPackages}/react-test-renderer/jsx-promised/index.js +0 -0
- /package/dist/common/{SubPackages → src/SubPackages}/react-test-renderer/jsx-promised/node.js +0 -0
- /package/dist/common/{SubPackages → src/SubPackages}/react-test-renderer/jsx-promised/web.js +0 -0
- /package/dist/common/{Web.js → src/Web.js} +0 -0
- /package/dist/common/{esbuildConfigs → src/esbuildConfigs}/features.js +0 -0
- /package/dist/common/{esbuildConfigs → src/esbuildConfigs}/tests.js +0 -0
- /package/dist/common/{lib → src/lib}/index.js +0 -0
- /package/dist/common/{puppeteerConfiger.js → src/puppeteerConfiger.js} +0 -0
- /package/dist/common/{web.html.js → src/web.html.js} +0 -0
- /package/dist/module/{SubPackages → src/SubPackages}/puppeteer.js +0 -0
- /package/dist/module/{SubPackages → src/SubPackages}/react/component/node.js +0 -0
- /package/dist/module/{SubPackages → src/SubPackages}/react/component/web.js +0 -0
- /package/dist/module/{SubPackages → src/SubPackages}/react/jsx/index.js +0 -0
- /package/dist/module/{SubPackages → src/SubPackages}/react/jsx/node.js +0 -0
- /package/dist/module/{SubPackages → src/SubPackages}/react/jsx/web.js +0 -0
- /package/dist/module/{SubPackages → src/SubPackages}/react-dom/component/node.js +0 -0
- /package/dist/module/{SubPackages → src/SubPackages}/react-dom/jsx/index.js +0 -0
- /package/dist/module/{SubPackages → src/SubPackages}/react-dom/jsx/node.js +0 -0
- /package/dist/module/{SubPackages → src/SubPackages}/react-test-renderer/MemoExoticComponent/node.js +0 -0
- /package/dist/module/{lib/types.js → src/SubPackages/react-test-renderer/component/index.js} +0 -0
- /package/dist/module/{SubPackages → src/SubPackages}/react-test-renderer/fc/node.js +0 -0
- /package/dist/module/{SubPackages → src/SubPackages}/react-test-renderer/fc/web.js +0 -0
- /package/dist/module/{SubPackages → src/SubPackages}/react-test-renderer/jsx/index.js +0 -0
- /package/dist/module/{SubPackages → src/SubPackages}/react-test-renderer/jsx/node.js +0 -0
- /package/dist/module/{SubPackages → src/SubPackages}/react-test-renderer/jsx/web.js +0 -0
- /package/dist/module/{SubPackages → src/SubPackages}/react-test-renderer/jsx-promised/index.js +0 -0
- /package/dist/module/{SubPackages → src/SubPackages}/react-test-renderer/jsx-promised/node.js +0 -0
- /package/dist/module/{SubPackages → src/SubPackages}/react-test-renderer/jsx-promised/web.js +0 -0
- /package/dist/{types/Puppeteer.d.ts → module/src/Types.js} +0 -0
- /package/dist/module/{Web.js → src/Web.js} +0 -0
- /package/dist/module/{esbuildConfigs → src/esbuildConfigs}/features.js +0 -0
- /package/dist/module/{esbuildConfigs → src/esbuildConfigs}/tests.js +0 -0
- /package/dist/module/{lib → src/lib}/index.js +0 -0
- /package/dist/{types/Reporter.d.ts → module/src/lib/types.js} +0 -0
- /package/dist/module/{puppeteerConfiger.js → src/puppeteerConfiger.js} +0 -0
- /package/dist/module/{web.html.js → src/web.html.js} +0 -0
- /package/dist/types/{SubPackages → src/SubPackages}/react/jsx/index.d.ts +0 -0
- /package/dist/types/{SubPackages → src/SubPackages}/react-dom/jsx/index.d.ts +0 -0
- /package/dist/types/{SubPackages → src/SubPackages}/react-test-renderer/jsx/index.d.ts +0 -0
- /package/dist/types/{SubPackages → src/SubPackages}/react-test-renderer/jsx-promised/index.d.ts +0 -0
- /package/dist/types/{esbuildConfigs → src/esbuildConfigs}/features.d.ts +0 -0
- /package/dist/types/{esbuildConfigs → src/esbuildConfigs}/index.d.ts +0 -0
- /package/dist/types/{esbuildConfigs → src/esbuildConfigs}/node.d.ts +0 -0
- /package/dist/types/{Scheduler.d.ts → src/esbuildConfigs/report.d.ts} +0 -0
- /package/dist/types/{esbuildConfigs → src/esbuildConfigs}/tests.d.ts +0 -0
- /package/dist/types/{esbuildConfigs → src/esbuildConfigs}/web.d.ts +0 -0
- /package/dist/types/{puppeteerConfiger.d.ts → src/puppeteerConfiger.d.ts} +0 -0
- /package/dist/types/{web.html.d.ts → src/web.html.d.ts} +0 -0
|
@@ -0,0 +1,581 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BaseCheck = exports.BaseThen = exports.BaseWhen = exports.BaseGiven = exports.BaseSuite = void 0;
|
|
4
|
+
class BaseSuite {
|
|
5
|
+
constructor(name, index, givens = {}, checks = []) {
|
|
6
|
+
this.name = name;
|
|
7
|
+
this.index = index;
|
|
8
|
+
this.givens = givens;
|
|
9
|
+
this.checks = checks;
|
|
10
|
+
this.fails = [];
|
|
11
|
+
}
|
|
12
|
+
toObj() {
|
|
13
|
+
return {
|
|
14
|
+
name: this.name,
|
|
15
|
+
givens: Object.keys(this.givens).map((k) => this.givens[k].toObj()),
|
|
16
|
+
fails: this.fails,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
setup(s, artifactory, tr, pm) {
|
|
20
|
+
return new Promise((res) => res(s));
|
|
21
|
+
}
|
|
22
|
+
assertThat(t) {
|
|
23
|
+
return t;
|
|
24
|
+
}
|
|
25
|
+
afterAll(store, artifactory, pm) {
|
|
26
|
+
return store;
|
|
27
|
+
}
|
|
28
|
+
async run(input, testResourceConfiguration, artifactory, tLog, pm) {
|
|
29
|
+
this.testResourceConfiguration = testResourceConfiguration;
|
|
30
|
+
tLog("test resources: ", JSON.stringify(testResourceConfiguration));
|
|
31
|
+
const suiteArtifactory = (fPath, value) => artifactory(`suite-${this.index}-${this.name}/${fPath}`, value);
|
|
32
|
+
console.log("\nSuite:", this.index, this.name);
|
|
33
|
+
tLog("\nSuite:", this.index, this.name);
|
|
34
|
+
const sNdx = this.index;
|
|
35
|
+
const sName = this.name;
|
|
36
|
+
for (const [gNdx, g] of Object.entries(this.givens)) {
|
|
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);
|
|
93
|
+
const giver = this.givens[gNdx];
|
|
94
|
+
try {
|
|
95
|
+
this.store = await giver.give(subject, gNdx, testResourceConfiguration, this.assertThat, suiteArtifactory, tLog, pm, sNdx);
|
|
96
|
+
}
|
|
97
|
+
catch (e) {
|
|
98
|
+
console.error(e);
|
|
99
|
+
this.fails.push(giver);
|
|
100
|
+
// return this;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
const afterAllProxy = new Proxy(pm, {
|
|
104
|
+
get(target, prop, receiver) {
|
|
105
|
+
if (prop === "writeFileSync") {
|
|
106
|
+
return (fp, contents) => target[prop](`suite-${sNdx}/afterAll/${fp}`, contents);
|
|
107
|
+
}
|
|
108
|
+
if (prop === "browser") {
|
|
109
|
+
return new Proxy(target[prop], {
|
|
110
|
+
get(bTarget, bProp, bReceiver) {
|
|
111
|
+
if (bProp === "pages") {
|
|
112
|
+
return async () => {
|
|
113
|
+
return bTarget.pages().then((pages) => {
|
|
114
|
+
return pages.map((page) => {
|
|
115
|
+
return new Proxy(page, {
|
|
116
|
+
get(pTarget, pProp, pReciever) {
|
|
117
|
+
if (pProp === "screenshot") {
|
|
118
|
+
return async (x) => {
|
|
119
|
+
return pm.customScreenShot(Object.assign(Object.assign({}, x), { path: `${testResourceConfiguration.fs}/suite-${sNdx}/afterAll` +
|
|
120
|
+
"/" +
|
|
121
|
+
x.path }));
|
|
122
|
+
// return await window["custom-screenshot"]({
|
|
123
|
+
// ...x,
|
|
124
|
+
// path:
|
|
125
|
+
// `${testResourceConfiguration.fs}/suite-${sNdx}/afterAll` +
|
|
126
|
+
// "/" +
|
|
127
|
+
// x.path,
|
|
128
|
+
// });
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
else if (pProp === "mainFrame") {
|
|
132
|
+
return () => pTarget[pProp]();
|
|
133
|
+
}
|
|
134
|
+
else if (pProp === "close") {
|
|
135
|
+
return () => pTarget[pProp]();
|
|
136
|
+
}
|
|
137
|
+
// else if (pProp === "mainFrame") {
|
|
138
|
+
// return () => target[pProp](...arguments);
|
|
139
|
+
// }
|
|
140
|
+
else {
|
|
141
|
+
return Reflect.get(...arguments);
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
});
|
|
145
|
+
});
|
|
146
|
+
});
|
|
147
|
+
// return (await target.pages()).map((page) => {
|
|
148
|
+
// return new Proxy(page, handler2);
|
|
149
|
+
// });
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
return Reflect.get(...arguments);
|
|
156
|
+
},
|
|
157
|
+
});
|
|
158
|
+
// pm.browser
|
|
159
|
+
try {
|
|
160
|
+
this.afterAll(this.store, artifactory, afterAllProxy);
|
|
161
|
+
}
|
|
162
|
+
catch (e) {
|
|
163
|
+
console.error(e);
|
|
164
|
+
// this.fails.push(this);
|
|
165
|
+
// return this;
|
|
166
|
+
}
|
|
167
|
+
// for (const [ndx, thater] of this.checks.entries()) {
|
|
168
|
+
// await thater.check(
|
|
169
|
+
// subject,
|
|
170
|
+
// thater.name,
|
|
171
|
+
// testResourceConfiguration,
|
|
172
|
+
// this.assertThat,
|
|
173
|
+
// suiteArtifactory,
|
|
174
|
+
// tLog,
|
|
175
|
+
// pm
|
|
176
|
+
// );
|
|
177
|
+
// }
|
|
178
|
+
// @TODO fix me
|
|
179
|
+
// for (const k of Object.keys(this.givens)) {
|
|
180
|
+
// const giver = this.givens[k];
|
|
181
|
+
// try {
|
|
182
|
+
// giver.afterAll(this.store, artifactory, pm);
|
|
183
|
+
// } catch (e) {
|
|
184
|
+
// console.error(e);
|
|
185
|
+
// this.fails.push(giver);
|
|
186
|
+
// return this;
|
|
187
|
+
// }
|
|
188
|
+
// }
|
|
189
|
+
////////////////
|
|
190
|
+
return this;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
exports.BaseSuite = BaseSuite;
|
|
194
|
+
class BaseGiven {
|
|
195
|
+
constructor(name, features, whens, thens, givenCB, initialValues) {
|
|
196
|
+
this.name = name;
|
|
197
|
+
this.features = features;
|
|
198
|
+
this.whens = whens;
|
|
199
|
+
this.thens = thens;
|
|
200
|
+
this.givenCB = givenCB;
|
|
201
|
+
this.initialValues = initialValues;
|
|
202
|
+
}
|
|
203
|
+
beforeAll(store, artifactory) {
|
|
204
|
+
return store;
|
|
205
|
+
}
|
|
206
|
+
toObj() {
|
|
207
|
+
return {
|
|
208
|
+
name: this.name,
|
|
209
|
+
whens: this.whens.map((w) => w.toObj()),
|
|
210
|
+
thens: this.thens.map((t) => t.toObj()),
|
|
211
|
+
error: this.error ? [this.error, this.error.stack] : null,
|
|
212
|
+
// fail: this.fail ? [this.fail] : false,
|
|
213
|
+
features: this.features,
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
async afterEach(store, key, artifactory, pm) {
|
|
217
|
+
return store;
|
|
218
|
+
}
|
|
219
|
+
async give(subject, key, testResourceConfiguration, tester, artifactory, tLog, pm, suiteNdx) {
|
|
220
|
+
tLog(`\n Given: ${this.name}`);
|
|
221
|
+
const givenArtifactory = (fPath, value) => artifactory(`given-${key}/${fPath}`, value);
|
|
222
|
+
try {
|
|
223
|
+
// tLog(`\n Given this.store`, this.store);
|
|
224
|
+
const beforeEachProxy = new Proxy(pm, {
|
|
225
|
+
get(target, prop, receiver) {
|
|
226
|
+
if (prop === "writeFileSync") {
|
|
227
|
+
return (fp, contents) => target[prop](`suite-${suiteNdx}/given-${key}/when/beforeEach/${fp}`, contents);
|
|
228
|
+
}
|
|
229
|
+
return Reflect.get(...arguments);
|
|
230
|
+
},
|
|
231
|
+
});
|
|
232
|
+
this.store = await this.givenThat(subject, testResourceConfiguration, givenArtifactory, this.givenCB, beforeEachProxy);
|
|
233
|
+
console.log("mark6", this.store);
|
|
234
|
+
for (const [whenNdx, whenStep] of this.whens.entries()) {
|
|
235
|
+
await whenStep.test(this.store, testResourceConfiguration, tLog, pm, `suite-${suiteNdx}/given-${key}/when/${whenNdx}`);
|
|
236
|
+
}
|
|
237
|
+
for (const [thenNdx, thenStep] of this.thens.entries()) {
|
|
238
|
+
const t = await thenStep.test(this.store, testResourceConfiguration, tLog, pm, `suite-${suiteNdx}/given-${key}/then-${thenNdx}`);
|
|
239
|
+
tester(t);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
catch (e) {
|
|
243
|
+
console.error(e);
|
|
244
|
+
this.error = e;
|
|
245
|
+
tLog(e.stack);
|
|
246
|
+
// tLog("\u0007"); // bell
|
|
247
|
+
// throw e;
|
|
248
|
+
}
|
|
249
|
+
finally {
|
|
250
|
+
try {
|
|
251
|
+
// const afterEachProxy = new Proxy(pm, {
|
|
252
|
+
// get(target, prop, receiver) {
|
|
253
|
+
// if (prop === "writeFileSync") {
|
|
254
|
+
// console.log("afterEachProxy", arguments, target[prop]);
|
|
255
|
+
// return (fp, contents) =>
|
|
256
|
+
// // target[prop](`${key}/andWhen/${fp}`, contents);
|
|
257
|
+
// target[prop](`${key}/afterEach/${fp}`, contents);
|
|
258
|
+
// }
|
|
259
|
+
// return Reflect.get(...arguments);
|
|
260
|
+
// },
|
|
261
|
+
// });
|
|
262
|
+
// await this.afterEach(this.store, key, givenArtifactory, afterEachProxy);
|
|
263
|
+
// await this.afterEach(this.store, key, givenArtifactory, pm);
|
|
264
|
+
const afterEachProxy = new Proxy(pm, {
|
|
265
|
+
get(target, prop, receiver) {
|
|
266
|
+
if (prop === "writeFileSync") {
|
|
267
|
+
return (fp, contents) => target[prop](`suite-${suiteNdx}/given-${key}/afterAll/${fp}`, contents);
|
|
268
|
+
}
|
|
269
|
+
if (prop === "browser") {
|
|
270
|
+
return new Proxy(target[prop], {
|
|
271
|
+
get(bTarget, bProp, bReceiver) {
|
|
272
|
+
if (bProp === "pages") {
|
|
273
|
+
return async () => {
|
|
274
|
+
return bTarget.pages().then((pages) => {
|
|
275
|
+
return pages.map((page) => {
|
|
276
|
+
return new Proxy(page, {
|
|
277
|
+
get(pTarget, pProp, pReciever) {
|
|
278
|
+
if (pProp === "screenshot") {
|
|
279
|
+
return async (x) => {
|
|
280
|
+
// console.log(
|
|
281
|
+
// "custom-screenshot-MARK-afterEachProxy",
|
|
282
|
+
// window["custom-screenshot"].toString()
|
|
283
|
+
// );
|
|
284
|
+
return pm.customScreenShot(Object.assign(Object.assign({}, x), { path: `${testResourceConfiguration.fs}/suite-${suiteNdx}/given-${key}/afterEach` +
|
|
285
|
+
"/" +
|
|
286
|
+
x.path }), page);
|
|
287
|
+
// return await pTarget[pProp]({
|
|
288
|
+
// ...x,
|
|
289
|
+
// path:
|
|
290
|
+
// `${testResourceConfiguration.fs}/suite-${suiteNdx}/given-${key}/afterEach` +
|
|
291
|
+
// "/" +
|
|
292
|
+
// x.path,
|
|
293
|
+
// });
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
else if (pProp === "mainFrame") {
|
|
297
|
+
return () => pTarget[pProp]();
|
|
298
|
+
// return target[pProp];
|
|
299
|
+
// return Reflect.get(...arguments);
|
|
300
|
+
}
|
|
301
|
+
else if (pProp === "exposeFunction") {
|
|
302
|
+
// return Reflect.get(target, prop, receiver);
|
|
303
|
+
return (...a) => pTarget[pProp](...a);
|
|
304
|
+
// return target[pProp];
|
|
305
|
+
}
|
|
306
|
+
else if (pProp === "removeExposedFunction") {
|
|
307
|
+
// return Reflect.get(target, prop, receiver);
|
|
308
|
+
return pTarget[pProp].bind(pTarget);
|
|
309
|
+
// return target[pProp];
|
|
310
|
+
}
|
|
311
|
+
// else if (pProp === "#frameManager") {
|
|
312
|
+
// return () => target[pProp](...arguments);
|
|
313
|
+
// }
|
|
314
|
+
else {
|
|
315
|
+
return Reflect.get(...arguments);
|
|
316
|
+
}
|
|
317
|
+
},
|
|
318
|
+
});
|
|
319
|
+
});
|
|
320
|
+
});
|
|
321
|
+
// return (await target.pages()).map((page) => {
|
|
322
|
+
// return new Proxy(page, handler2);
|
|
323
|
+
// });
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
},
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
return Reflect.get(...arguments);
|
|
330
|
+
},
|
|
331
|
+
});
|
|
332
|
+
console.log("mark5", this.store, key);
|
|
333
|
+
await this.afterEach(this.store, key, givenArtifactory, afterEachProxy);
|
|
334
|
+
}
|
|
335
|
+
catch (e) {
|
|
336
|
+
console.error("afterEach failed! no error will be recorded!", e);
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
return this.store;
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
exports.BaseGiven = BaseGiven;
|
|
343
|
+
class BaseWhen {
|
|
344
|
+
constructor(name, whenCB) {
|
|
345
|
+
this.name = name;
|
|
346
|
+
this.whenCB = whenCB;
|
|
347
|
+
}
|
|
348
|
+
toObj() {
|
|
349
|
+
return {
|
|
350
|
+
name: this.name,
|
|
351
|
+
error: this.error,
|
|
352
|
+
};
|
|
353
|
+
}
|
|
354
|
+
async test(store, testResourceConfiguration, tLog, pm, key) {
|
|
355
|
+
tLog(" When:", this.name);
|
|
356
|
+
const name = this.name;
|
|
357
|
+
const andWhenProxy = new Proxy(pm, {
|
|
358
|
+
// set(obj, prop, value) {
|
|
359
|
+
// return Reflect.set(...arguments);
|
|
360
|
+
// // if (prop === "eyeCount" && value % 2 !== 0) {
|
|
361
|
+
// // console.log("Monsters must have an even number of eyes");
|
|
362
|
+
// // } else {
|
|
363
|
+
// // return Reflect.set(...arguments);
|
|
364
|
+
// // }
|
|
365
|
+
// },
|
|
366
|
+
get(target, prop, receiver) {
|
|
367
|
+
if (prop === "writeFileSync") {
|
|
368
|
+
return (fp, contents) =>
|
|
369
|
+
// target[prop](`${key}/andWhen/${fp}`, contents);
|
|
370
|
+
target[prop](`${key}/andWhen/${fp}`, contents);
|
|
371
|
+
}
|
|
372
|
+
/////////////////////
|
|
373
|
+
if (prop === "browser") {
|
|
374
|
+
return new Proxy(target[prop], {
|
|
375
|
+
get(bTarget, bProp, bReceiver) {
|
|
376
|
+
if (bProp === "pages") {
|
|
377
|
+
return async () => {
|
|
378
|
+
return bTarget.pages().then((pages) => {
|
|
379
|
+
return pages.map((page) => {
|
|
380
|
+
return new Proxy(page, {
|
|
381
|
+
get(pTarget, pProp, pReciever) {
|
|
382
|
+
// console.log("mark get", pTarget, pProp, pReciever);
|
|
383
|
+
if (pProp === "screenshot") {
|
|
384
|
+
return async (x) => {
|
|
385
|
+
return pm.customScreenShot(Object.assign(Object.assign({}, x), { path: `${testResourceConfiguration.fs}/${key}/afterEach` +
|
|
386
|
+
"/" +
|
|
387
|
+
x.path }), page);
|
|
388
|
+
};
|
|
389
|
+
}
|
|
390
|
+
else if (pProp === "mainFrame") {
|
|
391
|
+
return () => pTarget[pProp]();
|
|
392
|
+
// return target[pProp];
|
|
393
|
+
// return Reflect.get(...arguments);
|
|
394
|
+
}
|
|
395
|
+
else if (pProp === "exposeFunction") {
|
|
396
|
+
// return Reflect.get(target, prop, receiver);
|
|
397
|
+
return pTarget[pProp].bind(pTarget);
|
|
398
|
+
// return target[pProp];
|
|
399
|
+
}
|
|
400
|
+
else if (pProp === "removeExposedFunction") {
|
|
401
|
+
// return Reflect.get(target, prop, receiver);
|
|
402
|
+
return pTarget[pProp].bind(pTarget);
|
|
403
|
+
// return target[pProp];
|
|
404
|
+
}
|
|
405
|
+
else if (pProp === "click") {
|
|
406
|
+
// console.log("mark12", arguments);
|
|
407
|
+
// return Reflect.get(target, prop, receiver);
|
|
408
|
+
// return pTarget[pProp].bind(pTarget);
|
|
409
|
+
// return target[pProp];
|
|
410
|
+
return (selector, options) => {
|
|
411
|
+
// console.log("mark13", selector, options);
|
|
412
|
+
// debugger;
|
|
413
|
+
pTarget[pProp](selector, options);
|
|
414
|
+
};
|
|
415
|
+
}
|
|
416
|
+
else if (pProp === "$") {
|
|
417
|
+
return Reflect.get(...arguments);
|
|
418
|
+
// return Reflect.get(target, prop, receiver);
|
|
419
|
+
// return pTarget[pProp].bind(pTarget);
|
|
420
|
+
// return target[pProp];
|
|
421
|
+
// return pTarget[pProp].bind(pTarget);
|
|
422
|
+
// return async (s) => {
|
|
423
|
+
// console.log("mark17", s);
|
|
424
|
+
// console.log("pTarget", pTarget);
|
|
425
|
+
// console.log("pProp", pProp);
|
|
426
|
+
// console.log("pReciever", pReciever);
|
|
427
|
+
// // return "XXX";
|
|
428
|
+
// // debugger;
|
|
429
|
+
// return await pTarget[pProp](s);
|
|
430
|
+
// };
|
|
431
|
+
}
|
|
432
|
+
else {
|
|
433
|
+
return Reflect.get(...arguments);
|
|
434
|
+
}
|
|
435
|
+
},
|
|
436
|
+
});
|
|
437
|
+
});
|
|
438
|
+
});
|
|
439
|
+
// return (await target.pages()).map((page) => {
|
|
440
|
+
// return new Proxy(page, handler2);
|
|
441
|
+
// });
|
|
442
|
+
};
|
|
443
|
+
}
|
|
444
|
+
},
|
|
445
|
+
});
|
|
446
|
+
}
|
|
447
|
+
///////////////////////
|
|
448
|
+
return Reflect.get(...arguments);
|
|
449
|
+
},
|
|
450
|
+
});
|
|
451
|
+
try {
|
|
452
|
+
return await this.andWhen(store, this.whenCB, testResourceConfiguration, andWhenProxy);
|
|
453
|
+
}
|
|
454
|
+
catch (e) {
|
|
455
|
+
this.error = true;
|
|
456
|
+
throw e;
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
exports.BaseWhen = BaseWhen;
|
|
461
|
+
class BaseThen {
|
|
462
|
+
constructor(name, thenCB) {
|
|
463
|
+
this.name = name;
|
|
464
|
+
this.thenCB = thenCB;
|
|
465
|
+
this.error = false;
|
|
466
|
+
}
|
|
467
|
+
toObj() {
|
|
468
|
+
return {
|
|
469
|
+
name: this.name,
|
|
470
|
+
error: this.error,
|
|
471
|
+
};
|
|
472
|
+
}
|
|
473
|
+
async test(store, testResourceConfiguration, tLog, pm, filepath) {
|
|
474
|
+
tLog(" Then:", this.name);
|
|
475
|
+
try {
|
|
476
|
+
const butThenProxy = new Proxy(pm, {
|
|
477
|
+
get(target, prop, receiver) {
|
|
478
|
+
if (prop === "writeFileSync") {
|
|
479
|
+
return (fp, contents) => target[prop](`${filepath}/${fp}`, contents);
|
|
480
|
+
}
|
|
481
|
+
if (prop === "browser") {
|
|
482
|
+
return new Proxy(target[prop], {
|
|
483
|
+
get(bTarget, bProp, bReceiver) {
|
|
484
|
+
if (bProp === "pages") {
|
|
485
|
+
return async () => {
|
|
486
|
+
return bTarget.pages().then((pages) => {
|
|
487
|
+
return pages.map((page) => {
|
|
488
|
+
return new Proxy(page, {
|
|
489
|
+
get(pTarget, pProp, pReciever) {
|
|
490
|
+
if (pProp === "screenshot") {
|
|
491
|
+
return async (x) => {
|
|
492
|
+
return pm.customScreenShot(Object.assign(Object.assign({}, x), { path: `${testResourceConfiguration.fs}/${filepath}/butThen` +
|
|
493
|
+
"/" +
|
|
494
|
+
x.path }), page);
|
|
495
|
+
// return await window["custom-screenshot"]({
|
|
496
|
+
// ...x,
|
|
497
|
+
// path:
|
|
498
|
+
// `${testResourceConfiguration.fs}/suite-${sNdx}/afterAll` +
|
|
499
|
+
// "/" +
|
|
500
|
+
// x.path,
|
|
501
|
+
// });
|
|
502
|
+
};
|
|
503
|
+
}
|
|
504
|
+
else if (pProp === "close") {
|
|
505
|
+
return () => pTarget[pProp]();
|
|
506
|
+
}
|
|
507
|
+
else if (pProp === "mainFrame") {
|
|
508
|
+
return () => pTarget[pProp]();
|
|
509
|
+
}
|
|
510
|
+
else if (pProp === "exposeFunction") {
|
|
511
|
+
// return Reflect.get(target, prop, receiver);
|
|
512
|
+
return (...a) => pTarget[pProp](...a);
|
|
513
|
+
// return target[pProp];
|
|
514
|
+
}
|
|
515
|
+
else if (pProp === "removeExposedFunction") {
|
|
516
|
+
// return Reflect.get(target, prop, receiver);
|
|
517
|
+
return pTarget[pProp].bind(pTarget);
|
|
518
|
+
// return target[pProp];
|
|
519
|
+
}
|
|
520
|
+
else {
|
|
521
|
+
return Reflect.get(...arguments);
|
|
522
|
+
}
|
|
523
|
+
},
|
|
524
|
+
});
|
|
525
|
+
});
|
|
526
|
+
});
|
|
527
|
+
// return (await target.pages()).map((page) => {
|
|
528
|
+
// return new Proxy(page, handler2);
|
|
529
|
+
// });
|
|
530
|
+
};
|
|
531
|
+
}
|
|
532
|
+
},
|
|
533
|
+
});
|
|
534
|
+
}
|
|
535
|
+
return Reflect.get(...arguments);
|
|
536
|
+
},
|
|
537
|
+
});
|
|
538
|
+
const x = await this.butThen(store, this.thenCB, testResourceConfiguration, butThenProxy
|
|
539
|
+
// pm
|
|
540
|
+
);
|
|
541
|
+
return x;
|
|
542
|
+
}
|
|
543
|
+
catch (e) {
|
|
544
|
+
console.log("test failed", e);
|
|
545
|
+
this.error = e.message;
|
|
546
|
+
throw e;
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
exports.BaseThen = BaseThen;
|
|
551
|
+
class BaseCheck {
|
|
552
|
+
constructor(name, features, checkCB, whens, thens) {
|
|
553
|
+
this.name = name;
|
|
554
|
+
this.features = features;
|
|
555
|
+
this.checkCB = checkCB;
|
|
556
|
+
this.whens = whens;
|
|
557
|
+
this.thens = thens;
|
|
558
|
+
}
|
|
559
|
+
async afterEach(store, key, cb, pm) {
|
|
560
|
+
return;
|
|
561
|
+
}
|
|
562
|
+
async check(subject, key, testResourceConfiguration, tester, artifactory, tLog, pm) {
|
|
563
|
+
tLog(`\n Check: ${this.name}`);
|
|
564
|
+
const store = await this.checkThat(subject, testResourceConfiguration, artifactory);
|
|
565
|
+
await this.checkCB(Object.entries(this.whens).reduce((a, [key, when]) => {
|
|
566
|
+
a[key] = async (payload) => {
|
|
567
|
+
return await when(payload, testResourceConfiguration).test(store, testResourceConfiguration, tLog, pm, "x");
|
|
568
|
+
};
|
|
569
|
+
return a;
|
|
570
|
+
}, {}), Object.entries(this.thens).reduce((a, [key, then]) => {
|
|
571
|
+
a[key] = async (payload) => {
|
|
572
|
+
const t = await then(payload, testResourceConfiguration).test(store, testResourceConfiguration, tLog, pm);
|
|
573
|
+
tester(t);
|
|
574
|
+
};
|
|
575
|
+
return a;
|
|
576
|
+
}, {}));
|
|
577
|
+
await this.afterEach(store, key, () => { }, pm);
|
|
578
|
+
return;
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
exports.BaseCheck = BaseCheck;
|
|
@@ -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);
|
|
@@ -80,6 +46,14 @@ class BaseBuilder {
|
|
|
80
46
|
return suiteDone.givens[k].error;
|
|
81
47
|
}).length;
|
|
82
48
|
puppetMaster.writeFileSync(`exitcode`, numberOfFailures.toString());
|
|
49
|
+
// if (numberOfFailures > 0) {
|
|
50
|
+
// puppetMaster.writeFileSync(
|
|
51
|
+
// `prompt`,
|
|
52
|
+
// `
|
|
53
|
+
// aider --message "make a script that prints hello" hello.js
|
|
54
|
+
// `
|
|
55
|
+
// );
|
|
56
|
+
// }
|
|
83
57
|
puppetMaster.writeFileSync(`tests.json`, JSON.stringify(this.toObj(), null, 2));
|
|
84
58
|
console.log(`exiting gracefully with ${numberOfFailures} failures.`);
|
|
85
59
|
return {
|