testeranto 0.90.0 → 0.100.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/bundle.js +4 -7
- package/dist/common/src/Node.js +5 -3
- package/dist/common/src/PM/main.js +254 -126
- package/dist/common/src/PM/node.js +20 -5
- package/dist/common/src/PM/web.js +19 -4
- package/dist/common/src/SubPackages/puppeteer.js +1 -1
- package/dist/common/src/SubPackages/react/jsx/index.js +14 -6
- package/dist/common/src/SubPackages/react/jsx/node.js +2 -2
- package/dist/common/src/SubPackages/react-dom/component/web.js +13 -39
- package/dist/common/src/SubPackages/react-test-renderer/component/interface.js +2 -10
- package/dist/common/src/Web.js +25 -21
- package/dist/common/src/cli.js +439 -0
- package/dist/common/src/cli2.js +144 -0
- package/dist/common/src/esbuildConfigs/inputFilesPlugin.js +18 -8
- package/dist/common/src/esbuildConfigs/node.js +1 -4
- package/dist/common/src/esbuildConfigs/web.js +1 -1
- package/dist/common/src/lib/abstractBase.js +31 -263
- package/dist/common/src/lib/basebuilder.js +1 -11
- package/dist/common/src/lib/classBuilder.js +1 -1
- package/dist/common/src/lib/core.js +8 -28
- package/dist/common/src/lib/types.js +1 -0
- package/dist/common/tsconfig.common.tsbuildinfo +1 -1
- package/dist/module/src/Node.js +5 -3
- package/dist/module/src/PM/main.js +254 -126
- package/dist/module/src/PM/node.js +20 -5
- package/dist/module/src/PM/web.js +19 -4
- package/dist/module/src/SubPackages/puppeteer.js +1 -1
- package/dist/module/src/SubPackages/react/jsx/index.js +14 -6
- package/dist/module/src/SubPackages/react/jsx/node.js +2 -2
- package/dist/module/src/SubPackages/react-dom/component/web.js +13 -39
- package/dist/module/src/SubPackages/react-test-renderer/component/interface.js +2 -10
- package/dist/module/src/Web.js +25 -21
- package/dist/module/src/cli.js +411 -0
- package/dist/module/src/cli2.js +116 -0
- package/dist/module/src/esbuildConfigs/inputFilesPlugin.js +18 -8
- package/dist/module/src/esbuildConfigs/node.js +1 -4
- package/dist/module/src/esbuildConfigs/web.js +1 -1
- package/dist/module/src/lib/abstractBase.js +31 -263
- package/dist/module/src/lib/basebuilder.js +1 -11
- package/dist/module/src/lib/classBuilder.js +1 -1
- package/dist/module/src/lib/core.js +8 -28
- package/dist/module/src/lib/types.js +1 -0
- package/dist/module/tsconfig.module.tsbuildinfo +1 -1
- package/dist/prebuild/cli.mjs +1491 -0
- package/dist/prebuild/{run-tests.mjs → cli2.mjs} +223 -212
- package/dist/types/src/Node.d.ts +6 -3
- package/dist/types/src/PM/index.d.ts +10 -2
- package/dist/types/src/PM/main.d.ts +14 -7
- package/dist/types/src/PM/node.d.ts +9 -2
- package/dist/types/src/PM/web.d.ts +9 -3
- package/dist/types/src/SubPackages/puppeteer.d.ts +1 -1
- package/dist/types/src/SubPackages/react/component/node.d.ts +1 -1
- package/dist/types/src/SubPackages/react/component/web.d.ts +1 -1
- package/dist/types/src/SubPackages/react/jsx/node.d.ts +3 -3
- package/dist/types/src/SubPackages/react/jsx/web.d.ts +2 -2
- package/dist/types/src/SubPackages/react-dom/component/node.d.ts +2 -2
- package/dist/types/src/SubPackages/react-dom/component/web.d.ts +1 -1
- package/dist/types/src/SubPackages/react-dom/jsx/node.d.ts +1 -1
- package/dist/types/src/SubPackages/react-dom/jsx/web.d.ts +2 -2
- package/dist/types/src/SubPackages/react-test-renderer/MemoExoticComponent/node.d.ts +2 -2
- package/dist/types/src/SubPackages/react-test-renderer/component/interface.d.ts +1 -1
- package/dist/types/src/SubPackages/react-test-renderer/component/node.d.ts +2 -2
- package/dist/types/src/SubPackages/react-test-renderer/component/web.d.ts +2 -2
- package/dist/types/src/SubPackages/react-test-renderer/fc/node.d.ts +2 -2
- package/dist/types/src/SubPackages/react-test-renderer/fc/web.d.ts +2 -2
- package/dist/types/src/SubPackages/react-test-renderer/jsx/node.d.ts +3 -2
- package/dist/types/src/SubPackages/react-test-renderer/jsx/web.d.ts +2 -2
- package/dist/types/src/SubPackages/react-test-renderer/jsx-promised/node.d.ts +2 -2
- package/dist/types/src/SubPackages/react-test-renderer/jsx-promised/web.d.ts +2 -2
- package/dist/types/src/Types.d.ts +60 -21
- package/dist/types/src/Web.d.ts +3 -3
- package/dist/types/src/lib/abstractBase.d.ts +6 -2
- package/dist/types/src/lib/core.d.ts +3 -3
- package/dist/types/src/lib/index.d.ts +1 -1
- package/dist/types/src/lib/types.d.ts +6 -30
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/package.json +23 -20
- package/src/Node.ts +6 -3
- package/src/PM/index.ts +12 -8
- package/src/PM/main.ts +331 -165
- package/src/PM/node.ts +42 -7
- package/src/PM/web.ts +33 -5
- package/src/SubPackages/puppeteer.ts +1 -1
- package/src/SubPackages/react/jsx/index.ts +15 -7
- package/src/SubPackages/react/jsx/node.ts +18 -6
- package/src/SubPackages/react-dom/component/web.ts +28 -51
- package/src/SubPackages/react-test-renderer/component/interface.ts +4 -11
- package/src/SubPackages/react-test-renderer/jsx/node.ts +16 -1
- package/src/Types.ts +362 -114
- package/src/Web.ts +45 -23
- package/src/cli.ts +535 -0
- package/src/cli2.ts +157 -0
- package/src/esbuildConfigs/inputFilesPlugin.ts +27 -9
- package/src/esbuildConfigs/node.ts +4 -7
- package/src/esbuildConfigs/web.ts +4 -3
- package/src/lib/abstractBase.ts +84 -291
- package/src/lib/basebuilder.ts +1 -12
- package/src/lib/classBuilder.ts +2 -1
- package/src/lib/core.ts +17 -29
- package/src/lib/types.ts +5 -177
- package/dist/common/src/Aider.js +0 -143
- package/dist/common/src/Project.js +0 -225
- package/dist/common/src/Puppeteer.js +0 -113
- package/dist/common/src/build-tests.js +0 -39
- package/dist/common/src/esbuildConfigs/features.js +0 -14
- package/dist/common/src/esbuildConfigs/report.js +0 -14
- package/dist/common/src/esbuildConfigs/tests.js +0 -13
- package/dist/common/src/run-tests.js +0 -39
- package/dist/module/src/Aider.js +0 -136
- package/dist/module/src/Project.js +0 -218
- package/dist/module/src/Puppeteer.js +0 -108
- package/dist/module/src/build-tests.js +0 -11
- package/dist/module/src/esbuildConfigs/features.js +0 -12
- package/dist/module/src/esbuildConfigs/report.js +0 -14
- package/dist/module/src/esbuildConfigs/tests.js +0 -11
- package/dist/module/src/run-tests.js +0 -11
- package/dist/prebuild/build-tests.mjs +0 -552
- package/dist/types/src/Aider.d.ts +0 -1
- package/dist/types/src/Project.d.ts +0 -12
- package/dist/types/src/Puppeteer.d.ts +0 -2
- package/dist/types/src/esbuildConfigs/features.d.ts +0 -4
- package/dist/types/src/esbuildConfigs/report.d.ts +0 -0
- package/dist/types/src/esbuildConfigs/tests.d.ts +0 -4
- package/src/Aider.ts +0 -168
- package/src/Project.ts +0 -291
- package/src/Puppeteer.ts +0 -145
- package/src/build-tests.ts +0 -12
- package/src/esbuildConfigs/features.ts +0 -17
- package/src/esbuildConfigs/report.ts +0 -15
- package/src/esbuildConfigs/tests.ts +0 -14
- package/src/run-tests.ts +0 -12
- /package/dist/types/src/{build-tests.d.ts → cli.d.ts} +0 -0
- /package/dist/types/src/{run-tests.d.ts → cli2.d.ts} +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import fs from "fs";
|
|
2
2
|
import path from "path";
|
|
3
3
|
import type { ImportKind, Metafile, Plugin } from "esbuild";
|
|
4
|
+
import { spawn } from "child_process";
|
|
4
5
|
|
|
5
6
|
const otherInputs: Record<string, Set<string>> = {};
|
|
6
7
|
|
|
7
8
|
const register = (entrypoint: string, sources: string[]): void => {
|
|
8
|
-
console.log("register", entrypoint, sources);
|
|
9
9
|
if (!otherInputs[entrypoint]) {
|
|
10
10
|
otherInputs[entrypoint] = new Set();
|
|
11
11
|
}
|
|
@@ -13,8 +13,6 @@ const register = (entrypoint: string, sources: string[]): void => {
|
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
function tree(meta: Metafile, key: string) {
|
|
16
|
-
console.log("searching metafile for", key);
|
|
17
|
-
|
|
18
16
|
const outputKey = Object.keys(meta.outputs).find((k) => {
|
|
19
17
|
return meta.outputs[k].entryPoint === key;
|
|
20
18
|
});
|
|
@@ -111,6 +109,12 @@ export default (
|
|
|
111
109
|
(t) => `docs/types/${t}.type_errors.txt`
|
|
112
110
|
);
|
|
113
111
|
|
|
112
|
+
const lintPath = path.join(
|
|
113
|
+
"./docs/",
|
|
114
|
+
platform,
|
|
115
|
+
entryPoint.split(".").slice(0, -1).join("."),
|
|
116
|
+
`lint_errors.txt`
|
|
117
|
+
);
|
|
114
118
|
fs.writeFileSync(
|
|
115
119
|
promptPath,
|
|
116
120
|
`
|
|
@@ -122,14 +126,11 @@ ${addableFiles
|
|
|
122
126
|
|
|
123
127
|
${typeErrorFiles
|
|
124
128
|
.map((x) => {
|
|
125
|
-
// const f = `docs/types/${x}.type_errors.txt`;
|
|
126
129
|
return `/read ${x}`;
|
|
127
|
-
// if (fs.existsSync(f)) {
|
|
128
|
-
// return `/read ${f}`;
|
|
129
|
-
// }
|
|
130
130
|
})
|
|
131
131
|
.join("\n")}
|
|
132
|
-
|
|
132
|
+
|
|
133
|
+
/read ${lintPath}
|
|
133
134
|
/read ${testPaths}
|
|
134
135
|
/read ${stdoutPath}
|
|
135
136
|
/read ${stderrPath}
|
|
@@ -138,9 +139,26 @@ ${typeErrorFiles
|
|
|
138
139
|
|
|
139
140
|
/code Fix the failing tests described in ${testPaths}. Correct any type signature errors described in the files [${typeErrorFiles.join(
|
|
140
141
|
", "
|
|
141
|
-
)}]. Implement any method which throws "Function not implemented."
|
|
142
|
+
)}]. Implement any method which throws "Function not implemented. Resolve the lint errors described in ${lintPath}"
|
|
142
143
|
`
|
|
143
144
|
);
|
|
145
|
+
|
|
146
|
+
const logContent: string[] = [];
|
|
147
|
+
const tsc = spawn("eslint", addableFiles);
|
|
148
|
+
|
|
149
|
+
tsc.stdout.on("data", (data) => {
|
|
150
|
+
const lines = data.toString().split("\n");
|
|
151
|
+
logContent.push(...lines);
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
tsc.stderr.on("data", (data) => {
|
|
155
|
+
console.error(`stderr: ${data}`);
|
|
156
|
+
process.exit(-1);
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
tsc.on("close", (code) => {
|
|
160
|
+
fs.writeFileSync(lintPath, logContent.join("\n"));
|
|
161
|
+
});
|
|
144
162
|
}
|
|
145
163
|
});
|
|
146
164
|
}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { BuildOptions } from "esbuild";
|
|
2
|
-
// import pkg from "esbuild-plugin-markdown";
|
|
3
|
-
// const { markdownPlugin } = pkg;
|
|
4
2
|
|
|
5
3
|
import { IBaseConfig } from "../lib/types";
|
|
6
4
|
|
|
@@ -16,9 +14,6 @@ export default (
|
|
|
16
14
|
"node",
|
|
17
15
|
entryPoints
|
|
18
16
|
);
|
|
19
|
-
// const inputFilesPluginFactory = inputFilesPlugin("node", entryPoints);
|
|
20
|
-
// const register = (x) => x;
|
|
21
|
-
|
|
22
17
|
return {
|
|
23
18
|
...baseEsBuildConfig(config),
|
|
24
19
|
|
|
@@ -53,7 +48,7 @@ export default (
|
|
|
53
48
|
entryPoints: [...entryPoints],
|
|
54
49
|
plugins: [
|
|
55
50
|
featuresPlugin,
|
|
56
|
-
|
|
51
|
+
|
|
57
52
|
...(config.nodePlugins.map((p) => p(register, entryPoints)) || []),
|
|
58
53
|
|
|
59
54
|
inputFilesPluginFactory,
|
|
@@ -63,7 +58,9 @@ export default (
|
|
|
63
58
|
name: "rebuild-notify",
|
|
64
59
|
setup(build) {
|
|
65
60
|
build.onEnd((result) => {
|
|
66
|
-
console.log(
|
|
61
|
+
console.log(
|
|
62
|
+
`> node build ended with ${result.errors.length} errors`
|
|
63
|
+
);
|
|
67
64
|
if (result.errors.length > 0) {
|
|
68
65
|
console.log(result);
|
|
69
66
|
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { BuildOptions } from "esbuild";
|
|
2
2
|
import path from "path";
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
// const { markdownPlugin } = pkg;
|
|
4
|
+
import pkg from "esbuild-plugin-markdown";
|
|
6
5
|
|
|
7
6
|
import { IBaseConfig } from "../lib/types.js";
|
|
8
7
|
|
|
@@ -77,7 +76,9 @@ export default (
|
|
|
77
76
|
name: "rebuild-notify",
|
|
78
77
|
setup(build) {
|
|
79
78
|
build.onEnd((result) => {
|
|
80
|
-
console.log(
|
|
79
|
+
console.log(
|
|
80
|
+
`> web build ended with ${result.errors.length} errors`
|
|
81
|
+
);
|
|
81
82
|
if (result.errors.length > 0) {
|
|
82
83
|
console.log(result);
|
|
83
84
|
}
|
package/src/lib/abstractBase.ts
CHANGED
|
@@ -112,21 +112,25 @@ export abstract class BaseSuite<
|
|
|
112
112
|
const suiteArtifactory = (fPath: string, value: unknown) =>
|
|
113
113
|
artifactory(`suite-${this.index}-${this.name}/${fPath}`, value);
|
|
114
114
|
|
|
115
|
-
console.log("\nSuite:", this.index, this.name);
|
|
115
|
+
// console.log("\nSuite:", this.index, this.name);
|
|
116
116
|
tLog("\nSuite:", this.index, this.name);
|
|
117
117
|
const sNdx = this.index;
|
|
118
118
|
const sName = this.name;
|
|
119
119
|
|
|
120
|
-
for (const [
|
|
120
|
+
for (const [gKey, g] of Object.entries(this.givens)) {
|
|
121
|
+
// console.log("gKey", gKey);
|
|
121
122
|
const beforeAllProxy = new Proxy(pm, {
|
|
122
123
|
get(target, prop, receiver) {
|
|
123
124
|
if (prop === "customScreenShot") {
|
|
124
|
-
return (opts) =>
|
|
125
|
-
target.customScreenShot(
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
125
|
+
return (opts, p) =>
|
|
126
|
+
target.customScreenShot(
|
|
127
|
+
{
|
|
128
|
+
...opts,
|
|
129
|
+
// path: `${filepath}/${opts.path}`,
|
|
130
|
+
path: `suite-${sNdx}/beforeAll/${opts.path}`,
|
|
131
|
+
},
|
|
132
|
+
p
|
|
133
|
+
);
|
|
130
134
|
}
|
|
131
135
|
|
|
132
136
|
if (prop === "writeFileSync") {
|
|
@@ -134,60 +138,6 @@ export abstract class BaseSuite<
|
|
|
134
138
|
target[prop](`suite-${sNdx}/beforeAll/${fp}`, contents);
|
|
135
139
|
}
|
|
136
140
|
|
|
137
|
-
// if (prop === "browser") {
|
|
138
|
-
// return new Proxy(target[prop], {
|
|
139
|
-
// get(bTarget, bProp, bReceiver) {
|
|
140
|
-
// if (bProp === "pages") {
|
|
141
|
-
// return async () => {
|
|
142
|
-
// return bTarget.pages().then((pages) => {
|
|
143
|
-
// return pages.map((page) => {
|
|
144
|
-
// return new Proxy(page, {
|
|
145
|
-
// get(pTarget, pProp, pReciever) {
|
|
146
|
-
// if (pProp === "screenshot") {
|
|
147
|
-
// return async (x) => {
|
|
148
|
-
// return pm.customScreenShot(
|
|
149
|
-
// {
|
|
150
|
-
// ...x,
|
|
151
|
-
// path:
|
|
152
|
-
// `${testResourceConfiguration.fs}/suite-${sNdx}/beforeAll` +
|
|
153
|
-
// "/" +
|
|
154
|
-
// x.path,
|
|
155
|
-
// },
|
|
156
|
-
// page
|
|
157
|
-
// );
|
|
158
|
-
// // return await window["custom-screenshot"]({
|
|
159
|
-
// // ...x,
|
|
160
|
-
// // path:
|
|
161
|
-
// // `${testResourceConfiguration.fs}/suite-${sNdx}/afterAll` +
|
|
162
|
-
// // "/" +
|
|
163
|
-
// // x.path,
|
|
164
|
-
// // });
|
|
165
|
-
// };
|
|
166
|
-
// } else if (pProp === "mainFrame") {
|
|
167
|
-
// return () => pTarget[pProp]();
|
|
168
|
-
// } else if (pProp === "close") {
|
|
169
|
-
// return () => pTarget[pProp]();
|
|
170
|
-
// }
|
|
171
|
-
|
|
172
|
-
// // else if (pProp === "mainFrame") {
|
|
173
|
-
// // return () => target[pProp](...arguments);
|
|
174
|
-
// // }
|
|
175
|
-
// else {
|
|
176
|
-
// return Reflect.get(...arguments);
|
|
177
|
-
// }
|
|
178
|
-
// },
|
|
179
|
-
// });
|
|
180
|
-
// });
|
|
181
|
-
// });
|
|
182
|
-
// // return (await target.pages()).map((page) => {
|
|
183
|
-
// // return new Proxy(page, handler2);
|
|
184
|
-
// // });
|
|
185
|
-
// };
|
|
186
|
-
// }
|
|
187
|
-
// },
|
|
188
|
-
// });
|
|
189
|
-
// }
|
|
190
|
-
|
|
191
141
|
return Reflect.get(...arguments);
|
|
192
142
|
},
|
|
193
143
|
});
|
|
@@ -199,11 +149,11 @@ export abstract class BaseSuite<
|
|
|
199
149
|
beforeAllProxy
|
|
200
150
|
);
|
|
201
151
|
|
|
202
|
-
const giver = this.givens[
|
|
152
|
+
const giver = this.givens[gKey];
|
|
203
153
|
try {
|
|
204
154
|
this.store = await giver.give(
|
|
205
155
|
subject,
|
|
206
|
-
|
|
156
|
+
gKey,
|
|
207
157
|
testResourceConfiguration,
|
|
208
158
|
this.assertThat,
|
|
209
159
|
suiteArtifactory,
|
|
@@ -218,68 +168,6 @@ export abstract class BaseSuite<
|
|
|
218
168
|
}
|
|
219
169
|
}
|
|
220
170
|
|
|
221
|
-
// const afterAllProxy = new Proxy(pm, {
|
|
222
|
-
// get(target, prop, receiver) {
|
|
223
|
-
// if (prop === "writeFileSync") {
|
|
224
|
-
// return (fp, contents) =>
|
|
225
|
-
// target[prop](`suite-${sNdx}/afterAll/${fp}`, contents);
|
|
226
|
-
// }
|
|
227
|
-
|
|
228
|
-
// if (prop === "browser") {
|
|
229
|
-
// return new Proxy(target[prop], {
|
|
230
|
-
// get(bTarget, bProp, bReceiver) {
|
|
231
|
-
// if (bProp === "pages") {
|
|
232
|
-
// return async () => {
|
|
233
|
-
// return bTarget.pages().then((pages) => {
|
|
234
|
-
// return pages.map((page) => {
|
|
235
|
-
// return new Proxy(page, {
|
|
236
|
-
// get(pTarget, pProp, pReciever) {
|
|
237
|
-
// if (pProp === "screenshot") {
|
|
238
|
-
// return async (x) => {
|
|
239
|
-
// return pm.customScreenShot({
|
|
240
|
-
// ...x,
|
|
241
|
-
// path:
|
|
242
|
-
// `${testResourceConfiguration.fs}/suite-${sNdx}/afterAll` +
|
|
243
|
-
// "/" +
|
|
244
|
-
// x.path,
|
|
245
|
-
// });
|
|
246
|
-
// // return await window["custom-screenshot"]({
|
|
247
|
-
// // ...x,
|
|
248
|
-
// // path:
|
|
249
|
-
// // `${testResourceConfiguration.fs}/suite-${sNdx}/afterAll` +
|
|
250
|
-
// // "/" +
|
|
251
|
-
// // x.path,
|
|
252
|
-
// // });
|
|
253
|
-
// };
|
|
254
|
-
// } else if (pProp === "mainFrame") {
|
|
255
|
-
// return () => pTarget[pProp]();
|
|
256
|
-
// } else if (pProp === "close") {
|
|
257
|
-
// return () => pTarget[pProp]();
|
|
258
|
-
// }
|
|
259
|
-
|
|
260
|
-
// // else if (pProp === "mainFrame") {
|
|
261
|
-
// // return () => target[pProp](...arguments);
|
|
262
|
-
// // }
|
|
263
|
-
// else {
|
|
264
|
-
// return Reflect.get(...arguments);
|
|
265
|
-
// }
|
|
266
|
-
// },
|
|
267
|
-
// });
|
|
268
|
-
// });
|
|
269
|
-
// });
|
|
270
|
-
// // return (await target.pages()).map((page) => {
|
|
271
|
-
// // return new Proxy(page, handler2);
|
|
272
|
-
// // });
|
|
273
|
-
// };
|
|
274
|
-
// }
|
|
275
|
-
// },
|
|
276
|
-
// });
|
|
277
|
-
// }
|
|
278
|
-
|
|
279
|
-
// return Reflect.get(...arguments);
|
|
280
|
-
// },
|
|
281
|
-
// });
|
|
282
|
-
|
|
283
171
|
try {
|
|
284
172
|
this.afterAll(
|
|
285
173
|
this.store,
|
|
@@ -349,6 +237,7 @@ export abstract class BaseGiven<
|
|
|
349
237
|
recommendedFsPath: string;
|
|
350
238
|
givenCB: ITestShape["given"];
|
|
351
239
|
initialValues: any;
|
|
240
|
+
key: string;
|
|
352
241
|
|
|
353
242
|
constructor(
|
|
354
243
|
name: string,
|
|
@@ -357,6 +246,7 @@ export abstract class BaseGiven<
|
|
|
357
246
|
thens: BaseThen<ITestShape>[],
|
|
358
247
|
givenCB: ITestShape["given"],
|
|
359
248
|
initialValues: any
|
|
249
|
+
// key: string
|
|
360
250
|
) {
|
|
361
251
|
this.name = name;
|
|
362
252
|
this.features = features;
|
|
@@ -366,12 +256,22 @@ export abstract class BaseGiven<
|
|
|
366
256
|
this.initialValues = initialValues;
|
|
367
257
|
}
|
|
368
258
|
|
|
369
|
-
beforeAll(
|
|
259
|
+
beforeAll(
|
|
260
|
+
store: ITestShape["istore"],
|
|
261
|
+
// artifactory: ITestArtifactory
|
|
262
|
+
// subject,
|
|
263
|
+
initializer,
|
|
264
|
+
artifactory,
|
|
265
|
+
testResource,
|
|
266
|
+
initialValues,
|
|
267
|
+
pm
|
|
268
|
+
) {
|
|
370
269
|
return store;
|
|
371
270
|
}
|
|
372
271
|
|
|
373
272
|
toObj() {
|
|
374
273
|
return {
|
|
274
|
+
key: this.key,
|
|
375
275
|
name: this.name,
|
|
376
276
|
whens: this.whens.map((w) => w.toObj()),
|
|
377
277
|
thens: this.thens.map((t) => t.toObj()),
|
|
@@ -386,6 +286,7 @@ export abstract class BaseGiven<
|
|
|
386
286
|
testResourceConfiguration,
|
|
387
287
|
artifactory: ITestArtifactory,
|
|
388
288
|
givenCB: ITestShape["given"],
|
|
289
|
+
initialValues: any,
|
|
389
290
|
pm: PM
|
|
390
291
|
): Promise<ITestShape["istore"]>;
|
|
391
292
|
|
|
@@ -398,6 +299,8 @@ export abstract class BaseGiven<
|
|
|
398
299
|
return store;
|
|
399
300
|
}
|
|
400
301
|
|
|
302
|
+
abstract uberCatcher(e);
|
|
303
|
+
|
|
401
304
|
async give(
|
|
402
305
|
subject: ITestShape["isubject"],
|
|
403
306
|
key: string,
|
|
@@ -408,6 +311,9 @@ export abstract class BaseGiven<
|
|
|
408
311
|
pm: PM,
|
|
409
312
|
suiteNdx: number
|
|
410
313
|
) {
|
|
314
|
+
this.key = key;
|
|
315
|
+
|
|
316
|
+
tLog(`\n ${this.key}`);
|
|
411
317
|
tLog(`\n Given: ${this.name}`);
|
|
412
318
|
|
|
413
319
|
const givenArtifactory = (fPath: string, value: unknown) =>
|
|
@@ -426,26 +332,45 @@ export abstract class BaseGiven<
|
|
|
426
332
|
}
|
|
427
333
|
|
|
428
334
|
if (prop === "customScreenShot") {
|
|
429
|
-
return (opts) =>
|
|
430
|
-
target.customScreenShot(
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
335
|
+
return (opts, p) =>
|
|
336
|
+
target.customScreenShot(
|
|
337
|
+
{
|
|
338
|
+
...opts,
|
|
339
|
+
path: `suite-${suiteNdx}/given-${key}/when/beforeEach/${opts.path}`,
|
|
340
|
+
},
|
|
341
|
+
p
|
|
342
|
+
);
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
if (prop === "screencast") {
|
|
346
|
+
return (opts, p) =>
|
|
347
|
+
target.screencast(
|
|
348
|
+
{
|
|
349
|
+
...opts,
|
|
350
|
+
path: `suite-${suiteNdx}/given-${key}/when/beforeEach/${opts.path}`,
|
|
351
|
+
},
|
|
352
|
+
p
|
|
353
|
+
);
|
|
435
354
|
}
|
|
436
355
|
|
|
437
356
|
return Reflect.get(...arguments);
|
|
438
357
|
},
|
|
439
358
|
});
|
|
440
359
|
|
|
360
|
+
this.uberCatcher((e) => {
|
|
361
|
+
console.error(e);
|
|
362
|
+
this.error = e.error;
|
|
363
|
+
tLog(e.stack);
|
|
364
|
+
});
|
|
365
|
+
|
|
441
366
|
this.store = await this.givenThat(
|
|
442
367
|
subject,
|
|
443
368
|
testResourceConfiguration,
|
|
444
369
|
givenArtifactory,
|
|
445
370
|
this.givenCB,
|
|
371
|
+
this.initialValues,
|
|
446
372
|
beforeEachProxy
|
|
447
373
|
);
|
|
448
|
-
// console.log("mark6", this.store);
|
|
449
374
|
|
|
450
375
|
for (const [whenNdx, whenStep] of this.whens.entries()) {
|
|
451
376
|
await whenStep.test(
|
|
@@ -479,11 +404,14 @@ export abstract class BaseGiven<
|
|
|
479
404
|
const afterEachProxy = new Proxy(pm, {
|
|
480
405
|
get(target, prop, receiver) {
|
|
481
406
|
if (prop === "customScreenShot") {
|
|
482
|
-
return (opts) =>
|
|
483
|
-
target.customScreenShot(
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
407
|
+
return (opts, p) =>
|
|
408
|
+
target.customScreenShot(
|
|
409
|
+
{
|
|
410
|
+
...opts,
|
|
411
|
+
path: `suite-${suiteNdx}/given-${key}/afterEach/${opts.path}`,
|
|
412
|
+
},
|
|
413
|
+
p
|
|
414
|
+
);
|
|
487
415
|
}
|
|
488
416
|
|
|
489
417
|
if (prop === "writeFileSync") {
|
|
@@ -500,7 +428,7 @@ export abstract class BaseGiven<
|
|
|
500
428
|
|
|
501
429
|
await this.afterEach(
|
|
502
430
|
this.store,
|
|
503
|
-
key,
|
|
431
|
+
this.key,
|
|
504
432
|
givenArtifactory,
|
|
505
433
|
// pm
|
|
506
434
|
afterEachProxy
|
|
@@ -553,101 +481,20 @@ export abstract class BaseWhen<ITestShape extends IBaseTest> {
|
|
|
553
481
|
const andWhenProxy = new Proxy(pm, {
|
|
554
482
|
get(target, prop, receiver) {
|
|
555
483
|
if (prop === "customScreenShot") {
|
|
556
|
-
return (opts) =>
|
|
557
|
-
target.customScreenShot(
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
484
|
+
return (opts, p) =>
|
|
485
|
+
target.customScreenShot(
|
|
486
|
+
{
|
|
487
|
+
...opts,
|
|
488
|
+
path: `${filepath}/${opts.path}`,
|
|
489
|
+
},
|
|
490
|
+
p
|
|
491
|
+
);
|
|
561
492
|
}
|
|
562
493
|
if (prop === "writeFileSync") {
|
|
563
494
|
return (fp, contents) =>
|
|
564
495
|
target[prop](`${filepath}/andWhen/${fp}`, contents);
|
|
565
496
|
}
|
|
566
497
|
|
|
567
|
-
/////////////////////
|
|
568
|
-
|
|
569
|
-
// if (prop === "browser") {
|
|
570
|
-
// return new Proxy(target[prop], {
|
|
571
|
-
// get(bTarget, bProp, bReceiver) {
|
|
572
|
-
// if (bProp === "pages") {
|
|
573
|
-
// return async () => {
|
|
574
|
-
// return bTarget.pages().then((pages) => {
|
|
575
|
-
// return pages.map((page) => {
|
|
576
|
-
// return new Proxy(page, {
|
|
577
|
-
// get(pTarget, pProp, pReciever) {
|
|
578
|
-
// // console.log("mark get", pTarget, pProp, pReciever);
|
|
579
|
-
// if (pProp === "screenshot") {
|
|
580
|
-
// return async (x) => {
|
|
581
|
-
// return pm.customScreenShot(
|
|
582
|
-
// {
|
|
583
|
-
// ...x,
|
|
584
|
-
// path:
|
|
585
|
-
// `${testResourceConfiguration.fs}/${key}/afterEach` +
|
|
586
|
-
// "/" +
|
|
587
|
-
// x.path,
|
|
588
|
-
// },
|
|
589
|
-
// page
|
|
590
|
-
// );
|
|
591
|
-
// };
|
|
592
|
-
// } else if (pProp === "mainFrame") {
|
|
593
|
-
// return () => pTarget[pProp]();
|
|
594
|
-
// // return target[pProp];
|
|
595
|
-
// // return Reflect.get(...arguments);
|
|
596
|
-
// } else if (pProp === "exposeFunction") {
|
|
597
|
-
// // return Reflect.get(target, prop, receiver);
|
|
598
|
-
// return pTarget[pProp].bind(pTarget);
|
|
599
|
-
// // return target[pProp];
|
|
600
|
-
// } else if (pProp === "removeExposedFunction") {
|
|
601
|
-
// // return Reflect.get(target, prop, receiver);
|
|
602
|
-
// return pTarget[pProp].bind(pTarget);
|
|
603
|
-
// // return target[pProp];
|
|
604
|
-
// } else if (pProp === "click") {
|
|
605
|
-
// // console.log("mark12", arguments);
|
|
606
|
-
// // return Reflect.get(target, prop, receiver);
|
|
607
|
-
// // return pTarget[pProp].bind(pTarget);
|
|
608
|
-
// // return target[pProp];
|
|
609
|
-
// return (selector, options) => {
|
|
610
|
-
// pTarget[pProp](selector, options);
|
|
611
|
-
// };
|
|
612
|
-
// } else if (pProp === "$eval") {
|
|
613
|
-
// // return pTarget[pProp].bind(pTarget);
|
|
614
|
-
// return (selector, options) => {
|
|
615
|
-
// pTarget[pProp](selector, options);
|
|
616
|
-
// };
|
|
617
|
-
// } else if (pProp === "$") {
|
|
618
|
-
// return Reflect.get(...arguments);
|
|
619
|
-
// // return Reflect.get(target, prop, receiver);
|
|
620
|
-
// // return pTarget[pProp].bind(pTarget);
|
|
621
|
-
// // return target[pProp];
|
|
622
|
-
// // return pTarget[pProp].bind(pTarget);
|
|
623
|
-
|
|
624
|
-
// // return async (s) => {
|
|
625
|
-
// // console.log("mark17", s);
|
|
626
|
-
// // console.log("pTarget", pTarget);
|
|
627
|
-
// // console.log("pProp", pProp);
|
|
628
|
-
// // console.log("pReciever", pReciever);
|
|
629
|
-
// // // return "XXX";
|
|
630
|
-
// // // debugger;
|
|
631
|
-
// // return await pTarget[pProp](s);
|
|
632
|
-
// // };
|
|
633
|
-
// } else {
|
|
634
|
-
// return Reflect.get(...arguments);
|
|
635
|
-
// }
|
|
636
|
-
// },
|
|
637
|
-
// });
|
|
638
|
-
// });
|
|
639
|
-
// });
|
|
640
|
-
// // return (await target.pages()).map((page) => {
|
|
641
|
-
// // return new Proxy(page, handler2);
|
|
642
|
-
// // });
|
|
643
|
-
// };
|
|
644
|
-
// }
|
|
645
|
-
// },
|
|
646
|
-
// });
|
|
647
|
-
// }
|
|
648
|
-
|
|
649
|
-
///////////////////////
|
|
650
|
-
|
|
651
498
|
return Reflect.get(...arguments);
|
|
652
499
|
},
|
|
653
500
|
});
|
|
@@ -730,11 +577,14 @@ export abstract class BaseThen<
|
|
|
730
577
|
const butThenProxy = new Proxy(pm, {
|
|
731
578
|
get(target, prop, receiver) {
|
|
732
579
|
if (prop === "customScreenShot") {
|
|
733
|
-
return (opts) =>
|
|
734
|
-
target.customScreenShot(
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
580
|
+
return (opts, p) =>
|
|
581
|
+
target.customScreenShot(
|
|
582
|
+
{
|
|
583
|
+
...opts,
|
|
584
|
+
path: `${filepath}/${opts.path}`,
|
|
585
|
+
},
|
|
586
|
+
p
|
|
587
|
+
);
|
|
738
588
|
}
|
|
739
589
|
|
|
740
590
|
if (prop === "writeFileSync") {
|
|
@@ -742,63 +592,6 @@ export abstract class BaseThen<
|
|
|
742
592
|
target[prop](`${filepath}/${fp}`, contents);
|
|
743
593
|
}
|
|
744
594
|
|
|
745
|
-
// if (prop === "browser") {
|
|
746
|
-
// return new Proxy(target[prop], {
|
|
747
|
-
// get(bTarget, bProp, bReceiver) {
|
|
748
|
-
// if (bProp === "pages") {
|
|
749
|
-
// return async () => {
|
|
750
|
-
// return bTarget.pages().then((pages) => {
|
|
751
|
-
// return pages.map((page) => {
|
|
752
|
-
// return new Proxy(page, {
|
|
753
|
-
// get(pTarget, pProp, pReciever) {
|
|
754
|
-
// if (pProp === "screenshot") {
|
|
755
|
-
// return async (x) => {
|
|
756
|
-
// return pm.customScreenShot(
|
|
757
|
-
// {
|
|
758
|
-
// ...x,
|
|
759
|
-
// path:
|
|
760
|
-
// `${testResourceConfiguration.fs}/${filepath}/butThen` +
|
|
761
|
-
// "/" +
|
|
762
|
-
// x.path,
|
|
763
|
-
// },
|
|
764
|
-
// page
|
|
765
|
-
// );
|
|
766
|
-
// // return await window["custom-screenshot"]({
|
|
767
|
-
// // ...x,
|
|
768
|
-
// // path:
|
|
769
|
-
// // `${testResourceConfiguration.fs}/suite-${sNdx}/afterAll` +
|
|
770
|
-
// // "/" +
|
|
771
|
-
// // x.path,
|
|
772
|
-
// // });
|
|
773
|
-
// };
|
|
774
|
-
// } else if (pProp === "close") {
|
|
775
|
-
// return () => pTarget[pProp]();
|
|
776
|
-
// } else if (pProp === "mainFrame") {
|
|
777
|
-
// return () => pTarget[pProp]();
|
|
778
|
-
// } else if (pProp === "exposeFunction") {
|
|
779
|
-
// // return Reflect.get(target, prop, receiver);
|
|
780
|
-
// return (...a) => pTarget[pProp](...a);
|
|
781
|
-
// // return target[pProp];
|
|
782
|
-
// } else if (pProp === "removeExposedFunction") {
|
|
783
|
-
// // return Reflect.get(target, prop, receiver);
|
|
784
|
-
// return pTarget[pProp].bind(pTarget);
|
|
785
|
-
// // return target[pProp];
|
|
786
|
-
// } else {
|
|
787
|
-
// return Reflect.get(...arguments);
|
|
788
|
-
// }
|
|
789
|
-
// },
|
|
790
|
-
// });
|
|
791
|
-
// });
|
|
792
|
-
// });
|
|
793
|
-
// // return (await target.pages()).map((page) => {
|
|
794
|
-
// // return new Proxy(page, handler2);
|
|
795
|
-
// // });
|
|
796
|
-
// };
|
|
797
|
-
// }
|
|
798
|
-
// },
|
|
799
|
-
// });
|
|
800
|
-
// }
|
|
801
|
-
|
|
802
595
|
return Reflect.get(...arguments);
|
|
803
596
|
},
|
|
804
597
|
});
|