testeranto 0.167.0 → 0.172.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.
Files changed (185) hide show
  1. package/dist/common/src/NavBar.js +45 -0
  2. package/dist/common/src/PM/main.js +81 -59
  3. package/dist/common/src/Pure.js +16 -14
  4. package/dist/common/src/ReportServer.js +48 -5
  5. package/dist/common/src/Web.js +35 -20
  6. package/dist/common/src/components/SunriseAnimation.test/implementation.js +1 -0
  7. package/dist/common/src/components/SunriseAnimation.test/index.js +1 -0
  8. package/dist/common/src/components/SunriseAnimation.test/interface.js +1 -0
  9. package/dist/common/src/components/SunriseAnimation.test/specification.js +1 -0
  10. package/dist/common/src/components/TestStatusBadge.js +55 -0
  11. package/dist/common/src/components/pure/ProjectPageView.js +204 -0
  12. package/dist/common/src/components/pure/ProjectPageView.test/adapter.js +20 -0
  13. package/dist/common/src/components/pure/ProjectPageView.test/implementation.js +71 -0
  14. package/dist/common/src/components/pure/ProjectPageView.test/index.js +10 -0
  15. package/dist/common/src/components/pure/ProjectPageView.test/specification.js +19 -0
  16. package/dist/common/src/components/pure/ProjectPageView.test/types.js +2 -0
  17. package/dist/common/src/lib/BaseSuite.js +3 -3
  18. package/dist/common/src/lib/BaseSuite.test/test.js +1 -1
  19. package/dist/common/src/lib/abstractBase.js +41 -14
  20. package/dist/common/src/lib/baseBuilder.test/baseBuilder.test.adapter.js +1 -1
  21. package/dist/common/src/lib/pmProxy.js +185 -64
  22. package/dist/common/testeranto.config.js +6 -0
  23. package/dist/common/tsconfig.common.tsbuildinfo +1 -1
  24. package/dist/module/src/App.js +3 -3
  25. package/dist/module/src/PM/main.js +81 -59
  26. package/dist/module/src/ProjectsPage.js +1 -110
  27. package/dist/module/src/Pure.js +16 -14
  28. package/dist/module/src/ReportServer.js +48 -5
  29. package/dist/module/src/TestPage.js +45 -16
  30. package/dist/module/src/Web.js +35 -20
  31. package/dist/module/src/components/SunriseAnimation.test/implementation.js +1 -0
  32. package/dist/module/src/components/SunriseAnimation.test/index.js +1 -0
  33. package/dist/module/src/components/SunriseAnimation.test/interface.js +1 -0
  34. package/dist/module/src/components/SunriseAnimation.test/specification.js +1 -0
  35. package/dist/module/src/components/pure/ProjectPageView.js +197 -0
  36. package/dist/module/src/components/pure/ProjectPageView.test/adapter.js +17 -0
  37. package/dist/module/src/components/pure/ProjectPageView.test/implementation.js +68 -0
  38. package/dist/module/src/components/pure/ProjectPageView.test/index.js +5 -0
  39. package/dist/module/src/components/pure/ProjectPageView.test/specification.js +15 -0
  40. package/dist/module/src/components/pure/ProjectPageView.test/types.js +1 -0
  41. package/dist/module/src/components/pure/ProjectsPageView.js +58 -0
  42. package/dist/module/src/components/pure/TestPageView.js +136 -0
  43. package/dist/module/src/components/stateful/ProjectPage.js +63 -0
  44. package/dist/module/src/components/stateful/ProjectsPage.js +55 -0
  45. package/dist/module/src/components/stateful/TestPage.js +82 -0
  46. package/dist/module/src/lib/BaseSuite.js +3 -3
  47. package/dist/module/src/lib/BaseSuite.test/test.js +1 -1
  48. package/dist/module/src/lib/abstractBase.js +41 -14
  49. package/dist/module/src/lib/baseBuilder.test/baseBuilder.test.adapter.js +1 -1
  50. package/dist/module/src/lib/pmProxy.js +185 -64
  51. package/dist/module/testeranto.config.js +6 -0
  52. package/dist/module/tsconfig.module.tsbuildinfo +1 -1
  53. package/dist/prebuild/App.css +13 -9
  54. package/dist/prebuild/App.js +600 -551
  55. package/dist/prebuild/ReportServer.mjs +44 -4
  56. package/dist/prebuild/run.mjs +67 -39
  57. package/dist/types/src/NavBar.d.ts +19 -0
  58. package/dist/types/src/PM/index.d.ts +3 -1
  59. package/dist/types/src/PM/main.d.ts +0 -4
  60. package/dist/types/src/PM/node.d.ts +2 -2
  61. package/dist/types/src/components/SunriseAnimation.test/interface.d.ts +0 -0
  62. package/dist/types/src/components/SunriseAnimation.test/specification.d.ts +0 -0
  63. package/dist/types/src/components/TestStatusBadge.d.ts +15 -0
  64. package/dist/types/src/components/pure/ProjectPageView.d.ts +14 -0
  65. package/dist/types/src/components/pure/ProjectPageView.test/adapter.d.ts +3 -0
  66. package/dist/types/src/components/pure/ProjectPageView.test/implementation.d.ts +3 -0
  67. package/dist/types/src/components/pure/ProjectPageView.test/index.d.ts +2 -0
  68. package/dist/types/src/components/pure/ProjectPageView.test/specification.d.ts +3 -0
  69. package/dist/types/src/components/pure/ProjectPageView.test/types.d.ts +39 -0
  70. package/dist/types/src/lib/BaseSuite.d.ts +2 -0
  71. package/dist/types/src/lib/abstractBase.d.ts +12 -0
  72. package/dist/types/tsconfig.types.tsbuildinfo +1 -1
  73. package/package.json +5 -3
  74. package/src/App.tsx +5 -9
  75. package/src/PM/index.ts +1 -1
  76. package/src/PM/main.ts +87 -82
  77. package/src/PM/node.ts +2 -2
  78. package/src/ProjectsPage.tsx +1 -164
  79. package/src/Pure.ts +16 -16
  80. package/src/ReportServer.ts +49 -6
  81. package/src/TestPage.tsx +78 -5
  82. package/src/Web.ts +35 -35
  83. package/src/components/SunriseAnimation.test/implementation.ts +0 -0
  84. package/src/components/SunriseAnimation.test/index.ts +0 -0
  85. package/src/components/SunriseAnimation.test/interface.ts +0 -0
  86. package/src/components/SunriseAnimation.test/specification.ts +0 -0
  87. package/src/components/pure/ProjectPageView.test/adapter.ts +21 -0
  88. package/src/components/pure/ProjectPageView.test/implementation.tsx +84 -0
  89. package/src/components/pure/ProjectPageView.test/index.ts +8 -0
  90. package/src/components/pure/ProjectPageView.test/specification.ts +31 -0
  91. package/src/components/pure/ProjectPageView.test/types.ts +55 -0
  92. package/src/components/pure/ProjectPageView.tsx +332 -0
  93. package/src/components/pure/ProjectsPageView.tsx +99 -0
  94. package/src/components/pure/TestPageView.tsx +278 -0
  95. package/src/components/stateful/ProjectPage.tsx +83 -0
  96. package/src/components/stateful/ProjectsPage.tsx +73 -0
  97. package/src/components/stateful/TestPage.tsx +107 -0
  98. package/src/lib/BaseSuite.test/test.ts +1 -1
  99. package/src/lib/BaseSuite.ts +9 -4
  100. package/src/lib/abstractBase.ts +45 -14
  101. package/src/lib/baseBuilder.test/baseBuilder.test.adapter.ts +1 -1
  102. package/src/lib/pmProxy.ts +184 -87
  103. package/testeranto/App.css +13 -9
  104. package/testeranto/App.js +600 -551
  105. package/testeranto/bundles/node/allTests/{chunk-4ONUZRZ4.mjs → chunk-3EUGBAOM.mjs} +1 -1
  106. package/testeranto/bundles/node/allTests/{chunk-IDCUSTSM.mjs → chunk-E75CSRER.mjs} +246 -115
  107. package/testeranto/bundles/node/allTests/{chunk-NQEP7SN4.mjs → chunk-M6DO7VMB.mjs} +1 -1
  108. package/testeranto/bundles/node/allTests/metafile.json +37 -37
  109. package/testeranto/bundles/node/allTests/src/lib/BaseSuite.test/node.test.mjs +4 -4
  110. package/testeranto/bundles/node/allTests/src/lib/baseBuilder.test/baseBuilder.test.node.mjs +3 -3
  111. package/testeranto/bundles/node/allTests/src/lib/classBuilder.test/classBuilder.test.mjs +3 -3
  112. package/testeranto/bundles/node/allTests/src/lib/core.test/core.test.mjs +2 -17
  113. package/testeranto/bundles/node/allTests/src/lib/pmProxy.test/index.mjs +354 -252
  114. package/testeranto/bundles/pure/allTests/{chunk-5SBJWHSZ.mjs → chunk-KHDVEHF7.mjs} +2 -17
  115. package/testeranto/bundles/pure/allTests/{chunk-4ULDTZFU.mjs → chunk-VMUSFSZM.mjs} +246 -115
  116. package/testeranto/bundles/pure/allTests/metafile.json +72 -42
  117. package/testeranto/bundles/pure/allTests/src/Pure.test.mjs +2 -2
  118. package/testeranto/bundles/pure/allTests/src/lib/BaseSuite.test/pure.test.mjs +3 -3
  119. package/testeranto/bundles/pure/allTests/src/lib/baseBuilder.test/baseBuilder.test.pure.mjs +2 -29
  120. package/testeranto/bundles/web/allTests/chunk-HPYA4YZC.mjs +2283 -0
  121. package/testeranto/bundles/web/allTests/{chunk-46E6YGGN.mjs → chunk-U7AW26HL.mjs} +292 -142
  122. package/testeranto/bundles/web/allTests/metafile.json +22 -943
  123. package/testeranto/bundles/web/allTests/src/components/pure/ProjectPageView.test/index.html +19 -0
  124. package/testeranto/bundles/web/allTests/src/components/pure/ProjectPageView.test/index.mjs +37524 -0
  125. package/testeranto/bundles/web/allTests/src/lib/BaseSuite.test/web.test.mjs +20 -2
  126. package/testeranto/bundles/web/allTests/src/lib/baseBuilder.test/baseBuilder.test.web.mjs +26 -2
  127. package/testeranto/reports/allTests/config.json +8 -0
  128. package/testeranto/reports/allTests/src/Pure.test/pure/type_errors.txt +9 -3
  129. package/testeranto/reports/allTests/src/components/pure/ProjectPageView.test/index/web/bdd_errors.txt +1 -0
  130. package/testeranto/reports/allTests/src/components/pure/ProjectPageView.test/index/web/lint_errors.txt +13 -0
  131. package/testeranto/reports/allTests/src/components/pure/ProjectPageView.test/index/web/logs.txt +50 -0
  132. package/testeranto/reports/allTests/src/components/pure/ProjectPageView.test/index/web/message.txt +2 -0
  133. package/testeranto/reports/allTests/src/components/pure/ProjectPageView.test/index/web/prompt.txt +17 -0
  134. package/testeranto/reports/allTests/src/components/pure/ProjectPageView.test/index/web/tests.json +32 -0
  135. package/testeranto/reports/allTests/src/components/pure/ProjectPageView.test/index/web/type_errors.txt +68 -0
  136. package/testeranto/reports/allTests/src/lib/BaseSuite.test/node.test/node/logs.txt +22 -39
  137. package/testeranto/reports/allTests/src/lib/BaseSuite.test/node.test/node/tests.json +6 -3
  138. package/testeranto/reports/allTests/src/lib/BaseSuite.test/node.test/node/type_errors.txt +8 -1
  139. package/testeranto/reports/allTests/src/lib/BaseSuite.test/pure.test/pure/tests.json +6 -3
  140. package/testeranto/reports/allTests/src/lib/BaseSuite.test/pure.test/pure/type_errors.txt +9 -3
  141. package/testeranto/reports/allTests/src/lib/BaseSuite.test/web.test/web/logs.txt +66 -55
  142. package/testeranto/reports/allTests/src/lib/BaseSuite.test/web.test/web/prompt.txt +2 -2
  143. package/testeranto/reports/allTests/src/lib/BaseSuite.test/web.test/web/tests.json +6 -3
  144. package/testeranto/reports/allTests/src/lib/BaseSuite.test/web.test/web/type_errors.txt +10 -5
  145. package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.node/node/logs.txt +16 -48
  146. package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.node/node/tests.json +18 -9
  147. package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.node/node/type_errors.txt +8 -1
  148. package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.pure/pure/type_errors.txt +10 -5
  149. package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.web/web/logs.txt +62 -33
  150. package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.web/web/prompt.txt +2 -2
  151. package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.web/web/tests.json +18 -9
  152. package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.web/web/type_errors.txt +10 -5
  153. package/testeranto/reports/allTests/src/lib/classBuilder.test/classBuilder.test/node/logs.txt +37 -50
  154. package/testeranto/reports/allTests/src/lib/classBuilder.test/classBuilder.test/node/tests.json +36 -18
  155. package/testeranto/reports/allTests/src/lib/classBuilder.test/classBuilder.test/node/type_errors.txt +8 -1
  156. package/testeranto/reports/allTests/src/lib/core.test/core.test/node/logs.txt +2 -2
  157. package/testeranto/reports/allTests/src/lib/core.test/core.test/node/type_errors.txt +9 -3
  158. package/testeranto/reports/allTests/src/lib/pmProxy.test/index/node/logs.txt +28 -43
  159. package/testeranto/reports/allTests/src/lib/pmProxy.test/index/node/tests.json +28 -14
  160. package/testeranto/reports/allTests/src/lib/pmProxy.test/index/node/type_errors.txt +8 -1
  161. package/testeranto/reports/allTests/summary.json +15 -8
  162. package/testeranto/reportsnode_build_errors +20 -0
  163. package/testeranto/reportspure_build_errors +343 -0
  164. package/testeranto/reportsweb_build_errors +25 -0
  165. package/testeranto.config.ts +7 -0
  166. package/tsc.log +100 -26
  167. package/dist/tsconfig.tsbuildinfo +0 -1
  168. package/testeranto/bundles/node/allTests/chunk-FFBRDUBH.mjs +0 -677
  169. package/testeranto/bundles/node/allTests/chunk-H2IBV7SY.mjs +0 -113
  170. package/testeranto/bundles/node/allTests/chunk-ZHOULXPN.mjs +0 -252
  171. package/testeranto/bundles/pure/allTests/chunk-CSMXYJ65.mjs +0 -200
  172. package/testeranto/bundles/pure/allTests/chunk-QK4IXLF6.mjs +0 -674
  173. package/testeranto/bundles/web/allTests/chunk-TU3MJSSI.mjs +0 -855
  174. package/testeranto/bundles/web/allTests/src/lib/BaseSuite.test/web.test/manifest.json +0 -1
  175. package/testeranto/bundles/web/allTests/src/lib/baseBuilder.test/baseBuilder.test.web/manifest.json +0 -1
  176. package/testeranto/reports/allTests/src/Pure.test/pure/manifest.json +0 -1
  177. package/testeranto/reports/allTests/src/lib/BaseSuite.test/node.test/node/manifest.json +0 -1
  178. package/testeranto/reports/allTests/src/lib/BaseSuite.test/pure.test/pure/manifest.json +0 -1
  179. package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.node/node/manifest.json +0 -1
  180. package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.pure/pure/manifest.json +0 -1
  181. package/testeranto/reports/allTests/src/lib/classBuilder.test/classBuilder.test/node/manifest.json +0 -1
  182. package/testeranto/reports/allTests/src/lib/core.test/core.test/node/manifest.json +0 -1
  183. package/testeranto/reports/allTests/src/lib/pmProxy.test/index/node/manifest.json +0 -1
  184. /package/{testeranto/reports/allTests/src/Pure.test/pure/logs.txt → dist/types/src/components/SunriseAnimation.test/implementation.d.ts} +0 -0
  185. /package/{testeranto/reports/allTests/src/lib/BaseSuite.test/pure.test/pure/logs.txt → dist/types/src/components/SunriseAnimation.test/index.d.ts} +0 -0
