@silasfmartins/testhub 1.0.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 (296) hide show
  1. package/.github/copilot-instructions.md +520 -0
  2. package/biome.json +37 -0
  3. package/dist/index.d.ts +45 -0
  4. package/dist/index.js +169 -0
  5. package/dist/scripts/consumer-postinstall.d.ts +15 -0
  6. package/dist/scripts/consumer-postinstall.js +785 -0
  7. package/dist/scripts/generate-docs.d.ts +16 -0
  8. package/dist/scripts/generate-docs.js +1363 -0
  9. package/dist/scripts/generate-index.d.ts +2 -0
  10. package/dist/scripts/generate-index.js +314 -0
  11. package/dist/scripts/init-api.d.ts +2 -0
  12. package/dist/scripts/init-api.js +525 -0
  13. package/dist/scripts/init-banco.d.ts +2 -0
  14. package/dist/scripts/init-banco.js +347 -0
  15. package/dist/scripts/init-frontend.d.ts +2 -0
  16. package/dist/scripts/init-frontend.js +627 -0
  17. package/dist/scripts/init-mobile.d.ts +2 -0
  18. package/dist/scripts/init-mobile.js +481 -0
  19. package/dist/scripts/init-scenarios.d.ts +2 -0
  20. package/dist/scripts/init-scenarios.js +846 -0
  21. package/dist/scripts/init-ssh.d.ts +2 -0
  22. package/dist/scripts/init-ssh.js +639 -0
  23. package/dist/scripts/package-versions.d.ts +57 -0
  24. package/dist/scripts/package-versions.js +768 -0
  25. package/dist/scripts/postinstall.d.ts +1 -0
  26. package/dist/scripts/postinstall.js +527 -0
  27. package/dist/scripts/robust-build.d.ts +7 -0
  28. package/dist/scripts/robust-build.js +88 -0
  29. package/dist/scripts/setup-local-packages.d.ts +31 -0
  30. package/dist/scripts/setup-local-packages.js +237 -0
  31. package/dist/scripts/smart-override.d.ts +2 -0
  32. package/dist/scripts/smart-override.js +1360 -0
  33. package/dist/scripts/sync-configs.d.ts +27 -0
  34. package/dist/scripts/sync-configs.js +248 -0
  35. package/dist/scripts/test-biome-parse.d.ts +5 -0
  36. package/dist/scripts/test-biome-parse.js +84 -0
  37. package/dist/scripts/ultracite-setup.d.ts +4 -0
  38. package/dist/scripts/ultracite-setup.js +310 -0
  39. package/dist/scripts/update-all-init-scripts.d.ts +2 -0
  40. package/dist/scripts/update-all-init-scripts.js +52 -0
  41. package/dist/scripts/update-biome-schema.d.ts +15 -0
  42. package/dist/scripts/update-biome-schema.js +124 -0
  43. package/dist/src/AutoCoreFacade.d.ts +145 -0
  44. package/dist/src/AutoCoreFacade.js +217 -0
  45. package/dist/src/api/ApiActions.d.ts +297 -0
  46. package/dist/src/api/ApiActions.js +1905 -0
  47. package/dist/src/api/Certificate.d.ts +60 -0
  48. package/dist/src/api/Certificate.js +79 -0
  49. package/dist/src/api/JsonResponse.d.ts +116 -0
  50. package/dist/src/api/JsonResponse.js +206 -0
  51. package/dist/src/appium/DeviceFarmViewer.d.ts +79 -0
  52. package/dist/src/appium/DeviceFarmViewer.js +1083 -0
  53. package/dist/src/appium/MobileActions.d.ts +347 -0
  54. package/dist/src/appium/MobileActions.js +1632 -0
  55. package/dist/src/appium/MobileConnection.d.ts +160 -0
  56. package/dist/src/appium/MobileConnection.js +772 -0
  57. package/dist/src/config/envLoader.d.ts +123 -0
  58. package/dist/src/config/envLoader.js +361 -0
  59. package/dist/src/config/jest-safe-setup.d.ts +19 -0
  60. package/dist/src/config/jest-safe-setup.js +369 -0
  61. package/dist/src/config/timeouts.d.ts +32 -0
  62. package/dist/src/config/timeouts.js +38 -0
  63. package/dist/src/desktop/DesktopActions.d.ts +46 -0
  64. package/dist/src/desktop/DesktopActions.js +398 -0
  65. package/dist/src/desktop/DesktopConnection.d.ts +32 -0
  66. package/dist/src/desktop/DesktopConnection.js +84 -0
  67. package/dist/src/domain/entities/TestExecution.d.ts +117 -0
  68. package/dist/src/domain/entities/TestExecution.js +150 -0
  69. package/dist/src/domain/entities/TestReport.d.ts +114 -0
  70. package/dist/src/domain/entities/TestReport.js +179 -0
  71. package/dist/src/domain/repositories/ITestRepository.d.ts +196 -0
  72. package/dist/src/domain/repositories/ITestRepository.js +14 -0
  73. package/dist/src/domain/schemas/ValidationSchemas.d.ts +159 -0
  74. package/dist/src/domain/schemas/ValidationSchemas.js +181 -0
  75. package/dist/src/functions/errors/BaseError.d.ts +78 -0
  76. package/dist/src/functions/errors/BaseError.js +245 -0
  77. package/dist/src/functions/errors/ConfigurationError.d.ts +16 -0
  78. package/dist/src/functions/errors/ConfigurationError.js +48 -0
  79. package/dist/src/functions/errors/ErrorCatalog.d.ts +148 -0
  80. package/dist/src/functions/errors/ErrorCatalog.js +157 -0
  81. package/dist/src/functions/errors/GlobalErrorHandler.d.ts +101 -0
  82. package/dist/src/functions/errors/GlobalErrorHandler.js +281 -0
  83. package/dist/src/functions/errors/IntegrationError.d.ts +17 -0
  84. package/dist/src/functions/errors/IntegrationError.js +51 -0
  85. package/dist/src/functions/errors/SecurityError.d.ts +14 -0
  86. package/dist/src/functions/errors/SecurityError.js +42 -0
  87. package/dist/src/functions/errors/SystemError.d.ts +12 -0
  88. package/dist/src/functions/errors/SystemError.js +36 -0
  89. package/dist/src/functions/errors/ValidationError.d.ts +14 -0
  90. package/dist/src/functions/errors/ValidationError.js +61 -0
  91. package/dist/src/functions/errors/index.d.ts +12 -0
  92. package/dist/src/functions/errors/index.js +13 -0
  93. package/dist/src/global-setup.d.ts +1 -0
  94. package/dist/src/global-setup.js +1037 -0
  95. package/dist/src/helpers/BancoActions.d.ts +188 -0
  96. package/dist/src/helpers/BancoActions.js +581 -0
  97. package/dist/src/helpers/EnviromentHelper.d.ts +17 -0
  98. package/dist/src/helpers/EnviromentHelper.js +66 -0
  99. package/dist/src/helpers/ParallelExecutionHelper.d.ts +183 -0
  100. package/dist/src/helpers/ParallelExecutionHelper.js +375 -0
  101. package/dist/src/helpers/SyncSignal.d.ts +15 -0
  102. package/dist/src/helpers/SyncSignal.js +44 -0
  103. package/dist/src/hubdocs/CategoryDetector.d.ts +83 -0
  104. package/dist/src/hubdocs/CategoryDetector.js +401 -0
  105. package/dist/src/hubdocs/DirectStatementInterceptor.d.ts +54 -0
  106. package/dist/src/hubdocs/DirectStatementInterceptor.js +243 -0
  107. package/dist/src/hubdocs/ExecutionTracker.d.ts +107 -0
  108. package/dist/src/hubdocs/ExecutionTracker.js +702 -0
  109. package/dist/src/hubdocs/HubDocs.d.ts +395 -0
  110. package/dist/src/hubdocs/HubDocs.js +3586 -0
  111. package/dist/src/hubdocs/StatementMethodFilter.d.ts +71 -0
  112. package/dist/src/hubdocs/StatementMethodFilter.js +618 -0
  113. package/dist/src/hubdocs/StatementTracker.d.ts +417 -0
  114. package/dist/src/hubdocs/StatementTracker.js +2419 -0
  115. package/dist/src/hubdocs/SwaggerGenerator.d.ts +59 -0
  116. package/dist/src/hubdocs/SwaggerGenerator.js +405 -0
  117. package/dist/src/hubdocs/index.d.ts +9 -0
  118. package/dist/src/hubdocs/index.js +9 -0
  119. package/dist/src/hubdocs/types.d.ts +114 -0
  120. package/dist/src/hubdocs/types.js +5 -0
  121. package/dist/src/infrastructure/DependencyContainer.d.ts +142 -0
  122. package/dist/src/infrastructure/DependencyContainer.js +250 -0
  123. package/dist/src/infrastructure/adapters/AppiumAdapter.d.ts +168 -0
  124. package/dist/src/infrastructure/adapters/AppiumAdapter.js +468 -0
  125. package/dist/src/infrastructure/adapters/OracleAdapter.d.ts +150 -0
  126. package/dist/src/infrastructure/adapters/OracleAdapter.js +388 -0
  127. package/dist/src/infrastructure/adapters/PlaywrightAdapter.d.ts +192 -0
  128. package/dist/src/infrastructure/adapters/PlaywrightAdapter.js +382 -0
  129. package/dist/src/infrastructure/adapters/SSHAdapter.d.ts +141 -0
  130. package/dist/src/infrastructure/adapters/SSHAdapter.js +428 -0
  131. package/dist/src/interfaces.d.ts +501 -0
  132. package/dist/src/interfaces.js +25 -0
  133. package/dist/src/internal/fakes/__fake-actions__.d.ts +17 -0
  134. package/dist/src/internal/fakes/__fake-actions__.js +21 -0
  135. package/dist/src/internal/fakes/__forbidden__.d.ts +10 -0
  136. package/dist/src/internal/fakes/__forbidden__.js +18 -0
  137. package/dist/src/internal/fakes/__honeypot__.d.ts +15 -0
  138. package/dist/src/internal/fakes/__honeypot__.js +24 -0
  139. package/dist/src/octane/OctaneReporter.d.ts +13 -0
  140. package/dist/src/octane/OctaneReporter.js +61 -0
  141. package/dist/src/playwright/CryptoActions.d.ts +20 -0
  142. package/dist/src/playwright/CryptoActions.js +75 -0
  143. package/dist/src/playwright/EnhancedWebActions.d.ts +7 -0
  144. package/dist/src/playwright/EnhancedWebActions.js +65 -0
  145. package/dist/src/playwright/WebActions.d.ts +1599 -0
  146. package/dist/src/playwright/WebActions.js +11788 -0
  147. package/dist/src/playwright/actions/ActionTimeline.d.ts +36 -0
  148. package/dist/src/playwright/actions/ActionTimeline.js +101 -0
  149. package/dist/src/playwright/actions/RecoveryQueue.d.ts +82 -0
  150. package/dist/src/playwright/actions/RecoveryQueue.js +130 -0
  151. package/dist/src/playwright/actions/SelectorCache.d.ts +53 -0
  152. package/dist/src/playwright/actions/SelectorCache.js +96 -0
  153. package/dist/src/playwright/actions/index.d.ts +13 -0
  154. package/dist/src/playwright/actions/index.js +14 -0
  155. package/dist/src/playwright/actions/types.d.ts +147 -0
  156. package/dist/src/playwright/actions/types.js +5 -0
  157. package/dist/src/playwright/fixtures.d.ts +112 -0
  158. package/dist/src/playwright/fixtures.js +718 -0
  159. package/dist/src/playwright/network-logs-reporter.d.ts +7 -0
  160. package/dist/src/playwright/network-logs-reporter.js +66 -0
  161. package/dist/src/playwright/registerRecoveryWrappers.d.ts +1 -0
  162. package/dist/src/playwright/registerRecoveryWrappers.js +54 -0
  163. package/dist/src/security/BuildSecurity.d.ts +12 -0
  164. package/dist/src/security/BuildSecurity.js +138 -0
  165. package/dist/src/security/EulaProtection.d.ts +70 -0
  166. package/dist/src/security/EulaProtection.js +155 -0
  167. package/dist/src/security/HoneypotManager.d.ts +46 -0
  168. package/dist/src/security/HoneypotManager.js +234 -0
  169. package/dist/src/security/KeysManager.d.ts +36 -0
  170. package/dist/src/security/KeysManager.js +158 -0
  171. package/dist/src/security/ProofOfWorkIntegration.d.ts +64 -0
  172. package/dist/src/security/ProofOfWorkIntegration.js +206 -0
  173. package/dist/src/security/SecurityValidation.d.ts +21 -0
  174. package/dist/src/security/SecurityValidation.js +163 -0
  175. package/dist/src/security/SourceMapProtection.d.ts +55 -0
  176. package/dist/src/security/SourceMapProtection.js +220 -0
  177. package/dist/src/security/protector.d.ts +1 -0
  178. package/dist/src/security/protector.js +97 -0
  179. package/dist/src/ssh/SSHActions.d.ts +262 -0
  180. package/dist/src/ssh/SSHActions.js +790 -0
  181. package/dist/src/ssh/SSHClient.d.ts +99 -0
  182. package/dist/src/ssh/SSHClient.js +409 -0
  183. package/dist/src/statements/BaseStatement.d.ts +38 -0
  184. package/dist/src/statements/BaseStatement.js +78 -0
  185. package/dist/src/testContext/AuthStateManager.d.ts +93 -0
  186. package/dist/src/testContext/AuthStateManager.js +256 -0
  187. package/dist/src/testContext/CoverageManager.d.ts +198 -0
  188. package/dist/src/testContext/CoverageManager.js +917 -0
  189. package/dist/src/testContext/TestAnnotations.d.ts +476 -0
  190. package/dist/src/testContext/TestAnnotations.js +2647 -0
  191. package/dist/src/testContext/TestContext.d.ts +138 -0
  192. package/dist/src/testContext/TestContext.js +369 -0
  193. package/dist/src/testContext/UnifiedHtmlGenerator.d.ts +7 -0
  194. package/dist/src/testContext/UnifiedHtmlGenerator.js +264 -0
  195. package/dist/src/testContext/UnifiedReportManager.d.ts +211 -0
  196. package/dist/src/testContext/UnifiedReportManager.js +1206 -0
  197. package/dist/src/testhub/DynamicConfigManager.d.ts +121 -0
  198. package/dist/src/testhub/DynamicConfigManager.js +320 -0
  199. package/dist/src/testhub/SystemsManager.d.ts +119 -0
  200. package/dist/src/testhub/SystemsManager.js +365 -0
  201. package/dist/src/testhub/TestHubClient.d.ts +335 -0
  202. package/dist/src/testhub/TestHubClient.js +1215 -0
  203. package/dist/src/testhub/TestHubReporter.d.ts +62 -0
  204. package/dist/src/testhub/TestHubReporter.js +576 -0
  205. package/dist/src/testhub/TestHubVars.d.ts +116 -0
  206. package/dist/src/testhub/TestHubVars.js +273 -0
  207. package/dist/src/utils/ActionInterceptor.d.ts +59 -0
  208. package/dist/src/utils/ActionInterceptor.js +741 -0
  209. package/dist/src/utils/ArtifactsCompressor.d.ts +43 -0
  210. package/dist/src/utils/ArtifactsCompressor.js +181 -0
  211. package/dist/src/utils/AutoLogsFinal.d.ts +47 -0
  212. package/dist/src/utils/AutoLogsFinal.js +148 -0
  213. package/dist/src/utils/CodeGenSession.d.ts +114 -0
  214. package/dist/src/utils/CodeGenSession.js +264 -0
  215. package/dist/src/utils/ConfigLogger.d.ts +133 -0
  216. package/dist/src/utils/ConfigLogger.js +611 -0
  217. package/dist/src/utils/CustomReporter.d.ts +22 -0
  218. package/dist/src/utils/CustomReporter.js +352 -0
  219. package/dist/src/utils/DataStore.d.ts +171 -0
  220. package/dist/src/utils/DataStore.js +484 -0
  221. package/dist/src/utils/DatabaseInterceptor.d.ts +19 -0
  222. package/dist/src/utils/DatabaseInterceptor.js +295 -0
  223. package/dist/src/utils/DateHelper.d.ts +16 -0
  224. package/dist/src/utils/DateHelper.js +120 -0
  225. package/dist/src/utils/DateValidator.d.ts +4 -0
  226. package/dist/src/utils/DateValidator.js +51 -0
  227. package/dist/src/utils/DocumentGenerator.d.ts +35 -0
  228. package/dist/src/utils/DocumentGenerator.js +129 -0
  229. package/dist/src/utils/EvidenceCapture.d.ts +90 -0
  230. package/dist/src/utils/EvidenceCapture.js +600 -0
  231. package/dist/src/utils/EvidenceReportGenerator.d.ts +70 -0
  232. package/dist/src/utils/EvidenceReportGenerator.js +799 -0
  233. package/dist/src/utils/FrameManagementUtil.d.ts +42 -0
  234. package/dist/src/utils/FrameManagementUtil.js +75 -0
  235. package/dist/src/utils/GlobalStatementsInterceptor.d.ts +1 -0
  236. package/dist/src/utils/GlobalStatementsInterceptor.js +1 -0
  237. package/dist/src/utils/HTMLTemplate.d.ts +1 -0
  238. package/dist/src/utils/HTMLTemplate.js +1034 -0
  239. package/dist/src/utils/InterceptacaoMagica.d.ts +23 -0
  240. package/dist/src/utils/InterceptacaoMagica.js +365 -0
  241. package/dist/src/utils/LogSanitizer.d.ts +35 -0
  242. package/dist/src/utils/LogSanitizer.js +110 -0
  243. package/dist/src/utils/Logger.d.ts +65 -0
  244. package/dist/src/utils/Logger.js +284 -0
  245. package/dist/src/utils/McpLocalClient.d.ts +141 -0
  246. package/dist/src/utils/McpLocalClient.js +871 -0
  247. package/dist/src/utils/PDFEvidenceGenerator.d.ts +20 -0
  248. package/dist/src/utils/PDFEvidenceGenerator.js +156 -0
  249. package/dist/src/utils/SpecFileAnalyzer.d.ts +35 -0
  250. package/dist/src/utils/SpecFileAnalyzer.js +209 -0
  251. package/dist/src/utils/StatementInterceptor.d.ts +18 -0
  252. package/dist/src/utils/StatementInterceptor.js +87 -0
  253. package/dist/src/utils/StatementLogger.d.ts +33 -0
  254. package/dist/src/utils/StatementLogger.js +113 -0
  255. package/dist/src/utils/StatementsInterceptor.d.ts +1 -0
  256. package/dist/src/utils/StatementsInterceptor.js +1 -0
  257. package/dist/src/utils/TeamsFlushHook.d.ts +17 -0
  258. package/dist/src/utils/TeamsFlushHook.js +168 -0
  259. package/dist/src/utils/TerminalLogCapture.d.ts +158 -0
  260. package/dist/src/utils/TerminalLogCapture.js +531 -0
  261. package/dist/src/utils/TestMethodLogger.d.ts +70 -0
  262. package/dist/src/utils/TestMethodLogger.js +95 -0
  263. package/dist/src/utils/UnifiedTeardown.d.ts +4 -0
  264. package/dist/src/utils/UnifiedTeardown.js +400 -0
  265. package/dist/src/utils/XPathCatalog.d.ts +152 -0
  266. package/dist/src/utils/XPathCatalog.js +350 -0
  267. package/dist/src/utils/generators.d.ts +90 -0
  268. package/dist/src/utils/generators.js +167 -0
  269. package/dist/src/utils/testRecovery/ResilientPlaywright.d.ts +152 -0
  270. package/dist/src/utils/testRecovery/ResilientPlaywright.js +715 -0
  271. package/dist/src/utils/testRecovery/TestRecoveryClient.d.ts +801 -0
  272. package/dist/src/utils/testRecovery/TestRecoveryClient.js +1415 -0
  273. package/dist/src/utils/testRecovery/autoFixCode.d.ts +65 -0
  274. package/dist/src/utils/testRecovery/autoFixCode.js +32 -0
  275. package/dist/vitest.config.d.ts +2 -0
  276. package/dist/vitest.config.js +59 -0
  277. package/dist/wdio.conf.d.ts +1 -0
  278. package/dist/wdio.conf.js +420 -0
  279. package/package.json +137 -0
  280. package/protect-loader.mjs +643 -0
  281. package/scripts/consumer-postinstall.ts +975 -0
  282. package/scripts/generate-index.ts +343 -0
  283. package/scripts/init-api.ts +613 -0
  284. package/scripts/init-banco.ts +437 -0
  285. package/scripts/init-frontend.ts +727 -0
  286. package/scripts/init-mobile.ts +558 -0
  287. package/scripts/init-scenarios.ts +925 -0
  288. package/scripts/init-ssh.ts +734 -0
  289. package/scripts/package-versions.ts +978 -0
  290. package/scripts/postinstall.ts +605 -0
  291. package/scripts/smart-override.ts +1675 -0
  292. package/scripts/sync-configs.ts +302 -0
  293. package/scripts/ultracite-setup.ts +370 -0
  294. package/src/types/globals.d.ts +48 -0
  295. package/tsconfig.json +29 -0
  296. package/types/autocore-sync-signal.d.ts +10 -0
