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