@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.
- package/.github/copilot-instructions.md +520 -0
- package/biome.json +37 -0
- package/dist/index.d.ts +45 -0
- package/dist/index.js +169 -0
- package/dist/scripts/consumer-postinstall.d.ts +15 -0
- package/dist/scripts/consumer-postinstall.js +785 -0
- package/dist/scripts/generate-docs.d.ts +16 -0
- package/dist/scripts/generate-docs.js +1363 -0
- package/dist/scripts/generate-index.d.ts +2 -0
- package/dist/scripts/generate-index.js +314 -0
- package/dist/scripts/init-api.d.ts +2 -0
- package/dist/scripts/init-api.js +525 -0
- package/dist/scripts/init-banco.d.ts +2 -0
- package/dist/scripts/init-banco.js +347 -0
- package/dist/scripts/init-frontend.d.ts +2 -0
- package/dist/scripts/init-frontend.js +627 -0
- package/dist/scripts/init-mobile.d.ts +2 -0
- package/dist/scripts/init-mobile.js +481 -0
- package/dist/scripts/init-scenarios.d.ts +2 -0
- package/dist/scripts/init-scenarios.js +846 -0
- package/dist/scripts/init-ssh.d.ts +2 -0
- package/dist/scripts/init-ssh.js +639 -0
- package/dist/scripts/package-versions.d.ts +57 -0
- package/dist/scripts/package-versions.js +768 -0
- package/dist/scripts/postinstall.d.ts +1 -0
- package/dist/scripts/postinstall.js +527 -0
- package/dist/scripts/robust-build.d.ts +7 -0
- package/dist/scripts/robust-build.js +88 -0
- package/dist/scripts/setup-local-packages.d.ts +31 -0
- package/dist/scripts/setup-local-packages.js +237 -0
- package/dist/scripts/smart-override.d.ts +2 -0
- package/dist/scripts/smart-override.js +1360 -0
- package/dist/scripts/sync-configs.d.ts +27 -0
- package/dist/scripts/sync-configs.js +248 -0
- package/dist/scripts/test-biome-parse.d.ts +5 -0
- package/dist/scripts/test-biome-parse.js +84 -0
- package/dist/scripts/ultracite-setup.d.ts +4 -0
- package/dist/scripts/ultracite-setup.js +310 -0
- package/dist/scripts/update-all-init-scripts.d.ts +2 -0
- package/dist/scripts/update-all-init-scripts.js +52 -0
- package/dist/scripts/update-biome-schema.d.ts +15 -0
- package/dist/scripts/update-biome-schema.js +124 -0
- package/dist/src/AutoCoreFacade.d.ts +145 -0
- package/dist/src/AutoCoreFacade.js +217 -0
- package/dist/src/api/ApiActions.d.ts +297 -0
- package/dist/src/api/ApiActions.js +1905 -0
- package/dist/src/api/Certificate.d.ts +60 -0
- package/dist/src/api/Certificate.js +79 -0
- package/dist/src/api/JsonResponse.d.ts +116 -0
- package/dist/src/api/JsonResponse.js +206 -0
- package/dist/src/appium/DeviceFarmViewer.d.ts +79 -0
- package/dist/src/appium/DeviceFarmViewer.js +1083 -0
- package/dist/src/appium/MobileActions.d.ts +347 -0
- package/dist/src/appium/MobileActions.js +1632 -0
- package/dist/src/appium/MobileConnection.d.ts +160 -0
- package/dist/src/appium/MobileConnection.js +772 -0
- package/dist/src/config/envLoader.d.ts +123 -0
- package/dist/src/config/envLoader.js +361 -0
- package/dist/src/config/jest-safe-setup.d.ts +19 -0
- package/dist/src/config/jest-safe-setup.js +369 -0
- package/dist/src/config/timeouts.d.ts +32 -0
- package/dist/src/config/timeouts.js +38 -0
- package/dist/src/desktop/DesktopActions.d.ts +46 -0
- package/dist/src/desktop/DesktopActions.js +398 -0
- package/dist/src/desktop/DesktopConnection.d.ts +32 -0
- package/dist/src/desktop/DesktopConnection.js +84 -0
- package/dist/src/domain/entities/TestExecution.d.ts +117 -0
- package/dist/src/domain/entities/TestExecution.js +150 -0
- package/dist/src/domain/entities/TestReport.d.ts +114 -0
- package/dist/src/domain/entities/TestReport.js +179 -0
- package/dist/src/domain/repositories/ITestRepository.d.ts +196 -0
- package/dist/src/domain/repositories/ITestRepository.js +14 -0
- package/dist/src/domain/schemas/ValidationSchemas.d.ts +159 -0
- package/dist/src/domain/schemas/ValidationSchemas.js +181 -0
- package/dist/src/functions/errors/BaseError.d.ts +78 -0
- package/dist/src/functions/errors/BaseError.js +245 -0
- package/dist/src/functions/errors/ConfigurationError.d.ts +16 -0
- package/dist/src/functions/errors/ConfigurationError.js +48 -0
- package/dist/src/functions/errors/ErrorCatalog.d.ts +148 -0
- package/dist/src/functions/errors/ErrorCatalog.js +157 -0
- package/dist/src/functions/errors/GlobalErrorHandler.d.ts +101 -0
- package/dist/src/functions/errors/GlobalErrorHandler.js +281 -0
- package/dist/src/functions/errors/IntegrationError.d.ts +17 -0
- package/dist/src/functions/errors/IntegrationError.js +51 -0
- package/dist/src/functions/errors/SecurityError.d.ts +14 -0
- package/dist/src/functions/errors/SecurityError.js +42 -0
- package/dist/src/functions/errors/SystemError.d.ts +12 -0
- package/dist/src/functions/errors/SystemError.js +36 -0
- package/dist/src/functions/errors/ValidationError.d.ts +14 -0
- package/dist/src/functions/errors/ValidationError.js +61 -0
- package/dist/src/functions/errors/index.d.ts +12 -0
- package/dist/src/functions/errors/index.js +13 -0
- package/dist/src/global-setup.d.ts +1 -0
- package/dist/src/global-setup.js +1037 -0
- package/dist/src/helpers/BancoActions.d.ts +188 -0
- package/dist/src/helpers/BancoActions.js +581 -0
- package/dist/src/helpers/EnviromentHelper.d.ts +17 -0
- package/dist/src/helpers/EnviromentHelper.js +66 -0
- package/dist/src/helpers/ParallelExecutionHelper.d.ts +183 -0
- package/dist/src/helpers/ParallelExecutionHelper.js +375 -0
- package/dist/src/helpers/SyncSignal.d.ts +15 -0
- package/dist/src/helpers/SyncSignal.js +44 -0
- package/dist/src/hubdocs/CategoryDetector.d.ts +83 -0
- package/dist/src/hubdocs/CategoryDetector.js +401 -0
- package/dist/src/hubdocs/DirectStatementInterceptor.d.ts +54 -0
- package/dist/src/hubdocs/DirectStatementInterceptor.js +243 -0
- package/dist/src/hubdocs/ExecutionTracker.d.ts +107 -0
- package/dist/src/hubdocs/ExecutionTracker.js +702 -0
- package/dist/src/hubdocs/HubDocs.d.ts +395 -0
- package/dist/src/hubdocs/HubDocs.js +3586 -0
- package/dist/src/hubdocs/StatementMethodFilter.d.ts +71 -0
- package/dist/src/hubdocs/StatementMethodFilter.js +618 -0
- package/dist/src/hubdocs/StatementTracker.d.ts +417 -0
- package/dist/src/hubdocs/StatementTracker.js +2419 -0
- package/dist/src/hubdocs/SwaggerGenerator.d.ts +59 -0
- package/dist/src/hubdocs/SwaggerGenerator.js +405 -0
- package/dist/src/hubdocs/index.d.ts +9 -0
- package/dist/src/hubdocs/index.js +9 -0
- package/dist/src/hubdocs/types.d.ts +114 -0
- package/dist/src/hubdocs/types.js +5 -0
- package/dist/src/infrastructure/DependencyContainer.d.ts +142 -0
- package/dist/src/infrastructure/DependencyContainer.js +250 -0
- package/dist/src/infrastructure/adapters/AppiumAdapter.d.ts +168 -0
- package/dist/src/infrastructure/adapters/AppiumAdapter.js +468 -0
- package/dist/src/infrastructure/adapters/OracleAdapter.d.ts +150 -0
- package/dist/src/infrastructure/adapters/OracleAdapter.js +388 -0
- package/dist/src/infrastructure/adapters/PlaywrightAdapter.d.ts +192 -0
- package/dist/src/infrastructure/adapters/PlaywrightAdapter.js +382 -0
- package/dist/src/infrastructure/adapters/SSHAdapter.d.ts +141 -0
- package/dist/src/infrastructure/adapters/SSHAdapter.js +428 -0
- package/dist/src/interfaces.d.ts +501 -0
- package/dist/src/interfaces.js +25 -0
- package/dist/src/internal/fakes/__fake-actions__.d.ts +17 -0
- package/dist/src/internal/fakes/__fake-actions__.js +21 -0
- package/dist/src/internal/fakes/__forbidden__.d.ts +10 -0
- package/dist/src/internal/fakes/__forbidden__.js +18 -0
- package/dist/src/internal/fakes/__honeypot__.d.ts +15 -0
- package/dist/src/internal/fakes/__honeypot__.js +24 -0
- package/dist/src/octane/OctaneReporter.d.ts +13 -0
- package/dist/src/octane/OctaneReporter.js +61 -0
- package/dist/src/playwright/CryptoActions.d.ts +20 -0
- package/dist/src/playwright/CryptoActions.js +75 -0
- package/dist/src/playwright/EnhancedWebActions.d.ts +7 -0
- package/dist/src/playwright/EnhancedWebActions.js +65 -0
- package/dist/src/playwright/WebActions.d.ts +1599 -0
- package/dist/src/playwright/WebActions.js +11788 -0
- package/dist/src/playwright/actions/ActionTimeline.d.ts +36 -0
- package/dist/src/playwright/actions/ActionTimeline.js +101 -0
- package/dist/src/playwright/actions/RecoveryQueue.d.ts +82 -0
- package/dist/src/playwright/actions/RecoveryQueue.js +130 -0
- package/dist/src/playwright/actions/SelectorCache.d.ts +53 -0
- package/dist/src/playwright/actions/SelectorCache.js +96 -0
- package/dist/src/playwright/actions/index.d.ts +13 -0
- package/dist/src/playwright/actions/index.js +14 -0
- package/dist/src/playwright/actions/types.d.ts +147 -0
- package/dist/src/playwright/actions/types.js +5 -0
- package/dist/src/playwright/fixtures.d.ts +112 -0
- package/dist/src/playwright/fixtures.js +718 -0
- package/dist/src/playwright/network-logs-reporter.d.ts +7 -0
- package/dist/src/playwright/network-logs-reporter.js +66 -0
- package/dist/src/playwright/registerRecoveryWrappers.d.ts +1 -0
- package/dist/src/playwright/registerRecoveryWrappers.js +54 -0
- package/dist/src/security/BuildSecurity.d.ts +12 -0
- package/dist/src/security/BuildSecurity.js +138 -0
- package/dist/src/security/EulaProtection.d.ts +70 -0
- package/dist/src/security/EulaProtection.js +155 -0
- package/dist/src/security/HoneypotManager.d.ts +46 -0
- package/dist/src/security/HoneypotManager.js +234 -0
- package/dist/src/security/KeysManager.d.ts +36 -0
- package/dist/src/security/KeysManager.js +158 -0
- package/dist/src/security/ProofOfWorkIntegration.d.ts +64 -0
- package/dist/src/security/ProofOfWorkIntegration.js +206 -0
- package/dist/src/security/SecurityValidation.d.ts +21 -0
- package/dist/src/security/SecurityValidation.js +163 -0
- package/dist/src/security/SourceMapProtection.d.ts +55 -0
- package/dist/src/security/SourceMapProtection.js +220 -0
- package/dist/src/security/protector.d.ts +1 -0
- package/dist/src/security/protector.js +97 -0
- package/dist/src/ssh/SSHActions.d.ts +262 -0
- package/dist/src/ssh/SSHActions.js +790 -0
- package/dist/src/ssh/SSHClient.d.ts +99 -0
- package/dist/src/ssh/SSHClient.js +409 -0
- package/dist/src/statements/BaseStatement.d.ts +38 -0
- package/dist/src/statements/BaseStatement.js +78 -0
- package/dist/src/testContext/AuthStateManager.d.ts +93 -0
- package/dist/src/testContext/AuthStateManager.js +256 -0
- package/dist/src/testContext/CoverageManager.d.ts +198 -0
- package/dist/src/testContext/CoverageManager.js +917 -0
- package/dist/src/testContext/TestAnnotations.d.ts +476 -0
- package/dist/src/testContext/TestAnnotations.js +2647 -0
- package/dist/src/testContext/TestContext.d.ts +138 -0
- package/dist/src/testContext/TestContext.js +369 -0
- package/dist/src/testContext/UnifiedHtmlGenerator.d.ts +7 -0
- package/dist/src/testContext/UnifiedHtmlGenerator.js +264 -0
- package/dist/src/testContext/UnifiedReportManager.d.ts +211 -0
- package/dist/src/testContext/UnifiedReportManager.js +1206 -0
- package/dist/src/testhub/DynamicConfigManager.d.ts +121 -0
- package/dist/src/testhub/DynamicConfigManager.js +320 -0
- package/dist/src/testhub/SystemsManager.d.ts +119 -0
- package/dist/src/testhub/SystemsManager.js +365 -0
- package/dist/src/testhub/TestHubClient.d.ts +335 -0
- package/dist/src/testhub/TestHubClient.js +1215 -0
- package/dist/src/testhub/TestHubReporter.d.ts +62 -0
- package/dist/src/testhub/TestHubReporter.js +576 -0
- package/dist/src/testhub/TestHubVars.d.ts +116 -0
- package/dist/src/testhub/TestHubVars.js +273 -0
- package/dist/src/utils/ActionInterceptor.d.ts +59 -0
- package/dist/src/utils/ActionInterceptor.js +741 -0
- package/dist/src/utils/ArtifactsCompressor.d.ts +43 -0
- package/dist/src/utils/ArtifactsCompressor.js +181 -0
- package/dist/src/utils/AutoLogsFinal.d.ts +47 -0
- package/dist/src/utils/AutoLogsFinal.js +148 -0
- package/dist/src/utils/CodeGenSession.d.ts +114 -0
- package/dist/src/utils/CodeGenSession.js +264 -0
- package/dist/src/utils/ConfigLogger.d.ts +133 -0
- package/dist/src/utils/ConfigLogger.js +611 -0
- package/dist/src/utils/CustomReporter.d.ts +22 -0
- package/dist/src/utils/CustomReporter.js +352 -0
- package/dist/src/utils/DataStore.d.ts +171 -0
- package/dist/src/utils/DataStore.js +484 -0
- package/dist/src/utils/DatabaseInterceptor.d.ts +19 -0
- package/dist/src/utils/DatabaseInterceptor.js +295 -0
- package/dist/src/utils/DateHelper.d.ts +16 -0
- package/dist/src/utils/DateHelper.js +120 -0
- package/dist/src/utils/DateValidator.d.ts +4 -0
- package/dist/src/utils/DateValidator.js +51 -0
- package/dist/src/utils/DocumentGenerator.d.ts +35 -0
- package/dist/src/utils/DocumentGenerator.js +129 -0
- package/dist/src/utils/EvidenceCapture.d.ts +90 -0
- package/dist/src/utils/EvidenceCapture.js +600 -0
- package/dist/src/utils/EvidenceReportGenerator.d.ts +70 -0
- package/dist/src/utils/EvidenceReportGenerator.js +799 -0
- package/dist/src/utils/FrameManagementUtil.d.ts +42 -0
- package/dist/src/utils/FrameManagementUtil.js +75 -0
- package/dist/src/utils/GlobalStatementsInterceptor.d.ts +1 -0
- package/dist/src/utils/GlobalStatementsInterceptor.js +1 -0
- package/dist/src/utils/HTMLTemplate.d.ts +1 -0
- package/dist/src/utils/HTMLTemplate.js +1034 -0
- package/dist/src/utils/InterceptacaoMagica.d.ts +23 -0
- package/dist/src/utils/InterceptacaoMagica.js +365 -0
- package/dist/src/utils/LogSanitizer.d.ts +35 -0
- package/dist/src/utils/LogSanitizer.js +110 -0
- package/dist/src/utils/Logger.d.ts +65 -0
- package/dist/src/utils/Logger.js +284 -0
- package/dist/src/utils/McpLocalClient.d.ts +141 -0
- package/dist/src/utils/McpLocalClient.js +871 -0
- package/dist/src/utils/PDFEvidenceGenerator.d.ts +20 -0
- package/dist/src/utils/PDFEvidenceGenerator.js +156 -0
- package/dist/src/utils/SpecFileAnalyzer.d.ts +35 -0
- package/dist/src/utils/SpecFileAnalyzer.js +209 -0
- package/dist/src/utils/StatementInterceptor.d.ts +18 -0
- package/dist/src/utils/StatementInterceptor.js +87 -0
- package/dist/src/utils/StatementLogger.d.ts +33 -0
- package/dist/src/utils/StatementLogger.js +113 -0
- package/dist/src/utils/StatementsInterceptor.d.ts +1 -0
- package/dist/src/utils/StatementsInterceptor.js +1 -0
- package/dist/src/utils/TeamsFlushHook.d.ts +17 -0
- package/dist/src/utils/TeamsFlushHook.js +168 -0
- package/dist/src/utils/TerminalLogCapture.d.ts +158 -0
- package/dist/src/utils/TerminalLogCapture.js +531 -0
- package/dist/src/utils/TestMethodLogger.d.ts +70 -0
- package/dist/src/utils/TestMethodLogger.js +95 -0
- package/dist/src/utils/UnifiedTeardown.d.ts +4 -0
- package/dist/src/utils/UnifiedTeardown.js +400 -0
- package/dist/src/utils/XPathCatalog.d.ts +152 -0
- package/dist/src/utils/XPathCatalog.js +350 -0
- package/dist/src/utils/generators.d.ts +90 -0
- package/dist/src/utils/generators.js +167 -0
- package/dist/src/utils/testRecovery/ResilientPlaywright.d.ts +152 -0
- package/dist/src/utils/testRecovery/ResilientPlaywright.js +715 -0
- package/dist/src/utils/testRecovery/TestRecoveryClient.d.ts +801 -0
- package/dist/src/utils/testRecovery/TestRecoveryClient.js +1415 -0
- package/dist/src/utils/testRecovery/autoFixCode.d.ts +65 -0
- package/dist/src/utils/testRecovery/autoFixCode.js +32 -0
- package/dist/vitest.config.d.ts +2 -0
- package/dist/vitest.config.js +59 -0
- package/dist/wdio.conf.d.ts +1 -0
- package/dist/wdio.conf.js +420 -0
- package/package.json +137 -0
- package/protect-loader.mjs +643 -0
- package/scripts/consumer-postinstall.ts +975 -0
- package/scripts/generate-index.ts +343 -0
- package/scripts/init-api.ts +613 -0
- package/scripts/init-banco.ts +437 -0
- package/scripts/init-frontend.ts +727 -0
- package/scripts/init-mobile.ts +558 -0
- package/scripts/init-scenarios.ts +925 -0
- package/scripts/init-ssh.ts +734 -0
- package/scripts/package-versions.ts +978 -0
- package/scripts/postinstall.ts +605 -0
- package/scripts/smart-override.ts +1675 -0
- package/scripts/sync-configs.ts +302 -0
- package/scripts/ultracite-setup.ts +370 -0
- package/src/types/globals.d.ts +48 -0
- package/tsconfig.json +29 -0
- package/types/autocore-sync-signal.d.ts +10 -0
|
@@ -0,0 +1,437 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
|
|
4
|
+
import fs from 'node:fs'
|
|
5
|
+
import path from 'node:path'
|
|
6
|
+
import yaml from 'js-yaml'
|
|
7
|
+
import {
|
|
8
|
+
generateBiomeConfigString,
|
|
9
|
+
generatePackageJson,
|
|
10
|
+
generateTsConfigForProject,
|
|
11
|
+
generateVitestConfigString,
|
|
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
|
+
type CatalogInfo = {
|
|
25
|
+
metadata?: {
|
|
26
|
+
name?: string
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const catalog = yaml.load(fs.readFileSync(catalogPath, 'utf-8')) as CatalogInfo
|
|
31
|
+
const projectName = catalog?.metadata?.name || 'meu-projeto'
|
|
32
|
+
const projectNameUnderscore = projectName.replace(/-/g, '_')
|
|
33
|
+
|
|
34
|
+
const write = (filePath: string, content: string) => {
|
|
35
|
+
const fullPath = path.join(root, filePath)
|
|
36
|
+
fs.mkdirSync(path.dirname(fullPath), { recursive: true })
|
|
37
|
+
fs.writeFileSync(fullPath, content)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
async function main() {
|
|
41
|
+
console.log(
|
|
42
|
+
'🚀 Inicializando projeto Banco Oracle com versões atualizadas...',
|
|
43
|
+
)
|
|
44
|
+
console.log(`📦 Projeto: ${projectName}`)
|
|
45
|
+
console.log('')
|
|
46
|
+
|
|
47
|
+
// ✅ Buscar versões mais recentes
|
|
48
|
+
const versions = await getLatestVersions()
|
|
49
|
+
|
|
50
|
+
// ✅ Gerar package.json com versões atualizadas
|
|
51
|
+
const packageJsonContent = generatePackageJson(projectName, 'banco', versions)
|
|
52
|
+
|
|
53
|
+
// ✅ Gerar tsconfig.json baseado no AutoCore
|
|
54
|
+
const tsconfigContent = generateTsConfigForProject('banco')
|
|
55
|
+
|
|
56
|
+
// ✅ Gerar vitest.config.ts baseado no AutoCore
|
|
57
|
+
const vitestConfigContent = generateVitestConfigString('banco')
|
|
58
|
+
|
|
59
|
+
// ✅ Gerar biome.json sincronizado com AutoCore
|
|
60
|
+
const biomeConfigContent = generateBiomeConfigString()
|
|
61
|
+
|
|
62
|
+
console.log('📝 Criando arquivos do projeto...')
|
|
63
|
+
|
|
64
|
+
// package.json com versões dinâmicas
|
|
65
|
+
write('package.json', JSON.stringify(packageJsonContent, null, 2))
|
|
66
|
+
|
|
67
|
+
// ✅ tsconfig.json sempre sincronizado com o AutoCore
|
|
68
|
+
write('tsconfig.json', JSON.stringify(tsconfigContent, null, 2))
|
|
69
|
+
|
|
70
|
+
// ✅ biome.json sincronizado automaticamente com o AutoCore
|
|
71
|
+
write('biome.json', biomeConfigContent)
|
|
72
|
+
|
|
73
|
+
// playwright.config.ts
|
|
74
|
+
write(
|
|
75
|
+
'playwright.config.ts',
|
|
76
|
+
`import { defineConfig } from '@playwright/test'
|
|
77
|
+
export default defineConfig({
|
|
78
|
+
globalSetup: '@silasfmartins/testhub/setup',
|
|
79
|
+
reporter: [
|
|
80
|
+
['list'],
|
|
81
|
+
['html', { open: 'never' }],
|
|
82
|
+
['@silasfmartins/testhub/reporter'],
|
|
83
|
+
],
|
|
84
|
+
testDir: './tests',
|
|
85
|
+
testMatch: ['**/*.spec.ts', '**/*.test.ts'],
|
|
86
|
+
// Timeouts adequados para testes de banco
|
|
87
|
+
timeout: 120_000,
|
|
88
|
+
expect: {
|
|
89
|
+
timeout: 60_000,
|
|
90
|
+
},
|
|
91
|
+
use: {
|
|
92
|
+
trace: 'on',
|
|
93
|
+
},
|
|
94
|
+
})`,
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
// .npmrc
|
|
98
|
+
write(
|
|
99
|
+
'.npmrc',
|
|
100
|
+
`registry=https://pkgs.dev.azure.com/telefonica-vivo-brasil/_packaging/DevOps/npm/registry/`,
|
|
101
|
+
)
|
|
102
|
+
|
|
103
|
+
// .gitignore
|
|
104
|
+
write(
|
|
105
|
+
'.gitignore',
|
|
106
|
+
`# Playwright
|
|
107
|
+
node_modules/
|
|
108
|
+
/test-results/
|
|
109
|
+
/playwright-report/
|
|
110
|
+
/blob-report/
|
|
111
|
+
/playwright/.cache/
|
|
112
|
+
|
|
113
|
+
# Tests e logs
|
|
114
|
+
/tests
|
|
115
|
+
/logs
|
|
116
|
+
|
|
117
|
+
.vscode
|
|
118
|
+
.vscode/
|
|
119
|
+
docs
|
|
120
|
+
docs/
|
|
121
|
+
|
|
122
|
+
# Environment files
|
|
123
|
+
.env
|
|
124
|
+
.env.preprod
|
|
125
|
+
.env.esteira1
|
|
126
|
+
.env.esteira2
|
|
127
|
+
.env.prodlike
|
|
128
|
+
|
|
129
|
+
# AutoCore específicos
|
|
130
|
+
.test-data-store.json
|
|
131
|
+
.env.lock
|
|
132
|
+
.configlogger.lock
|
|
133
|
+
.rbqa
|
|
134
|
+
.rbqa/
|
|
135
|
+
|
|
136
|
+
# VS Code
|
|
137
|
+
.vscode/settings.json
|
|
138
|
+
|
|
139
|
+
# Biome
|
|
140
|
+
.biome.log
|
|
141
|
+
|
|
142
|
+
# Coverage
|
|
143
|
+
coverage/
|
|
144
|
+
*.lcov`,
|
|
145
|
+
)
|
|
146
|
+
|
|
147
|
+
// Arquivo de environment padrão
|
|
148
|
+
write(
|
|
149
|
+
'.env',
|
|
150
|
+
`# Arquivo que seleciona o ambiente a ser utilizado
|
|
151
|
+
ENV=PREPROD`,
|
|
152
|
+
)
|
|
153
|
+
|
|
154
|
+
// Arquivo de environment padrão
|
|
155
|
+
write(
|
|
156
|
+
'.env.preprod',
|
|
157
|
+
`# Configurações de banco de dados para preprod
|
|
158
|
+
DB_HOST=
|
|
159
|
+
DB_PORT=1521
|
|
160
|
+
DB_SERVICE_NAME=
|
|
161
|
+
DB_USER=
|
|
162
|
+
DB_PASSWORD=
|
|
163
|
+
# Adicione suas variáveis de ambiente aqui`,
|
|
164
|
+
)
|
|
165
|
+
|
|
166
|
+
// Arquivo de environment esteira1
|
|
167
|
+
write(
|
|
168
|
+
'.env.esteira1',
|
|
169
|
+
`# Configurações de banco de dados para esteira1
|
|
170
|
+
DB_HOST=
|
|
171
|
+
DB_PORT=1521
|
|
172
|
+
DB_SERVICE_NAME=
|
|
173
|
+
DB_USER=
|
|
174
|
+
DB_PASSWORD=
|
|
175
|
+
# Adicione suas variáveis de ambiente aqui`,
|
|
176
|
+
)
|
|
177
|
+
|
|
178
|
+
// Arquivo de environment esteira2
|
|
179
|
+
write(
|
|
180
|
+
'.env.esteira2',
|
|
181
|
+
`# Configurações de banco de dados para esteira2
|
|
182
|
+
DB_HOST=
|
|
183
|
+
DB_PORT=1521
|
|
184
|
+
DB_SERVICE_NAME=
|
|
185
|
+
DB_USER=
|
|
186
|
+
DB_PASSWORD=
|
|
187
|
+
# Adicione suas variáveis de ambiente aqui`,
|
|
188
|
+
)
|
|
189
|
+
|
|
190
|
+
// Arquivo de environment prodlike
|
|
191
|
+
write(
|
|
192
|
+
'.env.prodlike',
|
|
193
|
+
`# Configurações de banco de dados para prodlike
|
|
194
|
+
DB_HOST=
|
|
195
|
+
DB_PORT=1521
|
|
196
|
+
DB_SERVICE_NAME=
|
|
197
|
+
DB_USER=
|
|
198
|
+
DB_PASSWORD=
|
|
199
|
+
# Adicione suas variáveis de ambiente aqui`,
|
|
200
|
+
)
|
|
201
|
+
|
|
202
|
+
// ✅ Estrutura de testes
|
|
203
|
+
console.log('📝 Criando estrutura de testes e models...')
|
|
204
|
+
|
|
205
|
+
// src/models/ModelDBA.ts
|
|
206
|
+
write(
|
|
207
|
+
'src/models/ModelDBA.ts',
|
|
208
|
+
`export class ModelDBA {
|
|
209
|
+
getCep(cidade: string): string {
|
|
210
|
+
return /*sql*/ \`
|
|
211
|
+
SELECT
|
|
212
|
+
ZIPCODE, X_NUMBER, X_BB_MAX_SPEED, X_OPTL_TR_NAME
|
|
213
|
+
FROM
|
|
214
|
+
siebel.s_addr_per
|
|
215
|
+
WHERE
|
|
216
|
+
x_network_owner = 'VIVO2'
|
|
217
|
+
AND x_access_technology = 'GPON'
|
|
218
|
+
AND city = '\${cidade}'
|
|
219
|
+
AND comments LIKE '%Endereço com cobertura%'
|
|
220
|
+
ORDER BY
|
|
221
|
+
last_upd DESC
|
|
222
|
+
\`;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
getCep2(cidade: string, tecnology: string): string {
|
|
226
|
+
return /*sql*/ \`
|
|
227
|
+
SELECT
|
|
228
|
+
ZIPCODE, X_NUMBER, X_BB_MAX_SPEED, X_OPTL_TR_NAME
|
|
229
|
+
FROM
|
|
230
|
+
siebel.s_addr_per
|
|
231
|
+
WHERE
|
|
232
|
+
x_network_owner = 'VIVO2'
|
|
233
|
+
AND x_access_technology = '\${tecnology}'
|
|
234
|
+
AND city = '\${cidade}'
|
|
235
|
+
AND comments LIKE '%Endereço com cobertura%'
|
|
236
|
+
ORDER BY
|
|
237
|
+
last_upd DESC
|
|
238
|
+
\`;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
`,
|
|
242
|
+
)
|
|
243
|
+
|
|
244
|
+
// src/statements/StatementsConsultaCep.ts
|
|
245
|
+
write(
|
|
246
|
+
'src/statements/StatementsConsultaCep.ts',
|
|
247
|
+
`import { BancoActions, DataStore } from "@silasfmartins/testhub";
|
|
248
|
+
import { ModelDBA } from "../models/ModelDBA.js";
|
|
249
|
+
|
|
250
|
+
export class StatementsConsultaCep {
|
|
251
|
+
/**
|
|
252
|
+
* Consulta CEP baseado na cidade fornecida
|
|
253
|
+
* @param cidade - Nome da cidade para a consulta
|
|
254
|
+
* @returns Resultados da consulta de CEP
|
|
255
|
+
*/
|
|
256
|
+
async validateCep(cidade: string) {
|
|
257
|
+
const MAX_RESULTS = 5;
|
|
258
|
+
|
|
259
|
+
// Executa e loga a ação
|
|
260
|
+
const results = await BancoActions.select(new ModelDBA().getCep(cidade));
|
|
261
|
+
|
|
262
|
+
// Limita e armazena resultados
|
|
263
|
+
const limitedResults = results.slice(0, MAX_RESULTS);
|
|
264
|
+
for (const [index, row] of limitedResults.entries()) {
|
|
265
|
+
DataStore.set(\`CEP\${index + 1}\`, row.ZIPCODE);
|
|
266
|
+
DataStore.set(\`NUMERO\${index + 1}\`, row.X_NUMBER);
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
// Validação e log
|
|
270
|
+
const houveResultados = results.length > 0;
|
|
271
|
+
if (!houveResultados) {
|
|
272
|
+
const sql = "SELECT 1 FROM DUAL WHERE 1=0";
|
|
273
|
+
await BancoActions.execute("Validação de retorno de dados", sql);
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
return limitedResults;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
`,
|
|
280
|
+
)
|
|
281
|
+
|
|
282
|
+
// tests/consulta-cep.spec.ts
|
|
283
|
+
write(
|
|
284
|
+
'tests/consulta-cep.spec.ts',
|
|
285
|
+
`import { type TestInfo, test, TestAnnotations } from "@silasfmartins/testhub";
|
|
286
|
+
import { StatementsConsultaCep } from "../src/statements/StatementsConsultaCep.js";
|
|
287
|
+
|
|
288
|
+
test.describe("Testes de Banco de Dados - CEP Curitiba", () => {
|
|
289
|
+
TestAnnotations.stopOnFailure(); // opcional: para o runner ao falhar um CT
|
|
290
|
+
|
|
291
|
+
test("CT001 - Consulta de CEPs com cobertura GPON em Curitiba", async ({}, testInfo: TestInfo) => {
|
|
292
|
+
TestAnnotations.Banco.testInfo = testInfo;
|
|
293
|
+
await TestAnnotations.setSystem("MEU_SISTEMA");
|
|
294
|
+
await new StatementsConsultaCep().validateCep("CURITIBA");
|
|
295
|
+
});
|
|
296
|
+
});
|
|
297
|
+
`,
|
|
298
|
+
)
|
|
299
|
+
|
|
300
|
+
//env.ts
|
|
301
|
+
write('src/env.ts', `import { config } from 'dotenv'
|
|
302
|
+
|
|
303
|
+
config()
|
|
304
|
+
|
|
305
|
+
const rawEnv = {
|
|
306
|
+
ENV: process.env.ENV,
|
|
307
|
+
}
|
|
308
|
+
export const env = rawEnv
|
|
309
|
+
`)
|
|
310
|
+
|
|
311
|
+
// SonarQube configuration
|
|
312
|
+
write(
|
|
313
|
+
'.azuredevops/sonar-project.properties',
|
|
314
|
+
`################### NÃO ALTERAR!!! ###################
|
|
315
|
+
# Informações gerais sobre o projeto. #
|
|
316
|
+
# Todas as variáveis de ambiente são fornecidas pela #
|
|
317
|
+
# automação, não alterar! #
|
|
318
|
+
######################################################
|
|
319
|
+
|
|
320
|
+
sonar.projectDescription=Projeto de API com AutoCore
|
|
321
|
+
sonar.analysis.orgName=\${env.AZ_ORG_NAME}
|
|
322
|
+
sonar.analysis.buildAuthor=\${env.AZ_BUILD_AUTHOR}
|
|
323
|
+
sonar.scm.exclusions.disabled=false
|
|
324
|
+
sonar.scm.forceReloadAll=true
|
|
325
|
+
sonar.log.level=DEBUG
|
|
326
|
+
sonar.verbose=true
|
|
327
|
+
sonar.sourceEncoding=UTF-8
|
|
328
|
+
|
|
329
|
+
# Diretórios e arquivos relevantes para Node.js/TypeScript
|
|
330
|
+
sonar.sources=src
|
|
331
|
+
sonar.inclusions=**/*.ts
|
|
332
|
+
sonar.test.inclusions=**/*.spec.ts,**/*.test.ts
|
|
333
|
+
sonar.typescript.lcov.reportPaths=coverage/lcov.info
|
|
334
|
+
sonar.javascript.lcov.reportPaths=coverage/lcov.info
|
|
335
|
+
|
|
336
|
+
# Exclusões de cobertura e análise
|
|
337
|
+
sonar.exclusions=node_modules/**,dist/**,coverage/**,**/*.config.js,**/*.config.ts
|
|
338
|
+
sonar.coverage.exclusions=**/*.d.ts,node_modules/**,dist/**,coverage/**,**/*.config.js,**/*.config.ts,**/*.spec.ts,**/*.test.ts
|
|
339
|
+
sonar.test.exclusions=node_modules/**,dist/**,coverage/**
|
|
340
|
+
|
|
341
|
+
# Configurações específicas para projetos API
|
|
342
|
+
sonar.javascript.environments=node
|
|
343
|
+
sonar.typescript.node=true
|
|
344
|
+
`,
|
|
345
|
+
)
|
|
346
|
+
|
|
347
|
+
// Pipeline Azure DevOps
|
|
348
|
+
write(
|
|
349
|
+
'.azuredevops/azure-pipeline.yml',
|
|
350
|
+
`trigger:
|
|
351
|
+
batch: true
|
|
352
|
+
branches:
|
|
353
|
+
include:
|
|
354
|
+
- 'master'
|
|
355
|
+
paths:
|
|
356
|
+
include:
|
|
357
|
+
- '*'
|
|
358
|
+
exclude:
|
|
359
|
+
- .azuredevops/*
|
|
360
|
+
- docs/*
|
|
361
|
+
- catalog-info.yaml
|
|
362
|
+
- mkdocs.yml
|
|
363
|
+
- scripts.py
|
|
364
|
+
- catalog/*
|
|
365
|
+
|
|
366
|
+
resources:
|
|
367
|
+
repositories:
|
|
368
|
+
- repository: CodePlay
|
|
369
|
+
name: DevOps/Vivo.CodePlay.Pipelines
|
|
370
|
+
type: git
|
|
371
|
+
ref: refs/heads/test-playwright
|
|
372
|
+
endpoint: CodePlay
|
|
373
|
+
|
|
374
|
+
pool:
|
|
375
|
+
name: GeneralPurposeLinuxAgentsCI
|
|
376
|
+
|
|
377
|
+
extends:
|
|
378
|
+
template: tech_products/qa/build/pipeline_node_npm.yml@CodePlay
|
|
379
|
+
parameters:
|
|
380
|
+
jobName: 'build_${projectNameUnderscore}_pkg'
|
|
381
|
+
commitSHA: '$(Build.SourceVersion)'
|
|
382
|
+
registryServiceConnection: 'ACR-DEVOPS'
|
|
383
|
+
govAppAcronym: ''
|
|
384
|
+
skipScan: false # Alterado para false para executar Fortify e SonarQube
|
|
385
|
+
`,
|
|
386
|
+
)
|
|
387
|
+
|
|
388
|
+
// ✅ Configurar Ultracite automaticamente
|
|
389
|
+
console.log('🤖 Configurando ambiente de desenvolvimento...')
|
|
390
|
+
await setupUltracite(root)
|
|
391
|
+
|
|
392
|
+
// ✅ Garantir sincronização final do biome.json
|
|
393
|
+
console.log('🔧 Sincronizando configuração do Biome...')
|
|
394
|
+
const finalBiomeConfig = generateBiomeConfigString()
|
|
395
|
+
write('biome.json', finalBiomeConfig)
|
|
396
|
+
|
|
397
|
+
// Remover o lock após tudo finalizar
|
|
398
|
+
const installLockPath = path.join(root, '.install.lock')
|
|
399
|
+
if (fs.existsSync(installLockPath)) {
|
|
400
|
+
fs.unlinkSync(installLockPath)
|
|
401
|
+
console.log('🗑️ Lock de instalação removido')
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
console.log('')
|
|
405
|
+
console.log('🎉 Projeto Banco de Dados gerado com sucesso!')
|
|
406
|
+
console.log('')
|
|
407
|
+
console.log('📋 Próximos passos:')
|
|
408
|
+
console.log(
|
|
409
|
+
' 1. Configure suas variáveis de ambiente de banco nos arquivos .env.*',
|
|
410
|
+
)
|
|
411
|
+
console.log(' 2. Adicione as credenciais do Oracle no .env.preprod')
|
|
412
|
+
console.log(' 3. Execute: npm run test:preprod')
|
|
413
|
+
console.log('')
|
|
414
|
+
console.log('🛠️ Comandos úteis:')
|
|
415
|
+
console.log(' npm run test:preprod - Executar testes em preprod')
|
|
416
|
+
console.log(' npm run test:esteira1 - Executar testes em esteira1')
|
|
417
|
+
console.log(' npm run test:esteira2 - Executar testes em esteira2')
|
|
418
|
+
console.log(' npm run test:prodlike - Executar testes em prodlike')
|
|
419
|
+
console.log(' npm run build - Compilar projeto')
|
|
420
|
+
console.log(' npm run update - Atualizar índices')
|
|
421
|
+
console.log(' npx biome check - Verificar código com Biome')
|
|
422
|
+
console.log(' npx biome format - Formatar código com Biome')
|
|
423
|
+
console.log('')
|
|
424
|
+
console.log('✅ Configurações sincronizadas com AutoCore:')
|
|
425
|
+
console.log(' 📝 tsconfig.json - Compilação TypeScript')
|
|
426
|
+
console.log(' 🎨 biome.json - Linting e formatação (SINCRONIZADO)')
|
|
427
|
+
console.log(' 📦 Dependências - Versões mais recentes')
|
|
428
|
+
console.log(' 🗄️ Oracle Database - Suporte completo')
|
|
429
|
+
console.log('')
|
|
430
|
+
console.log('🚀 Projeto pronto para desenvolvimento de testes de banco!')
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
// Executar função principal
|
|
434
|
+
main().catch((error) => {
|
|
435
|
+
console.error('❌ Erro durante inicialização:', error)
|
|
436
|
+
process.exit(1)
|
|
437
|
+
})
|