testeranto 0.75.0 → 0.79.4

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.
Files changed (138) hide show
  1. package/README.md +25 -24
  2. package/TaskMan.Dockerfile +23 -0
  3. package/TaskMan1.Dockerfile +23 -0
  4. package/devBot.dockerfile +12 -0
  5. package/dist/TaskMan.Dockerfile +23 -0
  6. package/dist/common/Node.js +1 -0
  7. package/dist/common/PM/index.js +0 -64
  8. package/dist/common/PM/main.js +278 -7
  9. package/dist/common/PM/node.js +4 -0
  10. package/dist/common/PM/web.js +3 -0
  11. package/dist/common/Project.js +6 -2
  12. package/dist/common/Puppeteer.js +12 -17
  13. package/dist/common/Reporter.js +1 -8
  14. package/dist/common/SubPackages/react-dom/component/web.js +5 -25
  15. package/dist/common/SubPackages/react-dom/jsx/web.js +80 -55
  16. package/dist/common/SubPackages/react-test-renderer/component/index.js +0 -86
  17. package/dist/common/SubPackages/react-test-renderer/component/interface.js +68 -0
  18. package/dist/common/SubPackages/react-test-renderer/component/node.js +2 -2
  19. package/dist/common/SubPackages/react-test-renderer/component/web.js +2 -2
  20. package/dist/common/TaskManBackEnd.js +174 -0
  21. package/dist/common/Types.js +0 -2
  22. package/dist/common/esbuildConfigs/index.js +1 -0
  23. package/dist/common/esbuildConfigs/inputFilesPlugin.js +49 -0
  24. package/dist/common/esbuildConfigs/node.js +3 -1
  25. package/dist/common/esbuildConfigs/web.js +3 -1
  26. package/dist/common/lib/abstractBase.js +222 -17
  27. package/dist/common/lib/basebuilder.js +4 -38
  28. package/dist/common/lib/classBuilder.js +1 -3
  29. package/dist/common/lib/core.js +3 -5
  30. package/dist/common/mongooseSchemas.js +56 -0
  31. package/dist/common/tsconfig.common.tsbuildinfo +1 -1
  32. package/dist/common/utils.js +16 -0
  33. package/dist/module/ExampleTab.js +112 -0
  34. package/dist/module/Node.js +1 -0
  35. package/dist/module/PM/index.js +0 -64
  36. package/dist/module/PM/main.js +278 -7
  37. package/dist/module/PM/node.js +4 -0
  38. package/dist/module/PM/web.js +3 -0
  39. package/dist/module/Project.js +6 -2
  40. package/dist/module/Puppeteer.js +12 -17
  41. package/dist/module/Reporter.js +1 -8
  42. package/dist/module/SubPackages/react-dom/component/web.js +5 -25
  43. package/dist/module/SubPackages/react-dom/jsx/web.js +80 -55
  44. package/dist/module/SubPackages/react-test-renderer/component/index.js +1 -59
  45. package/dist/module/SubPackages/react-test-renderer/component/interface.js +39 -0
  46. package/dist/module/SubPackages/react-test-renderer/component/node.js +1 -1
  47. package/dist/module/SubPackages/react-test-renderer/component/web.js +1 -1
  48. package/dist/module/TaskManBackEnd.js +169 -0
  49. package/dist/module/TaskManFrontEnd.js +600 -0
  50. package/dist/module/Types.js +0 -2
  51. package/dist/module/esbuildConfigs/index.js +1 -0
  52. package/dist/module/esbuildConfigs/inputFilesPlugin.js +44 -0
  53. package/dist/module/esbuildConfigs/node.js +3 -1
  54. package/dist/module/esbuildConfigs/web.js +3 -1
  55. package/dist/module/lib/abstractBase.js +222 -17
  56. package/dist/module/lib/basebuilder.js +4 -38
  57. package/dist/module/lib/classBuilder.js +1 -3
  58. package/dist/module/lib/core.js +3 -5
  59. package/dist/module/mongooseSchemas.js +50 -0
  60. package/dist/module/tsconfig.module.tsbuildinfo +1 -1
  61. package/dist/module/utils.js +9 -0
  62. package/dist/prebuild/Report.js +117 -36
  63. package/dist/prebuild/TaskManBackEnd.mjs +180 -0
  64. package/dist/prebuild/TaskManFrontEnd.css +12301 -0
  65. package/dist/prebuild/TaskManFrontEnd.js +81737 -0
  66. package/dist/types/Node.d.ts +1 -1
  67. package/dist/types/PM/index.d.ts +2 -1
  68. package/dist/types/PM/main.d.ts +6 -3
  69. package/dist/types/PM/node.d.ts +2 -0
  70. package/dist/types/PM/web.d.ts +1 -0
  71. package/dist/types/SubPackages/puppeteer.d.ts +1 -1
  72. package/dist/types/SubPackages/react/component/node.d.ts +1 -1
  73. package/dist/types/SubPackages/react/component/web.d.ts +1 -1
  74. package/dist/types/SubPackages/react/jsx/node.d.ts +2 -2
  75. package/dist/types/SubPackages/react/jsx/web.d.ts +2 -2
  76. package/dist/types/SubPackages/react-dom/component/node.d.ts +2 -2
  77. package/dist/types/SubPackages/react-dom/component/web.d.ts +8 -2
  78. package/dist/types/SubPackages/react-dom/jsx/node.d.ts +2 -2
  79. package/dist/types/SubPackages/react-dom/jsx/web.d.ts +2 -2
  80. package/dist/types/SubPackages/react-test-renderer/MemoExoticComponent/node.d.ts +2 -2
  81. package/dist/types/SubPackages/react-test-renderer/component/index.d.ts +0 -7
  82. package/dist/types/SubPackages/react-test-renderer/component/interface.d.ts +9 -0
  83. package/dist/types/SubPackages/react-test-renderer/component/node.d.ts +1 -2
  84. package/dist/types/SubPackages/react-test-renderer/component/web.d.ts +1 -2
  85. package/dist/types/SubPackages/react-test-renderer/fc/node.d.ts +1 -1
  86. package/dist/types/SubPackages/react-test-renderer/fc/web.d.ts +1 -1
  87. package/dist/types/SubPackages/react-test-renderer/jsx/node.d.ts +1 -2
  88. package/dist/types/SubPackages/react-test-renderer/jsx/web.d.ts +1 -2
  89. package/dist/types/SubPackages/react-test-renderer/jsx-promised/node.d.ts +1 -2
  90. package/dist/types/SubPackages/react-test-renderer/jsx-promised/web.d.ts +1 -2
  91. package/dist/types/TaskManBackEnd.d.ts +1 -0
  92. package/dist/types/Types.d.ts +19 -19
  93. package/dist/types/Web.d.ts +1 -1
  94. package/dist/types/esbuildConfigs/inputFilesPlugin.d.ts +5 -0
  95. package/dist/types/lib/abstractBase.d.ts +8 -8
  96. package/dist/types/lib/basebuilder.d.ts +1 -1
  97. package/dist/types/lib/classBuilder.d.ts +1 -1
  98. package/dist/types/lib/core.d.ts +1 -1
  99. package/dist/types/lib/index.d.ts +5 -5
  100. package/dist/types/lib/types.d.ts +15 -13
  101. package/dist/types/mongooseSchemas.d.ts +124 -0
  102. package/dist/types/tsconfig.types.tsbuildinfo +1 -1
  103. package/dist/types/utils.d.ts +2 -0
  104. package/docker-compose-dev.yml +9 -0
  105. package/docker-compose-prod.yml +18 -0
  106. package/package.json +20 -7
  107. package/src/ExampleTab.tsx +219 -0
  108. package/src/Node.ts +31 -2
  109. package/src/PM/index.ts +6 -83
  110. package/src/PM/main.ts +389 -11
  111. package/src/PM/node.ts +6 -0
  112. package/src/PM/web.ts +4 -0
  113. package/src/Project.ts +10 -2
  114. package/src/Puppeteer.ts +16 -17
  115. package/src/Report.tsx +17 -40
  116. package/src/Reporter.ts +1 -9
  117. package/src/SubPackages/react-dom/component/web.ts +10 -30
  118. package/src/SubPackages/react-dom/jsx/web.ts +111 -74
  119. package/src/SubPackages/react-test-renderer/component/index.ts +0 -66
  120. package/src/SubPackages/react-test-renderer/component/interface.ts +48 -0
  121. package/src/SubPackages/react-test-renderer/component/node.ts +2 -1
  122. package/src/SubPackages/react-test-renderer/component/web.ts +2 -1
  123. package/src/TaskManBackEnd.ts +218 -0
  124. package/src/TaskManFrontEnd.tsx +1222 -0
  125. package/src/Types.ts +136 -28
  126. package/src/Web.ts +32 -2
  127. package/src/esbuildConfigs/index.ts +1 -0
  128. package/src/esbuildConfigs/inputFilesPlugin.ts +65 -0
  129. package/src/esbuildConfigs/node.ts +3 -1
  130. package/src/esbuildConfigs/web.ts +4 -0
  131. package/src/lib/abstractBase.ts +337 -34
  132. package/src/lib/basebuilder.ts +17 -52
  133. package/src/lib/classBuilder.ts +14 -2
  134. package/src/lib/core.ts +18 -7
  135. package/src/lib/index.ts +115 -7
  136. package/src/lib/types.ts +143 -35
  137. package/src/mongooseSchemas.ts +105 -0
  138. package/src/utils.ts +15 -0
