@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,417 @@
1
+ /**
2
+ * 🎯 INTERCEPTADOR AUTOMÁTICO DE STATEMENTS
3
+ * Sistema 100% automático - detecta tudo pelos logs existentes
4
+ * Integrado com ExecutionTracker e relatórios HTML
5
+ * @version 3.1.0 - PERSISTÊNCIA AUTOMÁTICA ANTI-PERDA
6
+ */
7
+ type Statement = {
8
+ name: string;
9
+ className: string;
10
+ methodName: string;
11
+ startTime: number;
12
+ endTime?: number;
13
+ duration?: number;
14
+ status: 'running' | 'passed' | 'failed';
15
+ error?: string;
16
+ executedActions?: Array<{
17
+ type: 'API' | 'SSH' | 'DB' | 'UI' | 'MOBILE' | 'OTHER';
18
+ description: string;
19
+ timestamp: string;
20
+ duration?: number;
21
+ success?: boolean;
22
+ details?: {
23
+ method?: string;
24
+ url?: string;
25
+ statusCode?: number;
26
+ command?: string;
27
+ query?: string;
28
+ selector?: string;
29
+ selectorType?: string;
30
+ action?: string;
31
+ requestHeaders?: Record<string, string>;
32
+ requestBody?: string;
33
+ responseHeaders?: Record<string, string>;
34
+ responseBody?: string;
35
+ };
36
+ }>;
37
+ };
38
+ type AutoCT = {
39
+ name: string;
40
+ startTime: number;
41
+ endTime?: number;
42
+ duration?: number;
43
+ status: 'running' | 'passed' | 'failed' | 'skipped';
44
+ error?: string;
45
+ systemName?: string;
46
+ statements: Statement[];
47
+ actions?: string[];
48
+ executedActions?: Array<{
49
+ type: 'API' | 'SSH' | 'DB' | 'UI' | 'MOBILE' | 'OTHER';
50
+ description: string;
51
+ timestamp: string;
52
+ duration?: number;
53
+ success?: boolean;
54
+ details?: {
55
+ method?: string;
56
+ url?: string;
57
+ statusCode?: number;
58
+ command?: string;
59
+ query?: string;
60
+ selector?: string;
61
+ selectorType?: string;
62
+ action?: string;
63
+ requestHeaders?: Record<string, string>;
64
+ requestBody?: string;
65
+ responseHeaders?: Record<string, string>;
66
+ responseBody?: string;
67
+ };
68
+ }>;
69
+ logs?: string[];
70
+ logStartIndex?: number;
71
+ logEndIndex?: number;
72
+ ctId?: string;
73
+ ctName?: string;
74
+ ctOrder?: number;
75
+ className?: string;
76
+ methodName?: string;
77
+ timestamp?: string;
78
+ parentTest?: string;
79
+ };
80
+ type AutoCTExecutionData = {
81
+ testName: string;
82
+ cts: AutoCT[];
83
+ totalDuration: number;
84
+ totalCTs: number;
85
+ passedCTs: number;
86
+ failedCTs: number;
87
+ systemName?: string;
88
+ parentTest?: string;
89
+ ctId?: string;
90
+ ctName?: string;
91
+ ctOrder?: number;
92
+ status?: 'running' | 'passed' | 'failed' | 'skipped';
93
+ duration?: number;
94
+ timestamp?: string | number;
95
+ error?: string;
96
+ className?: string;
97
+ methodName?: string;
98
+ };
99
+ /**
100
+ * 📊 RASTREADOR AUTOMÁTICO DE CTs
101
+ * ZERO CONFIGURAÇÃO - DETECÇÃO AUTOMÁTICA + INTEGRAÇÃO COM RELATÓRIOS
102
+ */
103
+ export declare class StatementTracker {
104
+ /**
105
+ * 🛑 Flag global para indicar que algum CT falhou com stopOnFailure ativo
106
+ * Quando true, todos os próximos CTs devem ser pulados
107
+ */
108
+ private static hasFailedWithStopOnFailure;
109
+ /**
110
+ * 🔒 Controle de duplicação de logs - evita logs repetidos
111
+ */
112
+ private static lastLoggedCT;
113
+ private static lastLoggedRequest;
114
+ private static lastRequestTimestamp;
115
+ private static ctLogStreams;
116
+ /**
117
+ * ✅ CORRIGIDO: Criar CT automaticamente se não existir - VERSÃO ROBUSTA
118
+ * Um CT é criado por test(), não por statement!
119
+ * 🔧 FIX: Verificar se já existe CT com o MESMO NOME, não apenas status='running'
120
+ * ✅ AGORA COM FALLBACKS ROBUSTOS PARA PROJETOS CONSUMIDORES
121
+ */
122
+ static ensureCTCreated(): void;
123
+ /**
124
+ * 🎯 MÉTODO AUXILIAR: Detectar CT via análise de contexto de execução
125
+ * Para projetos consumidores onde TestContext pode não estar disponível
126
+ */
127
+ private static detectCTFromExecutionContext;
128
+ private static getCTStreamKey;
129
+ private static startCTLogStream;
130
+ private static stopCTLogStream;
131
+ /**
132
+ * 🚫 PADRÕES DE LOGS INTERNOS QUE NÃO DEVEM SER ENVIADOS PARA O TESTHUB
133
+ * Estes são logs do próprio framework, não logs úteis do teste
134
+ */
135
+ private static readonly INTERNAL_LOG_PATTERNS;
136
+ /**
137
+ * 🔍 Verifica se um log é interno do framework e deve ser filtrado
138
+ */
139
+ private static isInternalLog;
140
+ private static hydrateCTLogs;
141
+ /**
142
+ * ✅ CORRIGIDO: Pegar nome do CT atual (test()) - VERSÃO ROBUSTA COM MÚLTIPLOS FALLBACKS
143
+ * ES MODULES PURO + COMPATIBILIDADE TOTAL COM PROJETOS CONSUMIDORES
144
+ */
145
+ static getCurrentCTName(): string | null;
146
+ /**
147
+ * ✅ CORRIGIDO: Registrar início de um Statement (método)
148
+ * 🔧 FIX: Buscar CT pelo NOME, não pelo último índice
149
+ * 🆕 AGORA COM CRIAÇÃO AUTOMÁTICA DE CT SE NÃO EXISTIR
150
+ */
151
+ static startStatement(className: string, methodName: string): number;
152
+ /**
153
+ * ✅ CORRIGIDO: Registrar fim de um Statement
154
+ * 🔧 FIX: Buscar CT pelo NOME, não pelo último índice
155
+ */
156
+ static finishStatement(timestamp: number, success: boolean, error?: string): void;
157
+ static waitForDataReady(): Promise<void>;
158
+ /**
159
+ * ✅ NOVO: Finalizar e persistir todos os dados
160
+ * Salva ct-execution-data.json com dados completos
161
+ */
162
+ static finalize(): Promise<void>;
163
+ private static get executions();
164
+ private static get currentTest();
165
+ private static set currentTest(value);
166
+ private static get ctCounter();
167
+ private static set ctCounter(value);
168
+ private static get currentCTName();
169
+ private static set currentCTName(value);
170
+ private static get ctAutoCreated();
171
+ private static set ctAutoCreated(value);
172
+ /**
173
+ * 🆕 Define o sistema atual (chamado por TestAnnotations.setSystem)
174
+ */
175
+ static setCurrentSystem(systemName: string): void;
176
+ /**
177
+ * 🆕 Obtém o sistema atual
178
+ */
179
+ private static getCurrentSystem;
180
+ /**
181
+ * � Obtém referência segura dos logs capturados globalmente
182
+ */
183
+ /**
184
+ * 🆕 Obtém o sistema do CT em execução (público para uso externo)
185
+ * Retorna o sistema configurado via setSystem() para o CT atual
186
+ * @returns {string | null} Nome do sistema ou null se não configurado
187
+ */
188
+ static getCurrentCTSystem(): string | null;
189
+ /**
190
+ * 📝 Obtém logs globais normalizados (com índice + nível)
191
+ * 🔧 ATUALIZADO: Trabalha com índices globais para permitir fatiamento preciso por CT
192
+ */
193
+ private static getGlobalLogs;
194
+ private static gatherLogsFromTerminalCapture;
195
+ private static gatherLogsFromSharedFile;
196
+ private static gatherLegacyLogs;
197
+ private static normalizeLogs;
198
+ private static normalizeSingleLog;
199
+ private static formatLogEntry;
200
+ private static captureLogsBetweenIndices;
201
+ private static getLogsFromTestScope;
202
+ private static buildFallbackLogs;
203
+ private static getCurrentGlobalLogIndex;
204
+ /**
205
+ * 📊 Recalcula estatísticas derivadas com base nos CTs registrados
206
+ */
207
+ private static recomputeTestStats;
208
+ /**
209
+ * ��🔄 Obtém caminho do arquivo de persistência
210
+ */
211
+ private static getDataFilePath;
212
+ /**
213
+ * ⏱️ Formatar duração em formato legível
214
+ */
215
+ private static formatDuration;
216
+ /**
217
+ * 💾 Salva dados automaticamente no arquivo
218
+ * 🛡️ CORRIGIDO: Mescla com dados existentes antes de salvar (multi-worker safe)
219
+ */
220
+ private static saveDataToFile;
221
+ /**
222
+ * 🔄 FORÇA CARREGAMENTO DOS DADOS DO ARQUIVO
223
+ * Usado pelo CustomReporter que roda em processo separado dos testes
224
+ * Garante que os CTs criados pelos testes estejam disponíveis no Reporter
225
+ * 🆕 AGORA SUPORTA MÚLTIPLOS ARQUIVOS DE WORKERS
226
+ */
227
+ static forceLoadFromFile(): void;
228
+ /**
229
+ * 📂 Carrega dados do arquivo de persistência
230
+ */
231
+ private static loadDataFromFile;
232
+ /**
233
+ * 🚫 LISTA DE MÉTODOS QUE NÃO SÃO CTs
234
+ * Métodos de validação, assertions e utilitários não devem ser tratados como CTs
235
+ * ✅ CORRIGIDO: Incluir métodos do BancoActions que são AÇÕES, não CTs
236
+ * 🎯 NOVO: Lista de métodos que são apenas ações internas, não CTs completos
237
+ *
238
+ * ⚠️ IMPORTANTE: Métodos como validateCep, processOrder são CTs REAIS!
239
+ * Apenas métodos auxiliares como assert, log, setup devem estar aqui.
240
+ */
241
+ private static readonly NON_CT_METHODS;
242
+ /**
243
+ * 🎯 LISTA DE MÉTODOS QUE SÃO APENAS AÇÕES INTERNAS (NÃO CTs)
244
+ * Estes métodos são chamados DENTRO de um CT real, mas não são CTs por si só
245
+ */
246
+ private static readonly INTERNAL_ACTION_METHODS;
247
+ /**
248
+ * 🔍 VERIFICA SE MÉTODO É UM CT OU AÇÃO INTERNA
249
+ * ✅ NOVA LÓGICA: CT real vs Ação interna
250
+ *
251
+ * Um CT REAL é um método da classe Statement que:
252
+ * 1. Não está na lista NON_CT_METHODS (utilitários)
253
+ * 2. Não está na lista INTERNAL_ACTION_METHODS (ações como select, execute, click, etc.)
254
+ * 3. Não é método privado (_method)
255
+ * 4. É o método PRINCIPAL da classe (como validateCep, processOrder, etc.)
256
+ */
257
+ private static isValidCTMethod;
258
+ /**
259
+ * 🎯 INTERCEPTAR CLASSE AUTOMATICAMENTE
260
+ * ✅ CORRIGIDO: Apenas interceptar classes Statement, não Actions
261
+ */
262
+ static interceptStatement<T extends object>(StatementClass: new () => T): new () => T;
263
+ /**
264
+ * 🚀 INICIAR CT (CASO DE TESTE) AUTOMATICAMENTE
265
+ */
266
+ static startCT(ctName: string): void;
267
+ /**
268
+ * 🏁 FINALIZAR CT (CASO DE TESTE) AUTOMATICAMENTE
269
+ */
270
+ static endCT(ctName: string, success: boolean, errorMessage?: string): void;
271
+ /**
272
+ * 🎯 REGISTRAR AÇÃO EXECUTADA DURANTE STATEMENT (DENTRO DO CT)
273
+ * @param type Tipo da ação (API, SSH, DB, UI, MOBILE, OTHER)
274
+ * @param description Descrição da ação executada
275
+ * @param success Se a ação foi bem-sucedida
276
+ * @param duration Duração em milissegundos
277
+ * @param details Detalhes específicos da ação (método, url, statusCode, command, query, selector, etc.)
278
+ */
279
+ static recordAction(type: 'API' | 'SSH' | 'DB' | 'UI' | 'MOBILE' | 'OTHER', description: string, success?: boolean, duration?: number, details?: {
280
+ method?: string;
281
+ url?: string;
282
+ statusCode?: number;
283
+ command?: string;
284
+ query?: string;
285
+ selector?: string;
286
+ selectorType?: string;
287
+ action?: string;
288
+ timeHold?: number;
289
+ requestHeaders?: Record<string, string>;
290
+ requestBody?: string;
291
+ responseHeaders?: Record<string, string>;
292
+ responseBody?: string;
293
+ }): void;
294
+ /**
295
+ * 📊 OBTER DADOS FORMATADOS PARA INTEGRAÇÃO COM RELATÓRIOS HTML
296
+ */
297
+ static getReportData(): any;
298
+ /**
299
+ * 📊 OBTER RELATÓRIO COMPLETO
300
+ */
301
+ static getFullReport(): AutoCTExecutionData[];
302
+ /**
303
+ * 🔢 OBTER TOTAL DE CTs
304
+ */
305
+ static getTotalCTs(): number;
306
+ /**
307
+ * 📈 OBTER ESTATÍSTICAS
308
+ */
309
+ static getStats(): {
310
+ totalCTs: number;
311
+ passedCTs: number;
312
+ failedCTs: number;
313
+ totalDuration: number;
314
+ };
315
+ /**
316
+ * 🔍 DETECTAR NOME DO TESTE AUTOMATICAMENTE - VERSÃO ROBUSTA COM MÚLTIPLOS FALLBACKS
317
+ * CORRIGIDO: Pega o CN (test.describe) com compatibilidade total para projetos consumidores
318
+ * ✅ ACEITA qualquer nome no test.describe, com ou sem prefixo "CN"
319
+ * ES MODULES PURO + COMPATIBILIDADE UNIVERSAL
320
+ */
321
+ private static getCurrentTestName;
322
+ /**
323
+ * 🏷️ DEFINIR NOME DO TESTE MANUALMENTE
324
+ * Use este método para garantir que o nome correto do teste seja usado
325
+ */
326
+ static setTestName(testName: string): void;
327
+ /**
328
+ * 🔍 OBTER NOME DO TESTE ATUAL (PÚBLICO)
329
+ * Retorna o nome do teste atual sendo executado
330
+ */
331
+ static getCurrentTest(): string;
332
+ /**
333
+ * ❌ FINALIZAR APENAS CTs "RUNNING" COMO "FAILED"
334
+ * ✅ PRESERVA CTs que já passaram (status='passed')
335
+ * ❌ Marca apenas CTs em execução (status='running') como failed
336
+ * 📊 Preserva duração, logs e ações de todos os CTs
337
+ */
338
+ /**
339
+ * ✅ NOVO: Finaliza CTs "running" como PASSED quando teste PASSOU
340
+ */
341
+ static finalizeRunningCTsAsPassed(testName?: string, ctName?: string): void;
342
+ /**
343
+ * ❌ Finaliza CTs "running" como FAILED quando teste FALHOU
344
+ */
345
+ static finalizeRunningCTsAsFailed(testName?: string, reason?: string, ctName?: string): void;
346
+ /**
347
+ * 🧹 LIMPAR DADOS
348
+ */
349
+ static clear(): void;
350
+ /**
351
+ * 📡 LOG DE REQUEST COM PROTEÇÃO ANTI-DUPLICAÇÃO
352
+ * Evita logs duplicados de requisições consecutivas idênticas
353
+ * @param method Método HTTP (POST, GET, PUT, DELETE)
354
+ * @param descricao Descrição da requisição
355
+ */
356
+ static logRequest(method: string, descricao: string): void;
357
+ /**
358
+ * 📋 IMPRIMIR RELATÓRIO
359
+ */
360
+ static printReport(): void;
361
+ /**
362
+ * 🚨 MÉTODO DE EMERGÊNCIA: Força criação de CT quando detecção falha
363
+ * Para projetos consumidores onde a detecção automática não funciona
364
+ */
365
+ static forceCreateCT(ctName?: string): void;
366
+ /**
367
+ * ✅ NOVO: Finaliza CT individual com status específico
368
+ * Chamado pelo CustomReporter quando cada test() termina
369
+ */
370
+ static finalizarCT(ctName: string, status: 'passed' | 'failed' | 'skipped', options?: {
371
+ testName?: string;
372
+ errorMessage?: string;
373
+ }): void;
374
+ /**
375
+ * 🎯 OBTER CT ATUAL
376
+ */
377
+ static getCurrentCT(): string | null;
378
+ /**
379
+ * 🛑 Marca que um CT falhou com stopOnFailure ativo
380
+ */
381
+ static markFailedWithStopOnFailure(): void;
382
+ /**
383
+ * 🛑 Verifica se algum CT já falhou com stopOnFailure ativo
384
+ */
385
+ static hasAnyTestFailedWithStopOnFailure(): boolean;
386
+ /**
387
+ * 🛑 Reseta a flag de falha (útil para novos describes)
388
+ */
389
+ static resetStopOnFailureFlag(): void;
390
+ /**
391
+ * 🛑 Carrega a flag de stopOnFailure do arquivo JSON (para comunicação entre processos)
392
+ * Retorna true se a flag foi encontrada e está ativa
393
+ */
394
+ static loadStopOnFailureFlagFromFile(): boolean;
395
+ /**
396
+ * 🛑 Verificar se stopOnFailure está ativo
397
+ * Esta função permite ao StatementTracker acessar a configuração do TestAnnotations
398
+ */
399
+ static isStopOnFailureEnabled(): boolean;
400
+ /**
401
+ * 💾 SALVAR DADOS DOS CTS EM ARQUIVO
402
+ */
403
+ static saveExecutionData(outputPath?: string): Promise<void>;
404
+ /**
405
+ * � OBTER EXECUÇÕES (GETTER PÚBLICO)
406
+ */
407
+ static getExecutions(): Map<string, AutoCTExecutionData>;
408
+ /**
409
+ * �🔗 INTEGRAR COM EXECUTION TRACKER
410
+ */
411
+ static integrateWithExecutionTracker(): void;
412
+ }
413
+ /**
414
+ * 🌐 FUNÇÃO AUTOMÁTICA PARA FÁCIL USO
415
+ */
416
+ export declare const interceptStatement: typeof StatementTracker.interceptStatement;
417
+ export {};