testeranto 0.47.34 → 0.47.52

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 (309) hide show
  1. package/.nvmrc +1 -0
  2. package/Bundle.Dockerfile +45 -0
  3. package/README.md +86 -11
  4. package/Report.Dockerfile +43 -0
  5. package/dist/cjs-shim.js +12 -0
  6. package/dist/common/Features.js +3 -37
  7. package/dist/common/Init.js +30 -0
  8. package/dist/common/Node.js +15 -66
  9. package/dist/common/PM/index.js +7 -0
  10. package/dist/common/PM/main.js +641 -0
  11. package/dist/common/PM/node.js +88 -0
  12. package/dist/common/PM/web.js +132 -0
  13. package/dist/common/Project.js +109 -637
  14. package/dist/common/Puppeteer.js +103 -0
  15. package/dist/common/Reporter.js +112 -0
  16. package/dist/common/Scheduler.js +1 -0
  17. package/dist/common/SubPackages/puppeteer.js +21 -0
  18. package/dist/common/{subPackages → SubPackages}/react/component/node.js +4 -4
  19. package/dist/common/{subPackages → SubPackages}/react/component/web.js +4 -4
  20. package/dist/common/SubPackages/react/jsx/index.js +25 -0
  21. package/dist/common/SubPackages/react/jsx/node.js +10 -0
  22. package/dist/common/SubPackages/react/jsx/web.js +10 -0
  23. package/dist/common/{subPackages/react-dom/jsx → SubPackages/react-dom/component}/node.js +6 -6
  24. package/dist/common/SubPackages/react-dom/component/web.js +93 -0
  25. package/dist/common/SubPackages/react-dom/jsx/index.js +2 -0
  26. package/dist/common/SubPackages/react-dom/jsx/node.js +39 -0
  27. package/dist/common/SubPackages/react-dom/jsx/web.js +118 -0
  28. package/dist/common/SubPackages/react-test-renderer/MemoExoticComponent/node.js +44 -0
  29. package/dist/common/SubPackages/react-test-renderer/component/index.js +2 -0
  30. package/dist/common/{subPackages/react-test-renderer/component/index.js → SubPackages/react-test-renderer/component/interface.js} +23 -33
  31. package/dist/common/{subPackages/react-test-renderer/jsx → SubPackages/react-test-renderer/component}/node.js +3 -5
  32. package/dist/common/{subPackages/react/jsx → SubPackages/react-test-renderer/component}/web.js +3 -5
  33. package/dist/common/SubPackages/react-test-renderer/fc/node.js +50 -0
  34. package/dist/common/SubPackages/react-test-renderer/fc/web.js +50 -0
  35. package/dist/common/{subPackages → SubPackages}/react-test-renderer/jsx/index.js +7 -3
  36. package/dist/common/SubPackages/react-test-renderer/jsx/node.js +10 -0
  37. package/dist/common/SubPackages/react-test-renderer/jsx/web.js +10 -0
  38. package/dist/common/SubPackages/react-test-renderer/jsx-promised/index.js +42 -0
  39. package/dist/common/{subPackages/react/jsx → SubPackages/react-test-renderer/jsx-promised}/node.js +2 -2
  40. package/dist/common/TaskManBackEnd.js +174 -0
  41. package/dist/common/Web.js +31 -108
  42. package/dist/common/esbuildConfigs/features.js +14 -0
  43. package/dist/common/esbuildConfigs/index.js +21 -0
  44. package/dist/common/esbuildConfigs/inputFilesPlugin.js +49 -0
  45. package/dist/common/esbuildConfigs/node.js +39 -0
  46. package/dist/common/esbuildConfigs/report.js +14 -0
  47. package/dist/common/esbuildConfigs/tests.js +13 -0
  48. package/dist/common/esbuildConfigs/web.js +57 -0
  49. package/dist/common/lib/abstractBase.js +553 -0
  50. package/dist/common/lib/basebuilder.js +79 -0
  51. package/dist/common/lib/classBuilder.js +42 -0
  52. package/dist/common/lib/core.js +75 -0
  53. package/dist/common/lib/index.js +22 -0
  54. package/dist/common/lib/types.js +2 -0
  55. package/dist/common/mongooseSchemas.js +56 -0
  56. package/dist/common/preload.js +14 -27
  57. package/dist/common/puppeteerConfiger.js +24 -0
  58. package/dist/common/report.html.js +31 -0
  59. package/dist/common/tsconfig.common.tsbuildinfo +1 -1
  60. package/dist/common/utils.js +16 -0
  61. package/dist/common/web.html.js +22 -0
  62. package/dist/module/ExampleTab.js +112 -0
  63. package/dist/module/Features.js +2 -35
  64. package/dist/module/Init.js +25 -0
  65. package/dist/module/Node.js +15 -66
  66. package/dist/module/PM/index.js +3 -0
  67. package/dist/module/PM/main.js +611 -0
  68. package/dist/module/PM/node.js +81 -0
  69. package/dist/module/PM/web.js +125 -0
  70. package/dist/module/Project.js +110 -615
  71. package/dist/module/Puppeteer.js +98 -0
  72. package/dist/module/Reporter.js +107 -0
  73. package/dist/module/Scheduler.js +1 -0
  74. package/dist/module/SubPackages/puppeteer.js +16 -0
  75. package/dist/module/{subPackages → SubPackages}/react/component/node.js +3 -3
  76. package/dist/module/{subPackages → SubPackages}/react/component/web.js +3 -3
  77. package/dist/module/SubPackages/react/jsx/index.js +19 -0
  78. package/dist/module/SubPackages/react/jsx/node.js +5 -0
  79. package/dist/module/SubPackages/react/jsx/web.js +5 -0
  80. package/dist/module/{subPackages → SubPackages}/react-dom/component/node.js +7 -7
  81. package/dist/module/SubPackages/react-dom/component/web.js +88 -0
  82. package/dist/module/SubPackages/react-dom/jsx/node.js +31 -0
  83. package/dist/module/SubPackages/react-dom/jsx/web.js +90 -0
  84. package/dist/module/SubPackages/react-test-renderer/MemoExoticComponent/node.js +16 -0
  85. package/dist/module/SubPackages/react-test-renderer/component/index.js +1 -0
  86. package/dist/module/SubPackages/react-test-renderer/component/interface.js +39 -0
  87. package/dist/module/{subPackages → SubPackages}/react-test-renderer/component/node.js +2 -2
  88. package/dist/module/{subPackages → SubPackages}/react-test-renderer/component/web.js +2 -2
  89. package/dist/module/{subPackages → SubPackages}/react-test-renderer/fc/node.js +3 -3
  90. package/dist/module/SubPackages/react-test-renderer/fc/web.js +22 -0
  91. package/dist/module/{subPackages → SubPackages}/react-test-renderer/jsx/index.js +7 -3
  92. package/dist/module/SubPackages/react-test-renderer/jsx/node.js +5 -0
  93. package/dist/module/SubPackages/react-test-renderer/jsx/web.js +5 -0
  94. package/dist/module/SubPackages/react-test-renderer/jsx-promised/index.js +16 -0
  95. package/dist/module/{subPackages/react-test-renderer/jsx → SubPackages/react-test-renderer/jsx-promised}/node.js +1 -1
  96. package/dist/module/TaskManBackEnd.js +169 -0
  97. package/dist/module/TaskManFrontEnd.js +600 -0
  98. package/dist/module/Web.js +31 -108
  99. package/dist/module/esbuildConfigs/features.js +12 -0
  100. package/dist/module/esbuildConfigs/index.js +19 -0
  101. package/dist/module/esbuildConfigs/inputFilesPlugin.js +44 -0
  102. package/dist/module/esbuildConfigs/node.js +34 -0
  103. package/dist/module/esbuildConfigs/report.js +14 -0
  104. package/dist/module/esbuildConfigs/tests.js +11 -0
  105. package/dist/module/esbuildConfigs/web.js +52 -0
  106. package/dist/module/lib/abstractBase.js +545 -0
  107. package/dist/module/lib/basebuilder.js +75 -0
  108. package/dist/module/lib/classBuilder.js +38 -0
  109. package/dist/module/lib/core.js +72 -0
  110. package/dist/module/lib/index.js +18 -0
  111. package/dist/module/lib/types.js +1 -0
  112. package/dist/module/mongooseSchemas.js +50 -0
  113. package/dist/module/preload.js +15 -26
  114. package/dist/module/puppeteerConfiger.js +19 -0
  115. package/dist/module/report.html.js +29 -0
  116. package/dist/module/tsconfig.module.tsbuildinfo +1 -1
  117. package/dist/module/utils.js +9 -0
  118. package/dist/module/web.html.js +20 -0
  119. package/dist/prebuild/TaskManBackEnd.mjs +174 -0
  120. package/dist/prebuild/TaskManFrontEnd.css +12301 -0
  121. package/dist/prebuild/TaskManFrontEnd.js +81264 -0
  122. package/dist/types/Features.d.ts +1 -34
  123. package/dist/types/Init.d.ts +2 -0
  124. package/dist/types/Node.d.ts +5 -11
  125. package/dist/types/PM/index.d.ts +20 -0
  126. package/dist/types/PM/main.d.ts +31 -0
  127. package/dist/types/PM/node.d.ts +27 -0
  128. package/dist/types/PM/web.d.ts +25 -0
  129. package/dist/types/Project.d.ts +3 -29
  130. package/dist/types/Puppeteer.d.ts +2 -0
  131. package/dist/types/Reporter.d.ts +1 -0
  132. package/dist/types/Scheduler.d.ts +0 -0
  133. package/dist/types/SubPackages/puppeteer.d.ts +6 -0
  134. package/dist/types/SubPackages/react/component/node.d.ts +7 -0
  135. package/dist/types/SubPackages/react/component/web.d.ts +7 -0
  136. package/dist/types/SubPackages/react/jsx/index.d.ts +12 -0
  137. package/dist/types/SubPackages/react/jsx/node.d.ts +4 -0
  138. package/dist/types/SubPackages/react/jsx/web.d.ts +4 -0
  139. package/dist/types/SubPackages/react-dom/component/node.d.ts +12 -0
  140. package/dist/types/SubPackages/react-dom/component/web.d.ts +11 -0
  141. package/dist/types/SubPackages/react-dom/jsx/index.d.ts +6 -0
  142. package/dist/types/SubPackages/react-dom/jsx/node.d.ts +6 -0
  143. package/dist/types/SubPackages/react-dom/jsx/web.d.ts +5 -0
  144. package/dist/types/SubPackages/react-test-renderer/MemoExoticComponent/node.d.ts +5 -0
  145. package/dist/types/SubPackages/react-test-renderer/component/index.d.ts +13 -0
  146. package/dist/types/SubPackages/react-test-renderer/component/interface.d.ts +9 -0
  147. package/dist/types/SubPackages/react-test-renderer/component/node.d.ts +8 -0
  148. package/dist/types/SubPackages/react-test-renderer/component/web.d.ts +3 -0
  149. package/dist/types/SubPackages/react-test-renderer/fc/node.d.ts +8 -0
  150. package/dist/types/SubPackages/react-test-renderer/fc/web.d.ts +8 -0
  151. package/dist/types/{subPackages → SubPackages}/react-test-renderer/jsx/index.d.ts +5 -4
  152. package/dist/types/SubPackages/react-test-renderer/jsx/node.d.ts +8 -0
  153. package/dist/types/SubPackages/react-test-renderer/jsx/web.d.ts +8 -0
  154. package/dist/types/SubPackages/react-test-renderer/jsx-promised/index.d.ts +15 -0
  155. package/dist/types/SubPackages/react-test-renderer/jsx-promised/node.d.ts +4 -0
  156. package/dist/types/SubPackages/react-test-renderer/jsx-promised/web.d.ts +4 -0
  157. package/dist/types/TaskManBackEnd.d.ts +3 -0
  158. package/dist/types/Types.d.ts +49 -16
  159. package/dist/types/Web.d.ts +5 -11
  160. package/dist/types/esbuildConfigs/features.d.ts +4 -0
  161. package/dist/types/esbuildConfigs/index.d.ts +4 -0
  162. package/dist/types/esbuildConfigs/inputFilesPlugin.d.ts +5 -0
  163. package/dist/types/esbuildConfigs/node.d.ts +4 -0
  164. package/dist/types/esbuildConfigs/report.d.ts +0 -0
  165. package/dist/types/esbuildConfigs/tests.d.ts +4 -0
  166. package/dist/types/esbuildConfigs/web.d.ts +4 -0
  167. package/dist/types/lib/abstractBase.d.ts +104 -0
  168. package/dist/types/lib/basebuilder.d.ts +27 -0
  169. package/dist/types/lib/classBuilder.d.ts +7 -0
  170. package/dist/types/lib/core.d.ts +8 -0
  171. package/dist/types/lib/index.d.ts +59 -0
  172. package/dist/types/lib/types.d.ts +62 -0
  173. package/dist/types/mongooseSchemas.d.ts +124 -0
  174. package/dist/types/preload.d.ts +0 -1
  175. package/dist/types/puppeteerConfiger.d.ts +4 -0
  176. package/dist/types/report.html.d.ts +2 -0
  177. package/dist/types/tsconfig.types.tsbuildinfo +1 -1
  178. package/dist/types/utils.d.ts +2 -0
  179. package/dist/types/web.html.d.ts +2 -0
  180. package/index.html +30 -0
  181. package/package.json +151 -79
  182. package/src/ExampleTab.tsx +219 -0
  183. package/src/Features.ts +2 -58
  184. package/src/Init.ts +51 -0
  185. package/src/Node.ts +71 -157
  186. package/src/PM/index.ts +25 -0
  187. package/src/PM/main.ts +830 -0
  188. package/src/PM/node.ts +128 -0
  189. package/src/PM/web.ts +166 -0
  190. package/src/Project.ts +158 -797
  191. package/src/Puppeteer.ts +141 -0
  192. package/src/Reporter.ts +126 -0
  193. package/src/Scheduler.ts +0 -0
  194. package/src/SubPackages/puppeteer.ts +51 -0
  195. package/src/SubPackages/react/component/node.ts +43 -0
  196. package/src/SubPackages/react/component/web.ts +43 -0
  197. package/src/SubPackages/react/jsx/index.ts +42 -0
  198. package/src/SubPackages/react/jsx/node.ts +26 -0
  199. package/src/SubPackages/react/jsx/web.ts +30 -0
  200. package/src/{subPackages → SubPackages}/react-dom/component/node.ts +24 -44
  201. package/src/SubPackages/react-dom/component/web.ts +143 -0
  202. package/src/SubPackages/react-dom/jsx/index.ts +6 -0
  203. package/src/SubPackages/react-dom/jsx/node.ts +68 -0
  204. package/src/SubPackages/react-dom/jsx/web.ts +139 -0
  205. package/src/SubPackages/react-test-renderer/MemoExoticComponent/node.ts +38 -0
  206. package/src/SubPackages/react-test-renderer/component/index.ts +23 -0
  207. package/src/SubPackages/react-test-renderer/component/interface.ts +48 -0
  208. package/src/SubPackages/react-test-renderer/component/node.ts +17 -0
  209. package/src/SubPackages/react-test-renderer/component/web.ts +17 -0
  210. package/src/SubPackages/react-test-renderer/fc/node.ts +49 -0
  211. package/src/SubPackages/react-test-renderer/fc/web.ts +48 -0
  212. package/src/SubPackages/react-test-renderer/jsx/index.ts +48 -0
  213. package/src/SubPackages/react-test-renderer/jsx/node.ts +20 -0
  214. package/src/SubPackages/react-test-renderer/jsx/web.ts +20 -0
  215. package/src/SubPackages/react-test-renderer/jsx-promised/index.ts +40 -0
  216. package/src/SubPackages/react-test-renderer/jsx-promised/node.ts +19 -0
  217. package/src/SubPackages/react-test-renderer/jsx-promised/web.ts +22 -0
  218. package/src/TaskManBackEnd.ts +228 -0
  219. package/src/TaskManFrontEnd.tsx +1222 -0
  220. package/src/Types.ts +222 -17
  221. package/src/Web.ts +86 -217
  222. package/src/cjs-shim.js +12 -0
  223. package/src/esbuildConfigs/features.ts +17 -0
  224. package/src/esbuildConfigs/index.ts +23 -0
  225. package/src/esbuildConfigs/inputFilesPlugin.ts +65 -0
  226. package/src/esbuildConfigs/node.ts +62 -0
  227. package/src/esbuildConfigs/report.ts +15 -0
  228. package/src/esbuildConfigs/tests.ts +14 -0
  229. package/src/esbuildConfigs/web.ts +79 -0
  230. package/src/lib/abstractBase.ts +910 -0
  231. package/src/lib/basebuilder.ts +214 -0
  232. package/src/lib/classBuilder.ts +131 -0
  233. package/src/lib/core.ts +224 -0
  234. package/src/lib/index.ts +226 -0
  235. package/src/lib/types.ts +303 -0
  236. package/src/mongooseSchemas.ts +105 -0
  237. package/src/preload.ts +14 -28
  238. package/src/puppeteerConfiger.ts +26 -0
  239. package/src/report.html.ts +29 -0
  240. package/src/utils.ts +15 -0
  241. package/src/web.html.ts +20 -0
  242. package/tests/Rectangle.test.ts +189 -0
  243. package/trash/TaskMan.Dockerfile +23 -0
  244. package/trash/TaskMan1.Dockerfile +43 -0
  245. package/trash/devBot.dockerfile +12 -0
  246. package/trash/docker-compose-dev.yml +9 -0
  247. package/trash/docker-compose-prod.yml +18 -0
  248. package/trash/electronBuild.ts +32 -0
  249. package/tsconfig.json +18 -6
  250. package/tsconfig.module.json +14 -4
  251. package/tsconfig.types.json +13 -4
  252. package/dist/common/NodeWriter.js +0 -56
  253. package/dist/common/core.js +0 -396
  254. package/dist/common/electron.js +0 -52
  255. package/dist/common/subPackages/react/jsx/index.js +0 -26
  256. package/dist/common/subPackages/react-dom/component/node.js +0 -101
  257. package/dist/common/subPackages/react-dom/component/web.js +0 -61
  258. package/dist/common/subPackages/react-dom/jsx/web.js +0 -76
  259. package/dist/common/subPackages/react-test-renderer/component/node.js +0 -8
  260. package/dist/common/subPackages/react-test-renderer/component/web.js +0 -8
  261. package/dist/module/NodeWriter.js +0 -50
  262. package/dist/module/Report.js +0 -186
  263. package/dist/module/core.js +0 -387
  264. package/dist/module/electron.js +0 -47
  265. package/dist/module/subPackages/react/jsx/index.js +0 -22
  266. package/dist/module/subPackages/react/jsx/node.js +0 -5
  267. package/dist/module/subPackages/react/jsx/web.js +0 -5
  268. package/dist/module/subPackages/react-dom/component/web.js +0 -56
  269. package/dist/module/subPackages/react-dom/jsx/node.js +0 -93
  270. package/dist/module/subPackages/react-dom/jsx/web.js +0 -48
  271. package/dist/module/subPackages/react-test-renderer/component/index.js +0 -52
  272. package/dist/types/NodeWriter.d.ts +0 -2
  273. package/dist/types/core.d.ts +0 -220
  274. package/dist/types/subPackages/react/component/node.d.ts +0 -12
  275. package/dist/types/subPackages/react/component/web.d.ts +0 -12
  276. package/dist/types/subPackages/react/jsx/index.d.ts +0 -15
  277. package/dist/types/subPackages/react/jsx/node.d.ts +0 -4
  278. package/dist/types/subPackages/react/jsx/web.d.ts +0 -4
  279. package/dist/types/subPackages/react-dom/component/node.d.ts +0 -14
  280. package/dist/types/subPackages/react-dom/component/web.d.ts +0 -19
  281. package/dist/types/subPackages/react-dom/jsx/node.d.ts +0 -14
  282. package/dist/types/subPackages/react-dom/jsx/web.d.ts +0 -15
  283. package/dist/types/subPackages/react-test-renderer/component/index.d.ts +0 -20
  284. package/dist/types/subPackages/react-test-renderer/component/node.d.ts +0 -9
  285. package/dist/types/subPackages/react-test-renderer/component/web.d.ts +0 -9
  286. package/dist/types/subPackages/react-test-renderer/jsx/node.d.ts +0 -4
  287. package/dist/types/subPackages/react-test-renderer/jsx/web.d.ts +0 -4
  288. package/src/NodeWriter.ts +0 -72
  289. package/src/Report.tsx +0 -392
  290. package/src/core.ts +0 -1396
  291. package/src/electron.ts +0 -59
  292. package/src/subPackages/react/component/node.ts +0 -75
  293. package/src/subPackages/react/component/web.ts +0 -80
  294. package/src/subPackages/react/jsx/index.ts +0 -64
  295. package/src/subPackages/react/jsx/node.ts +0 -29
  296. package/src/subPackages/react/jsx/web.ts +0 -29
  297. package/src/subPackages/react-dom/component/web.ts +0 -129
  298. package/src/subPackages/react-dom/jsx/node.ts +0 -150
  299. package/src/subPackages/react-dom/jsx/web.ts +0 -117
  300. package/src/subPackages/react-test-renderer/component/index.ts +0 -101
  301. package/src/subPackages/react-test-renderer/component/node.ts +0 -30
  302. package/src/subPackages/react-test-renderer/component/web.ts +0 -30
  303. package/src/subPackages/react-test-renderer/fc/node.tsx +0 -77
  304. package/src/subPackages/react-test-renderer/jsx/index.ts +0 -51
  305. package/src/subPackages/react-test-renderer/jsx/node.ts +0 -31
  306. package/src/subPackages/react-test-renderer/jsx/web.ts +0 -31
  307. /package/dist/common/{subPackages/react-test-renderer/jsx → SubPackages/react-test-renderer/jsx-promised}/web.js +0 -0
  308. /package/dist/{types/electron.d.ts → module/SubPackages/react-dom/jsx/index.js} +0 -0
  309. /package/dist/module/{subPackages/react-test-renderer/jsx → SubPackages/react-test-renderer/jsx-promised}/web.js +0 -0
