@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,142 @@
1
+ /**
2
+ * @fileoverview Container de Injeção de Dependência para AutoCore
3
+ * @module Infrastructure/DI
4
+ */
5
+ import type { BrowserContext, Page } from '@playwright/test';
6
+ import { type IMobileDriver } from './adapters/AppiumAdapter.js';
7
+ import { type IDatabaseClient } from './adapters/OracleAdapter.js';
8
+ import { type IWebDriver } from './adapters/PlaywrightAdapter.js';
9
+ import { type ISSHClient } from './adapters/SSHAdapter.js';
10
+ /**
11
+ * Tipos de serviços disponíveis no container
12
+ */
13
+ export type ServiceType = 'webDriver' | 'mobileDriver' | 'sshClient' | 'databaseClient' | 'testExecutionService' | 'reportGenerationService' | 'configurationService';
14
+ /**
15
+ * Mapa de tipos para interfaces
16
+ */
17
+ export interface ServiceMap {
18
+ webDriver: IWebDriver;
19
+ mobileDriver: IMobileDriver;
20
+ sshClient: ISSHClient;
21
+ databaseClient: IDatabaseClient;
22
+ testExecutionService: unknown;
23
+ reportGenerationService: unknown;
24
+ configurationService: unknown;
25
+ }
26
+ /**
27
+ * Factory function para criação de serviços
28
+ */
29
+ export type ServiceFactory<T = unknown> = (container: DIContainer) => T | Promise<T>;
30
+ /**
31
+ * Configuração de registro de serviço
32
+ */
33
+ export interface ServiceRegistration<T = unknown> {
34
+ factory: ServiceFactory<T>;
35
+ singleton: boolean;
36
+ dependencies?: ServiceType[];
37
+ }
38
+ /**
39
+ * Container de Injeção de Dependência
40
+ * Implementa padrão Service Locator com injeção de dependência
41
+ */
42
+ export declare class DIContainer {
43
+ private services;
44
+ private instances;
45
+ private resolving;
46
+ /**
47
+ * Registra um serviço no container
48
+ */
49
+ register<K extends ServiceType>(type: K, factory: ServiceFactory<ServiceMap[K]>, options?: {
50
+ singleton?: boolean;
51
+ dependencies?: ServiceType[];
52
+ }): void;
53
+ /**
54
+ * Registra uma instância já criada
55
+ */
56
+ registerInstance<K extends ServiceType>(type: K, instance: ServiceMap[K]): void;
57
+ /**
58
+ * Resolve um serviço do container
59
+ */
60
+ resolve<K extends ServiceType>(type: K): Promise<ServiceMap[K]>;
61
+ /**
62
+ * Verifica se um serviço está registrado
63
+ */
64
+ hasService(type: ServiceType): boolean;
65
+ /**
66
+ * Remove um serviço do container
67
+ */
68
+ unregister(type: ServiceType): void;
69
+ /**
70
+ * Limpa todas as instâncias (mantém registros)
71
+ */
72
+ clearInstances(): void;
73
+ /**
74
+ * Limpa todo o container
75
+ */
76
+ clear(): void;
77
+ /**
78
+ * Lista todos os serviços registrados
79
+ */
80
+ getRegisteredServices(): ServiceType[];
81
+ /**
82
+ * Cria um escopo filho do container
83
+ * Útil para isolar instâncias por teste ou contexto
84
+ */
85
+ createScope(): DIContainer;
86
+ }
87
+ /**
88
+ * Configurador de serviços padrão do AutoCore
89
+ */
90
+ export declare class AutoCoreServiceConfigurator {
91
+ /**
92
+ * Configura todos os serviços padrão no container
93
+ */
94
+ static configure(container: DIContainer): void;
95
+ /**
96
+ * Configura container para testes web com Playwright
97
+ */
98
+ static configureForWeb(container: DIContainer, page: Page, context?: BrowserContext): void;
99
+ /**
100
+ * Configura container para testes móveis com Appium
101
+ */
102
+ static configureForMobile(container: DIContainer, driver: unknown, deviceConfig?: Record<string, unknown>): void;
103
+ /**
104
+ * Configura container para testes com SSH
105
+ */
106
+ static configureForSSH(container: DIContainer, credentials: {
107
+ host: string;
108
+ port: number;
109
+ username: string;
110
+ password?: string;
111
+ privateKey?: string;
112
+ }): Promise<void>;
113
+ /**
114
+ * Configura container para testes com Oracle
115
+ */
116
+ static configureForDatabase(container: DIContainer, config: {
117
+ host: string;
118
+ port: number;
119
+ database: string;
120
+ username: string;
121
+ password: string;
122
+ }): Promise<void>;
123
+ }
124
+ /**
125
+ * Container global padrão
126
+ * Pode ser usado para casos simples, mas recomenda-se criar instâncias específicas
127
+ */
128
+ export declare const defaultContainer: DIContainer;
129
+ /**
130
+ * Decorator para injeção de dependência em classes
131
+ */
132
+ export declare function Injectable<T extends new (...args: any[]) => any>(dependencies?: ServiceType[]): (target: T) => T;
133
+ /**
134
+ * Decorator para propriedades que devem ser injetadas
135
+ */
136
+ export declare function Inject(serviceType: ServiceType): (target: any, propertyKey: string) => void;
137
+ /**
138
+ * Utilitário para resolver dependências em funções
139
+ */
140
+ export declare function resolveDependencies<T extends ServiceType[]>(container: DIContainer, ...serviceTypes: T): Promise<{
141
+ [K in keyof T]: ServiceMap[T[K]];
142
+ }>;
@@ -0,0 +1,250 @@
1
+ /**
2
+ * @fileoverview Container de Injeção de Dependência para AutoCore
3
+ * @module Infrastructure/DI
4
+ */
5
+ import { ValidationError } from '../functions/errors/ValidationError.js';
6
+ import { AppiumAdapter } from './adapters/AppiumAdapter.js';
7
+ import { OracleAdapter, } from './adapters/OracleAdapter.js';
8
+ import { PlaywrightAdapter, } from './adapters/PlaywrightAdapter.js';
9
+ import { SSHAdapter } from './adapters/SSHAdapter.js';
10
+ /**
11
+ * Container de Injeção de Dependência
12
+ * Implementa padrão Service Locator com injeção de dependência
13
+ */
14
+ export class DIContainer {
15
+ services = new Map();
16
+ instances = new Map();
17
+ resolving = new Set();
18
+ /**
19
+ * Registra um serviço no container
20
+ */
21
+ register(type, factory, options = {}) {
22
+ const registration = {
23
+ factory,
24
+ singleton: options.singleton !== false, // Default para singleton
25
+ dependencies: options.dependencies || [],
26
+ };
27
+ this.services.set(type, registration);
28
+ }
29
+ /**
30
+ * Registra uma instância já criada
31
+ */
32
+ registerInstance(type, instance) {
33
+ this.instances.set(type, instance);
34
+ this.register(type, () => instance, { singleton: true });
35
+ }
36
+ /**
37
+ * Resolve um serviço do container
38
+ */
39
+ async resolve(type) {
40
+ // Verificar dependência circular
41
+ if (this.resolving.has(type)) {
42
+ throw ValidationError.invalidConfiguration('dependency', `Dependência circular detectada para serviço: ${type}`);
43
+ }
44
+ // Retornar instância singleton se existir
45
+ if (this.instances.has(type)) {
46
+ return this.instances.get(type);
47
+ }
48
+ // Verificar se serviço está registrado
49
+ const registration = this.services.get(type);
50
+ if (!registration) {
51
+ throw ValidationError.invalidConfiguration('service', `Serviço não registrado: ${type}`);
52
+ }
53
+ this.resolving.add(type);
54
+ try {
55
+ // Resolver dependências primeiro
56
+ const dependencies = [];
57
+ if (registration.dependencies) {
58
+ for (const depType of registration.dependencies) {
59
+ const dependency = await this.resolve(depType);
60
+ dependencies.push(dependency);
61
+ }
62
+ }
63
+ // Criar instância
64
+ const instance = await registration.factory(this);
65
+ // Armazenar se for singleton
66
+ if (registration.singleton) {
67
+ this.instances.set(type, instance);
68
+ }
69
+ return instance;
70
+ }
71
+ finally {
72
+ this.resolving.delete(type);
73
+ }
74
+ }
75
+ /**
76
+ * Verifica se um serviço está registrado
77
+ */
78
+ hasService(type) {
79
+ return this.services.has(type);
80
+ }
81
+ /**
82
+ * Remove um serviço do container
83
+ */
84
+ unregister(type) {
85
+ this.services.delete(type);
86
+ this.instances.delete(type);
87
+ }
88
+ /**
89
+ * Limpa todas as instâncias (mantém registros)
90
+ */
91
+ clearInstances() {
92
+ this.instances.clear();
93
+ }
94
+ /**
95
+ * Limpa todo o container
96
+ */
97
+ clear() {
98
+ this.services.clear();
99
+ this.instances.clear();
100
+ this.resolving.clear();
101
+ }
102
+ /**
103
+ * Lista todos os serviços registrados
104
+ */
105
+ getRegisteredServices() {
106
+ return Array.from(this.services.keys());
107
+ }
108
+ /**
109
+ * Cria um escopo filho do container
110
+ * Útil para isolar instâncias por teste ou contexto
111
+ */
112
+ createScope() {
113
+ const scope = new DIContainer();
114
+ // Copiar registros (mas não instâncias)
115
+ for (const [type, registration] of this.services) {
116
+ scope.services.set(type, registration);
117
+ }
118
+ return scope;
119
+ }
120
+ }
121
+ /**
122
+ * Configurador de serviços padrão do AutoCore
123
+ */
124
+ export class AutoCoreServiceConfigurator {
125
+ /**
126
+ * Configura todos os serviços padrão no container
127
+ */
128
+ static configure(container) {
129
+ // Registrar adaptadores de infraestrutura
130
+ container.register('webDriver', () => {
131
+ throw ValidationError.invalidConfiguration('webDriver', 'WebDriver deve ser configurado com instância específica');
132
+ }, { singleton: true });
133
+ container.register('mobileDriver', () => {
134
+ throw ValidationError.invalidConfiguration('mobileDriver', 'MobileDriver deve ser configurado com instância específica');
135
+ }, { singleton: true });
136
+ container.register('sshClient', () => new SSHAdapter(), { singleton: true });
137
+ container.register('databaseClient', () => new OracleAdapter(), {
138
+ singleton: true,
139
+ });
140
+ // Registrar serviços de aplicação (placeholders até implementarmos)
141
+ container.register('testExecutionService', async (c) => {
142
+ const webDriver = await c.resolve('webDriver');
143
+ const mobileDriver = await c.resolve('mobileDriver');
144
+ // Placeholder - será implementado na próxima etapa
145
+ return {
146
+ webDriver,
147
+ mobileDriver,
148
+ execute: async (_testConfig) => {
149
+ // placeholder
150
+ },
151
+ };
152
+ }, {
153
+ singleton: false, // Novo serviço por execução
154
+ dependencies: ['webDriver', 'mobileDriver'],
155
+ });
156
+ container.register('reportGenerationService', async (_c) => {
157
+ // Placeholder - será implementado na próxima etapa
158
+ return {
159
+ generateReport: async (_results) => {
160
+ // placeholder
161
+ },
162
+ };
163
+ }, { singleton: true });
164
+ container.register('configurationService', () => {
165
+ // Placeholder - será implementado na próxima etapa
166
+ return {
167
+ getConfig: (_key) => {
168
+ return null;
169
+ },
170
+ };
171
+ }, { singleton: true });
172
+ }
173
+ /**
174
+ * Configura container para testes web com Playwright
175
+ */
176
+ static configureForWeb(container, page, context) {
177
+ const webDriver = new PlaywrightAdapter(page, context);
178
+ container.registerInstance('webDriver', webDriver);
179
+ }
180
+ /**
181
+ * Configura container para testes móveis com Appium
182
+ */
183
+ static configureForMobile(container, driver, deviceConfig) {
184
+ const mobileDriver = new AppiumAdapter(driver, deviceConfig);
185
+ container.registerInstance('mobileDriver', mobileDriver);
186
+ }
187
+ /**
188
+ * Configura container para testes com SSH
189
+ */
190
+ static async configureForSSH(container, credentials) {
191
+ const sshClient = new SSHAdapter();
192
+ await sshClient.connect(credentials);
193
+ container.registerInstance('sshClient', sshClient);
194
+ }
195
+ /**
196
+ * Configura container para testes com Oracle
197
+ */
198
+ static async configureForDatabase(container, config) {
199
+ const databaseClient = new OracleAdapter();
200
+ await databaseClient.connect(config);
201
+ container.registerInstance('databaseClient', databaseClient);
202
+ }
203
+ }
204
+ /**
205
+ * Container global padrão
206
+ * Pode ser usado para casos simples, mas recomenda-se criar instâncias específicas
207
+ */
208
+ export const defaultContainer = new DIContainer();
209
+ // Configurar serviços padrão
210
+ AutoCoreServiceConfigurator.configure(defaultContainer);
211
+ /**
212
+ * Decorator para injeção de dependência em classes
213
+ */
214
+ export function Injectable(dependencies = []) {
215
+ return (target) => class extends target {
216
+ constructor(...args) {
217
+ super(...args);
218
+ // Adicionar metadados de dependências
219
+ Object.defineProperty(this, '__dependencies', {
220
+ value: dependencies,
221
+ writable: false,
222
+ enumerable: false,
223
+ });
224
+ }
225
+ };
226
+ }
227
+ /**
228
+ * Decorator para propriedades que devem ser injetadas
229
+ */
230
+ export function Inject(serviceType) {
231
+ return (target, propertyKey) => {
232
+ Object.defineProperty(target, propertyKey, {
233
+ get() {
234
+ if (!this.__container) {
235
+ throw ValidationError.invalidConfiguration('injection', `Container não configurado para classe ${target.constructor.name}`);
236
+ }
237
+ return this.__container.resolve(serviceType);
238
+ },
239
+ enumerable: true,
240
+ configurable: false,
241
+ });
242
+ };
243
+ }
244
+ /**
245
+ * Utilitário para resolver dependências em funções
246
+ */
247
+ export async function resolveDependencies(container, ...serviceTypes) {
248
+ const resolved = await Promise.all(serviceTypes.map((type) => container.resolve(type)));
249
+ return resolved;
250
+ }
@@ -0,0 +1,168 @@
1
+ /**
2
+ * @fileoverview Adaptador Appium para automação móvel seguindo padrões DDD
3
+ * @module Infrastructure/Adapters
4
+ */
5
+ /**
6
+ * Interface para drivers móveis
7
+ */
8
+ export interface IMobileDriver {
9
+ tap(selector: string, options?: {
10
+ timeout?: number;
11
+ }): Promise<void>;
12
+ doubleTap(selector: string): Promise<void>;
13
+ longPress(selector: string, duration?: number): Promise<void>;
14
+ swipe(startSelector: string, endSelector: string): Promise<void>;
15
+ swipeByCoordinates(startX: number, startY: number, endX: number, endY: number): Promise<void>;
16
+ scroll(direction: 'up' | 'down' | 'left' | 'right', distance?: number): Promise<void>;
17
+ sendKeys(selector: string, text: string): Promise<void>;
18
+ clearText(selector: string): Promise<void>;
19
+ hideKeyboard(): Promise<void>;
20
+ getText(selector: string): Promise<string>;
21
+ getAttribute(selector: string, attribute: string): Promise<string | null>;
22
+ isDisplayed(selector: string): Promise<boolean>;
23
+ isEnabled(selector: string): Promise<boolean>;
24
+ waitForElement(selector: string, options?: {
25
+ timeout?: number;
26
+ condition?: 'visible' | 'clickable' | 'exists';
27
+ }): Promise<void>;
28
+ pinch(selector: string, scale: number): Promise<void>;
29
+ zoom(selector: string, scale: number): Promise<void>;
30
+ rotate(orientation: 'portrait' | 'landscape'): Promise<void>;
31
+ switchToWebView(): Promise<void>;
32
+ switchToNativeApp(): Promise<void>;
33
+ getCurrentActivity(): Promise<string>;
34
+ launchApp(): Promise<void>;
35
+ closeApp(): Promise<void>;
36
+ resetApp(): Promise<void>;
37
+ screenshot(path?: string): Promise<Buffer>;
38
+ getPageSource(): Promise<string>;
39
+ quit(): Promise<void>;
40
+ }
41
+ /**
42
+ * Adaptador que integra Appium com a arquitetura do AutoCore
43
+ * Implementa a interface IMobileDriver usando WebDriverIO
44
+ */
45
+ export declare class AppiumAdapter implements IMobileDriver {
46
+ private driver;
47
+ private deviceConfig;
48
+ constructor(driver: any, // WebDriverIO instance
49
+ deviceConfig: any);
50
+ /**
51
+ * Toca em um elemento
52
+ */
53
+ tap(selector: string, options?: {
54
+ timeout?: number;
55
+ }): Promise<void>;
56
+ /**
57
+ * Duplo toque em um elemento
58
+ */
59
+ doubleTap(selector: string): Promise<void>;
60
+ /**
61
+ * Pressão longa em um elemento
62
+ */
63
+ longPress(selector: string, duration?: number): Promise<void>;
64
+ /**
65
+ * Desliza de um elemento para outro
66
+ */
67
+ swipe(startSelector: string, endSelector: string): Promise<void>;
68
+ /**
69
+ * Desliza por coordenadas
70
+ */
71
+ swipeByCoordinates(startX: number, startY: number, endX: number, endY: number): Promise<void>;
72
+ /**
73
+ * Rola a tela em uma direção
74
+ */
75
+ scroll(direction: 'up' | 'down' | 'left' | 'right', distance?: number): Promise<void>;
76
+ /**
77
+ * Envia texto para um elemento
78
+ */
79
+ sendKeys(selector: string, text: string): Promise<void>;
80
+ /**
81
+ * Limpa texto de um elemento
82
+ */
83
+ clearText(selector: string): Promise<void>;
84
+ /**
85
+ * Esconde o teclado
86
+ */
87
+ hideKeyboard(): Promise<void>;
88
+ /**
89
+ * Obtém texto de um elemento
90
+ */
91
+ getText(selector: string): Promise<string>;
92
+ /**
93
+ * Obtém atributo de um elemento
94
+ */
95
+ getAttribute(selector: string, attribute: string): Promise<string | null>;
96
+ /**
97
+ * Verifica se elemento está visível
98
+ */
99
+ isDisplayed(selector: string): Promise<boolean>;
100
+ /**
101
+ * Verifica se elemento está habilitado
102
+ */
103
+ isEnabled(selector: string): Promise<boolean>;
104
+ /**
105
+ * Aguarda elemento ficar em condição específica
106
+ */
107
+ waitForElement(selector: string, options?: {
108
+ timeout?: number;
109
+ condition?: 'visible' | 'clickable' | 'exists';
110
+ }): Promise<void>;
111
+ /**
112
+ * Gesto de pinça (reduzir)
113
+ */
114
+ pinch(selector: string, scale: number): Promise<void>;
115
+ /**
116
+ * Gesto de zoom (ampliar)
117
+ */
118
+ zoom(selector: string, scale: number): Promise<void>;
119
+ /**
120
+ * Rotaciona dispositivo
121
+ */
122
+ rotate(orientation: 'portrait' | 'landscape'): Promise<void>;
123
+ /**
124
+ * Muda para contexto WebView
125
+ */
126
+ switchToWebView(): Promise<void>;
127
+ /**
128
+ * Muda para contexto nativo
129
+ */
130
+ switchToNativeApp(): Promise<void>;
131
+ /**
132
+ * Obtém activity atual (Android)
133
+ */
134
+ getCurrentActivity(): Promise<string>;
135
+ /**
136
+ * Abre a aplicação
137
+ */
138
+ launchApp(): Promise<void>;
139
+ /**
140
+ * Fecha a aplicação
141
+ */
142
+ closeApp(): Promise<void>;
143
+ /**
144
+ * Reseta a aplicação
145
+ */
146
+ resetApp(): Promise<void>;
147
+ /**
148
+ * Captura screenshot
149
+ */
150
+ screenshot(path?: string): Promise<Buffer>;
151
+ /**
152
+ * Obtém código fonte da página
153
+ */
154
+ getPageSource(): Promise<string>;
155
+ /**
156
+ * Encerra o driver
157
+ */
158
+ quit(): Promise<void>;
159
+ /**
160
+ * Obtém a instância do WebDriverIO
161
+ * Para casos onde é necessário acessar funcionalidades específicas
162
+ */
163
+ getDriver(): any;
164
+ /**
165
+ * Obtém configuração do dispositivo
166
+ */
167
+ getDeviceConfig(): any;
168
+ }