@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,476 @@
1
+ import type { TestInfo } from '@playwright/test';
2
+ import type { IPage } from '../interfaces.js';
3
+ /**
4
+ * Classe unificada para configurar contextos de teste e integração com UnifiedReportManager.
5
+ * Permite configurar automaticamente o contexto do teste (API, Frontend, Mobile, SSH, Banco, Mixed),
6
+ * registrar logs, metadados, screenshots e garantir limpeza automática de sessões mobile.
7
+ *
8
+ * ✅ AGORA COM SISTEMA AUTOMÁTICO - Não precisa configurar nada manualmente!
9
+ */
10
+ export declare class TestAnnotations {
11
+ /**
12
+ * Opções do runner para testes desktop
13
+ * - attachWindow: se true, tentará iniciar/atacar uma janela da aplicação
14
+ * - closeWindow: se true, fechará a aplicação ao final do CT
15
+ * - app_path: caminho para o executável a ser iniciado
16
+ */
17
+ private static runnerOptions;
18
+ /**
19
+ * Define opções do runner (attachWindow, closeWindow, app_path)
20
+ */
21
+ static setRunnerOptions(options: {
22
+ attachWindow?: boolean;
23
+ closeWindow?: boolean;
24
+ app_path?: string;
25
+ }): Promise<void>;
26
+ /**
27
+ * ✅ REMOVIDO: inicializarAutoCore - Agora é automático!
28
+ * O sistema se inicializa sozinho quando o módulo é carregado.
29
+ */
30
+ /**
31
+ * 🛑 Ativa o modo "parar ao falhar" globalmente.
32
+ * Quando ativado, se um CT falhar, os próximos CTs não serão executados.
33
+ * Pode ser chamado no escopo do test.describe() para aplicar a todos os CTs do CN.
34
+ * @param enabled - true para ativar, false para desativar (padrão: true)
35
+ */
36
+ static stopOnFailure(enabled?: boolean): void;
37
+ /**
38
+ * 🛑 Verifica se o modo "parar ao falhar" está ativo.
39
+ * @returns true se stopOnFailure está ativo
40
+ */
41
+ static isStopOnFailureEnabled(): boolean;
42
+ /**
43
+ * 🎯 NOVO: Captura CT diretamente do contexto do Playwright e registra automaticamente
44
+ */
45
+ private static capturarCTDoPlaywright;
46
+ /**
47
+ * Detecta automaticamente o contexto principal do projeto a partir das variáveis de ambiente.
48
+ * @returns O tipo de contexto principal detectado.
49
+ */
50
+ private static detectProjectContext;
51
+ /**
52
+ * Configuração automática do contexto do teste.
53
+ * Detecta o contexto, configura interceptadores e registra logs/metadados.
54
+ */
55
+ static Auto: {
56
+ testInfo: TestInfo;
57
+ };
58
+ /**
59
+ * Detecta se o projeto é realmente mixed (múltiplos contextos).
60
+ * @returns true se for mixed, false caso contrário.
61
+ */
62
+ private static detectIfMixed;
63
+ /**
64
+ * Configura interceptador seguro para um contexto específico.
65
+ * @param testName Nome do teste.
66
+ * @param contexto Contexto do teste.
67
+ */
68
+ private static setupSpecificInterceptor;
69
+ /**
70
+ * Configura interceptadores para todos os contextos (usado em projetos mixed).
71
+ * @param testName Nome do teste.
72
+ */
73
+ private static setupAllInterceptors;
74
+ /**
75
+ * Configura finalização automática do teste para registrar duração.
76
+ * @param testInfo TestInfo do Playwright.
77
+ */
78
+ private static setupTestFinalization;
79
+ /**
80
+ * ✅ NOVO: Configura cobertura automática para teste Frontend
81
+ * @param testInfo TestInfo do Playwright
82
+ */
83
+ private static setupFrontendCoverage;
84
+ /**
85
+ * ✅ NOVO: Finaliza e registra cobertura para um teste
86
+ * @param testName Nome do teste
87
+ * @param testInfo TestInfo do teste
88
+ * @param duration Duração do teste em ms
89
+ */
90
+ private static finalizeCoverageForTest;
91
+ /**
92
+ * 🆕 Configura interceptação automática de todas as classes Statements
93
+ */
94
+ private static setupStatementInterception;
95
+ /**
96
+ * 🚨 Interceptação imediata - Configurada ANTES de qualquer import
97
+ */
98
+ private static setupImmediateInterception;
99
+ /**
100
+ * 🔥 Interceptação em tempo real de métodos Statement
101
+ */
102
+ private static setupRealTimeMethodInterception;
103
+ /**
104
+ * 🆕 Intercepta constructors de classes Statement para capturar instanciações
105
+ */
106
+ private static setupConstructorInterception;
107
+ /**
108
+ * 🚀 Detecta automaticamente classes Statement via análise de arquivo .spec.ts
109
+ */
110
+ private static detectStatementClassesFromCallStack;
111
+ /**
112
+ * 🎯 Detecta classes Statement de um arquivo .spec.ts específico
113
+ */
114
+ private static detectStatementClassesFromSpecFile;
115
+ /**
116
+ * 🌐 Interceptar classes Statement disponíveis no globalThis
117
+ */
118
+ private static interceptGlobalStatements;
119
+ /**
120
+ * ✨ NOVO: Interceptação dinâmica de construtores Statement
121
+ */
122
+ private static setupDynamicConstructorInterception;
123
+ /**
124
+ * ✨ NOVO: Interceptar classes Statement já importadas nos módulos
125
+ */
126
+ private static interceptImportedStatements;
127
+ /**
128
+ * 🔄 Detecta classes Statement do contexto atual do teste (fallback ESM)
129
+ */
130
+ private static detectStatementClassesFromTestContext;
131
+ /**
132
+ * 🛠️ Obtém módulo fs compatível com ESM
133
+ */
134
+ private static getFileSystemModule;
135
+ /**
136
+ * 🛠️ Obtém módulo path compatível com ESM
137
+ */
138
+ private static getPathModule;
139
+ /**
140
+ * 🌐 Detecta classes Statement do contexto global - APENAS análise real
141
+ */
142
+ private static detectStatementClassesFromGlobal;
143
+ /**
144
+ * 🌐 Configuração universal que intercepta qualquer instanciação de classe com padrão Statement
145
+ */
146
+ private static setupUniversalStatementInterception;
147
+ /**
148
+ * 🎯 Intercepta uma classe diretamente no momento da descoberta
149
+ */
150
+ private static interceptClassDirectly;
151
+ /**
152
+ * 🏗️ Criar instância interceptada
153
+ */
154
+ private static createInterceptedInstance;
155
+ /**
156
+ * 🌐 Configuração universal de interceptação de constructor
157
+ */
158
+ private static setupUniversalConstructorInterception;
159
+ /**
160
+ * 🚀 Monitoramento contínuo de instanciações de Statement durante o teste
161
+ */
162
+ private static setupContinuousStatementMonitoring;
163
+ /**
164
+ * 🆕 Configuração dinâmica para interceptar instanciações em tempo real
165
+ */
166
+ private static setupDynamicInterception;
167
+ /**
168
+ * Configura interceptador seguro para registrar logs no UnifiedReportManager.
169
+ * @param testName Nome do teste.
170
+ * @param className Nome da classe/contexto.
171
+ * @param originalMethod Método original de log.
172
+ * @param targetClass Classe alvo.
173
+ * @param methodName Nome do método.
174
+ */
175
+ static setupSafeInterceptor(testName: string, className: string, originalMethod: any, targetClass: any, methodName: string): void;
176
+ /**
177
+ * 🌐 Seleciona o sistema do TestHub para o teste.
178
+ * O sistema deve ser selecionado ANTES de usar qualquer ação (API, Frontend, SSH, Banco).
179
+ * As configurações (URLs, credenciais, hosts) serão injetadas automaticamente.
180
+ *
181
+ * @param systemName Nome do sistema (use o enum Systems para IntelliSense)
182
+ * @param environmentName Nome do ambiente (opcional, usa process.env.ENV se não fornecido)
183
+ *
184
+ * @example
185
+ * // IMPORTANTE: Na primeira execução, use string diretamente:
186
+ * await TestAnnotations.setSystem("AUTENTICA_IN_HML")
187
+ *
188
+ * // Após primeira execução, o enum será gerado e você pode usar:
189
+ * import { Systems } from "../.rbqa/SystemsEnum"
190
+ * await TestAnnotations.setSystem(Systems.AUTENTICA_IN_HML) // 👈 IntelliSense disponível
191
+ *
192
+ * // Exemplo completo:
193
+ * test("CT001", async ({}, testInfo) => {
194
+ * TestAnnotations.Api.testInfo = testInfo
195
+ * await TestAnnotations.setSystem(Systems.AUTENTICA_IN_HML)
196
+ *
197
+ * // Agora as URLs e credenciais estão configuradas automaticamente
198
+ * await new StatementsToken().getToken()
199
+ * })
200
+ */
201
+ static setSystem(systemName: string, environmentName?: string): Promise<void>;
202
+ /**
203
+ * 🌐 Obtém a URL do sistema atualmente configurado.
204
+ * Deve ser chamado APÓS setSystem().
205
+ *
206
+ * @returns URL do sistema ou undefined se nenhum sistema foi configurado
207
+ *
208
+ * @example
209
+ * await TestAnnotations.setSystem("AUTENTICA_IN_HML")
210
+ * const url = TestAnnotations.getSystemUrl()
211
+ * console.log(url) // "https://autenticainthml.redecorp.br"
212
+ */
213
+ static getSystemUrl(): string | undefined;
214
+ /**
215
+ * 🌐 Obtém as configurações completas do sistema atualmente configurado.
216
+ * Deve ser chamado APÓS setSystem().
217
+ *
218
+ * @returns Configurações do sistema ou null se nenhum sistema foi configurado
219
+ *
220
+ * @example
221
+ * await TestAnnotations.setSystem("AUTENTICA_IN_HML")
222
+ * const config = TestAnnotations.getSystemConfig()
223
+ * console.log(config?.baseUrl) // "https://autenticainthml.redecorp.br"
224
+ * console.log(config?.username) // "usuario"
225
+ */
226
+ static getSystemConfig(): {
227
+ baseUrl: string;
228
+ username?: string;
229
+ password?: string;
230
+ host?: string;
231
+ port?: string;
232
+ serviceName?: string;
233
+ privateKeyPath?: string;
234
+ } | null;
235
+ /**
236
+ * Configura um teste como API, com interceptador e logs.
237
+ */
238
+ static Api: {
239
+ testInfo: TestInfo;
240
+ };
241
+ /**
242
+ * Configura um teste como Frontend, com logs e cobertura automática.
243
+ */
244
+ static Frontend: {
245
+ /**
246
+ * Configura contexto Frontend com TestInfo e cobertura automática
247
+ * @param testInfo TestInfo do Playwright
248
+ * @param enableCoverage Se deve habilitar cobertura automática (padrão: true)
249
+ */
250
+ configure(testInfo: TestInfo, enableCoverage?: boolean): void;
251
+ /**
252
+ * 🆕 Inicializa contexto Frontend com page e testInfo em uma única chamada
253
+ * @param options Objeto com page e testInfo do Playwright
254
+ * @example
255
+ * test('CT001', async ({ page }, testInfo) => {
256
+ * TestAnnotations.Frontend.init({ page, testInfo })
257
+ * await TestAnnotations.setSystem('MEU_SISTEMA')
258
+ * await new MinhaPage().minhaAcao()
259
+ * })
260
+ */
261
+ init(options: {
262
+ page: IPage;
263
+ testInfo: TestInfo;
264
+ enableCoverage?: boolean;
265
+ }): void;
266
+ testInfo: TestInfo;
267
+ };
268
+ /**
269
+ * Configura um teste como Mobile, com limpeza automática de sessão.
270
+ */
271
+ static Mobile: {
272
+ testInfo: TestInfo;
273
+ };
274
+ /**
275
+ * Configura limpeza automática para testes mobile.
276
+ * @param testInfo TestInfo do Playwright.
277
+ */
278
+ private static setupMobileAutoCleanup;
279
+ /**
280
+ * Método utilitário para configurar mobile capabilities.
281
+ * @param capabilities Objeto de capabilities do dispositivo.
282
+ */
283
+ static setupMobileCapabilities(capabilities: {
284
+ deviceId: string;
285
+ platformName: 'Android' | 'iOS';
286
+ appPackage?: string;
287
+ appActivity?: string;
288
+ bundleId?: string;
289
+ }): Promise<void>;
290
+ /**
291
+ * Configura um teste como SSH, com interceptador e logs.
292
+ */
293
+ static SSH: {
294
+ testInfo: TestInfo;
295
+ };
296
+ /**
297
+ * Configura um teste como Banco, com interceptador e logs.
298
+ */
299
+ static Banco: {
300
+ testInfo: TestInfo;
301
+ };
302
+ /**
303
+ * Configura um teste como Mixed, com interceptadores e limpeza automática.
304
+ */
305
+ static Mixed: {
306
+ testInfo: TestInfo;
307
+ };
308
+ /**
309
+ * Adiciona um log ao UnifiedReportManager para o teste.
310
+ * @param testName Nome do teste.
311
+ * @param message Mensagem de log.
312
+ * @param tipo Tipo do log ('info', 'success', 'error', 'warning').
313
+ */
314
+ static addLog(testName: string, message: string, tipo?: 'info' | 'success' | 'error' | 'warning'): void;
315
+ /**
316
+ * Define metadados para o teste no UnifiedReportManager.
317
+ * @param testName Nome do teste.
318
+ * @param metadata Objeto de metadados.
319
+ */
320
+ static setMetadata(testName: string, metadata: any): void;
321
+ /**
322
+ * Define a duração do teste no UnifiedReportManager.
323
+ * @param testName Nome do teste.
324
+ * @param duracao Duração em segundos.
325
+ */
326
+ static setDuration(testName: string, duracao: number): void;
327
+ /**
328
+ * Obtém o contexto atual do teste.
329
+ * @returns O tipo de contexto ou null.
330
+ */
331
+ static getCurrentTestContext(): string | null;
332
+ /**
333
+ * Marca o teste como falha no UnifiedReportManager.
334
+ * @param testName Nome do teste.
335
+ * @param reason Motivo da falha (opcional).
336
+ */
337
+ static markTestAsFailed(testName: string, reason?: string): void;
338
+ /**
339
+ * Marca o teste como sucesso no UnifiedReportManager.
340
+ * @param testName Nome do teste.
341
+ * @param message Mensagem de sucesso (opcional).
342
+ */
343
+ static markTestAsSuccess(testName: string, message?: string): void;
344
+ /**
345
+ * Adiciona um screenshot ao relatório do teste.
346
+ * @param testName Nome do teste.
347
+ * @param screenshotName Nome do screenshot.
348
+ * @param buffer Buffer da imagem.
349
+ */
350
+ static addScreenshot(testName: string, screenshotName: string, buffer: Buffer): Promise<void>;
351
+ /**
352
+ * Obtém estatísticas globais dos testes.
353
+ * @returns Objeto com total, concluídos, ativos e por tipo.
354
+ */
355
+ static getGlobalStats(): {
356
+ totalTests: number;
357
+ completedTests: number;
358
+ activeTests: number;
359
+ testsByType: Record<string, number>;
360
+ };
361
+ /**
362
+ * Limpa interceptadores ativos (debug).
363
+ */
364
+ static clearInterceptors(): void;
365
+ /**
366
+ * Obtém interceptadores ativos (debug).
367
+ * @returns Array de chaves de interceptadores ativos.
368
+ */
369
+ static getActiveInterceptors(): string[];
370
+ /**
371
+ * 🔥 FORÇA interceptação direta das classes Statement do projeto real
372
+ */
373
+ private static forceInterceptRealProjectStatements;
374
+ /**
375
+ * 🎯 Cria uma versão completamente interceptada de uma classe Statement
376
+ */
377
+ private static createForceInterceptedClass;
378
+ /**
379
+ * 🚀 Gerencia execução de métodos CT detectados via log
380
+ */
381
+ private static handleMethodExecution;
382
+ /**
383
+ * 🚨 NOVO: Gerencia erros de validação detectados via log
384
+ */
385
+ private static handleValidationError;
386
+ /**
387
+ * 🏁 Finaliza o CT ativo quando o teste termina
388
+ */
389
+ static finalizarCTAtivo(): void;
390
+ /**
391
+ * 🆕 Restaurar console original e limpar dados
392
+ */
393
+ static restaurarConsoleOriginal(): void;
394
+ /**
395
+ * 🆕 Obter logs capturados (para debugging)
396
+ */
397
+ static getLogsCapturados(): string[];
398
+ /**
399
+ * 💾 Salva o estado de autenticação atual (cookies + localStorage + sessionStorage)
400
+ * @param filePath Caminho opcional para salvar (padrão: ./test-results/auth/auth-state.json)
401
+ * @example
402
+ * // Após fazer login
403
+ * await TestAnnotations.saveAuthState('./auth/admin-user.json')
404
+ */
405
+ static saveAuthState(filePath?: string): Promise<string>;
406
+ /**
407
+ * 🔄 Restaura o estado de autenticação salvo
408
+ * @param filePath Caminho do arquivo de estado
409
+ * @example
410
+ * // Antes de rodar testes
411
+ * await TestAnnotations.restoreAuthState('./auth/admin-user.json')
412
+ */
413
+ static restoreAuthState(filePath?: string): Promise<void>;
414
+ /**
415
+ * 🧹 Limpa todo o estado de autenticação
416
+ * @example
417
+ * // Logout completo
418
+ * await TestAnnotations.clearAuthState()
419
+ */
420
+ static clearAuthState(): Promise<void>;
421
+ /**
422
+ * 📄 Verifica se existe um arquivo de estado salvo
423
+ * @param filePath Caminho do arquivo
424
+ */
425
+ static authStateExists(filePath?: string): boolean;
426
+ /**
427
+ * 🔍 Lê o estado salvo sem aplicar
428
+ * @param filePath Caminho do arquivo
429
+ */
430
+ static readAuthState(filePath?: string): import("./AuthStateManager.js").AuthState | null;
431
+ /**
432
+ * 🗑️ Remove um arquivo de estado
433
+ * @param filePath Caminho do arquivo
434
+ */
435
+ static deleteAuthState(filePath?: string): boolean;
436
+ /**
437
+ * 📋 Lista todos os estados salvos
438
+ */
439
+ static listAuthStates(): string[];
440
+ }
441
+ export declare const Api: {
442
+ testInfo: TestInfo;
443
+ }, Frontend: {
444
+ /**
445
+ * Configura contexto Frontend com TestInfo e cobertura automática
446
+ * @param testInfo TestInfo do Playwright
447
+ * @param enableCoverage Se deve habilitar cobertura automática (padrão: true)
448
+ */
449
+ configure(testInfo: TestInfo, enableCoverage?: boolean): void;
450
+ /**
451
+ * 🆕 Inicializa contexto Frontend com page e testInfo em uma única chamada
452
+ * @param options Objeto com page e testInfo do Playwright
453
+ * @example
454
+ * test('CT001', async ({ page }, testInfo) => {
455
+ * TestAnnotations.Frontend.init({ page, testInfo })
456
+ * await TestAnnotations.setSystem('MEU_SISTEMA')
457
+ * await new MinhaPage().minhaAcao()
458
+ * })
459
+ */
460
+ init(options: {
461
+ page: IPage;
462
+ testInfo: TestInfo;
463
+ enableCoverage?: boolean;
464
+ }): void;
465
+ testInfo: TestInfo;
466
+ }, Mobile: {
467
+ testInfo: TestInfo;
468
+ }, SSH: {
469
+ testInfo: TestInfo;
470
+ }, Banco: {
471
+ testInfo: TestInfo;
472
+ }, Mixed: {
473
+ testInfo: TestInfo;
474
+ }, Auto: {
475
+ testInfo: TestInfo;
476
+ };