@@ -0,0 +1,174 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const express_1 = __importDefault(require("express"));
7
+ const mongodb_1 = require("mongodb");
8
+ const mongoose_1 = __importDefault(require("mongoose"));
9
+ const path_1 = __importDefault(require("path"));
10
+ const fs_1 = __importDefault(require("fs"));
11
+ const mongooseSchemas_1 = require("./mongooseSchemas");
12
+ // export const chatChannel = new mongoose.Schema<IChatChannel>({
13
+ // // name: { type: String, required: true },
14
+ // users: [
15
+ // {
16
+ // type: mongoose.Schema.Types.ObjectId,
17
+ // ref: "User",
18
+ // required: true,
19
+ // },
20
+ // ],
21
+ // });
22
+ const app = (0, express_1.default)();
23
+ const port = 3000;
24
+ function findTextFiles(dir, fileList = []) {
25
+ const files = fs_1.default.readdirSync(dir);
26
+ for (const file of files) {
27
+ const filePath = path_1.default.join(dir, file);
28
+ const fileStat = fs_1.default.statSync(filePath);
29
+ if (fileStat.isDirectory() && file !== "node_modules") {
30
+ findTextFiles(filePath, fileList); // Recursive call for subdirectories
31
+ }
32
+ else if (path_1.default.extname(file) === ".txt") {
33
+ fileList.push(filePath);
34
+ }
35
+ else if (path_1.default.extname(file) === ".md") {
36
+ fileList.push(filePath);
37
+ }
38
+ }
39
+ return fileList;
40
+ }
41
+ function listToTree(fileList) {
42
+ const root = {
43
+ name: "root",
44
+ children: [],
45
+ };
46
+ for (const path of fileList) {
47
+ const parts = path.split("/");
48
+ let current = root;
49
+ for (let i = 0; i < parts.length; i++) {
50
+ const part = parts[i];
51
+ if (!part)
52
+ continue; // Skip empty parts (e.g., from leading '/')
53
+ let child = current.children.find((c) => c.name === part);
54
+ if (!child) {
55
+ child = { name: part, children: [] };
56
+ current.children.push(child);
57
+ }
58
+ current = child;
59
+ }
60
+ }
61
+ return root.children;
62
+ }
63
+ new mongodb_1.MongoClient(`mongodb://${process.env.MONGO_HOST || "127.0.0.1"}:27017`)
64
+ .connect()
65
+ .then(async (conn) => {
66
+ const db = conn.db("taskman");
67
+ await mongoose_1.default.connect(`mongodb://${process.env.MONGO_HOST || "127.0.0.1"}:27017/taskman`);
68
+ const usersModel = mongoose_1.default.model("User", mongooseSchemas_1.userSchema);
69
+ const kanbanModel = mongoose_1.default.model("Kanban", mongooseSchemas_1.kanbanSchema);
70
+ const ganttModel = mongoose_1.default.model("Gantt", mongooseSchemas_1.ganttSchema);
71
+ const featuresModel = mongoose_1.default.model("Features", mongooseSchemas_1.featuresSchema);
72
+ // const roomsModel = mongoose.model<any>("Rooms", RoomSchema);
73
+ // const huddleModdle = mongoose.model<any>("Huddles", HuddleSchema);
74
+ const MessagesModel = mongoose_1.default.model("Messages", mongooseSchemas_1.chatCatMessageSchema);
75
+ const ChatChannel = mongoose_1.default.model("ChatChannel", mongooseSchemas_1.channelsFeature);
76
+ const huddleModdle = ChatChannel.discriminator("Huddle", mongooseSchemas_1.HuddleSchema);
77
+ const roomsModel = ChatChannel.discriminator("Room", mongooseSchemas_1.RoomSchema);
78
+ app.get("/TaskManFrontend.js", (req, res) => {
79
+ res.sendFile(`${process.cwd()}/dist/prebuild/TaskManFrontEnd.js`);
80
+ });
81
+ app.get("/TaskManFrontEnd.css", (req, res) => {
82
+ res.sendFile(`${process.cwd()}/dist/prebuild/TaskManFrontEnd.css`);
83
+ });
84
+ // app.get(`/preMergeCheck`, async (req, res) => {
85
+ // const commit = req.params["commit"];
86
+ // // res.json(await keyedModels[key].find({}));
87
+ // });
88
+ // app.get("/TaskManFrontend.js", (req, res) => {
89
+ // res.sendFile(
90
+ // `${process.cwd()}/node_modules/testeranto/dist/prebuild/TaskManFrontEnd.js`
91
+ // );
92
+ // });
93
+ // app.get("/TaskManFrontEnd.css", (req, res) => {
94
+ // res.sendFile(
95
+ // `${process.cwd()}/node_modules/testeranto/dist/prebuild/TaskManFrontEnd.css`
96
+ // );
97
+ // });
98
+ app.get("/testeranto.json", (req, res) => {
99
+ res.sendFile(`${process.cwd()}/docs/testeranto.json`);
100
+ });
101
+ app.get("/", (req, res) => {
102
+ res.send(`<!DOCTYPE html>
103
+ <html lang="en">
104
+
105
+ <head>
106
+ <meta name="description" content="Webpage description goes here" />
107
+ <meta charset="utf-8" />
108
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
109
+ <meta name="author" content="" />
110
+
111
+ <title>TaskMan</title>
112
+
113
+ <link rel="stylesheet" href="/TaskManFrontEnd.css" />
114
+ <script type="module" src="/TaskManFrontEnd.js"></script>
115
+ </head>
116
+
117
+ <body><div id="root">react is loading</div></body>
118
+
119
+ </html>`);
120
+ });
121
+ app.listen(port, () => {
122
+ console.log(`Example app listening on port ${port}`);
123
+ });
124
+ ///////////////////////////////////////////////
125
+ const keyedModels = {
126
+ users: usersModel,
127
+ kanbans: kanbanModel,
128
+ features: featuresModel,
129
+ gantts: ganttModel,
130
+ rooms: roomsModel,
131
+ huddles: huddleModdle,
132
+ messages: MessagesModel,
133
+ };
134
+ Object.keys(keyedModels).forEach((key) => {
135
+ app.get(`/${key}.json`, async (req, res) => {
136
+ console.log("GET", key, keyedModels[key]);
137
+ res.json(await keyedModels[key].find({}));
138
+ });
139
+ app.get(`/${key}/:id.json`, async (req, res) => {
140
+ res.json(await keyedModels[key]
141
+ .find({ id: { $eq: req.params["id"] } })
142
+ .toArray());
143
+ });
144
+ app.post(`/${key}/:id.json`, async (req, res) => {
145
+ res.json(await keyedModels[key]
146
+ .find({ id: { $eq: req.params["id"] } })
147
+ .toArray());
148
+ });
149
+ app.post(`/${key}.json`, async (req, res) => {
150
+ res.json(await keyedModels[key]
151
+ .find({ id: { $eq: req.params["id"] } })
152
+ .toArray());
153
+ });
154
+ });
155
+ app.use("/docs", express_1.default.static(path_1.default.join(process.cwd(), "docs")));
156
+ app.get("/docGal/fs.json", (req, res) => {
157
+ const directoryPath = "./"; // Replace with the desired directory path
158
+ // const textFiles = findTextFiles(directoryPath);
159
+ res.json(listToTree(findTextFiles(directoryPath)));
160
+ // res.send(`<!DOCTYPE html>
161
+ // <html lang="en">
162
+ // <head>
163
+ // <meta name="description" content="Webpage description goes here" />
164
+ // <meta charset="utf-8" />
165
+ // <meta name="viewport" content="width=device-width, initial-scale=1" />
166
+ // <meta name="author" content="" />
167
+ // <title>TaskMan</title>
168
+ // <link rel="stylesheet" href="/TaskManFrontEnd.css" />
169
+ // <script type="module" src="/TaskManFrontEnd.js"></script>
170
+ // </head>
171
+ // <body><div id="root">react is loading</div></body>
172
+ // </html>`);
173
+ });
174
+ });
@@ -1,4 +1,2 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- // export type ITTestShape = {
4
- // };
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.default = (config) => {
4
4
  return {
5
+ // packages: "external",
5
6
  target: "esnext",
6
7
  format: "esm",
7
8
  splitting: true,
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const fs_1 = __importDefault(require("fs"));
7
+ const path_1 = __importDefault(require("path"));
8
+ exports.default = (platform, entryPoints) => {
9
+ return {
10
+ name: "metafileWriter",
11
+ setup(build) {
12
+ build.onEnd((result) => {
13
+ if (result.errors.length === 0) {
14
+ entryPoints.forEach((entryPoint) => {
15
+ const filePath = path_1.default.join("./docs/", platform, entryPoint.split(".").slice(0, -1).join("."), `inputFiles.json`);
16
+ const dirName = path_1.default.dirname(filePath);
17
+ if (!fs_1.default.existsSync(dirName)) {
18
+ fs_1.default.mkdirSync(dirName, { recursive: true });
19
+ }
20
+ fs_1.default.writeFileSync(filePath, JSON.stringify(Object.keys(Object.keys(result.metafile.outputs)
21
+ .filter((s) => {
22
+ if (!result.metafile.outputs[s].entryPoint) {
23
+ return false;
24
+ }
25
+ return (path_1.default.resolve(result.metafile.outputs[s].entryPoint) ===
26
+ path_1.default.resolve(entryPoint));
27
+ })
28
+ .reduce((mm, el) => {
29
+ mm.push(result.metafile.outputs[el].inputs);
30
+ return mm;
31
+ }, [])[0])
32
+ .filter((f) => {
33
+ const regex = /^src\/.*/g;
34
+ const matches = f.match(regex);
35
+ const passes = (matches === null || matches === void 0 ? void 0 : matches.length) === 1;
36
+ return passes;
37
+ })
38
+ .filter((f) => {
39
+ const regex = /.*\.test\..*/g;
40
+ const matches = f.match(regex);
41
+ const passes = (matches === null || matches === void 0 ? void 0 : matches.length) === 1;
42
+ return !passes;
43
+ })));
44
+ });
45
+ }
46
+ });
47
+ },
48
+ };
49
+ };
@@ -4,8 +4,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const index_js_1 = __importDefault(require("./index.js"));
7
+ const inputFilesPlugin_1 = __importDefault(require("./inputFilesPlugin"));
7
8
  exports.default = (config, entryPoints) => {
8
- return Object.assign(Object.assign({}, (0, index_js_1.default)(config)), { splitting: true, outdir: config.outdir + "/node", inject: [`./node_modules/testeranto/dist/cjs-shim.js`], supported: {
9
+ return Object.assign(Object.assign({}, (0, index_js_1.default)(config)), { splitting: true, outdir: config.outdir + "/node", inject: [`./node_modules/testeranto/dist/cjs-shim.js`], metafile: true, supported: {
9
10
  "dynamic-import": true,
10
11
  }, define: {
11
12
  "process.env.FLUENTFFMPEG_COV": "0",
@@ -20,6 +21,7 @@ exports.default = (config, entryPoints) => {
20
21
  ...config.externals,
21
22
  ], entryPoints: [...entryPoints], plugins: [
22
23
  ...(config.nodePlugins || []),
24
+ (0, inputFilesPlugin_1.default)("node", entryPoints),
23
25
  {
24
26
  name: "rebuild-notify",
25
27
  setup(build) {
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const path_1 = __importDefault(require("path"));
7
7
  const index_js_1 = __importDefault(require("./index.js"));
8
+ const inputFilesPlugin_js_1 = __importDefault(require("./inputFilesPlugin.js"));
8
9
  exports.default = (config, entryPoints) => {
9
10
  return Object.assign(Object.assign({}, (0, index_js_1.default)(config)), {
10
11
  // inject: ["./node_modules/testeranto/dist/cjs-shim.js"],
@@ -14,7 +15,7 @@ exports.default = (config, entryPoints) => {
14
15
  // splitting: true,
15
16
  outdir: config.outdir + "/web", alias: {
16
17
  react: path_1.default.resolve("./node_modules/react"),
17
- }, external: [
18
+ }, metafile: true, external: [
18
19
  "testeranto.json",
19
20
  "features.test.ts",
20
21
  // "url",
@@ -38,6 +39,7 @@ exports.default = (config, entryPoints) => {
38
39
  "dns",
39
40
  ], platform: "browser", entryPoints: [...entryPoints], plugins: [
40
41
  ...(config.webPlugins || []),
42
+ (0, inputFilesPlugin_js_1.default)("node", entryPoints),
41
43
  {
42
44
  name: "rebuild-notify",
43
45
  setup(build) {
@@ -34,7 +34,62 @@ class BaseSuite {
34
34
  const sNdx = this.index;
35
35
  const sName = this.name;
36
36
  for (const [gNdx, g] of Object.entries(this.givens)) {
37
- const subject = await this.setup(input, suiteArtifactory, testResourceConfiguration, pm);
37
+ const beforeAllProxy = new Proxy(pm, {
38
+ get(target, prop, receiver) {
39
+ if (prop === "writeFileSync") {
40
+ return (fp, contents) => target[prop](`suite-${sNdx}/beforeAll/${fp}`, contents);
41
+ }
42
+ if (prop === "browser") {
43
+ return new Proxy(target[prop], {
44
+ get(bTarget, bProp, bReceiver) {
45
+ if (bProp === "pages") {
46
+ return async () => {
47
+ return bTarget.pages().then((pages) => {
48
+ return pages.map((page) => {
49
+ return new Proxy(page, {
50
+ get(pTarget, pProp, pReciever) {
51
+ if (pProp === "screenshot") {
52
+ return async (x) => {
53
+ return pm.customScreenShot(Object.assign(Object.assign({}, x), { path: `${testResourceConfiguration.fs}/suite-${sNdx}/beforeAll` +
54
+ "/" +
55
+ x.path }), page);
56
+ // return await window["custom-screenshot"]({
57
+ // ...x,
58
+ // path:
59
+ // `${testResourceConfiguration.fs}/suite-${sNdx}/afterAll` +
60
+ // "/" +
61
+ // x.path,
62
+ // });
63
+ };
64
+ }
65
+ else if (pProp === "mainFrame") {
66
+ return () => pTarget[pProp]();
67
+ }
68
+ else if (pProp === "close") {
69
+ return () => pTarget[pProp]();
70
+ }
71
+ // else if (pProp === "mainFrame") {
72
+ // return () => target[pProp](...arguments);
73
+ // }
74
+ else {
75
+ return Reflect.get(...arguments);
76
+ }
77
+ },
78
+ });
79
+ });
80
+ });
81
+ // return (await target.pages()).map((page) => {
82
+ // return new Proxy(page, handler2);
83
+ // });
84
+ };
85
+ }
86
+ },
87
+ });
88
+ }
89
+ return Reflect.get(...arguments);
90
+ },
91
+ });
92
+ const subject = await this.setup(input, suiteArtifactory, testResourceConfiguration, beforeAllProxy);
38
93
  const giver = this.givens[gNdx];
39
94
  try {
40
95
  this.store = await giver.give(subject, gNdx, testResourceConfiguration, this.assertThat, suiteArtifactory, tLog, pm, sNdx);
@@ -61,17 +116,24 @@ class BaseSuite {
61
116
  get(pTarget, pProp, pReciever) {
62
117
  if (pProp === "screenshot") {
63
118
  return async (x) => {
64
- // console.log(
65
- // "custom-screenshot-MARK-afterAllProxy",
66
- // // arguments,
67
- // // x,
68
- // window["custom-screenshot"].toString()
69
- // );
70
- return await window["custom-screenshot"](Object.assign(Object.assign({}, x), { path: `${testResourceConfiguration.fs}/suite-${sNdx}/afterAll` +
119
+ return pm.customScreenShot(Object.assign(Object.assign({}, x), { path: `${testResourceConfiguration.fs}/suite-${sNdx}/afterAll` +
71
120
  "/" +
72
121
  x.path }));
122
+ // return await window["custom-screenshot"]({
123
+ // ...x,
124
+ // path:
125
+ // `${testResourceConfiguration.fs}/suite-${sNdx}/afterAll` +
126
+ // "/" +
127
+ // x.path,
128
+ // });
73
129
  };
74
130
  }
131
+ else if (pProp === "mainFrame") {
132
+ return () => pTarget[pProp]();
133
+ }
134
+ else if (pProp === "close") {
135
+ return () => pTarget[pProp]();
136
+ }
75
137
  // else if (pProp === "mainFrame") {
76
138
  // return () => target[pProp](...arguments);
77
139
  // }
@@ -162,7 +224,6 @@ class BaseGiven {
162
224
  const beforeEachProxy = new Proxy(pm, {
163
225
  get(target, prop, receiver) {
164
226
  if (prop === "writeFileSync") {
165
- console.log("beforeEachProx", arguments, target[prop]);
166
227
  return (fp, contents) => target[prop](`suite-${suiteNdx}/given-${key}/when/beforeEach/${fp}`, contents);
167
228
  }
168
229
  return Reflect.get(...arguments);
@@ -172,8 +233,8 @@ class BaseGiven {
172
233
  for (const [whenNdx, whenStep] of this.whens.entries()) {
173
234
  await whenStep.test(this.store, testResourceConfiguration, tLog, pm, `suite-${suiteNdx}/given-${key}/when/${whenNdx}`);
174
235
  }
175
- for (const thenStep of this.thens) {
176
- const t = await thenStep.test(this.store, testResourceConfiguration, tLog, pm);
236
+ for (const [thenNdx, thenStep] of this.thens.entries()) {
237
+ const t = await thenStep.test(this.store, testResourceConfiguration, tLog, pm, `suite-${suiteNdx}/given-${key}/then-${thenNdx}`);
177
238
  tester(t);
178
239
  }
179
240
  }
@@ -218,12 +279,34 @@ class BaseGiven {
218
279
  // "custom-screenshot-MARK-afterEachProxy",
219
280
  // window["custom-screenshot"].toString()
220
281
  // );
221
- return await pTarget[pProp](Object.assign(Object.assign({}, x), { path: `${testResourceConfiguration.fs}/suite-${suiteNdx}/given-${key}/afterEach` +
282
+ return pm.customScreenShot(Object.assign(Object.assign({}, x), { path: `${testResourceConfiguration.fs}/suite-${suiteNdx}/given-${key}/afterEach` +
222
283
  "/" +
223
- x.path }));
284
+ x.path }), page);
285
+ // return await pTarget[pProp]({
286
+ // ...x,
287
+ // path:
288
+ // `${testResourceConfiguration.fs}/suite-${suiteNdx}/given-${key}/afterEach` +
289
+ // "/" +
290
+ // x.path,
291
+ // });
224
292
  };
225
293
  }
226
- // else if (pProp === "mainFrame") {
294
+ else if (pProp === "mainFrame") {
295
+ return () => pTarget[pProp]();
296
+ // return target[pProp];
297
+ // return Reflect.get(...arguments);
298
+ }
299
+ else if (pProp === "exposeFunction") {
300
+ // return Reflect.get(target, prop, receiver);
301
+ return (...a) => pTarget[pProp](...a);
302
+ // return target[pProp];
303
+ }
304
+ else if (pProp === "removeExposedFunction") {
305
+ // return Reflect.get(target, prop, receiver);
306
+ return pTarget[pProp].bind(pTarget);
307
+ // return target[pProp];
308
+ }
309
+ // else if (pProp === "#frameManager") {
227
310
  // return () => target[pProp](...arguments);
228
311
  // }
229
312
  else {
@@ -271,11 +354,69 @@ class BaseWhen {
271
354
  const andWhenProxy = new Proxy(pm, {
272
355
  get(target, prop, receiver) {
273
356
  if (prop === "writeFileSync") {
274
- console.log("andWhenProxy", arguments, target[prop]);
275
357
  return (fp, contents) =>
276
358
  // target[prop](`${key}/andWhen/${fp}`, contents);
277
359
  target[prop](`${key}/andWhen/${fp}`, contents);
278
360
  }
361
+ /////////////////////
362
+ if (prop === "browser") {
363
+ return new Proxy(target[prop], {
364
+ get(bTarget, bProp, bReceiver) {
365
+ if (bProp === "pages") {
366
+ return async () => {
367
+ return bTarget.pages().then((pages) => {
368
+ return pages.map((page) => {
369
+ return new Proxy(page, {
370
+ get(pTarget, pProp, pReciever) {
371
+ if (pProp === "screenshot") {
372
+ return async (x) => {
373
+ // console.log(
374
+ // "custom-screenshot-MARK-afterEachProxy",
375
+ // window["custom-screenshot"].toString()
376
+ // );
377
+ return pm.customScreenShot(Object.assign(Object.assign({}, x), { path: `${testResourceConfiguration.fs}/${key}/afterEach` +
378
+ "/" +
379
+ x.path }), page);
380
+ // return await pTarget[pProp]({
381
+ // ...x,
382
+ // path:
383
+ // `${testResourceConfiguration.fs}/suite-${suiteNdx}/given-${key}/afterEach` +
384
+ // "/" +
385
+ // x.path,
386
+ // });
387
+ };
388
+ }
389
+ else if (pProp === "mainFrame") {
390
+ return () => pTarget[pProp]();
391
+ // return target[pProp];
392
+ // return Reflect.get(...arguments);
393
+ }
394
+ else if (pProp === "exposeFunction") {
395
+ // return Reflect.get(target, prop, receiver);
396
+ return pTarget[pProp].bind(pTarget);
397
+ // return target[pProp];
398
+ }
399
+ else if (pProp === "removeExposedFunction") {
400
+ // return Reflect.get(target, prop, receiver);
401
+ return pTarget[pProp].bind(pTarget);
402
+ // return target[pProp];
403
+ }
404
+ else {
405
+ return Reflect.get(...arguments);
406
+ }
407
+ },
408
+ });
409
+ });
410
+ });
411
+ // return (await target.pages()).map((page) => {
412
+ // return new Proxy(page, handler2);
413
+ // });
414
+ };
415
+ }
416
+ },
417
+ });
418
+ }
419
+ ///////////////////////
279
420
  return Reflect.get(...arguments);
280
421
  },
281
422
  });
@@ -301,10 +442,74 @@ class BaseThen {
301
442
  error: this.error,
302
443
  };
303
444
  }
304
- async test(store, testResourceConfiguration, tLog, pm) {
445
+ async test(store, testResourceConfiguration, tLog, pm, filepath) {
305
446
  tLog(" Then:", this.name);
306
447
  try {
307
- const x = await this.butThen(store, this.thenCB, testResourceConfiguration);
448
+ const butThenProxy = new Proxy(pm, {
449
+ get(target, prop, receiver) {
450
+ if (prop === "writeFileSync") {
451
+ return (fp, contents) => target[prop](`${filepath}/${fp}`, contents);
452
+ }
453
+ if (prop === "browser") {
454
+ return new Proxy(target[prop], {
455
+ get(bTarget, bProp, bReceiver) {
456
+ if (bProp === "pages") {
457
+ return async () => {
458
+ return bTarget.pages().then((pages) => {
459
+ return pages.map((page) => {
460
+ return new Proxy(page, {
461
+ get(pTarget, pProp, pReciever) {
462
+ if (pProp === "screenshot") {
463
+ return async (x) => {
464
+ return pm.customScreenShot(Object.assign(Object.assign({}, x), { path: `${testResourceConfiguration.fs}/${filepath}/butThen` +
465
+ "/" +
466
+ x.path }), page);
467
+ // return await window["custom-screenshot"]({
468
+ // ...x,
469
+ // path:
470
+ // `${testResourceConfiguration.fs}/suite-${sNdx}/afterAll` +
471
+ // "/" +
472
+ // x.path,
473
+ // });
474
+ };
475
+ }
476
+ else if (pProp === "close") {
477
+ return () => pTarget[pProp]();
478
+ }
479
+ else if (pProp === "mainFrame") {
480
+ return () => pTarget[pProp]();
481
+ }
482
+ else if (pProp === "exposeFunction") {
483
+ // return Reflect.get(target, prop, receiver);
484
+ return (...a) => pTarget[pProp](...a);
485
+ // return target[pProp];
486
+ }
487
+ else if (pProp === "removeExposedFunction") {
488
+ // return Reflect.get(target, prop, receiver);
489
+ return pTarget[pProp].bind(pTarget);
490
+ // return target[pProp];
491
+ }
492
+ else {
493
+ return Reflect.get(...arguments);
494
+ }
495
+ },
496
+ });
497
+ });
498
+ });
499
+ // return (await target.pages()).map((page) => {
500
+ // return new Proxy(page, handler2);
501
+ // });
502
+ };
503
+ }
504
+ },
505
+ });
506
+ }
507
+ return Reflect.get(...arguments);
508
+ },
509
+ });
510
+ const x = await this.butThen(store, this.thenCB, testResourceConfiguration, butThenProxy
511
+ // pm
512
+ );
308
513
  return x;
309
514
  }
310
515
  catch (e) {