@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,65 @@
1
+ import { type ErrorType, type ActionType } from './TestRecoveryClient.js';
2
+ /** Parâmetros para correção automática de código */
3
+ export interface AutoFixCodeParams {
4
+ /** XPath antigo/quebrado */
5
+ xpath: string;
6
+ /** Novo XPath corrigido */
7
+ newXPath: string;
8
+ /** Tipo do erro que causou a falha */
9
+ errorType?: ErrorType;
10
+ /** Tipo de ação que falhou */
11
+ actionType?: ActionType;
12
+ /** Caminho absoluto do projeto Playwright */
13
+ projectRoot?: string;
14
+ /** Arquivo específico para corrigir (relativo a projectRoot) */
15
+ attributesFile?: string;
16
+ /** Nome da propriedade/getter a corrigir */
17
+ locatorProperty?: string;
18
+ /** Nome do sistema (para contexto) */
19
+ systemName?: string;
20
+ /** Se true, aplica correção automaticamente. Se false, retorna preview */
21
+ autoConfirm?: boolean;
22
+ }
23
+ /** Resultado da correção automática */
24
+ export interface AutoFixCodeResult {
25
+ success: boolean;
26
+ fileUpdated: boolean;
27
+ filePath?: string;
28
+ changes?: {
29
+ oldXPath: string;
30
+ newXPath: string;
31
+ property?: string;
32
+ lineNumber?: number;
33
+ };
34
+ }
35
+ /**
36
+ * Corrige automaticamente um XPath quebrado no código-fonte
37
+ *
38
+ * @example
39
+ * ```typescript
40
+ * // Correção automática (aplica imediatamente)
41
+ * const success = await autoFixCode({
42
+ * xpath: "//button[@id='btn-old']",
43
+ * newXPath: "//button[@data-testid='btn-login']",
44
+ * attributesFile: 'src/attributes/AttributesLogin.ts',
45
+ * autoConfirm: true
46
+ * })
47
+ *
48
+ * // Preview sem aplicar (para revisão manual)
49
+ * const result = await autoFixCode({
50
+ * xpath: "//button[@id='btn-old']",
51
+ * newXPath: "//button[@data-testid='btn-login']",
52
+ * autoConfirm: false
53
+ * })
54
+ * if (result.changes) {
55
+ * console.log(`Linha ${result.changes.lineNumber}: ${result.changes.oldXPath} → ${result.changes.newXPath}`)
56
+ * }
57
+ * ```
58
+ *
59
+ * @param params Parâmetros da correção
60
+ * @returns true se a correção foi aplicada com sucesso
61
+ */
62
+ export declare function autoFixCode(params: AutoFixCodeParams): Promise<boolean>;
63
+ export declare function autoFixCode(params: AutoFixCodeParams & {
64
+ autoConfirm: false;
65
+ }): Promise<AutoFixCodeResult>;
@@ -0,0 +1,32 @@
1
+ import { fixInCode } from './TestRecoveryClient.js';
2
+ export async function autoFixCode(params) {
3
+ const projectRoot = params.projectRoot || process.env.AUTOCORE_PROJECT_ROOT || process.cwd();
4
+ const payload = {
5
+ url: undefined,
6
+ failedXPath: params.xpath,
7
+ newXPath: params.newXPath,
8
+ errorType: params.errorType,
9
+ actionType: params.actionType,
10
+ projectRoot,
11
+ attributesFile: params.attributesFile,
12
+ locatorProperty: params.locatorProperty,
13
+ systemName: params.systemName,
14
+ autoConfirm: params.autoConfirm ?? true,
15
+ };
16
+ const result = await fixInCode(payload);
17
+ if (!result) {
18
+ return params.autoConfirm === false
19
+ ? { success: false, fileUpdated: false }
20
+ : false;
21
+ }
22
+ // Se autoConfirm=false, retorna resultado completo para revisão
23
+ if (params.autoConfirm === false) {
24
+ return {
25
+ success: result.success,
26
+ fileUpdated: result.fileUpdated,
27
+ filePath: result.filePath,
28
+ changes: result.changes,
29
+ };
30
+ }
31
+ return result.success && result.fileUpdated;
32
+ }
@@ -0,0 +1,2 @@
1
+ declare const _default: import("vite").UserConfig;
2
+ export default _default;
@@ -0,0 +1,59 @@
1
+ import { defineConfig } from 'vitest/config';
2
+ export default defineConfig({
3
+ test: {
4
+ // ✅ IMPORTANTE: globals: false evita conflitos com Jest/Playwright
5
+ // Use imports explícitos: import { describe, it, expect } from 'vitest'
6
+ globals: false,
7
+ environment: 'node',
8
+ // 🔧 NOVO: Variáveis de ambiente para testes
9
+ env: {
10
+ DISABLE_DEVICEFARM_AUTOOPEN: 'true', // Desabilitar abertura automática do DeviceFarmViewer durante testes
11
+ },
12
+ setupFiles: [
13
+ '@silasfmartins/testhub/setup', // ✅ AutoCore Jest-Safe Setup
14
+ './tests/setup.ts', // ✅ Setup específico do projeto
15
+ ],
16
+ // 🔧 NOVO: Incluir tanto .test.ts quanto .spec.ts
17
+ include: [
18
+ 'tests/**/*.test.ts',
19
+ 'tests/**/*.spec.ts',
20
+ '**/*.test.ts',
21
+ '**/*.spec.ts',
22
+ ],
23
+ // 🔧 NOVO: Excluir arquivos que podem causar conflito
24
+ exclude: [
25
+ 'node_modules/**',
26
+ 'dist/**',
27
+ '.git/**',
28
+ 'coverage/**',
29
+ 'playwright-report/**',
30
+ 'test-results/**',
31
+ ],
32
+ // 🔧 Configurações de isolamento melhoradas
33
+ isolate: true, // Isolar cada arquivo de teste
34
+ pool: 'forks', // Usar forks em vez de threads para evitar conflitos
35
+ // 🔧 NOVO: Configurações para evitar conflitos Jest/Vitest
36
+ sequence: {
37
+ concurrent: false, // Executar sequencialmente
38
+ shuffle: false, // Não embaralhar ordem dos testes
39
+ },
40
+ // 🔧 NOVO: Configurações de retry e timeout
41
+ retry: 0, // Não retry em caso de falha
42
+ testTimeout: 30_000, // 30 segundos timeout
43
+ hookTimeout: 10_000, // 10 segundos para hooks
44
+ coverage: {
45
+ provider: 'v8',
46
+ reporter: ['text', 'html', 'lcov'],
47
+ include: ['src/**/*.ts'],
48
+ exclude: [
49
+ 'tests/**',
50
+ 'src/**/*.d.ts',
51
+ 'src/**/*.test.ts',
52
+ 'src/**/*.spec.ts',
53
+ ],
54
+ },
55
+ },
56
+ esbuild: {
57
+ target: 'node18', // Target específico para melhor compatibilidade
58
+ },
59
+ });
@@ -0,0 +1 @@
1
+ export declare const config: WebdriverIO.Config;
@@ -0,0 +1,420 @@
1
+ /// <reference types="@wdio/types" />
2
+ import { Agent } from 'node:https';
3
+ // 🔧 CONFIGURAÇÃO OTIMIZADA PARA DEVICEFARM
4
+ const isDeviceFarm = process.env.DEVICEFARM_HOST || process.env.DEVICEFARM_API_KEY;
5
+ const deviceFarmHost = process.env.DEVICEFARM_HOST || 'devicefarm-qa.com.br';
6
+ const deviceFarmPort = Number(process.env.DEVICEFARM_PORT) || 443;
7
+ const deviceFarmPath = process.env.DEVICEFARM_PATH || '/api/mobile/wd/hub';
8
+ export const config = {
9
+ //
10
+ // ====================
11
+ // Runner Configuration
12
+ // ====================
13
+ runner: 'local',
14
+ tsConfigPath: './tsconfig.e2e.json',
15
+ // 🌐 CONFIGURAÇÃO DEVICEFARM
16
+ ...(isDeviceFarm
17
+ ? {
18
+ protocol: 'https',
19
+ hostname: deviceFarmHost,
20
+ port: deviceFarmPort,
21
+ path: deviceFarmPath,
22
+ }
23
+ : {
24
+ port: 4723,
25
+ }),
26
+ //
27
+ // ==================
28
+ // Specify Test Files
29
+ // ==================
30
+ // Define which test specs should run. The pattern is relative to the directory
31
+ // of the configuration file being run.
32
+ //
33
+ // The specs are defined as an array of spec files (optionally using wildcards
34
+ // that will be expanded). The test for each spec file will be run in a separate
35
+ // worker process. In order to have a group of spec files run in the same worker
36
+ // process simply enclose them in an array within the specs array.
37
+ //
38
+ // The path of the spec files will be resolved relative from the directory of
39
+ // of the config file unless it's absolute.
40
+ //
41
+ specs: [
42
+ // ToDo: define location for spec files here
43
+ 'tests/**/*.spec.ts',
44
+ ],
45
+ // Patterns to exclude.
46
+ exclude: [
47
+ // 'path/to/excluded/files'
48
+ ],
49
+ //
50
+ // ============
51
+ // Capabilities
52
+ // ============
53
+ // Define your capabilities here. WebdriverIO can run multiple capabilities at the same
54
+ // time. Depending on the number of capabilities, WebdriverIO launches several test
55
+ // sessions. Within your capabilities you can overwrite the spec and exclude options in
56
+ // order to group specific specs to a specific capability.
57
+ //
58
+ // First, you can define how many instances should be started at the same time. Let's
59
+ // say you have 3 different capabilities (Chrome, Firefox, and Safari) and you have
60
+ // set maxInstances to 1; wdio will spawn 3 processes. Therefore, if you have 10 spec
61
+ // files and you set maxInstances to 10, all spec files will get tested at the same time
62
+ // and 30 processes will get spawned. The property handles how many capabilities
63
+ // from the same test should run tests.
64
+ //
65
+ maxInstances: 10,
66
+ //
67
+ // If you have trouble getting all important capabilities together, check out the
68
+ // Sauce Labs platform configurator - a great tool to configure your capabilities:
69
+ // https://saucelabs.com/platform/platform-configurator
70
+ //
71
+ capabilities: [
72
+ {
73
+ // 🔧 CAPABILITIES DINÂMICAS PARA DEVICEFARM iOS/Android
74
+ ...(isDeviceFarm
75
+ ? {
76
+ // 📱 CONFIGURAÇÃO UNIVERSAL DEVICEFARM (iOS/Android)
77
+ 'appium:apiKey': process.env.DEVICEFARM_API_KEY ||
78
+ '75ec082d-f22c-4b17-b872-1a0d4791fa40',
79
+ 'appium:deviceId': process.env.DEVICEFARM_DEVICE_ID ||
80
+ process.env.MOBILE_DEVICE_ID ||
81
+ 'device-001',
82
+ // 🍎 iOS quando especificado
83
+ ...(process.env.MOBILE_PLATFORM === 'iOS' ||
84
+ process.env.IOS_BUNDLE_ID
85
+ ? {
86
+ platformName: 'iOS',
87
+ 'appium:automationName': 'XCUITest',
88
+ 'appium:bundleId': process.env.IOS_BUNDLE_ID || 'com.apple.Preferences',
89
+ 'appium:autoAcceptAlerts': true,
90
+ 'appium:autoDismissAlerts': false,
91
+ 'appium:shouldUseSingletonTestManager': false,
92
+ 'appium:shouldUseTestManagerForVisibilityDetection': false,
93
+ 'appium:maxTypingFrequency': 60,
94
+ 'appium:simpleIsVisibleCheck': true,
95
+ 'appium:wdaLocalPort': 8100,
96
+ 'appium:mjpegServerPort': 9100,
97
+ 'appium:webkitDebugProxyPort': 27_753,
98
+ 'appium:useNewWDA': false,
99
+ 'appium:clearSystemFiles': false,
100
+ 'appium:preventWDAAttachments': true,
101
+ 'appium:connectHardwareKeyboard': false,
102
+ 'appium:calendarAccessAuthorized': true,
103
+ 'appium:isHeadless': false,
104
+ }
105
+ : {
106
+ // 🤖 Android quando especificado ou padrão
107
+ platformName: 'Android',
108
+ 'appium:automationName': 'UiAutomator2',
109
+ 'appium:appPackage': process.env.ANDROID_APP_PACKAGE || 'com.android.settings',
110
+ 'appium:appActivity': process.env.ANDROID_APP_ACTIVITY || '.Settings',
111
+ 'appium:autoGrantPermissions': true,
112
+ 'appium:disableWindowAnimation': true,
113
+ 'appium:skipServerInstallation': true,
114
+ 'appium:skipDeviceInitialization': false,
115
+ }),
116
+ // 🔒 CONFIGURAÇÕES SSL UNIVERSAIS PARA DEVICEFARM
117
+ 'appium:acceptSslCerts': true,
118
+ 'appium:acceptInsecureCerts': true,
119
+ 'appium:ignoreSSLErrors': true,
120
+ 'appium:acceptSslCertificates': true,
121
+ // 🎯 CONFIGURAÇÕES DE PERFORMANCE UNIVERSAIS
122
+ 'appium:newCommandTimeout': 600,
123
+ 'appium:commandTimeouts': {
124
+ default: 60_000,
125
+ },
126
+ 'appium:noReset': true,
127
+ 'appium:fullReset': false,
128
+ }
129
+ : {
130
+ // 🏠 CONFIGURAÇÃO LOCAL (Android padrão)
131
+ platformName: 'Android',
132
+ browserName: 'Chrome',
133
+ 'appium:deviceName': 'Android GoogleAPI Emulator',
134
+ 'appium:platformVersion': '12.0',
135
+ 'appium:automationName': 'UiAutomator2',
136
+ }),
137
+ },
138
+ ],
139
+ //
140
+ // ===================
141
+ // Test Configurations
142
+ // ===================
143
+ // Define all options that are relevant for the WebdriverIO instance here
144
+ //
145
+ // Level of logging verbosity: trace | debug | info | warn | error | silent
146
+ logLevel: 'info',
147
+ // 🔒 CONFIGURAÇÕES SSL PARA WEBDRIVERIO
148
+ ...(isDeviceFarm
149
+ ? {
150
+ agent: new Agent({
151
+ rejectUnauthorized: false,
152
+ keepAlive: true,
153
+ maxSockets: 50,
154
+ }),
155
+ }
156
+ : {}),
157
+ //
158
+ // Set specific log levels per logger
159
+ // loggers:
160
+ // - webdriver, webdriverio
161
+ // - @wdio/browserstack-service, @wdio/lighthouse-service, @wdio/sauce-service
162
+ // - @wdio/mocha-framework, @wdio/jasmine-framework
163
+ // - @wdio/local-runner
164
+ // - @wdio/sumologic-reporter
165
+ // - @wdio/cli, @wdio/config, @wdio/utils
166
+ // Level of logging verbosity: trace | debug | info | warn | error | silent
167
+ // logLevels: {
168
+ // webdriver: 'info',
169
+ // '@wdio/appium-service': 'info'
170
+ // },
171
+ //
172
+ // If you only want to run your tests until a specific amount of tests have failed use
173
+ // bail (default is 0 - don't bail, run all tests).
174
+ bail: 0,
175
+ //
176
+ // Set a base URL in order to shorten url command calls. If your `url` parameter starts
177
+ // with `/`, the base url gets prepended, not including the path portion of your baseUrl.
178
+ // If your `url` parameter starts without a scheme or `/` (like `some/path`), the base url
179
+ // gets prepended directly.
180
+ // baseUrl: 'http://localhost:8080',
181
+ //
182
+ // Default timeout for all waitFor* commands.
183
+ waitforTimeout: isDeviceFarm ? 30_000 : 10_000, // DeviceFarm precisa de mais tempo
184
+ //
185
+ // Default timeout in milliseconds for request
186
+ // if browser driver or grid doesn't send response
187
+ connectionRetryTimeout: isDeviceFarm ? 180_000 : 120_000, // 3 min para DeviceFarm
188
+ //
189
+ // Default request retries count
190
+ connectionRetryCount: isDeviceFarm ? 5 : 3, // Mais tentativas para DeviceFarm
191
+ //
192
+ // Test runner services
193
+ // Services take over a specific job you don't want to take care of. They enhance
194
+ // your test setup with almost no effort. Unlike plugins, they don't add new
195
+ // commands. Instead, they hook themselves up into the test process.
196
+ services: ['appium'],
197
+ // Framework you want to run your specs with.
198
+ // The following are supported: Mocha, Jasmine, and Cucumber
199
+ // see also: https://webdriver.io/docs/frameworks
200
+ //
201
+ // Make sure you have the wdio adapter package for the specific framework installed
202
+ // before running any tests.
203
+ framework: 'mocha',
204
+ //
205
+ // The number of times to retry the entire specfile when it fails as a whole
206
+ // specFileRetries: 1,
207
+ //
208
+ // Delay in seconds between the spec file retry attempts
209
+ // specFileRetriesDelay: 0,
210
+ //
211
+ // Whether or not retried spec files should be retried immediately or deferred to the end of the queue
212
+ // specFileRetriesDeferred: false,
213
+ //
214
+ // Test reporter for stdout.
215
+ // The only one supported by default is 'dot'
216
+ // see also: https://webdriver.io/docs/dot-reporter
217
+ reporters: ['spec'],
218
+ // Options to be passed to Mocha.
219
+ // See the full list at http://mochajs.org/
220
+ mochaOpts: {
221
+ ui: 'bdd',
222
+ timeout: isDeviceFarm ? 120_000 : 60_000, // DeviceFarm precisa de mais tempo
223
+ },
224
+ //
225
+ // =====
226
+ // Hooks DeviceFarm
227
+ // =====
228
+ /**
229
+ * 🔧 DEVICEFARM: Hook executado antes da sessão iniciar
230
+ */
231
+ beforeSession(config, capabilities, specs, cid) {
232
+ if (isDeviceFarm) {
233
+ console.log('🔧 Preparando sessão DeviceFarm...');
234
+ // Configurar SSL permissivo
235
+ process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
236
+ // Configurações adicionais de SSL
237
+ process.env.HTTPS_PROXY_REJECT_UNAUTHORIZED = '0';
238
+ process.env.REJECT_UNAUTHORIZED = '0';
239
+ }
240
+ },
241
+ /**
242
+ * 🔧 DEVICEFARM: Hook executado antes dos testes iniciarem
243
+ */
244
+ before(capabilities, specs) {
245
+ if (isDeviceFarm) {
246
+ console.log('🍎 Sessão DeviceFarm iniciada com sucesso!');
247
+ console.log(`📱 Device: ${capabilities['appium:deviceId'] || 'N/A'}`);
248
+ console.log(`🎯 Platform: ${capabilities.platformName || 'N/A'}`);
249
+ }
250
+ },
251
+ /**
252
+ * 🔧 DEVICEFARM: Hook executado após cada teste
253
+ */
254
+ afterTest(test, context, { error, result, duration, passed, retries }) {
255
+ if (isDeviceFarm) {
256
+ const status = passed ? '✅' : '❌';
257
+ console.log(`${status} ${test.title}: ${duration}ms`);
258
+ if (error) {
259
+ console.log(`💥 Erro: ${error.message}`);
260
+ }
261
+ }
262
+ },
263
+ //
264
+ // =====
265
+ // Hooks
266
+ // =====
267
+ // WebdriverIO provides several hooks you can use to interfere with the test process in order to enhance
268
+ // it and to build services around it. You can either apply a single function or an array of
269
+ // methods to it. If one of them returns with a promise, WebdriverIO will wait until that promise got
270
+ // resolved to continue.
271
+ /**
272
+ * Gets executed once before all workers get launched.
273
+ * @param {object} config wdio configuration object
274
+ * @param {Array.<Object>} capabilities list of capabilities details
275
+ */
276
+ // onPrepare: function (config, capabilities) {
277
+ // },
278
+ /**
279
+ * Gets executed before a worker process is spawned and can be used to initialize specific service
280
+ * for that worker as well as modify runtime environments in an async fashion.
281
+ * @param {string} cid capability id (e.g 0-0)
282
+ * @param {object} caps object containing capabilities for session that will be spawn in the worker
283
+ * @param {object} specs specs to be run in the worker process
284
+ * @param {object} args object that will be merged with the main configuration once worker is initialized
285
+ * @param {object} execArgv list of string arguments passed to the worker process
286
+ */
287
+ // onWorkerStart: function (cid, caps, specs, args, execArgv) {
288
+ // },
289
+ /**
290
+ * Gets executed just after a worker process has exited.
291
+ * @param {string} cid capability id (e.g 0-0)
292
+ * @param {number} exitCode 0 - success, 1 - fail
293
+ * @param {object} specs specs to be run in the worker process
294
+ * @param {number} retries number of retries used
295
+ */
296
+ // onWorkerEnd: function (cid, exitCode, specs, retries) {
297
+ // },
298
+ /**
299
+ * Gets executed just before initialising the webdriver session and test framework. It allows you
300
+ * to manipulate configurations depending on the capability or spec.
301
+ * @param {object} config wdio configuration object
302
+ * @param {Array.<Object>} capabilities list of capabilities details
303
+ * @param {Array.<String>} specs List of spec file paths that are to be run
304
+ * @param {string} cid worker id (e.g. 0-0)
305
+ */
306
+ // beforeSession: function (config, capabilities, specs, cid) {
307
+ // },
308
+ /**
309
+ * Gets executed before test execution begins. At this point you can access to all global
310
+ * variables like `browser`. It is the perfect place to define custom commands.
311
+ * @param {Array.<Object>} capabilities list of capabilities details
312
+ * @param {Array.<String>} specs List of spec file paths that are to be run
313
+ * @param {object} browser instance of created browser/device session
314
+ */
315
+ // before: function (capabilities, specs) {
316
+ // },
317
+ /**
318
+ * Runs before a WebdriverIO command gets executed.
319
+ * @param {string} commandName hook command name
320
+ * @param {Array} args arguments that command would receive
321
+ */
322
+ // beforeCommand: function (commandName, args) {
323
+ // },
324
+ /**
325
+ * Hook that gets executed before the suite starts
326
+ * @param {object} suite suite details
327
+ */
328
+ // beforeSuite: function (suite) {
329
+ // },
330
+ /**
331
+ * Function to be executed before a test (in Mocha/Jasmine) starts.
332
+ */
333
+ // beforeTest: function (test, context) {
334
+ // },
335
+ /**
336
+ * Hook that gets executed _before_ a hook within the suite starts (e.g. runs before calling
337
+ * beforeEach in Mocha)
338
+ */
339
+ // beforeHook: function (test, context, hookName) {
340
+ // },
341
+ /**
342
+ * Hook that gets executed _after_ a hook within the suite starts (e.g. runs after calling
343
+ * afterEach in Mocha)
344
+ */
345
+ // afterHook: function (test, context, { error, result, duration, passed, retries }, hookName) {
346
+ // },
347
+ /**
348
+ * Function to be executed after a test (in Mocha/Jasmine only)
349
+ * @param {object} test test object
350
+ * @param {object} context scope object the test was executed with
351
+ * @param {Error} result.error error object in case the test fails, otherwise `undefined`
352
+ * @param {*} result.result return object of test function
353
+ * @param {number} result.duration duration of test
354
+ * @param {boolean} result.passed true if test has passed, otherwise false
355
+ * @param {object} result.retries information about spec related retries, e.g. `{ attempts: 0, limit: 0 }`
356
+ */
357
+ // afterTest: function(test, context, { error, result, duration, passed, retries }) {
358
+ // },
359
+ /**
360
+ * Hook that gets executed after the suite has ended
361
+ * @param {object} suite suite details
362
+ */
363
+ // afterSuite: function (suite) {
364
+ // },
365
+ /**
366
+ * Runs after a WebdriverIO command gets executed
367
+ * @param {string} commandName hook command name
368
+ * @param {Array} args arguments that command would receive
369
+ * @param {number} result 0 - command success, 1 - command error
370
+ * @param {object} error error object if any
371
+ */
372
+ // afterCommand: function (commandName, args, result, error) {
373
+ // },
374
+ /**
375
+ * Gets executed after all tests are done. You still have access to all global variables from
376
+ * the test.
377
+ * @param {number} result 0 - test pass, 1 - test fail
378
+ * @param {Array.<Object>} capabilities list of capabilities details
379
+ * @param {Array.<String>} specs List of spec file paths that ran
380
+ */
381
+ // after: function (result, capabilities, specs) {
382
+ // },
383
+ /**
384
+ * Gets executed right after terminating the webdriver session.
385
+ * @param {object} config wdio configuration object
386
+ * @param {Array.<Object>} capabilities list of capabilities details
387
+ * @param {Array.<String>} specs List of spec file paths that ran
388
+ */
389
+ // afterSession: function (config, capabilities, specs) {
390
+ // },
391
+ /**
392
+ * Gets executed after all workers got shut down and the process is about to exit. An error
393
+ * thrown in the onComplete hook will result in the test run failing.
394
+ * @param {object} exitCode 0 - success, 1 - fail
395
+ * @param {object} config wdio configuration object
396
+ * @param {Array.<Object>} capabilities list of capabilities details
397
+ * @param {<Object>} results object containing test results
398
+ */
399
+ // onComplete: function(exitCode, config, capabilities, results) {
400
+ // },
401
+ /**
402
+ * Gets executed when a refresh happens.
403
+ * @param {string} oldSessionId session ID of the old session
404
+ * @param {string} newSessionId session ID of the new session
405
+ */
406
+ // onReload: function(oldSessionId, newSessionId) {
407
+ // }
408
+ /**
409
+ * Hook that gets executed before a WebdriverIO assertion happens.
410
+ * @param {object} params information about the assertion to be executed
411
+ */
412
+ // beforeAssertion: function(params) {
413
+ // }
414
+ /**
415
+ * Hook that gets executed after a WebdriverIO assertion happened.
416
+ * @param {object} params information about the assertion that was executed, including its results
417
+ */
418
+ // afterAssertion: function(params) {
419
+ // }
420
+ };