@@ -1,855 +0,0 @@
1
- // src/lib/pmProxy.ts
2
- var baseProxy = function(pm, mappings) {
3
- return new Proxy(pm, {
4
- get: (target, prop, receiver) => {
5
- for (const mapping of mappings) {
6
- const method = mapping[0];
7
- const arger = mapping[1];
8
- if (prop === method) {
9
- return (...x) => target[prop](arger(...x));
10
- }
11
- }
12
- return (...x) => target[prop](...x);
13
- }
14
- });
15
- };
16
- var butThenProxy = (pm, filepath) => baseProxy(pm, [
17
- [
18
- "screencast",
19
- (opts2, p) => [
20
- {
21
- ...opts2,
22
- path: `${filepath}/butThen/${opts2.path}`
23
- },
24
- p
25
- ]
26
- ],
27
- ["createWriteStream", (fp) => [`${filepath}/butThen/${fp}`]],
28
- [
29
- "writeFileSync",
30
- (fp, contents) => [`${filepath}/butThen/${fp}`, contents]
31
- ],
32
- [
33
- "customScreenShot",
34
- (opts2, p) => [
35
- {
36
- ...opts2,
37
- path: `${filepath}/butThen/${opts2.path}`
38
- },
39
- p
40
- ]
41
- ]
42
- ]);
43
- var andWhenProxy = (pm, filepath) => baseProxy(pm, [
44
- [
45
- "screencast",
46
- (opts2, p) => [
47
- {
48
- ...opts2,
49
- path: `${filepath}/andWhen/${opts2.path}`
50
- },
51
- p
52
- ]
53
- ],
54
- ["createWriteStream", (fp) => [`${filepath}/andWhen/${fp}`]],
55
- ["writeFileSync", (fp, contents) => [`${filepath}/andWhen${fp}`, contents]],
56
- [
57
- "customScreenShot",
58
- (opts2, p) => [
59
- {
60
- ...opts2,
61
- path: `${filepath}/andWhen${opts2.path}`
62
- },
63
- p
64
- ]
65
- ]
66
- ]);
67
- var afterEachProxy = (pm, suite, given) => baseProxy(pm, [
68
- [
69
- "screencast",
70
- (opts2, p) => [
71
- {
72
- ...opts2,
73
- path: `suite-${suite}/given-${given}/afterEach/${opts2.path}`
74
- },
75
- p
76
- ]
77
- ],
78
- ["createWriteStream", (fp) => [`suite-${suite}/afterEach/${fp}`]],
79
- [
80
- "writeFileSync",
81
- (fp, contents) => [
82
- `suite-${suite}/given-${given}/afterEach/${fp}`,
83
- contents
84
- ]
85
- ],
86
- [
87
- "customScreenShot",
88
- (opts2, p) => [
89
- {
90
- ...opts2,
91
- path: `suite-${suite}/given-${given}/afterEach/${opts2.path}`
92
- },
93
- p
94
- ]
95
- ]
96
- ]);
97
- var beforeEachProxy = (pm, suite) => baseProxy(pm, [
98
- [
99
- "screencast",
100
- (opts2, p) => [
101
- {
102
- ...opts2,
103
- path: `suite-${suite}/beforeEach/${opts2.path}`
104
- },
105
- p
106
- ]
107
- ],
108
- [
109
- "writeFileSync",
110
- (fp, contents) => [`suite-${suite}/beforeEach/${fp}`, contents]
111
- ],
112
- [
113
- "customScreenShot",
114
- (opts2, p) => [
115
- {
116
- ...opts2,
117
- path: `suite-${suite}/beforeEach/${opts2.path}`
118
- },
119
- p
120
- ]
121
- ],
122
- ["createWriteStream", (fp) => [`suite-${suite}/beforeEach/${fp}`]]
123
- ]);
124
- var beforeAllProxy = (pm, suite) => baseProxy(pm, [
125
- [
126
- "writeFileSync",
127
- (fp, contents) => [`suite-${suite}/beforeAll/${fp}`, contents]
128
- ],
129
- [
130
- "customScreenShot",
131
- (opts2, p) => [
132
- {
133
- ...opts2,
134
- path: `suite-${suite}/beforeAll/${opts2.path}`
135
- },
136
- p
137
- ]
138
- ],
139
- ["createWriteStream", (fp) => [`suite-${suite}/beforeAll/${fp}`]]
140
- ]);
141
- var afterAllProxy = (pm, suite) => baseProxy(pm, [
142
- ["createWriteStream", (fp) => [`suite-${suite}/afterAll/${fp}`]],
143
- [
144
- "writeFileSync",
145
- (fp, contents) => [`suite-${suite}/afterAll/${fp}`, contents]
146
- ],
147
- [
148
- "customScreenShot",
149
- (opts2, p) => [
150
- {
151
- ...opts2,
152
- path: `suite-${suite}/afterAll/${opts2.path}`
153
- },
154
- p
155
- ]
156
- ]
157
- ]);
158
-
159
- // src/lib/BaseSuite.ts
160
- var BaseSuite = class {
161
- constructor(name, index, givens = {}) {
162
- const suiteName = name || "testSuite";
163
- if (!suiteName) {
164
- throw new Error("BaseSuite requires a non-empty name");
165
- }
166
- console.log("[DEBUG] BaseSuite constructor - name:", suiteName, "index:", index);
167
- this.name = suiteName;
168
- this.index = index;
169
- this.givens = givens;
170
- this.fails = 0;
171
- console.log("[DEBUG] BaseSuite initialized:", this.name, this.index);
172
- console.log("[DEBUG] BaseSuite givens:", Object.keys(givens));
173
- }
174
- features() {
175
- try {
176
- const features = Object.keys(this.givens).map((k) => this.givens[k].features).flat().filter((value, index, array) => {
177
- return array.indexOf(value) === index;
178
- });
179
- console.debug("[DEBUG] Features extracted:", features);
180
- return features || [];
181
- } catch (e) {
182
- console.error("[ERROR] Failed to extract features:", e);
183
- return [];
184
- }
185
- }
186
- toObj() {
187
- const givens = Object.keys(this.givens).map((k) => this.givens[k].toObj());
188
- return {
189
- name: this.name,
190
- givens,
191
- fails: this.fails,
192
- failed: this.failed,
193
- features: this.features()
194
- };
195
- }
196
- setup(s, artifactory, tr, pm) {
197
- return new Promise((res) => res(s));
198
- }
199
- assertThat(t) {
200
- return !!t;
201
- }
202
- afterAll(store, artifactory, pm) {
203
- return store;
204
- }
205
- async run(input, testResourceConfiguration, artifactory, tLog, pm) {
206
- this.testResourceConfiguration = testResourceConfiguration;
207
- const suiteArtifactory = (fPath, value) => artifactory(`suite-${this.index}-${this.name}/${fPath}`, value);
208
- tLog("\nSuite:", this.index, this.name);
209
- const sNdx = this.index;
210
- const subject = await this.setup(
211
- input,
212
- suiteArtifactory,
213
- testResourceConfiguration,
214
- beforeAllProxy(pm, sNdx.toString())
215
- );
216
- for (const [gKey, g] of Object.entries(this.givens)) {
217
- const giver = this.givens[gKey];
218
- this.store = await giver.give(
219
- subject,
220
- gKey,
221
- testResourceConfiguration,
222
- this.assertThat,
223
- suiteArtifactory,
224
- tLog,
225
- pm,
226
- sNdx
227
- ).catch((e) => {
228
- this.failed = true;
229
- this.fails = this.fails + 1;
230
- console.error("Given error 1:", e);
231
- throw e;
232
- });
233
- }
234
- try {
235
- this.afterAll(
236
- this.store,
237
- artifactory,
238
- afterAllProxy(pm, sNdx.toString())
239
- );
240
- } catch (e) {
241
- console.error(e);
242
- }
243
- return this;
244
- }
245
- };
246
-
247
- // src/PM/index.ts
248
- var PM = class {
249
- };
250
-
251
- // src/PM/web.ts
252
- var PM_Web = class extends PM {
253
- constructor(t) {
254
- super();
255
- this.testResourceConfiguration = t;
256
- }
257
- start() {
258
- return new Promise((r) => r());
259
- }
260
- stop() {
261
- return new Promise((r) => r());
262
- }
263
- getInnerHtml(selector, page2) {
264
- throw new Error("web.ts getInnHtml not implemented");
265
- }
266
- pages() {
267
- throw new Error("Method not implemented.");
268
- }
269
- stopSideCar(n) {
270
- return window["stopSideCar"](n, this.testResourceConfiguration.name);
271
- }
272
- launchSideCar(n) {
273
- return window["launchSideCar"](n, this.testResourceConfiguration.name);
274
- }
275
- waitForSelector(p, s) {
276
- return window["waitForSelector"](p, s);
277
- }
278
- screencast(o, p) {
279
- return window["screencast"](
280
- {
281
- ...opts,
282
- path: this.testResourceConfiguration.fs + "/" + opts.path
283
- },
284
- page.mainFrame()._id,
285
- this.testResourceConfiguration.name
286
- );
287
- }
288
- screencastStop(recorder) {
289
- return window["screencastStop"](recorder);
290
- }
291
- closePage(p) {
292
- return window["closePage"](p);
293
- }
294
- goto(p, url) {
295
- return window["goto"](p, url);
296
- }
297
- newPage() {
298
- return window["newPage"]();
299
- }
300
- $(selector) {
301
- return window["$"](selector);
302
- }
303
- isDisabled(selector) {
304
- return window["isDisabled"](selector);
305
- }
306
- getAttribute(selector, attribute) {
307
- return window["getAttribute"](selector, attribute);
308
- }
309
- getValue(selector) {
310
- return window["getValue"](selector);
311
- }
312
- focusOn(selector) {
313
- return window["focusOn"](selector);
314
- }
315
- typeInto(value) {
316
- return window["typeInto"](value);
317
- }
318
- async page(x) {
319
- return window["page"](x);
320
- }
321
- click(selector) {
322
- return window["click"](selector);
323
- }
324
- customScreenShot(x, y) {
325
- const opts2 = x[0];
326
- const page2 = x[1];
327
- console.log("customScreenShot 2 opts", opts2);
328
- console.log("customScreenShot 2 page", page2);
329
- return window["customScreenShot"](
330
- {
331
- ...opts2,
332
- path: this.testResourceConfiguration.fs + "/" + opts2.path
333
- },
334
- this.testResourceConfiguration.name,
335
- page2
336
- );
337
- }
338
- existsSync(destFolder) {
339
- return window["existsSync"](destFolder);
340
- }
341
- mkdirSync(x) {
342
- return window["mkdirSync"](this.testResourceConfiguration.fs + "/");
343
- }
344
- write(uid, contents) {
345
- return window["write"](uid, contents);
346
- }
347
- writeFileSync(filepath, contents) {
348
- return window["writeFileSync"](
349
- this.testResourceConfiguration.fs + "/" + filepath,
350
- contents,
351
- this.testResourceConfiguration.name
352
- );
353
- }
354
- createWriteStream(filepath) {
355
- return window["createWriteStream"](
356
- this.testResourceConfiguration.fs + "/" + filepath,
357
- this.testResourceConfiguration.name
358
- );
359
- }
360
- end(uid) {
361
- return window["end"](uid);
362
- }
363
- customclose() {
364
- window["customclose"](
365
- this.testResourceConfiguration.fs,
366
- this.testResourceConfiguration.name
367
- );
368
- }
369
- testArtiFactoryfileWriter(tLog, callback) {
370
- return (fPath, value) => {
371
- callback(
372
- new Promise((res, rej) => {
373
- tLog("testArtiFactory =>", fPath);
374
- })
375
- );
376
- };
377
- }
378
- };
379
-
380
- // src/lib/index.ts
381
- var BaseAdapter = () => ({
382
- beforeAll: async (s) => s,
383
- beforeEach: async function(subject, initialValues, x, testResource, pm) {
384
- return subject;
385
- },
386
- afterEach: async (s) => s,
387
- afterAll: (store) => void 0,
388
- butThen: async (store, thenCb) => {
389
- return thenCb(store);
390
- },
391
- andWhen: async (store, whenCB, testResource, pm) => {
392
- try {
393
- await whenCB(store, testResource, pm);
394
- } catch (error) {
395
- console.error("Error in andWhen:", error);
396
- throw error;
397
- }
398
- },
399
- assertThis: (x) => x
400
- });
401
- var DefaultAdapter = (p) => {
402
- return {
403
- ...BaseAdapter,
404
- ...p
405
- };
406
- };
407
- var defaultTestResourceRequirement = {
408
- ports: 0
409
- };
410
-
411
- // src/lib/abstractBase.ts
412
- var BaseGiven = class {
413
- constructor(name, features, whens, thens, givenCB, initialValues) {
414
- this.name = name;
415
- this.features = features;
416
- this.whens = whens;
417
- this.thens = thens;
418
- this.givenCB = givenCB;
419
- this.initialValues = initialValues;
420
- }
421
- beforeAll(store) {
422
- return store;
423
- }
424
- toObj() {
425
- return {
426
- key: this.key,
427
- name: this.name,
428
- whens: this.whens.map((w) => {
429
- if (w && w.toObj)
430
- return w.toObj();
431
- console.error("w is not as expected!", w);
432
- return {};
433
- }),
434
- thens: this.thens.map((t) => t.toObj()),
435
- error: this.error ? [this.error, this.error.stack] : null,
436
- failed: this.failed,
437
- features: this.features
438
- };
439
- }
440
- async afterEach(store, key, artifactory, pm) {
441
- return store;
442
- }
443
- async give(subject, key, testResourceConfiguration, tester, artifactory, tLog, pm, suiteNdx) {
444
- this.key = key;
445
- tLog(`
446
- ${this.key}`);
447
- tLog(`
448
- Given: ${this.name}`);
449
- const givenArtifactory = (fPath, value) => artifactory(`given-${key}/${fPath}`, value);
450
- this.uberCatcher((e) => {
451
- console.error(e);
452
- this.error = e.error;
453
- tLog(e.stack);
454
- });
455
- try {
456
- this.store = await this.givenThat(
457
- subject,
458
- testResourceConfiguration,
459
- givenArtifactory,
460
- this.givenCB,
461
- this.initialValues,
462
- beforeEachProxy(pm, suiteNdx.toString())
463
- );
464
- } catch (e) {
465
- console.error("failure 4 ", e);
466
- this.error = e;
467
- throw e;
468
- }
469
- try {
470
- for (const [whenNdx, whenStep] of this.whens.entries()) {
471
- await whenStep.test(
472
- this.store,
473
- testResourceConfiguration,
474
- tLog,
475
- pm,
476
- `suite-${suiteNdx}/given-${key}/when/${whenNdx}`
477
- );
478
- }
479
- for (const [thenNdx, thenStep] of this.thens.entries()) {
480
- const t = await thenStep.test(
481
- this.store,
482
- testResourceConfiguration,
483
- tLog,
484
- pm,
485
- `suite-${suiteNdx}/given-${key}/then-${thenNdx}`
486
- );
487
- tester(t);
488
- }
489
- } catch (e) {
490
- this.failed = true;
491
- tLog(e.stack);
492
- throw e;
493
- } finally {
494
- try {
495
- await this.afterEach(
496
- this.store,
497
- this.key,
498
- givenArtifactory,
499
- afterEachProxy(pm, suiteNdx.toString(), key)
500
- );
501
- } catch (e) {
502
- console.error("afterEach failed!", e);
503
- this.failed = e;
504
- throw e;
505
- }
506
- }
507
- return this.store;
508
- }
509
- };
510
- var BaseWhen = class {
511
- constructor(name, whenCB) {
512
- this.name = name;
513
- this.whenCB = whenCB;
514
- }
515
- toObj() {
516
- console.log("toObj error", this.error);
517
- return {
518
- name: this.name,
519
- error: this.error && this.error.name + this.error.stack
520
- };
521
- }
522
- async test(store, testResourceConfiguration, tLog, pm, filepath) {
523
- try {
524
- tLog(" When:", this.name);
525
- console.debug("[DEBUG] Executing When step:", this.name);
526
- const result = await this.andWhen(
527
- store,
528
- this.whenCB,
529
- testResourceConfiguration,
530
- andWhenProxy(pm, filepath)
531
- );
532
- console.debug("[DEBUG] When step completed:", this.name);
533
- return result;
534
- } catch (e) {
535
- console.error("[ERROR] When step failed:", this.name, e);
536
- this.error = e;
537
- throw e;
538
- }
539
- }
540
- };
541
- var BaseThen = class {
542
- constructor(name, thenCB) {
543
- this.name = name;
544
- this.thenCB = thenCB;
545
- this.error = false;
546
- }
547
- toObj() {
548
- return {
549
- name: this.name,
550
- error: this.error
551
- };
552
- }
553
- async test(store, testResourceConfiguration, tLog, pm, filepath) {
554
- return this.butThen(
555
- store,
556
- async (s) => {
557
- if (typeof this.thenCB === "function") {
558
- return await this.thenCB(s);
559
- } else {
560
- return this.thenCB;
561
- }
562
- },
563
- testResourceConfiguration,
564
- butThenProxy(pm, filepath)
565
- ).catch((e) => {
566
- this.error = e.toString();
567
- });
568
- }
569
- };
570
-
571
- // src/lib/basebuilder.ts
572
- var BaseBuilder = class {
573
- constructor(input, suitesOverrides, givenOverides, whenOverides, thenOverides, testResourceRequirement, testSpecification) {
574
- this.artifacts = [];
575
- this.artifacts = [];
576
- this.testResourceRequirement = testResourceRequirement;
577
- this.suitesOverrides = suitesOverrides;
578
- this.givenOverides = givenOverides;
579
- this.whenOverides = whenOverides;
580
- this.thenOverides = thenOverides;
581
- this.testSpecification = testSpecification;
582
- this.specs = testSpecification(
583
- this.Suites(),
584
- this.Given(),
585
- this.When(),
586
- this.Then()
587
- );
588
- this.testJobs = this.specs.map((suite) => {
589
- const suiteRunner = (suite2) => async (puppetMaster, tLog) => {
590
- const x = await suite2.run(
591
- input,
592
- puppetMaster.testResourceConfiguration,
593
- (fPath, value) => puppetMaster.testArtiFactoryfileWriter(
594
- tLog,
595
- (p) => {
596
- this.artifacts.push(p);
597
- }
598
- )(puppetMaster.testResourceConfiguration.fs + "/" + fPath, value),
599
- tLog,
600
- puppetMaster
601
- );
602
- return x;
603
- };
604
- const runner = suiteRunner(suite);
605
- return {
606
- test: suite,
607
- toObj: () => {
608
- return suite.toObj();
609
- },
610
- runner,
611
- receiveTestResourceConfig: async function(puppetMaster) {
612
- const logFilePath = "logs.txt";
613
- const access = await puppetMaster.createWriteStream(
614
- logFilePath
615
- );
616
- const tLog = async (...l) => {
617
- };
618
- const suiteDone = await runner(puppetMaster, tLog);
619
- const logPromise = new Promise(async (res) => {
620
- await puppetMaster.end(access);
621
- res(true);
622
- });
623
- const fails = suiteDone.fails;
624
- await puppetMaster.writeFileSync(`bdd_errors.txt`, fails.toString());
625
- await puppetMaster.writeFileSync(
626
- `tests.json`,
627
- JSON.stringify(this.toObj(), null, 2)
628
- );
629
- return {
630
- failed: fails > 0,
631
- fails,
632
- artifacts: this.artifacts || [],
633
- logPromise,
634
- features: suiteDone.features()
635
- };
636
- }
637
- };
638
- });
639
- }
640
- // testsJson() {
641
- // puppetMaster.writeFileSync(
642
- // `tests.json`,
643
- // JSON.stringify({ features: suiteDone.features() }, null, 2)
644
- // );
645
- // }
646
- Specs() {
647
- return this.specs;
648
- }
649
- Suites() {
650
- return this.suitesOverrides;
651
- }
652
- Given() {
653
- return this.givenOverides;
654
- }
655
- When() {
656
- return this.whenOverides;
657
- }
658
- Then() {
659
- return this.thenOverides;
660
- }
661
- };
662
-
663
- // src/lib/classBuilder.ts
664
- var ClassBuilder = class extends BaseBuilder {
665
- constructor(testImplementation, testSpecification, input, suiteKlasser, givenKlasser, whenKlasser, thenKlasser, testResourceRequirement) {
666
- const classySuites = Object.entries(testImplementation.suites).reduce(
667
- (a, [key], index) => {
668
- a[key] = (somestring, givens) => {
669
- return new suiteKlasser.prototype.constructor(
670
- somestring,
671
- index,
672
- givens
673
- );
674
- };
675
- return a;
676
- },
677
- {}
678
- );
679
- const classyGivens = Object.entries(testImplementation.givens).reduce(
680
- (a, [key, g]) => {
681
- a[key] = (features, whens, thens, ...initialValues) => {
682
- return new givenKlasser.prototype.constructor(
683
- key,
684
- features,
685
- whens,
686
- thens,
687
- testImplementation.givens[key],
688
- initialValues
689
- );
690
- };
691
- return a;
692
- },
693
- {}
694
- );
695
- const classyWhens = Object.entries(testImplementation.whens).reduce(
696
- (a, [key, whEn]) => {
697
- a[key] = (...payload) => {
698
- return new whenKlasser.prototype.constructor(
699
- `${whEn.name}: ${payload && payload.toString()}`,
700
- whEn(...payload)
701
- );
702
- };
703
- return a;
704
- },
705
- {}
706
- );
707
- const classyThens = Object.entries(
708
- testImplementation.thens
709
- ).reduce(
710
- (a, [key, thEn]) => {
711
- a[key] = (expected, ...x) => {
712
- return new thenKlasser.prototype.constructor(
713
- `${thEn.name}: ${expected && expected.toString()}`,
714
- thEn(expected, ...x)
715
- );
716
- };
717
- return a;
718
- },
719
- {}
720
- );
721
- super(
722
- input,
723
- classySuites,
724
- classyGivens,
725
- classyWhens,
726
- classyThens,
727
- testResourceRequirement,
728
- testSpecification
729
- );
730
- }
731
- };
732
-
733
- // src/lib/core.ts
734
- var TesterantoCore = class extends ClassBuilder {
735
- constructor(input, testSpecification, testImplementation, testResourceRequirement = defaultTestResourceRequirement, testAdapter, uberCatcher) {
736
- const fullAdapter = DefaultAdapter(testAdapter);
737
- super(
738
- testImplementation,
739
- testSpecification,
740
- input,
741
- class extends BaseSuite {
742
- afterAll(store, artifactory, pm) {
743
- return fullAdapter.afterAll(store, pm);
744
- }
745
- assertThat(t) {
746
- return fullAdapter.assertThis(t);
747
- }
748
- async setup(s, artifactory, tr, pm) {
749
- return (fullAdapter.beforeAll || (async (input2, artifactory2, tr2, pm2) => input2))(
750
- s,
751
- this.testResourceConfiguration,
752
- // artifactory,
753
- pm
754
- );
755
- }
756
- },
757
- class Given extends BaseGiven {
758
- constructor() {
759
- super(...arguments);
760
- this.uberCatcher = uberCatcher;
761
- }
762
- async givenThat(subject, testResource, artifactory, initializer, initialValues, pm) {
763
- return fullAdapter.beforeEach(
764
- subject,
765
- initializer,
766
- testResource,
767
- initialValues,
768
- pm
769
- );
770
- }
771
- afterEach(store, key, artifactory, pm) {
772
- return new Promise(
773
- (res) => res(fullAdapter.afterEach(store, key, pm))
774
- );
775
- }
776
- },
777
- class When extends BaseWhen {
778
- async andWhen(store, whenCB, testResource, pm) {
779
- return await fullAdapter.andWhen(store, whenCB, testResource, pm);
780
- }
781
- },
782
- class Then extends BaseThen {
783
- async butThen(store, thenCB, testResource, pm) {
784
- return await fullAdapter.butThen(store, thenCB, testResource, pm);
785
- }
786
- },
787
- testResourceRequirement
788
- );
789
- }
790
- };
791
-
792
- // src/Web.ts
793
- var errorCallback = (e) => {
794
- };
795
- var unhandledrejectionCallback = (event) => {
796
- console.log("window.addEventListener unhandledrejection", event);
797
- };
798
- var WebTesteranto = class extends TesterantoCore {
799
- constructor(input, testSpecification, testImplementation, testResourceRequirement, testAdapter) {
800
- super(
801
- input,
802
- testSpecification,
803
- testImplementation,
804
- testResourceRequirement,
805
- testAdapter,
806
- (cb) => {
807
- window.removeEventListener("error", errorCallback);
808
- errorCallback = (e) => {
809
- console.log("window.addEventListener error", e);
810
- cb(e);
811
- };
812
- window.addEventListener("error", errorCallback);
813
- window.removeEventListener(
814
- "unhandledrejection",
815
- unhandledrejectionCallback
816
- );
817
- window.removeEventListener(
818
- "unhandledrejection",
819
- unhandledrejectionCallback
820
- );
821
- unhandledrejectionCallback = (event) => {
822
- console.log("window.addEventListener unhandledrejection", event);
823
- cb({ error: event.reason.message });
824
- };
825
- window.addEventListener(
826
- "unhandledrejection",
827
- unhandledrejectionCallback
828
- );
829
- }
830
- );
831
- }
832
- async receiveTestResourceConfig(partialTestResource) {
833
- const t = partialTestResource;
834
- const pm = new PM_Web(t);
835
- return await this.testJobs[0].receiveTestResourceConfig(pm);
836
- }
837
- };
838
- var Web_default = async (input, testSpecification, testImplementation, testAdapter, testResourceRequirement = defaultTestResourceRequirement) => {
839
- return new WebTesteranto(
840
- input,
841
- testSpecification,
842
- testImplementation,
843
- testResourceRequirement,
844
- testAdapter
845
- );
846
- };
847
-
848
- export {
849
- BaseGiven,
850
- BaseWhen,
851
- BaseThen,
852
- BaseBuilder,
853
- BaseSuite,
854
- Web_default
855
- };