@@ -0,0 +1,150 @@
1
+ /**
2
+ * @fileoverview Entidade de domínio para execução de testes
3
+ * @module Domain/Entities
4
+ */
5
+ import { ValidationError } from '../../functions/errors/ValidationError.js';
6
+ /**
7
+ * Tipos de teste suportados pelo framework
8
+ */
9
+ export var TestType;
10
+ (function (TestType) {
11
+ TestType["API"] = "api";
12
+ TestType["WEB"] = "web";
13
+ TestType["MOBILE"] = "mobile";
14
+ TestType["SSH"] = "ssh";
15
+ TestType["DATABASE"] = "database";
16
+ })(TestType || (TestType = {}));
17
+ /**
18
+ * Status de execução do teste
19
+ */
20
+ export var TestStatus;
21
+ (function (TestStatus) {
22
+ TestStatus["PENDING"] = "pending";
23
+ TestStatus["RUNNING"] = "running";
24
+ TestStatus["PASSED"] = "passed";
25
+ TestStatus["FAILED"] = "failed";
26
+ TestStatus["SKIPPED"] = "skipped";
27
+ })(TestStatus || (TestStatus = {}));
28
+ /**
29
+ * Entidade principal para execução de testes
30
+ * Contém a lógica de negócio para gerenciar o ciclo de vida de um teste
31
+ */
32
+ export class TestExecution {
33
+ id;
34
+ specification;
35
+ _status = TestStatus.PENDING;
36
+ _startTime;
37
+ _endTime;
38
+ _result;
39
+ _steps = [];
40
+ constructor(id, specification) {
41
+ this.id = id;
42
+ this.specification = specification;
43
+ if (!id.trim()) {
44
+ throw ValidationError.missingRequiredParameter('id');
45
+ }
46
+ if (!specification.name.trim()) {
47
+ throw ValidationError.missingRequiredParameter('specification.name');
48
+ }
49
+ }
50
+ /**
51
+ * Inicia a execução do teste
52
+ */
53
+ start() {
54
+ if (this._status !== TestStatus.PENDING) {
55
+ throw ValidationError.invalidConfiguration('testStatus', `Cannot start test in ${this._status} status`);
56
+ }
57
+ this._status = TestStatus.RUNNING;
58
+ this._startTime = new Date();
59
+ }
60
+ /**
61
+ * Adiciona um passo de execução
62
+ */
63
+ addStep(step) {
64
+ if (this._status !== TestStatus.RUNNING) {
65
+ throw ValidationError.invalidConfiguration('testStatus', 'Cannot add steps to non-running test');
66
+ }
67
+ this._steps.push(step);
68
+ }
69
+ /**
70
+ * Completa a execução do teste com sucesso
71
+ */
72
+ complete(message, metadata) {
73
+ this._endTime = new Date();
74
+ this._result = {
75
+ status: TestStatus.PASSED,
76
+ message,
77
+ duration: this.duration,
78
+ timestamp: this._endTime,
79
+ metadata,
80
+ };
81
+ this._status = TestStatus.PASSED;
82
+ }
83
+ /**
84
+ * Marca o teste como falhou
85
+ */
86
+ fail(error, metadata) {
87
+ this._endTime = new Date();
88
+ this._result = {
89
+ status: TestStatus.FAILED,
90
+ message: error.message,
91
+ error,
92
+ duration: this.duration,
93
+ timestamp: this._endTime,
94
+ metadata,
95
+ };
96
+ this._status = TestStatus.FAILED;
97
+ }
98
+ /**
99
+ * Pula a execução do teste
100
+ */
101
+ skip(reason) {
102
+ this._endTime = new Date();
103
+ this._result = {
104
+ status: TestStatus.SKIPPED,
105
+ message: reason,
106
+ duration: this.duration,
107
+ timestamp: this._endTime,
108
+ };
109
+ this._status = TestStatus.SKIPPED;
110
+ }
111
+ /**
112
+ * Status atual do teste
113
+ */
114
+ get status() {
115
+ return this._status;
116
+ }
117
+ /**
118
+ * Resultado da execução (disponível após conclusão)
119
+ */
120
+ get result() {
121
+ return this._result;
122
+ }
123
+ /**
124
+ * Duração da execução em milissegundos
125
+ */
126
+ get duration() {
127
+ if (!this._startTime)
128
+ return 0;
129
+ const endTime = this._endTime || new Date();
130
+ return endTime.getTime() - this._startTime.getTime();
131
+ }
132
+ /**
133
+ * Passos executados durante o teste
134
+ */
135
+ get steps() {
136
+ return [...this._steps];
137
+ }
138
+ /**
139
+ * Verifica se o teste está em execução
140
+ */
141
+ get isRunning() {
142
+ return this._status === TestStatus.RUNNING;
143
+ }
144
+ /**
145
+ * Verifica se o teste foi concluído (passou, falhou ou foi pulado)
146
+ */
147
+ get isCompleted() {
148
+ return [TestStatus.PASSED, TestStatus.FAILED, TestStatus.SKIPPED].includes(this._status);
149
+ }
150
+ }
@@ -0,0 +1,114 @@
1
+ /**
2
+ * @fileoverview Entidade de domínio para relatórios de teste
3
+ * @module Domain/Entities
4
+ */
5
+ import { type TestExecution, TestStatus, type TestType } from './TestExecution.js';
6
+ /**
7
+ * Formato de saída do relatório
8
+ */
9
+ export declare enum ReportFormat {
10
+ JSON = "json",
11
+ HTML = "html",
12
+ XML = "xml",
13
+ PDF = "pdf"
14
+ }
15
+ /**
16
+ * Configuração para geração de relatório
17
+ */
18
+ export interface ReportConfiguration {
19
+ readonly format: ReportFormat;
20
+ readonly includeSteps: boolean;
21
+ readonly includeScreenshots: boolean;
22
+ readonly includeMetadata: boolean;
23
+ readonly customFields?: Record<string, any>;
24
+ }
25
+ /**
26
+ * Estatísticas gerais do relatório
27
+ */
28
+ export interface ReportStatistics {
29
+ readonly total: number;
30
+ readonly passed: number;
31
+ readonly failed: number;
32
+ readonly skipped: number;
33
+ readonly duration: number;
34
+ readonly successRate: number;
35
+ }
36
+ /**
37
+ * Sumário por tipo de teste
38
+ */
39
+ export interface TestTypeSummary {
40
+ readonly type: TestType;
41
+ readonly total: number;
42
+ readonly passed: number;
43
+ readonly failed: number;
44
+ readonly skipped: number;
45
+ readonly averageDuration: number;
46
+ }
47
+ /**
48
+ * Entidade para representar um relatório de execução de testes
49
+ */
50
+ export declare class TestReport {
51
+ readonly id: string;
52
+ readonly name: string;
53
+ readonly configuration: ReportConfiguration;
54
+ private _executions;
55
+ private _generatedAt?;
56
+ private _isGenerated;
57
+ constructor(id: string, name: string, configuration: ReportConfiguration);
58
+ /**
59
+ * Adiciona uma execução de teste ao relatório
60
+ */
61
+ addExecution(execution: TestExecution): void;
62
+ /**
63
+ * Remove uma execução do relatório
64
+ */
65
+ removeExecution(executionId: string): boolean;
66
+ /**
67
+ * Marca o relatório como gerado
68
+ */
69
+ markAsGenerated(): void;
70
+ /**
71
+ * Calcula estatísticas gerais do relatório
72
+ */
73
+ getStatistics(): ReportStatistics;
74
+ /**
75
+ * Obter sumário por tipo de teste
76
+ */
77
+ getTestTypeSummaries(): TestTypeSummary[];
78
+ /**
79
+ * Obter execuções filtradas por status
80
+ */
81
+ getExecutionsByStatus(status: TestStatus): TestExecution[];
82
+ /**
83
+ * Obter execuções filtradas por tipo
84
+ */
85
+ getExecutionsByType(type: TestType): TestExecution[];
86
+ /**
87
+ * Obter execuções que falharam
88
+ */
89
+ getFailedExecutions(): TestExecution[];
90
+ /**
91
+ * Obter as execuções mais lentas
92
+ */
93
+ getSlowestExecutions(limit?: number): TestExecution[];
94
+ /**
95
+ * Lista de todas as execuções
96
+ */
97
+ get executions(): readonly TestExecution[];
98
+ /**
99
+ * Data de geração do relatório
100
+ */
101
+ get generatedAt(): Date | undefined;
102
+ /**
103
+ * Verifica se o relatório foi gerado
104
+ */
105
+ get isGenerated(): boolean;
106
+ /**
107
+ * Verifica se tem execuções
108
+ */
109
+ get hasExecutions(): boolean;
110
+ /**
111
+ * Conta total de execuções
112
+ */
113
+ get totalExecutions(): number;
114
+ }
@@ -0,0 +1,179 @@
1
+ /**
2
+ * @fileoverview Entidade de domínio para relatórios de teste
3
+ * @module Domain/Entities
4
+ */
5
+ import { ValidationError } from '../../functions/errors/ValidationError.js';
6
+ import { TestStatus, } from './TestExecution.js';
7
+ /**
8
+ * Formato de saída do relatório
9
+ */
10
+ export var ReportFormat;
11
+ (function (ReportFormat) {
12
+ ReportFormat["JSON"] = "json";
13
+ ReportFormat["HTML"] = "html";
14
+ ReportFormat["XML"] = "xml";
15
+ ReportFormat["PDF"] = "pdf";
16
+ })(ReportFormat || (ReportFormat = {}));
17
+ /**
18
+ * Entidade para representar um relatório de execução de testes
19
+ */
20
+ export class TestReport {
21
+ id;
22
+ name;
23
+ configuration;
24
+ _executions = [];
25
+ _generatedAt;
26
+ _isGenerated = false;
27
+ constructor(id, name, configuration) {
28
+ this.id = id;
29
+ this.name = name;
30
+ this.configuration = configuration;
31
+ if (!id.trim()) {
32
+ throw ValidationError.missingRequiredParameter('id');
33
+ }
34
+ if (!name.trim()) {
35
+ throw ValidationError.missingRequiredParameter('name');
36
+ }
37
+ }
38
+ /**
39
+ * Adiciona uma execução de teste ao relatório
40
+ */
41
+ addExecution(execution) {
42
+ if (this._isGenerated) {
43
+ throw ValidationError.invalidConfiguration('reportStatus', 'Cannot add executions to generated report');
44
+ }
45
+ this._executions.push(execution);
46
+ }
47
+ /**
48
+ * Remove uma execução do relatório
49
+ */
50
+ removeExecution(executionId) {
51
+ if (this._isGenerated) {
52
+ throw ValidationError.invalidConfiguration('reportStatus', 'Cannot remove executions from generated report');
53
+ }
54
+ const index = this._executions.findIndex((exec) => exec.id === executionId);
55
+ if (index >= 0) {
56
+ this._executions.splice(index, 1);
57
+ return true;
58
+ }
59
+ return false;
60
+ }
61
+ /**
62
+ * Marca o relatório como gerado
63
+ */
64
+ markAsGenerated() {
65
+ this._isGenerated = true;
66
+ this._generatedAt = new Date();
67
+ }
68
+ /**
69
+ * Calcula estatísticas gerais do relatório
70
+ */
71
+ getStatistics() {
72
+ const completedExecutions = this._executions.filter((exec) => exec.isCompleted);
73
+ const total = completedExecutions.length;
74
+ const passed = completedExecutions.filter((exec) => exec.status === TestStatus.PASSED).length;
75
+ const failed = completedExecutions.filter((exec) => exec.status === TestStatus.FAILED).length;
76
+ const skipped = completedExecutions.filter((exec) => exec.status === TestStatus.SKIPPED).length;
77
+ const totalDuration = completedExecutions.reduce((sum, exec) => sum + exec.duration, 0);
78
+ const successRate = total > 0 ? (passed / total) * 100 : 0;
79
+ return {
80
+ total,
81
+ passed,
82
+ failed,
83
+ skipped,
84
+ duration: totalDuration,
85
+ successRate: Math.round(successRate * 100) / 100,
86
+ };
87
+ }
88
+ /**
89
+ * Obter sumário por tipo de teste
90
+ */
91
+ getTestTypeSummaries() {
92
+ const typeGroups = new Map();
93
+ // Agrupar execuções por tipo
94
+ this._executions
95
+ .filter((exec) => exec.isCompleted)
96
+ .forEach((exec) => {
97
+ const type = exec.specification.type;
98
+ if (!typeGroups.has(type)) {
99
+ typeGroups.set(type, []);
100
+ }
101
+ typeGroups.get(type).push(exec);
102
+ });
103
+ // Calcular estatísticas para cada tipo
104
+ return Array.from(typeGroups.entries()).map(([type, executions]) => {
105
+ const total = executions.length;
106
+ const passed = executions.filter((exec) => exec.status === TestStatus.PASSED).length;
107
+ const failed = executions.filter((exec) => exec.status === TestStatus.FAILED).length;
108
+ const skipped = executions.filter((exec) => exec.status === TestStatus.SKIPPED).length;
109
+ const averageDuration = total > 0
110
+ ? executions.reduce((sum, exec) => sum + exec.duration, 0) / total
111
+ : 0;
112
+ return {
113
+ type,
114
+ total,
115
+ passed,
116
+ failed,
117
+ skipped,
118
+ averageDuration: Math.round(averageDuration),
119
+ };
120
+ });
121
+ }
122
+ /**
123
+ * Obter execuções filtradas por status
124
+ */
125
+ getExecutionsByStatus(status) {
126
+ return this._executions.filter((exec) => exec.status === status);
127
+ }
128
+ /**
129
+ * Obter execuções filtradas por tipo
130
+ */
131
+ getExecutionsByType(type) {
132
+ return this._executions.filter((exec) => exec.specification.type === type);
133
+ }
134
+ /**
135
+ * Obter execuções que falharam
136
+ */
137
+ getFailedExecutions() {
138
+ return this.getExecutionsByStatus(TestStatus.FAILED);
139
+ }
140
+ /**
141
+ * Obter as execuções mais lentas
142
+ */
143
+ getSlowestExecutions(limit = 10) {
144
+ return this._executions
145
+ .filter((exec) => exec.isCompleted)
146
+ .sort((a, b) => b.duration - a.duration)
147
+ .slice(0, limit);
148
+ }
149
+ /**
150
+ * Lista de todas as execuções
151
+ */
152
+ get executions() {
153
+ return [...this._executions];
154
+ }
155
+ /**
156
+ * Data de geração do relatório
157
+ */
158
+ get generatedAt() {
159
+ return this._generatedAt;
160
+ }
161
+ /**
162
+ * Verifica se o relatório foi gerado
163
+ */
164
+ get isGenerated() {
165
+ return this._isGenerated;
166
+ }
167
+ /**
168
+ * Verifica se tem execuções
169
+ */
170
+ get hasExecutions() {
171
+ return this._executions.length > 0;
172
+ }
173
+ /**
174
+ * Conta total de execuções
175
+ */
176
+ get totalExecutions() {
177
+ return this._executions.length;
178
+ }
179
+ }
@@ -0,0 +1,196 @@
1
+ /**
2
+ * @fileoverview Interfaces de repositório para o domínio de testes
3
+ * @module Domain/Repositories
4
+ */
5
+ import type { TestExecution, TestStatus, TestType } from '../entities/TestExecution.js';
6
+ import type { TestReport } from '../entities/TestReport.js';
7
+ /**
8
+ * Critérios para busca de execuções de teste
9
+ */
10
+ export interface TestExecutionQuery {
11
+ status?: TestStatus[];
12
+ type?: TestType[];
13
+ dateFrom?: Date;
14
+ dateTo?: Date;
15
+ tags?: string[];
16
+ name?: string;
17
+ limit?: number;
18
+ offset?: number;
19
+ }
20
+ /**
21
+ * Resultado paginado de execuções
22
+ */
23
+ export interface PaginatedTestExecutions {
24
+ executions: TestExecution[];
25
+ total: number;
26
+ hasMore: boolean;
27
+ }
28
+ /**
29
+ * Interface para repositório de execuções de teste
30
+ * Define operações para persistir e recuperar execuções de teste
31
+ */
32
+ export interface ITestRepository {
33
+ /**
34
+ * Salva uma execução de teste
35
+ */
36
+ save(execution: TestExecution): Promise<void>;
37
+ /**
38
+ * Busca uma execução por ID
39
+ */
40
+ findById(id: string): Promise<TestExecution | null>;
41
+ /**
42
+ * Busca execuções com critérios específicos
43
+ */
44
+ findByQuery(query: TestExecutionQuery): Promise<PaginatedTestExecutions>;
45
+ /**
46
+ * Lista todas as execuções
47
+ */
48
+ findAll(): Promise<TestExecution[]>;
49
+ /**
50
+ * Remove uma execução
51
+ */
52
+ delete(id: string): Promise<boolean>;
53
+ /**
54
+ * Conta execuções por status
55
+ */
56
+ countByStatus(): Promise<Map<TestStatus, number>>;
57
+ /**
58
+ * Busca execuções recentes
59
+ */
60
+ findRecent(limit?: number): Promise<TestExecution[]>;
61
+ /**
62
+ * Busca execuções por tipo de teste
63
+ */
64
+ findByType(type: TestType): Promise<TestExecution[]>;
65
+ }
66
+ /**
67
+ * Critérios para busca de relatórios
68
+ */
69
+ export interface ReportQuery {
70
+ name?: string;
71
+ dateFrom?: Date;
72
+ dateTo?: Date;
73
+ format?: string;
74
+ limit?: number;
75
+ offset?: number;
76
+ }
77
+ /**
78
+ * Resultado paginado de relatórios
79
+ */
80
+ export interface PaginatedReports {
81
+ reports: TestReport[];
82
+ total: number;
83
+ hasMore: boolean;
84
+ }
85
+ /**
86
+ * Interface para repositório de relatórios
87
+ * Define operações para persistir e recuperar relatórios de teste
88
+ */
89
+ export interface IReportRepository {
90
+ /**
91
+ * Salva um relatório
92
+ */
93
+ save(report: TestReport): Promise<void>;
94
+ /**
95
+ * Busca um relatório por ID
96
+ */
97
+ findById(id: string): Promise<TestReport | null>;
98
+ /**
99
+ * Busca relatórios com critérios específicos
100
+ */
101
+ findByQuery(query: ReportQuery): Promise<PaginatedReports>;
102
+ /**
103
+ * Lista todos os relatórios
104
+ */
105
+ findAll(): Promise<TestReport[]>;
106
+ /**
107
+ * Remove um relatório
108
+ */
109
+ delete(id: string): Promise<boolean>;
110
+ /**
111
+ * Busca relatórios recentes
112
+ */
113
+ findRecent(limit?: number): Promise<TestReport[]>;
114
+ /**
115
+ * Gera conteúdo do relatório em formato específico
116
+ */
117
+ generateContent(reportId: string, format: string): Promise<Buffer>;
118
+ /**
119
+ * Exporta relatório para arquivo
120
+ */
121
+ export(reportId: string, filePath: string, format: string): Promise<void>;
122
+ }
123
+ /**
124
+ * Configuração de conexão
125
+ */
126
+ export interface ConnectionConfig {
127
+ type: 'web' | 'mobile' | 'api' | 'ssh' | 'database';
128
+ host?: string;
129
+ port?: number;
130
+ timeout?: number;
131
+ retries?: number;
132
+ credentials?: Record<string, any>;
133
+ options?: Record<string, any>;
134
+ }
135
+ /**
136
+ * Status de uma conexão
137
+ */
138
+ export declare enum ConnectionStatus {
139
+ DISCONNECTED = "disconnected",
140
+ CONNECTING = "connecting",
141
+ CONNECTED = "connected",
142
+ ERROR = "error"
143
+ }
144
+ /**
145
+ * Informações de conexão
146
+ */
147
+ export interface ConnectionInfo {
148
+ id: string;
149
+ config: ConnectionConfig;
150
+ status: ConnectionStatus;
151
+ connectedAt?: Date;
152
+ lastError?: Error;
153
+ metadata?: Record<string, any>;
154
+ }
155
+ /**
156
+ * Interface para repositório de conexões
157
+ * Gerencia conexões com sistemas externos
158
+ */
159
+ export interface IConnectionRepository {
160
+ /**
161
+ * Cria uma nova conexão
162
+ */
163
+ create(config: ConnectionConfig): Promise<ConnectionInfo>;
164
+ /**
165
+ * Estabelece uma conexão
166
+ */
167
+ connect(connectionId: string): Promise<void>;
168
+ /**
169
+ * Desconecta uma conexão
170
+ */
171
+ disconnect(connectionId: string): Promise<void>;
172
+ /**
173
+ * Busca conexão por ID
174
+ */
175
+ findById(id: string): Promise<ConnectionInfo | null>;
176
+ /**
177
+ * Lista conexões por tipo
178
+ */
179
+ findByType(type: string): Promise<ConnectionInfo[]>;
180
+ /**
181
+ * Lista todas as conexões ativas
182
+ */
183
+ findActive(): Promise<ConnectionInfo[]>;
184
+ /**
185
+ * Remove uma conexão
186
+ */
187
+ delete(id: string): Promise<boolean>;
188
+ /**
189
+ * Testa uma conexão
190
+ */
191
+ test(connectionId: string): Promise<boolean>;
192
+ /**
193
+ * Monitora status das conexões
194
+ */
195
+ getHealthStatus(): Promise<Map<string, ConnectionStatus>>;
196
+ }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * @fileoverview Interfaces de repositório para o domínio de testes
3
+ * @module Domain/Repositories
4
+ */
5
+ /**
6
+ * Status de uma conexão
7
+ */
8
+ export var ConnectionStatus;
9
+ (function (ConnectionStatus) {
10
+ ConnectionStatus["DISCONNECTED"] = "disconnected";
11
+ ConnectionStatus["CONNECTING"] = "connecting";
12
+ ConnectionStatus["CONNECTED"] = "connected";
13
+ ConnectionStatus["ERROR"] = "error";
14
+ })(ConnectionStatus || (ConnectionStatus = {}));