@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,925 @@
1
+ #!/usr/bin/env node
2
+ // @ts-nocheck
3
+
4
+ import fs from 'node:fs'
5
+ import { execSync } from 'child_process'
6
+ import yaml from 'js-yaml'
7
+ import path from 'path'
8
+ import {
9
+ generateBiomeConfigString,
10
+ generatePackageJson,
11
+ generateTsConfigForProject,
12
+ getLatestVersions,
13
+ } from './package-versions.js'
14
+ import { setupUltracite } from './ultracite-setup.js'
15
+
16
+ const root = process.cwd()
17
+ const catalogPath = path.join(root, 'catalog-info.yaml')
18
+
19
+ if (!fs.existsSync(catalogPath)) {
20
+ console.error('❌ Arquivo catalog-info.yaml não encontrado.')
21
+ process.exit(1)
22
+ }
23
+
24
+ const catalog = yaml.load(fs.readFileSync(catalogPath, 'utf-8')) as any
25
+ const projectName = catalog?.metadata?.name || 'meu-projeto'
26
+ const projectNameUnderscore = projectName.replace(/-/g, '_')
27
+
28
+ const write = (filePath: string, content: string) => {
29
+ const fullPath = path.join(root, filePath)
30
+ fs.mkdirSync(path.dirname(fullPath), { recursive: true })
31
+ fs.writeFileSync(fullPath, content)
32
+ }
33
+
34
+ async function main() {
35
+ console.log('🚀 Inicializando projeto de Cenários com versões atualizadas...')
36
+ console.log(`📦 Projeto: ${projectName}`)
37
+ console.log('')
38
+
39
+ // ✅ Buscar versões mais recentes
40
+ const versions = await getLatestVersions()
41
+
42
+ // ✅ Gerar package.json com versões atualizadas
43
+ const packageJsonContent = generatePackageJson(
44
+ projectName,
45
+ 'scenarios',
46
+ versions,
47
+ )
48
+
49
+ // ✅ Gerar tsconfig.json baseado no AutoCore
50
+ const tsconfigContent = generateTsConfigForProject('scenarios')
51
+
52
+ // ✅ Gerar biome.json sincronizado com AutoCore
53
+ const biomeConfigContent = generateBiomeConfigString()
54
+
55
+ console.log('📝 Criando arquivos do projeto...')
56
+
57
+ // package.json com versões dinâmicas
58
+ write('package.json', JSON.stringify(packageJsonContent, null, 2))
59
+
60
+ // ✅ tsconfig.json sempre sincronizado com o AutoCore
61
+ write('tsconfig.json', JSON.stringify(tsconfigContent, null, 2))
62
+
63
+ // ✅ biome.json sincronizado automaticamente com o AutoCore
64
+ write('biome.json', biomeConfigContent)
65
+
66
+ //env.ts
67
+ write('env.ts', `import { config } from 'dotenv'
68
+
69
+ config()
70
+
71
+ const rawEnv = {
72
+ ENV: process.env.ENV,
73
+ }
74
+ export const env = rawEnv
75
+ `)
76
+
77
+ // playwright.config.ts otimizado para cenários
78
+ write(
79
+ 'playwright.config.ts',
80
+ `
81
+ import { defineConfig, devices } from '@playwright/test';
82
+
83
+ export default defineConfig({
84
+ globalSetup: '@silasfmartins/testhub/setup',
85
+ reporter: [['list'], ['html', { open: 'never' }], ['@silasfmartins/testhub/reporter']],
86
+ testDir: './tests',
87
+ testMatch: ['**/**/*.spec.ts', '**/**/*.test.ts'],
88
+ timeout: 1_800_000,
89
+ expect: {
90
+ timeout: 1_800_000,
91
+ },
92
+ fullyParallel: false,
93
+ workers: 1,
94
+ retries: 0,
95
+ use: {
96
+ baseURL: '',
97
+ },
98
+ projects: [
99
+ // ✅ Projetos "headless" (sem browser) — para SSH, API, Banco, Mobile
100
+ {
101
+ name: 'ssh',
102
+ use: {
103
+ browserName: undefined,
104
+ screenshot: 'off',
105
+ trace: 'off',
106
+ video: 'off',
107
+ },
108
+ },
109
+ {
110
+ name: 'api',
111
+ use: {
112
+ browserName: undefined,
113
+ screenshot: 'off',
114
+ trace: 'off',
115
+ video: 'off'
116
+ },
117
+ },
118
+ {
119
+ name: 'banco',
120
+ use: {
121
+ browserName: undefined,
122
+ screenshot: 'off',
123
+ trace: 'off',
124
+ video: 'off'
125
+ },
126
+ },
127
+ {
128
+ name: 'mobile',
129
+ use: { browserName: undefined,
130
+ screenshot: 'off',
131
+ trace: 'off',
132
+ video: 'off'
133
+ },
134
+ },
135
+
136
+ // ✅ Projetos de browser — só serão usados se você solicitar via --project
137
+ {
138
+ name: 'chromium',
139
+ use: {
140
+ browserName: 'chromium',
141
+ viewport: { width: 1366, height: 768 },
142
+ headless: process.env.PLAYWRIGHT_HEADLESS === 'true',
143
+ screenshot: 'on',
144
+ trace: 'on',
145
+ video: 'on'
146
+ },
147
+ },
148
+ {
149
+ name: 'firefox',
150
+ use: {
151
+ browserName: 'firefox',
152
+ viewport: { width: 1366, height: 768 },
153
+ headless: process.env.PLAYWRIGHT_HEADLESS === 'true',
154
+ screenshot: 'on',
155
+ trace: 'on',
156
+ video: 'on'
157
+ },
158
+ },
159
+ {
160
+ name: 'webkit',
161
+ use: {
162
+ browserName: 'webkit',
163
+ viewport: { width: 1366, height: 768 },
164
+ headless: process.env.PLAYWRIGHT_HEADLESS === 'true',
165
+ screenshot: 'on',
166
+ trace: 'on',
167
+ video: 'on'
168
+ },
169
+ }
170
+ ],
171
+ });
172
+ `,
173
+ )
174
+
175
+ // .npmrc
176
+ write(
177
+ '.npmrc',
178
+ `registry=https://pkgs.dev.azure.com/telefonica-vivo-brasil/_packaging/DevOps/npm/registry/`,
179
+ )
180
+
181
+ // .gitignore otimizado para cenários
182
+ write(
183
+ '.gitignore',
184
+ `# Playwright
185
+ node_modules/
186
+ /test-results/
187
+ /playwright-report/
188
+ /blob-report/
189
+ /playwright/.cache/
190
+ playwright-videos
191
+ /playwright-videos/
192
+ /playwright-videos
193
+
194
+ # Tests e logs
195
+ /logs
196
+
197
+ .vscode
198
+ .vscode/
199
+ docs
200
+ docs/
201
+
202
+ # Environment files
203
+ .env
204
+ .env.preprod
205
+ .env.esteira1
206
+ .env.esteira2
207
+ .env.prodlike
208
+ .env.prod
209
+ # AutoCore específicos
210
+ .test-data-store.json
211
+ .env.lock
212
+ .configlogger.lock
213
+ .rbqa
214
+ .rbqa/
215
+
216
+ # VS Code
217
+ .vscode/settings.json
218
+ .github/
219
+ .github
220
+
221
+ # Biome
222
+ .biome.log
223
+
224
+ # Coverage
225
+ coverage/
226
+ *.lcov
227
+
228
+ # Cenários específicos
229
+ /evidencias/
230
+ /screenshots/
231
+ /videos/
232
+ /downloads/
233
+
234
+ # Octane/ALM específicos
235
+ octane-report.json
236
+ alm-results.xml`,
237
+ )
238
+
239
+ // Arquivos de environment mais completos
240
+ write(
241
+ '.env.preprod',
242
+ `# Configurações de ambiente para preprod
243
+ BASE_URL=
244
+
245
+ # Configurações específicas para cenários
246
+ SCENARIO_TIMEOUT=180000
247
+ WAIT_BETWEEN_SCENARIOS=1000
248
+
249
+ # Octane/ALM Integration (opcional)
250
+ OCTANE_URL=
251
+ OCTANE_SHARED_SPACE=
252
+ OCTANE_WORKSPACE=
253
+ OCTANE_CLIENT_ID=
254
+ OCTANE_CLIENT_SECRET=
255
+
256
+ # Base URLs específicas (ajuste conforme necessário)
257
+ BASE_URL_API=
258
+ BASE_URL_TOKEN=
259
+
260
+ # Database (se necessário para cenários)
261
+ DB_HOST=
262
+ DB_PORT=1521
263
+ DB_SERVICE_NAME=
264
+ DB_USER=
265
+ DB_PASSWORD=
266
+
267
+ # Adicione suas variáveis específicas aqui`,
268
+ )
269
+
270
+ // Arquivo de environment padrão
271
+ write(
272
+ '.env',
273
+ `# Arquivo que seleciona o ambiente a ser utilizado
274
+ ENV=preprod`,
275
+ )
276
+
277
+ write(
278
+ '.env.esteira1',
279
+ `# Configurações de ambiente para esteira1
280
+ BASE_URL=
281
+
282
+ # Configurações específicas para cenários
283
+ SCENARIO_TIMEOUT=180000
284
+ WAIT_BETWEEN_SCENARIOS=1000
285
+
286
+ # Base URLs específicas
287
+ BASE_URL_API=
288
+ BASE_URL_TOKEN=
289
+
290
+ # Octane/ALM Integration (opcional)
291
+ OCTANE_URL=
292
+ OCTANE_SHARED_SPACE=
293
+ OCTANE_WORKSPACE=
294
+ OCTANE_CLIENT_ID=
295
+ OCTANE_CLIENT_SECRET=
296
+
297
+ # Database (se necessário)
298
+ DB_HOST=
299
+ DB_PORT=1521
300
+ DB_SERVICE_NAME=
301
+ DB_USER=
302
+ DB_PASSWORD=`,
303
+ )
304
+
305
+ write(
306
+ '.env.esteira2',
307
+ `# Configurações de ambiente para esteira2
308
+ BASE_URL=
309
+
310
+ # Configurações específicas para cenários
311
+ SCENARIO_TIMEOUT=180000
312
+ WAIT_BETWEEN_SCENARIOS=1000
313
+
314
+ # Base URLs específicas
315
+ BASE_URL_API=
316
+ BASE_URL_TOKEN=
317
+
318
+ # Octane/ALM Integration (opcional)
319
+ OCTANE_URL=
320
+ OCTANE_SHARED_SPACE=
321
+ OCTANE_WORKSPACE=
322
+ OCTANE_CLIENT_ID=
323
+ OCTANE_CLIENT_SECRET=
324
+
325
+ # Database (se necessário)
326
+ DB_HOST=
327
+ DB_PORT=1521
328
+ DB_SERVICE_NAME=
329
+ DB_USER=
330
+ DB_PASSWORD=`,
331
+ )
332
+
333
+ write(
334
+ '.env.prodlike',
335
+ `# Configurações de ambiente para prodlike
336
+ BASE_URL=
337
+
338
+ # Configurações específicas para cenários
339
+ SCENARIO_TIMEOUT=180000
340
+ WAIT_BETWEEN_SCENARIOS=1000
341
+
342
+ # Base URLs específicas
343
+ BASE_URL_API=
344
+ BASE_URL_TOKEN=
345
+
346
+ # Octane/ALM Integration (opcional)
347
+ OCTANE_URL=
348
+ OCTANE_SHARED_SPACE=
349
+ OCTANE_WORKSPACE=
350
+ OCTANE_CLIENT_ID=
351
+ OCTANE_CLIENT_SECRET=
352
+
353
+ # Database (se necessário)
354
+ DB_HOST=
355
+ DB_PORT=1521
356
+ DB_SERVICE_NAME=
357
+ DB_USER=
358
+ DB_PASSWORD=`,
359
+ )
360
+
361
+ // Exemplo de teste para cenários mais estruturado
362
+ write(
363
+ 'tests/CN001_ConsultaEndereco.spec.ts',
364
+ `import { type TestInfo, test, TestAnnotations } from '@silasfmartins/testhub'
365
+ import {
366
+ StatementsAlocarConfigurar,
367
+ StatementsConsultaCobertura,
368
+ StatementsConsultaEndereco,
369
+ StatementsConsultaEnderecoTecnico,
370
+ StatementsConsultaQualificacao,
371
+ StatementsConsultaViabilidade,
372
+ StatementsReservaQualificacao,
373
+ StatementsToken,
374
+ } from '@rbqa/test-oss-api'
375
+
376
+ test.describe('CN001_ConsultaEndereco [octane-@7075_-_ATENDIMENTO_-_FENIX_-_Cancelamento_para_fluxo_com_Portabilidade_linha_vivo_-_Vivo1_-_Parceiro]', () => {
377
+ TestAnnotations.stopOnFailure() // opcional: para o runner ao falhar um CT
378
+
379
+ test('CT001_Requisição do Token', async ({}, testInfo: TestInfo) => {
380
+ TestAnnotations.Api.testInfo = testInfo
381
+ await TestAnnotations.setSystem('MEU_SISTEMA')
382
+ await new StatementsToken().getToken()
383
+ })
384
+
385
+ test('CT002_Consultar Endereço', async ({}, testInfo: TestInfo) => {
386
+ TestAnnotations.Api.testInfo = testInfo
387
+ await TestAnnotations.setSystem('MEU_SISTEMA')
388
+ await new StatementsConsultaEndereco().consultaEndereco()
389
+ })
390
+
391
+ test('CT003_Consultar Cobertura', async ({}, testInfo: TestInfo) => {
392
+ TestAnnotations.Api.testInfo = testInfo
393
+ await TestAnnotations.setSystem('MEU_SISTEMA')
394
+ await new StatementsConsultaCobertura().consultaCobertura()
395
+ })
396
+
397
+ test('CT004_Consultar Endereço Técnico', async ({}, testInfo: TestInfo) => {
398
+ TestAnnotations.Api.testInfo = testInfo
399
+ await TestAnnotations.setSystem('MEU_SISTEMA')
400
+ await new StatementsConsultaEnderecoTecnico().consultaEnderecoTecnico()
401
+ })
402
+
403
+ test('CT005_Consultar Viabilidade', async ({}, testInfo: TestInfo) => {
404
+ TestAnnotations.Api.testInfo = testInfo
405
+ await TestAnnotations.setSystem('MEU_SISTEMA')
406
+ await new StatementsConsultaViabilidade().consultaViabilidade()
407
+ })
408
+
409
+ test('CT006_Consultar Qualificação', async ({}, testInfo: TestInfo) => {
410
+ TestAnnotations.Api.testInfo = testInfo
411
+ await TestAnnotations.setSystem('MEU_SISTEMA')
412
+ await new StatementsConsultaQualificacao().consultaQualificacao()
413
+ })
414
+
415
+ test('CT007_Reserva Qualificação', async ({}, testInfo: TestInfo) => {
416
+ TestAnnotations.Api.testInfo = testInfo
417
+ await TestAnnotations.setSystem('MEU_SISTEMA')
418
+ await new StatementsReservaQualificacao().reservaQualificacao()
419
+ })
420
+
421
+ test('CT008_Alocar e Configurar', async ({}, testInfo: TestInfo) => {
422
+ TestAnnotations.Api.testInfo = testInfo
423
+ await TestAnnotations.setSystem('MEU_SISTEMA')
424
+ await new StatementsAlocarConfigurar().alocarConfigurar()
425
+ })
426
+ })
427
+ `,
428
+ )
429
+
430
+ // Azure DevOps pipeline
431
+ write(
432
+ '.azuredevops/azure-pipeline.yml',
433
+ `name: Testes OSS
434
+
435
+ trigger:
436
+ batch: true
437
+ branches:
438
+ include:
439
+ - '*'
440
+ paths:
441
+ exclude:
442
+ - '*'
443
+
444
+ parameters:
445
+ - name: env
446
+ displayName: Escolha o ambiente pra rodar E2E
447
+ type: string
448
+ default: preprod
449
+ values:
450
+ - preprod
451
+ - esteira1
452
+ - esteira2
453
+ - prodlike
454
+
455
+ - name: browser
456
+ displayName: Escolha o navegador para os testes
457
+ type: string
458
+ default: chromium
459
+ values:
460
+ - chromium
461
+ - firefox
462
+ - webkit
463
+
464
+ - name: testWithScreenShots
465
+ displayName: Ativar capturas de tela
466
+ type: boolean
467
+ default: true
468
+
469
+ - name: test
470
+ displayName: Testes específicos para executar
471
+ type: string
472
+ default: "CN001_ConsultaEndereco.spec.ts"
473
+ values:
474
+ - "CN001_ConsultaEndereco.spec.ts"
475
+ - "CN002_FluxoCompleto.spec.ts"
476
+ - "all"
477
+
478
+ resources:
479
+ repositories:
480
+ - repository: CorePipelines
481
+ name: DevOps/Vivo.Core.Pipelines
482
+ type: git
483
+ ref: feat/qa_execuca_cenarios_b2b
484
+ endpoint: CorePipelines
485
+
486
+ extends:
487
+ template: /provisioners/qa/trunkbased/node/scenarios_default/provisioner_entry.yml@CorePipelines
488
+ parameters:
489
+ node:
490
+ name_test: "\${{ parameters.test }}"
491
+ browser: "\${{ parameters.browser }}"
492
+ testWithScreenShots: \${{ parameters.testWithScreenShots }}
493
+ environment: "\${{ parameters.env }}"
494
+ description: "Cenários E2E Automatizados"
495
+ scenariosName: "autocore"
496
+ scenariosType: "e2e"
497
+ `,
498
+ )
499
+
500
+ // README.md
501
+ write(
502
+ 'README.md',
503
+ `# ${projectName}
504
+
505
+ Projeto de automação de cenários E2E baseado no AutoCore com suporte completo a múltiplos tipos de teste.
506
+
507
+ ## 🚀 Como usar
508
+
509
+ ### Instalação de dependências
510
+ \`\`\`bash
511
+ npm install
512
+ \`\`\`
513
+
514
+ ### Instalar navegadores
515
+ \`\`\`bash
516
+ npx playwright install
517
+ \`\`\`
518
+
519
+ ### Executar testes
520
+ \`\`\`bash
521
+ # Ambiente preprod
522
+ npm run test:preprod
523
+
524
+ # Ambiente esteira1
525
+ npm run test:esteira1
526
+
527
+ # Ambiente esteira2
528
+ npm run test:esteira2
529
+
530
+ # Ambiente prodlike
531
+ npm run test:prodlike
532
+
533
+ # Apenas Chromium
534
+ npm run test:preprod:chromium
535
+
536
+ # Interface visual
537
+ npm run ui:preprod
538
+
539
+ # Modo debug
540
+ npm run debug:preprod
541
+ \`\`\`
542
+
543
+ # Sincronizar Projetos de Sistemas com o de cenários
544
+ npm run sync
545
+
546
+ ## 📋 Configuração de ambiente
547
+
548
+ ### Variáveis essenciais nos arquivos \`.env.*\`:
549
+
550
+ \`\`\`bash
551
+ # URLs principais
552
+ BASE_URL=https://your-app.com
553
+ BASE_URL_API=https://api.your-app.com
554
+ BASE_URL_TOKEN=https://auth.your-app.com
555
+
556
+ # Timeouts (em milissegundos)
557
+ NAVIGATION_TIMEOUT=30000
558
+ ACTION_TIMEOUT=15000
559
+ SCENARIO_TIMEOUT=180000
560
+
561
+ # Screenshots e evidências
562
+ WAIT_BETWEEN_SCENARIOS=1000
563
+ SLOW_MO=0
564
+
565
+ # Database (se necessário)
566
+ DB_HOST=oracle-host
567
+ DB_PORT=1521
568
+ DB_SERVICE_NAME=service_name
569
+ DB_USER=username
570
+ DB_PASSWORD=password
571
+ NODE_ORACLEDB_DRIVER_MODE=thick
572
+
573
+ # Octane/ALM Integration (opcional)
574
+ OCTANE_URL=https://your-octane.com
575
+ OCTANE_SHARED_SPACE=12345
576
+ OCTANE_WORKSPACE=67890
577
+ OCTANE_CLIENT_ID=client_id
578
+ OCTANE_CLIENT_SECRET=client_secret
579
+ \`\`\`
580
+
581
+ ## 📂 Estrutura do projeto
582
+
583
+ \`\`\`
584
+ ${projectName}/
585
+ ├── tests/ # Cenários de teste
586
+ │ ├── CN001_ConsultaEndereco.spec.ts
587
+ │ └── CN002_FluxoCompleto.spec.ts
588
+ ├── .env.* # Variáveis por ambiente
589
+ ├── playwright.config.ts # Configuração otimizada para cenários
590
+ ├── tsconfig.json # TypeScript sincronizado com AutoCore
591
+ ├── biome.json # Linting sincronizado com AutoCore
592
+ ├── .azuredevops/ # Pipeline CI/CD
593
+ │ ├── azure-pipeline.yml
594
+ │ └── sonar-project.properties
595
+ └── README.md # Esta documentação
596
+ \`\`\`
597
+
598
+ ## 🔧 Desenvolvimento
599
+
600
+ ### Tecnologias e ferramentas:
601
+ - **TypeScript**: Configurado e sincronizado com AutoCore
602
+ - **Playwright**: Framework E2E com suporte multi-browser
603
+ - **AutoCore**: Sistema unificado (API + Frontend + Mobile + SSH + Banco)
604
+ - **Biome**: Linting e formatação sincronizados
605
+ - **Ultracite**: Experiência de desenvolvimento aprimorada
606
+
607
+ ### Padrões implementados:
608
+ - **Mixed Test Context**: Cenários podem usar API, Frontend, Mobile, SSH e Banco
609
+ - **Data Store**: Compartilhamento de dados entre fases do cenário
610
+ - **Screenshot automático**: Em falhas e quando habilitado
611
+ - **Timeouts configuráveis**: Por tipo de ação e cenário
612
+ - **Retry logic**: Configurável por ambiente
613
+ - **Evidências organizadas**: Screenshots, vídeos, downloads
614
+
615
+ ## 🧪 Exemplos de Uso
616
+
617
+ ### Cenário básico com API e Interface:
618
+ \`\`\`typescript
619
+ test('CT001 - Cenário misto', async ({ page }, testInfo) => {
620
+ TestAnnotations.Mixed.testInfo = testInfo;
621
+
622
+ // 1. Obter token via API
623
+ const tokenResponse = await ApiActions.post(tokenRequest, 'Obtenção de token');
624
+ DataStore.set('TOKEN', tokenResponse.body.access_token);
625
+
626
+ // 2. Usar interface
627
+ await WebActions.navegarPara('/app', 'Navegação');
628
+ await WebActions.preencherCampo(searchInput, 'busca', 'Preenchimento');
629
+
630
+ // 3. Validar via banco (se disponível)
631
+ const dbResults = await BancoHelper.executarQuery(query);
632
+ expect(dbResults.length).toBeGreaterThan(0);
633
+ });
634
+ \`\`\`
635
+
636
+ ### Cenário com múltiplas fases:
637
+ \`\`\`typescript
638
+ test('Fluxo E2E completo', async () => {
639
+ // Fase 1: Autenticação
640
+ await authenticateViaAPI();
641
+
642
+ // Fase 2: Navegação e interação
643
+ await performUIInteractions();
644
+
645
+ // Fase 3: Validação de dados
646
+ await validateDataConsistency();
647
+
648
+ // Fase 4: Cleanup e relatório
649
+ await generateEvidences();
650
+ });
651
+ \`\`\`
652
+
653
+ ### Cenário com SSH e Banco:
654
+ \`\`\`typescript
655
+ test('Validação de infraestrutura', async () => {
656
+ // Verificar serviços via SSH
657
+ await SSHActions.write('systemctl status myapp');
658
+
659
+ // Validar dados no banco
660
+ await BancoActions.executarQuery('SELECT 1 FROM dual');
661
+
662
+ // Validar interface está acessível
663
+ await WebActions.navegarPara('/health', 'Health check');
664
+ });
665
+ \`\`\`
666
+
667
+ ## 🎯 Comandos Avançados
668
+
669
+ \`\`\`bash
670
+ # Execução específica por browser
671
+ npm run test:preprod -- --project=chromium
672
+ npm run test:preprod -- --project=firefox
673
+ npm run test:preprod -- --project=webkit
674
+
675
+ # Execução com parâmetros específicos
676
+ SLOW_MO=1000 npm run debug:preprod
677
+
678
+ # Execução de cenários específicos
679
+ npm run test:preprod -- --grep "CT001"
680
+ npm run test:preprod -- --grep "ConsultaEndereco"
681
+
682
+ # Execução com retry personalizado
683
+ npm run test:preprod -- --retries=3
684
+
685
+ # Execução em modo headed (visual)
686
+ npm run test:preprod -- --headed
687
+
688
+ # Geração de relatórios
689
+ npm run octane:generate
690
+ npm run octane:send
691
+
692
+ # Debug e desenvolvimento
693
+ npm run debug:preprod # Debug interativo
694
+ npm run ui:preprod # Interface visual dos testes
695
+ \`\`\`
696
+
697
+ ## 📊 Relatórios e Evidências
698
+
699
+ ### Playwright nativo:
700
+ - \`playwright-report/\` - Relatório HTML interativo
701
+ - \`test-results/\` - Resultados detalhados e artifacts
702
+ - Screenshots automáticos em falhas
703
+
704
+ ### Evidências customizadas:
705
+ - \`evidencias/\` - Screenshots manuais
706
+ - \`screenshots/\` - Screenshots automáticos
707
+ - \`videos/\` - Gravações de execução
708
+ - \`downloads/\` - Arquivos baixados durante testes
709
+
710
+ ### Integração Octane/ALM:
711
+ - \`octane-report.json\` - Relatório no formato Octane
712
+ - Mapeamento de IDs de teste (CT001, CT002, etc.)
713
+
714
+ ## 🔄 Sincronização com AutoCore
715
+
716
+ Este projeto mantém sincronização automática com o AutoCore para:
717
+
718
+ - **tsconfig.json**: Configuração TypeScript
719
+ - **biome.json**: Linting e formatação
720
+ - **Versões de dependências**: Sempre atualizadas
721
+ - **Configurações de teste**: Playwright otimizado para cenários
722
+
723
+ Para sincronizar manualmente:
724
+ \`\`\`bash
725
+ npx autocore-sync-configs
726
+ \`\`\`
727
+
728
+ ## 📈 Monitoramento e Métricas
729
+
730
+ ### Métricas coletadas automaticamente:
731
+ - **Duração total por cenário**
732
+ - **Tempo por fase** (autenticação, navegação, validação)
733
+ - **Taxa de sucesso** por ambiente
734
+ - **Performance de carregamento** de páginas
735
+ - **Uso de recursos** (CPU, memória)
736
+
737
+ ### Logs estruturados:
738
+ - **Logs por fase** do cenário
739
+ - **Correlação entre API e UI**
740
+ - **Evidências automáticas** em falhas
741
+ - **Rastreabilidade completa** das ações
742
+
743
+ ## 🆘 Resolução de Problemas
744
+
745
+ ### Timeouts de cenário:
746
+ \`\`\`bash
747
+ # Aumentar timeout específico
748
+ SCENARIO_TIMEOUT=300000 npm run test:preprod # 5 minutos
749
+
750
+ # Aumentar timeout de navegação
751
+ NAVIGATION_TIMEOUT=60000 npm run test:preprod # 1 minuto
752
+ \`\`\`
753
+
754
+ ### Problemas de sincronização:
755
+ \`\`\`bash
756
+ # Adicionar espera entre cenários
757
+ WAIT_BETWEEN_SCENARIOS=3000 npm run test:preprod # 3 segundos
758
+
759
+ # Modo lento para debug
760
+ SLOW_MO=2000 npm run debug:preprod # 2 segundos por ação
761
+ \`\`\`
762
+
763
+ ### Problemas de browser:
764
+ \`\`\`bash
765
+ # Reinstalar browsers
766
+ npx playwright install --force
767
+
768
+ # Executar apenas Chromium
769
+ npm run test:preprod:chromium
770
+
771
+ # Modo headed para visualizar
772
+ npm run test:preprod -- --headed
773
+ \`\`\`
774
+
775
+ ### Problemas de banco/API:
776
+ \`\`\`bash
777
+ # Verificar conectividade
778
+ telnet $DB_HOST $DB_PORT
779
+ curl -I $BASE_URL_API/health
780
+
781
+ # Logs detalhados
782
+ DEBUG=autocore:* npm run test:preprod
783
+ \`\`\`
784
+
785
+ ### Performance lenta:
786
+ \`\`\`bash
787
+ # Reduzir workers
788
+ npm run test:preprod -- --workers=1
789
+
790
+ # Executar apenas cenários críticos
791
+ npm run test:preprod -- --grep "CT001|CT002"
792
+ \`\`\`
793
+
794
+ ## 📝 Boas Práticas
795
+
796
+ ### Estrutura de cenários:
797
+ 1. **Nomenclatura consistente**: CN001, CN002 para cenários; CT001, CT002 para casos de teste
798
+ 2. **Fases bem definidas**: Autenticação → Navegação → Validação → Cleanup
799
+ 3. **Data Store**: Compartilhar dados entre fases usando DataStore
800
+ 4. **Evidências**: Screenshots automáticos em falhas, manuais em pontos críticos
801
+ 5. **Timeouts**: Configurar adequadamente para cada tipo de ação
802
+
803
+ ### Desenvolvimento:
804
+ 1. **Mixed Context**: Use TestAnnotations.Mixed para cenários completos
805
+ 2. **Error Handling**: Capturar screenshots e logs em falhas
806
+ 3. **Retry Logic**: Configurar retry apenas onde faz sentido
807
+ 4. **Cleanup**: Sempre limpar dados/estado entre cenários
808
+ 5. **Documentação**: Documentar dependências e pré-condições
809
+
810
+ ### CI/CD:
811
+ 1. **Ambientes isolados**: Configurações específicas por ambiente
812
+ 2. **Parallelização**: Cuidado com cenários que têm dependências
813
+ 3. **Evidências**: Sempre coletar artifacts em builds
814
+ 4. **Notificações**: Integrar com Octane/ALM para rastreabilidade
815
+ 5. **Monitoramento**: Acompanhar métricas de execução
816
+
817
+ ## 📚 Referências
818
+
819
+ - [AutoCore Website](http://brtlvlty0559pl:3002/)
820
+ - [Playwright Documentation](https://playwright.dev/)
821
+ - [Playwright Best Practices](https://playwright.dev/docs/best-practices)
822
+ - [Azure DevOps Pipelines](https://docs.microsoft.com/azure/devops/pipelines/)
823
+
824
+ ---
825
+
826
+ **Gerado automaticamente pelo AutoCore v${versions?.dependencies?.['@silasfmartins/testhub'] || 'latest'}**
827
+
828
+ ## 🎯 Próximos passos após geração:
829
+
830
+ 1. **Configure ambientes**: Edite os arquivos \`.env.*\` com suas URLs e credenciais
831
+ 2. **Teste conectividade**: Execute \`npm run test:preprod\` para validar configuração
832
+ 3. **Personalize cenários**: Adapte os exemplos CN001 e CN002 para seus casos de uso
833
+ 4. **Configure Octane**: Se usar ALM/Octane, configure as variáveis de integração
834
+ 5. **Ajuste pipeline**: Personalize \`.azuredevops/azure-pipeline.yml\` conforme necessário
835
+
836
+ 🚀 **Seu projeto de cenários está pronto para desenvolvimento avançado!**
837
+ `,
838
+ )
839
+
840
+ // 📦 Instalação de dependências NPM
841
+ console.log('📦 Instalando dependências NPM...')
842
+ try {
843
+ execSync('npm install', {
844
+ stdio: 'inherit',
845
+ cwd: root,
846
+ })
847
+ console.log('✅ Dependências NPM instaladas com sucesso')
848
+ } catch (error) {
849
+ console.warn('⚠️ Erro ao instalar dependências automaticamente')
850
+ console.log('💡 Execute manualmente: npm install')
851
+ }
852
+
853
+ // 🎭 CRÍTICO: Sempre instalar browsers Playwright
854
+ console.log('🎭 Instalando browsers Playwright...')
855
+ try {
856
+ execSync('npx playwright install', {
857
+ stdio: 'inherit',
858
+ cwd: root,
859
+ })
860
+ console.log('✅ Browsers Playwright instalados com sucesso')
861
+ } catch (error) {
862
+ console.warn('⚠️ Erro ao instalar browsers automaticamente')
863
+ console.log('💡 Execute manualmente: npx playwright install')
864
+ }
865
+
866
+ // ✅ Configurar Ultracite automaticamente
867
+ console.log('🤖 Configurando ambiente de desenvolvimento...')
868
+ await setupUltracite(root)
869
+
870
+ // ✅ Garantir sincronização final do biome.json
871
+ console.log('🔧 Sincronizando configuração do Biome...')
872
+ const finalBiomeConfig = generateBiomeConfigString()
873
+ write('biome.json', finalBiomeConfig)
874
+
875
+ // ✅ Instalação finalizada com sucesso
876
+
877
+ console.log('')
878
+ console.log('🎉 Projeto de Cenários E2E gerado com sucesso!')
879
+ console.log('')
880
+ console.log('📋 Próximos passos:')
881
+ console.log(' 1. Configure suas variáveis de ambiente nos arquivos .env.*')
882
+ console.log(' 2. Adicione URLs da aplicação, API e autenticação')
883
+ console.log(' 3. Configure banco de dados se necessário')
884
+ console.log(' 4. Execute: npm run test:preprod')
885
+ console.log(' 5. O Ultracite está configurado para VS Code')
886
+ console.log('')
887
+ console.log('🛠️ Comandos úteis:')
888
+ console.log(' npm run test:preprod - Executar cenários em preprod')
889
+ console.log(
890
+ ' npm run test:preprod:screenshots - Com screenshots habilitados',
891
+ )
892
+ console.log(' npm run ui:preprod - Interface visual dos testes')
893
+ console.log(' npm run debug:preprod - Modo debug interativo')
894
+ console.log(' npm run octane:generate - Gerar relatório Octane')
895
+ console.log(' npx biome check - Verificar código com Biome')
896
+ console.log(' npx biome format - Formatar código com Biome')
897
+ console.log('')
898
+ console.log('✅ Configurações sincronizadas com AutoCore:')
899
+ console.log(' 📝 tsconfig.json - Compilação TypeScript')
900
+ console.log(' 🎨 biome.json - Linting e formatação (SINCRONIZADO)')
901
+ console.log(' 🤖 Ultracite - Experiência de desenvolvimento')
902
+ console.log(' 📦 Dependências - Versões mais recentes')
903
+ console.log(' 🎭 Playwright - Configuração otimizada para cenários')
904
+ console.log(
905
+ ' 🔄 Mixed Context - Suporte a API + Frontend + Mobile + SSH + Banco',
906
+ )
907
+ console.log(' 🐙 Octane/ALM - Scripts de integração incluídos')
908
+ console.log('')
909
+ console.log(
910
+ '🚀 Projeto pronto para desenvolvimento de cenários E2E avançados!',
911
+ )
912
+ console.log('')
913
+ console.log('💡 Dicas importantes:')
914
+ console.log(' • Use TestAnnotations.Mixed para cenários completos')
915
+ console.log(' • Configure timeouts adequados para cenários longos')
916
+ console.log(' • Aproveite o DataStore para compartilhar dados entre fases')
917
+ console.log(' • Screenshots automáticos em falhas estão habilitados')
918
+ console.log(' • Relatórios HTML detalhados são gerados automaticamente')
919
+ }
920
+
921
+ // Executar função principal
922
+ main().catch((error) => {
923
+ console.error('❌ Erro durante inicialização:', error)
924
+ process.exit(1)
925
+ })