@@ -0,0 +1,553 @@
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
+ for (const [whenNdx, whenStep] of this.whens.entries()) {
234
+ await whenStep.test(this.store, testResourceConfiguration, tLog, pm, `suite-${suiteNdx}/given-${key}/when/${whenNdx}`);
235
+ }
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}`);
238
+ tester(t);
239
+ }
240
+ }
241
+ catch (e) {
242
+ this.error = e;
243
+ tLog(e);
244
+ tLog("\u0007"); // bell
245
+ // throw e;
246
+ }
247
+ finally {
248
+ try {
249
+ // const afterEachProxy = new Proxy(pm, {
250
+ // get(target, prop, receiver) {
251
+ // if (prop === "writeFileSync") {
252
+ // console.log("afterEachProxy", arguments, target[prop]);
253
+ // return (fp, contents) =>
254
+ // // target[prop](`${key}/andWhen/${fp}`, contents);
255
+ // target[prop](`${key}/afterEach/${fp}`, contents);
256
+ // }
257
+ // return Reflect.get(...arguments);
258
+ // },
259
+ // });
260
+ // await this.afterEach(this.store, key, givenArtifactory, afterEachProxy);
261
+ // await this.afterEach(this.store, key, givenArtifactory, pm);
262
+ const afterEachProxy = new Proxy(pm, {
263
+ get(target, prop, receiver) {
264
+ if (prop === "writeFileSync") {
265
+ return (fp, contents) => target[prop](`suite-${suiteNdx}/given-${key}/afterAll/${fp}`, contents);
266
+ }
267
+ if (prop === "browser") {
268
+ return new Proxy(target[prop], {
269
+ get(bTarget, bProp, bReceiver) {
270
+ if (bProp === "pages") {
271
+ return async () => {
272
+ return bTarget.pages().then((pages) => {
273
+ return pages.map((page) => {
274
+ return new Proxy(page, {
275
+ get(pTarget, pProp, pReciever) {
276
+ if (pProp === "screenshot") {
277
+ return async (x) => {
278
+ // console.log(
279
+ // "custom-screenshot-MARK-afterEachProxy",
280
+ // window["custom-screenshot"].toString()
281
+ // );
282
+ return pm.customScreenShot(Object.assign(Object.assign({}, x), { path: `${testResourceConfiguration.fs}/suite-${suiteNdx}/given-${key}/afterEach` +
283
+ "/" +
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
+ // });
292
+ };
293
+ }
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") {
310
+ // return () => target[pProp](...arguments);
311
+ // }
312
+ else {
313
+ return Reflect.get(...arguments);
314
+ }
315
+ },
316
+ });
317
+ });
318
+ });
319
+ // return (await target.pages()).map((page) => {
320
+ // return new Proxy(page, handler2);
321
+ // });
322
+ };
323
+ }
324
+ },
325
+ });
326
+ }
327
+ return Reflect.get(...arguments);
328
+ },
329
+ });
330
+ await this.afterEach(this.store, key, givenArtifactory, afterEachProxy);
331
+ }
332
+ catch (e) {
333
+ console.error("afterEach failed! no error will be recorded!", e);
334
+ }
335
+ }
336
+ return this.store;
337
+ }
338
+ }
339
+ exports.BaseGiven = BaseGiven;
340
+ class BaseWhen {
341
+ constructor(name, whenCB) {
342
+ this.name = name;
343
+ this.whenCB = whenCB;
344
+ }
345
+ toObj() {
346
+ return {
347
+ name: this.name,
348
+ error: this.error,
349
+ };
350
+ }
351
+ async test(store, testResourceConfiguration, tLog, pm, key) {
352
+ tLog(" When:", this.name);
353
+ const name = this.name;
354
+ const andWhenProxy = new Proxy(pm, {
355
+ get(target, prop, receiver) {
356
+ if (prop === "writeFileSync") {
357
+ return (fp, contents) =>
358
+ // target[prop](`${key}/andWhen/${fp}`, contents);
359
+ target[prop](`${key}/andWhen/${fp}`, contents);
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
+ ///////////////////////
420
+ return Reflect.get(...arguments);
421
+ },
422
+ });
423
+ try {
424
+ return await this.andWhen(store, this.whenCB, testResourceConfiguration, andWhenProxy);
425
+ }
426
+ catch (e) {
427
+ this.error = true;
428
+ throw e;
429
+ }
430
+ }
431
+ }
432
+ exports.BaseWhen = BaseWhen;
433
+ class BaseThen {
434
+ constructor(name, thenCB) {
435
+ this.name = name;
436
+ this.thenCB = thenCB;
437
+ this.error = false;
438
+ }
439
+ toObj() {
440
+ return {
441
+ name: this.name,
442
+ error: this.error,
443
+ };
444
+ }
445
+ async test(store, testResourceConfiguration, tLog, pm, filepath) {
446
+ tLog(" Then:", this.name);
447
+ try {
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
+ );
513
+ return x;
514
+ }
515
+ catch (e) {
516
+ console.log("test failed", e);
517
+ this.error = e.message;
518
+ throw e;
519
+ }
520
+ }
521
+ }
522
+ exports.BaseThen = BaseThen;
523
+ class BaseCheck {
524
+ constructor(name, features, checkCB, whens, thens) {
525
+ this.name = name;
526
+ this.features = features;
527
+ this.checkCB = checkCB;
528
+ this.whens = whens;
529
+ this.thens = thens;
530
+ }
531
+ async afterEach(store, key, cb, pm) {
532
+ return;
533
+ }
534
+ async check(subject, key, testResourceConfiguration, tester, artifactory, tLog, pm) {
535
+ tLog(`\n Check: ${this.name}`);
536
+ const store = await this.checkThat(subject, testResourceConfiguration, artifactory);
537
+ await this.checkCB(Object.entries(this.whens).reduce((a, [key, when]) => {
538
+ a[key] = async (payload) => {
539
+ return await when(payload, testResourceConfiguration).test(store, testResourceConfiguration, tLog, pm, "x");
540
+ };
541
+ return a;
542
+ }, {}), Object.entries(this.thens).reduce((a, [key, then]) => {
543
+ a[key] = async (payload) => {
544
+ const t = await then(payload, testResourceConfiguration).test(store, testResourceConfiguration, tLog, pm);
545
+ tester(t);
546
+ };
547
+ return a;
548
+ }, {}));
549
+ await this.afterEach(store, key, () => { }, pm);
550
+ return;
551
+ }
552
+ }
553
+ exports.BaseCheck = BaseCheck;
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BaseBuilder = void 0;
4
+ class BaseBuilder {
5
+ constructor(input, suitesOverrides, givenOverides, whenOverides, thenOverides, checkOverides, testResourceRequirement, testSpecification) {
6
+ this.input = input;
7
+ this.artifacts = [];
8
+ this.artifacts = [];
9
+ this.testResourceRequirement = testResourceRequirement;
10
+ this.suitesOverrides = suitesOverrides;
11
+ this.givenOverides = givenOverides;
12
+ this.whenOverides = whenOverides;
13
+ this.thenOverides = thenOverides;
14
+ this.checkOverides = checkOverides;
15
+ this.testSpecification = testSpecification;
16
+ this.specs = testSpecification(this.Suites(), this.Given(), this.When(), this.Then(), this.Check());
17
+ this.testJobs = this.specs.map((suite) => {
18
+ const suiteRunner = (suite) => async (puppetMaster, tLog) => {
19
+ await puppetMaster.startPuppeteer({
20
+ browserWSEndpoint: puppetMaster.testResourceConfiguration.browserWSEndpoint,
21
+ }, puppetMaster.testResourceConfiguration.fs);
22
+ return await suite.run(input, puppetMaster.testResourceConfiguration, (fPath, value) => puppetMaster.testArtiFactoryfileWriter(tLog, (p) => {
23
+ this.artifacts.push(p);
24
+ })(puppetMaster.testResourceConfiguration.fs + "/" + fPath, value), tLog, puppetMaster);
25
+ };
26
+ const runner = suiteRunner(suite);
27
+ return {
28
+ test: suite,
29
+ toObj: () => {
30
+ return suite.toObj();
31
+ },
32
+ runner,
33
+ receiveTestResourceConfig: async function (puppetMaster) {
34
+ await puppetMaster.mkdirSync();
35
+ const logFilePath = "log.txt";
36
+ const access = await puppetMaster.createWriteStream(logFilePath);
37
+ const tLog = (...l) => {
38
+ puppetMaster.write(access, `${l.toString()}\n`);
39
+ };
40
+ const suiteDone = await runner(puppetMaster, tLog);
41
+ const logPromise = new Promise((res, rej) => {
42
+ puppetMaster.end(access);
43
+ res(true);
44
+ });
45
+ const numberOfFailures = Object.keys(suiteDone.givens).filter((k) => {
46
+ return suiteDone.givens[k].error;
47
+ }).length;
48
+ puppetMaster.writeFileSync(`exitcode`, numberOfFailures.toString());
49
+ puppetMaster.writeFileSync(`tests.json`, JSON.stringify(this.toObj(), null, 2));
50
+ console.log(`exiting gracefully with ${numberOfFailures} failures.`);
51
+ return {
52
+ failed: numberOfFailures,
53
+ artifacts: this.artifacts || [],
54
+ logPromise,
55
+ };
56
+ },
57
+ };
58
+ });
59
+ }
60
+ Specs() {
61
+ return this.specs;
62
+ }
63
+ Suites() {
64
+ return this.suitesOverrides;
65
+ }
66
+ Given() {
67
+ return this.givenOverides;
68
+ }
69
+ When() {
70
+ return this.whenOverides;
71
+ }
72
+ Then() {
73
+ return this.thenOverides;
74
+ }
75
+ Check() {
76
+ return this.checkOverides;
77
+ }
78
+ }
79
+ exports.BaseBuilder = BaseBuilder;