@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,7 @@
1
+ import type { Reporter, FullResult, FullConfig } from '@playwright/test/reporter';
2
+ declare class NetworkLogsReporter implements Reporter {
3
+ private projectRoot;
4
+ onBegin(config: FullConfig): void;
5
+ onEnd(_result: FullResult): Promise<void>;
6
+ }
7
+ export default NetworkLogsReporter;
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Reporter customizado que copia os network logs para playwright-report/evidence/
3
+ * após a geração do relatório HTML
4
+ *
5
+ * Fluxo:
6
+ * 1. Durante o teste: arquivos são salvos em test-results/network-logs/
7
+ * 2. Após gerar relatório: arquivos são copiados para playwright-report/evidence/network-logs/
8
+ *
9
+ * Para usar, adicione ao seu playwright.config.ts:
10
+ * @example
11
+ * import { NetworkLogsReporter } from '@silasfmartins/testhub'
12
+ * export default defineConfig({
13
+ * reporter: [['html'], NetworkLogsReporter],
14
+ * })
15
+ */
16
+ import * as fs from 'node:fs';
17
+ import * as path from 'node:path';
18
+ import { Logger } from '../utils/Logger.js';
19
+ class NetworkLogsReporter {
20
+ projectRoot = '';
21
+ onBegin(config) {
22
+ // Detecta o diretório do projeto a partir do rootDir do config
23
+ this.projectRoot = config.rootDir;
24
+ // Se rootDir termina com 'tests', remove para ir ao projeto raiz
25
+ if (this.projectRoot.endsWith('tests') || this.projectRoot.endsWith('tests/') || this.projectRoot.endsWith('tests\\')) {
26
+ this.projectRoot = path.dirname(this.projectRoot);
27
+ }
28
+ }
29
+ async onEnd(_result) {
30
+ // Copia os arquivos de test-results/network-logs/ para playwright-report/evidence/network-logs/
31
+ // Isso acontece APÓS a geração do relatório HTML
32
+ const sourceDir = path.join(this.projectRoot, 'test-results', 'network-logs');
33
+ const destDir = path.join(this.projectRoot, 'playwright-report', 'evidence', 'network-logs');
34
+ if (!fs.existsSync(sourceDir)) {
35
+ return;
36
+ }
37
+ try {
38
+ // Cria pasta destino se não existir
39
+ if (!fs.existsSync(destDir)) {
40
+ fs.mkdirSync(destDir, { recursive: true });
41
+ }
42
+ // Lista arquivos na pasta source
43
+ const files = fs.readdirSync(sourceDir);
44
+ if (files.length === 0) {
45
+ return;
46
+ }
47
+ Logger.info('\n═════════════════════════════════════════════════════════════════');
48
+ Logger.info('📡 [AutoCore] Copiando Network Logs para playwright-report/');
49
+ Logger.info('═════════════════════════════════════════════════════════════════');
50
+ let copiedCount = 0;
51
+ for (const file of files) {
52
+ const sourcePath = path.join(sourceDir, file);
53
+ const destPath = path.join(destDir, file);
54
+ // Copia o arquivo (mantém original em test-results/)
55
+ fs.copyFileSync(sourcePath, destPath);
56
+ copiedCount++;
57
+ }
58
+ Logger.success(` ✅ ${copiedCount} arquivo(s) copiado(s) para: ${destDir}`);
59
+ Logger.info('═════════════════════════════════════════════════════════════════\n');
60
+ }
61
+ catch (err) {
62
+ Logger.error('❌ [AutoCore] Erro ao copiar network logs', err);
63
+ }
64
+ }
65
+ }
66
+ export default NetworkLogsReporter;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,54 @@
1
+ import { WebActions } from './WebActions.js';
2
+ import { Logger } from '../utils/Logger.js';
3
+ // Register wrappers that call WebActions.withRecovery around public static methods
4
+ // This file is imported once during AutoCore initialization to enable global recovery.
5
+ (function registerRecoveryWrappers() {
6
+ try {
7
+ const exclude = new Set([
8
+ 'withRecovery',
9
+ 'extractSelector',
10
+ 'detectSelectorType',
11
+ 'getLocatorInContext',
12
+ 'isInFrame',
13
+ 'getCurrentFrameSelector',
14
+ 'resolveWaitVisibilityOptions',
15
+ 'getCallerMethodName',
16
+ 'interceptForAutoDocs',
17
+ 'updateAutoDocsStatus',
18
+ 'getPage',
19
+ 'ensurePageInitialized',
20
+ 'logToUnified',
21
+ 'addActionMetadata',
22
+ 'prototype',
23
+ 'length',
24
+ 'name'
25
+ ]);
26
+ const staticNames = Object.getOwnPropertyNames(WebActions);
27
+ const candidates = staticNames.filter((n) => {
28
+ if (exclude.has(n))
29
+ return false;
30
+ const v = WebActions[n];
31
+ return typeof v === 'function';
32
+ });
33
+ for (const name of candidates) {
34
+ const orig = WebActions[name];
35
+ if (!orig || orig.__recovery_wrapped)
36
+ continue;
37
+ const wrapped = function (...args) {
38
+ const originalElement = args.length ? args[0] : undefined;
39
+ return WebActions.withRecovery(originalElement, name, async (candidate) => {
40
+ const newArgs = Array.from(args);
41
+ if (newArgs.length)
42
+ newArgs[0] = candidate;
43
+ return orig.apply(WebActions, newArgs);
44
+ }, args[1]);
45
+ };
46
+ wrapped.__recovery_wrapped = true;
47
+ WebActions[name] = wrapped;
48
+ }
49
+ }
50
+ catch (e) {
51
+ // eslint-disable-next-line no-console
52
+ Logger.warning(`⚠️ [WebActions] Failed to register recovery wrappers: ${e}`);
53
+ }
54
+ })();
@@ -0,0 +1,12 @@
1
+ /**
2
+ * AutoCore Build Security: Watermarking e manifesto assinado
3
+ * Gera watermarks, hashes e assinatura para validação offline
4
+ */
5
+ /**
6
+ * Constrói manifesto completo com assinatura
7
+ */
8
+ export declare function buildSecurityManifest(distPath: string): void;
9
+ /**
10
+ * Valida integridade de arquivo específico
11
+ */
12
+ export declare function validateFileIntegrity(filePath: string, expectedHash: string, expectedWatermark?: string): boolean;
@@ -0,0 +1,138 @@
1
+ /**
2
+ * AutoCore Build Security: Watermarking e manifesto assinado
3
+ * Gera watermarks, hashes e assinatura para validação offline
4
+ */
5
+ import { createHash, randomBytes } from 'node:crypto';
6
+ import { readdirSync, readFileSync, statSync, writeFileSync } from 'node:fs';
7
+ import { extname, join, relative } from 'node:path';
8
+ import { Logger } from '../utils/Logger.js';
9
+ const WATERMARK_SIGNATURE = 'AUTOCORE_WM_';
10
+ const MANIFEST_VERSION = '1.0.0';
11
+ /**
12
+ * Gera watermark único para arquivo
13
+ */
14
+ function generateWatermark() {
15
+ const timestamp = Date.now().toString(36);
16
+ const random = randomBytes(8).toString('hex');
17
+ return `${WATERMARK_SIGNATURE}${timestamp}_${random}`;
18
+ }
19
+ /**
20
+ * Injeta watermark no final do arquivo JS
21
+ */
22
+ function injectWatermark(filePath) {
23
+ const content = readFileSync(filePath, 'utf8');
24
+ const watermark = generateWatermark();
25
+ // Adiciona watermark como comentário no final
26
+ const watermarkedContent = `${content}\n// ${watermark}\n`;
27
+ writeFileSync(filePath, watermarkedContent, 'utf8');
28
+ return watermark;
29
+ }
30
+ /**
31
+ * Calcula hash SHA-512 de arquivo
32
+ */
33
+ function calculateFileHash(filePath) {
34
+ const content = readFileSync(filePath);
35
+ return createHash('sha512').update(content).digest('hex');
36
+ }
37
+ /**
38
+ * Coleta todos os arquivos JS no diretório dist
39
+ */
40
+ function collectDistFiles(distPath) {
41
+ const files = [];
42
+ function scanDir(dir) {
43
+ const items = readdirSync(dir);
44
+ for (const item of items) {
45
+ const fullPath = join(dir, item);
46
+ const stat = statSync(fullPath);
47
+ if (stat.isDirectory()) {
48
+ scanDir(fullPath);
49
+ }
50
+ else if (extname(item) === '.js') {
51
+ const relativePath = relative(distPath, fullPath);
52
+ const watermark = injectWatermark(fullPath);
53
+ const hash = calculateFileHash(fullPath);
54
+ files.push({
55
+ path: relativePath.replace(/\\/g, '/'), // Normalizar para Unix paths
56
+ hash,
57
+ size: stat.size,
58
+ watermark,
59
+ });
60
+ }
61
+ }
62
+ }
63
+ scanDir(distPath);
64
+ return files;
65
+ }
66
+ /**
67
+ * Gera manifesto de integridade
68
+ */
69
+ function generateIntegrityManifest(distPath) {
70
+ const files = collectDistFiles(distPath);
71
+ return {
72
+ version: MANIFEST_VERSION,
73
+ timestamp: new Date().toISOString(),
74
+ algo: 'sha512',
75
+ files,
76
+ };
77
+ }
78
+ /**
79
+ * Assina manifesto com chave privada (simulado - use chave real em produção)
80
+ */
81
+ function signManifest(manifest) {
82
+ // Em produção, use uma chave privada real
83
+ // Para este exemplo, geramos uma assinatura determinística
84
+ const content = JSON.stringify({
85
+ version: manifest.version,
86
+ timestamp: manifest.timestamp,
87
+ files: manifest.files.map((f) => ({ path: f.path, hash: f.hash })),
88
+ });
89
+ const hash = createHash('sha256').update(content).digest('hex');
90
+ return `ECDSA_SIM_${hash.substring(0, 32)}`;
91
+ }
92
+ /**
93
+ * Constrói manifesto completo com assinatura
94
+ */
95
+ export function buildSecurityManifest(distPath) {
96
+ Logger.info('🔒 Gerando manifesto de segurança...');
97
+ const manifest = generateIntegrityManifest(distPath);
98
+ manifest.signature = signManifest(manifest);
99
+ // Salva manifesto principal
100
+ const manifestPath = join(distPath, 'integrity.manifest.json');
101
+ writeFileSync(manifestPath, JSON.stringify(manifest, null, 2));
102
+ // Salva versão compacta para o loader
103
+ const compactManifest = {
104
+ v: manifest.version,
105
+ t: manifest.timestamp,
106
+ s: manifest.signature,
107
+ f: manifest.files.map((f) => [f.path, f.hash, f.watermark]),
108
+ };
109
+ const compactPath = join(distPath, 'security.compact.json');
110
+ writeFileSync(compactPath, JSON.stringify(compactManifest));
111
+ Logger.info(`✅ Manifesto gerado: ${manifest.files.length} arquivos protegidos`);
112
+ Logger.info(`📝 Assinatura: ${manifest.signature?.substring(0, 20)}...`);
113
+ }
114
+ /**
115
+ * Valida integridade de arquivo específico
116
+ */
117
+ export function validateFileIntegrity(filePath, expectedHash, expectedWatermark) {
118
+ try {
119
+ const content = readFileSync(filePath, 'utf8');
120
+ // Verificar watermark se fornecido
121
+ if (expectedWatermark && !content.includes(expectedWatermark)) {
122
+ return false;
123
+ }
124
+ // Verificar hash
125
+ const actualHash = calculateFileHash(filePath);
126
+ return actualHash === expectedHash;
127
+ }
128
+ catch {
129
+ return false;
130
+ }
131
+ }
132
+ /**
133
+ * Script de build - chama esta função após tsc
134
+ */
135
+ if (import.meta.url.endsWith(process.argv[1])) {
136
+ const distPath = process.argv[2] || './dist';
137
+ buildSecurityManifest(distPath);
138
+ }
@@ -0,0 +1,70 @@
1
+ /**
2
+ * 🔒 Sistema de Proteção EULA - AutoCore Framework
3
+ *
4
+ * ⚠️ CRÍTICO: Sistema de proteção de licença e termos de uso
5
+ * Este módulo implementa verificações de conformidade com EULA
6
+ */
7
+ /**
8
+ * Estado do sistema de proteção EULA
9
+ */
10
+ interface EulaState {
11
+ accepted: boolean;
12
+ version: string;
13
+ acceptedAt?: Date;
14
+ userAgent?: string;
15
+ fingerprint?: string;
16
+ }
17
+ /**
18
+ * 🔒 Classe principal de proteção EULA
19
+ */
20
+ export declare class EulaProtection {
21
+ private static instance;
22
+ private state;
23
+ private readonly EULA_VERSION;
24
+ private constructor();
25
+ /**
26
+ * Singleton instance
27
+ */
28
+ static getInstance(): EulaProtection;
29
+ /**
30
+ * 🔍 Verificar se EULA foi aceito
31
+ */
32
+ isEulaAccepted(): boolean;
33
+ /**
34
+ * ✅ Aceitar EULA
35
+ */
36
+ acceptEula(userAgent?: string): void;
37
+ /**
38
+ * 🔍 Carregar estado do EULA
39
+ */
40
+ private loadEulaState;
41
+ /**
42
+ * 💾 Salvar estado do EULA
43
+ */
44
+ private saveEulaState;
45
+ /**
46
+ * 🔑 Gerar fingerprint único
47
+ */
48
+ private generateFingerprint;
49
+ /**
50
+ * 📋 Obter termos do EULA
51
+ */
52
+ getEulaTerms(): string;
53
+ /**
54
+ * 🛡️ Verificar proteção antes de executar
55
+ */
56
+ static enforceEula(): void;
57
+ /**
58
+ * 📊 Estatísticas do EULA
59
+ */
60
+ getStats(): EulaState;
61
+ }
62
+ /**
63
+ * 🚀 Função de conveniência para aceitar EULA
64
+ */
65
+ export declare function acceptEula(): void;
66
+ /**
67
+ * 🔍 Função de conveniência para verificar EULA
68
+ */
69
+ export declare function isEulaAccepted(): boolean;
70
+ export {};
@@ -0,0 +1,155 @@
1
+ /**
2
+ * 🔒 Sistema de Proteção EULA - AutoCore Framework
3
+ *
4
+ * ⚠️ CRÍTICO: Sistema de proteção de licença e termos de uso
5
+ * Este módulo implementa verificações de conformidade com EULA
6
+ */
7
+ import { existsSync, readFileSync } from 'node:fs';
8
+ import { join } from 'node:path';
9
+ import { Logger } from '../utils/Logger.js';
10
+ /**
11
+ * 🔒 Classe principal de proteção EULA
12
+ */
13
+ export class EulaProtection {
14
+ static instance;
15
+ state;
16
+ EULA_VERSION = '1.0.0';
17
+ constructor() {
18
+ this.state = {
19
+ accepted: false,
20
+ version: this.EULA_VERSION,
21
+ };
22
+ this.loadEulaState();
23
+ }
24
+ /**
25
+ * Singleton instance
26
+ */
27
+ static getInstance() {
28
+ if (!EulaProtection.instance) {
29
+ EulaProtection.instance = new EulaProtection();
30
+ }
31
+ return EulaProtection.instance;
32
+ }
33
+ /**
34
+ * 🔍 Verificar se EULA foi aceito
35
+ */
36
+ isEulaAccepted() {
37
+ return this.state.accepted && this.state.version === this.EULA_VERSION;
38
+ }
39
+ /**
40
+ * ✅ Aceitar EULA
41
+ */
42
+ acceptEula(userAgent) {
43
+ this.state = {
44
+ accepted: true,
45
+ version: this.EULA_VERSION,
46
+ acceptedAt: new Date(),
47
+ userAgent,
48
+ fingerprint: this.generateFingerprint(),
49
+ };
50
+ this.saveEulaState();
51
+ }
52
+ /**
53
+ * 🔍 Carregar estado do EULA
54
+ */
55
+ loadEulaState() {
56
+ try {
57
+ const eulaPath = join(process.cwd(), '.eula-state');
58
+ if (existsSync(eulaPath)) {
59
+ const data = readFileSync(eulaPath, 'utf-8');
60
+ const parsed = JSON.parse(data);
61
+ // Verificar se é a versão atual
62
+ if (parsed.version === this.EULA_VERSION) {
63
+ this.state = parsed;
64
+ }
65
+ }
66
+ }
67
+ catch (error) {
68
+ // Estado padrão em caso de erro
69
+ this.state.accepted = false;
70
+ }
71
+ }
72
+ /**
73
+ * 💾 Salvar estado do EULA
74
+ */
75
+ saveEulaState() {
76
+ try {
77
+ const { writeFileSync } = require('node:fs');
78
+ const eulaPath = join(process.cwd(), '.eula-state');
79
+ writeFileSync(eulaPath, JSON.stringify(this.state, null, 2));
80
+ }
81
+ catch (error) {
82
+ Logger.warning(`⚠️ Não foi possível salvar estado do EULA: ${error}`);
83
+ }
84
+ }
85
+ /**
86
+ * 🔑 Gerar fingerprint único
87
+ */
88
+ generateFingerprint() {
89
+ const { randomBytes } = require('node:crypto');
90
+ const data = [
91
+ process.version,
92
+ process.platform,
93
+ process.arch,
94
+ randomBytes(8).toString('hex'),
95
+ ].join('-');
96
+ const { createHash } = require('node:crypto');
97
+ return createHash('sha256').update(data).digest('hex').substring(0, 16);
98
+ }
99
+ /**
100
+ * 📋 Obter termos do EULA
101
+ */
102
+ getEulaTerms() {
103
+ return `
104
+ # 📋 EULA - End User License Agreement
105
+ ## AutoCore Framework v${this.EULA_VERSION}
106
+
107
+ ### 🎯 Termos de Uso
108
+
109
+ 1. **Licença**: Este software é licenciado para uso em projetos de automação de testes
110
+ 2. **Restrições**: Não é permitida redistribuição sem autorização
111
+ 3. **Garantias**: O software é fornecido "como está" sem garantias
112
+ 4. **Responsabilidade**: O usuário é responsável pelo uso adequado
113
+
114
+ ### ✅ Aceitação
115
+
116
+ Ao usar este framework, você concorda com os termos acima.
117
+ `.trim();
118
+ }
119
+ /**
120
+ * 🛡️ Verificar proteção antes de executar
121
+ */
122
+ static enforceEula() {
123
+ const protection = EulaProtection.getInstance();
124
+ if (!protection.isEulaAccepted()) {
125
+ Logger.info('\n' + '='.repeat(60));
126
+ Logger.info('🔒 PROTEÇÃO EULA ATIVADA');
127
+ Logger.info('='.repeat(60));
128
+ Logger.info(protection.getEulaTerms());
129
+ Logger.info('\n' + '='.repeat(60));
130
+ Logger.warning('⚠️ Para continuar, aceite os termos do EULA');
131
+ Logger.info('💡 Execute: EulaProtection.getInstance().acceptEula()');
132
+ Logger.info('='.repeat(60) + '\n');
133
+ throw new Error('EULA não aceito. Execute acceptEula() para continuar.');
134
+ }
135
+ }
136
+ /**
137
+ * 📊 Estatísticas do EULA
138
+ */
139
+ getStats() {
140
+ return { ...this.state };
141
+ }
142
+ }
143
+ /**
144
+ * 🚀 Função de conveniência para aceitar EULA
145
+ */
146
+ export function acceptEula() {
147
+ EulaProtection.getInstance().acceptEula(process.env.USER_AGENT);
148
+ Logger.success('✅ EULA aceito com sucesso!');
149
+ }
150
+ /**
151
+ * 🔍 Função de conveniência para verificar EULA
152
+ */
153
+ export function isEulaAccepted() {
154
+ return EulaProtection.getInstance().isEulaAccepted();
155
+ }
@@ -0,0 +1,46 @@
1
+ /**
2
+ * HoneypotManager: Sistema de honeypots dinâmicos para detecção de automação
3
+ * Cria armadilhas invisíveis em tempo de execução que detectam uso por IA
4
+ */
5
+ export declare class HoneypotManager {
6
+ private static tripped;
7
+ private static readonly zeroWidthChars;
8
+ /**
9
+ * Verifica se algum honeypot foi ativado
10
+ */
11
+ static isTripped(): boolean;
12
+ /**
13
+ * Marca um honeypot como ativado
14
+ */
15
+ static tripHoneypot(source: string): void;
16
+ /**
17
+ * Injeta caracteres invisíveis em strings/comentários TypeScript
18
+ * Marcam arquivos sem afetar funcionalidade
19
+ */
20
+ static injectInvisibleMarkers(content: string, marker?: string): string;
21
+ /**
22
+ * Cria source maps com metadados de proteção
23
+ */
24
+ static injectSourceMapProtection(sourceMapContent: string): string;
25
+ /**
26
+ * Cria arquivos honeypot dinâmicos em diretórios temporários
27
+ */
28
+ static createDynamicHoneypots(baseDir: string): void;
29
+ /**
30
+ * Gera honeypot TypeScript com aparência legítima
31
+ */
32
+ private static generateTsHoneypot;
33
+ /**
34
+ * Gera honeypot JSON com configurações falsas mas realistas
35
+ */
36
+ private static generateJsonHoneypot;
37
+ /**
38
+ * Verifica integridade de arquivos protegidos
39
+ */
40
+ static verifyFileIntegrity(filePath: string): boolean;
41
+ /**
42
+ * Cria método isento que força degradação quando chamado
43
+ */
44
+ static createPoisonMethod(methodName: string): Function;
45
+ }
46
+ export default HoneypotManager;