Antes de meterle a sprint 1 etapa 4 y 5
This commit is contained in:
49
tests/design-system/tokens.test.ts
Normal file
49
tests/design-system/tokens.test.ts
Normal file
@@ -0,0 +1,49 @@
|
||||
/**
|
||||
* Tests del sistema de diseño InQ ROI — Sprint 1.5.
|
||||
*
|
||||
* Verifican que los tokens de marca estén correctamente definidos en
|
||||
* tailwind.config.js y que no haya contaminación de la marca hermana CONCILIA.
|
||||
*
|
||||
* Estos tests son la fuente de verdad del contrato de marca: si cambiás
|
||||
* un token, el test falla y te fuerza a ser explícito con el cambio.
|
||||
*/
|
||||
import { describe, it, expect } from 'vitest'
|
||||
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
||||
const tailwindConfig = require('../../tailwind.config.js').default ?? require('../../tailwind.config.js')
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const colors = (tailwindConfig.theme.extend.colors) as Record<string, any>
|
||||
|
||||
describe('Design tokens — paleta InQ ROI', () => {
|
||||
it('expone tokens de marca InQ con estructura anidada correcta', () => {
|
||||
const inq = colors.inq
|
||||
|
||||
expect(inq.orange.DEFAULT).toBe('#F59845')
|
||||
expect(inq.orange.dark).toBe('#B45309')
|
||||
expect(inq.orange.light).toBe('#FEF3E2')
|
||||
expect(inq.orange.lighter).toBe('#FFF8ED')
|
||||
expect(inq.magenta).toBe('#ED3E8F')
|
||||
})
|
||||
|
||||
it('NO incluye los colores de CONCILIA (marca hermana, no mezclar)', () => {
|
||||
const configStr = JSON.stringify(tailwindConfig)
|
||||
|
||||
// Morado primario de CONCILIA
|
||||
expect(configStr).not.toContain('#572FA2')
|
||||
expect(configStr).not.toContain('#572fa2')
|
||||
|
||||
// Magenta de CONCILIA
|
||||
expect(configStr).not.toContain('#CB1889')
|
||||
expect(configStr).not.toContain('#cb1889')
|
||||
})
|
||||
|
||||
it('expone tokens del heatmap saturado (calibrado para tests E2E)', () => {
|
||||
const heatmap = colors.heatmap
|
||||
|
||||
// Valores en mayúscula: #10B981, #F59E0B, #EF4444
|
||||
// Deben coincidir con HEATMAP_LOW/MID/HIGH en src/lib/colors.ts
|
||||
expect(heatmap.low).toBe('#10B981')
|
||||
expect(heatmap.mid).toBe('#F59E0B')
|
||||
expect(heatmap.high).toBe('#EF4444')
|
||||
})
|
||||
})
|
||||
65
tests/e2e/screenshots-etapa-1.spec.ts
Normal file
65
tests/e2e/screenshots-etapa-1.spec.ts
Normal file
@@ -0,0 +1,65 @@
|
||||
/**
|
||||
* Screenshots de validación visual — Etapa 1 Sprint 1.5.
|
||||
*
|
||||
* Captura 3 vistas que muestran la identidad InQ aplicada:
|
||||
* 1. workspace.png — CTAs naranjas, Simular button, tabs
|
||||
* 2. report-tabs.png — tab activo naranja en el reporte
|
||||
* 3. switch-on.png — switch de automatización en estado ON naranja
|
||||
*
|
||||
* Estos screenshots son evidencia de que el cambio de --primary a naranja
|
||||
* se ve correctamente en la aplicación real.
|
||||
*/
|
||||
import { test } from '@playwright/test'
|
||||
import { resolve } from 'path'
|
||||
import { mkdirSync } from 'fs'
|
||||
import { fileURLToPath } from 'url'
|
||||
|
||||
const __dirname = fileURLToPath(new URL('.', import.meta.url))
|
||||
const BPMN_DIR = resolve(__dirname, '../../public/sample-processes')
|
||||
const OUT_DIR = resolve(__dirname, '../screenshots/etapa-1')
|
||||
|
||||
test.beforeAll(() => { mkdirSync(OUT_DIR, { recursive: true }) })
|
||||
|
||||
test('screenshot workspace — CTAs naranjas visibles', async ({ page }) => {
|
||||
await page.goto('/')
|
||||
await page.locator('#bpmn-file-input').setInputFiles(resolve(BPMN_DIR, 'simple-linear.bpmn'))
|
||||
await page.waitForURL(/\/workspace\//, { timeout: 15_000 })
|
||||
await page.waitForSelector('button:has-text("Simular")', { timeout: 10_000 })
|
||||
await page.waitForTimeout(1_000)
|
||||
|
||||
await page.screenshot({ path: resolve(OUT_DIR, 'workspace.png'), fullPage: false })
|
||||
})
|
||||
|
||||
test('screenshot switch ON — switch de automatización naranja', async ({ page }) => {
|
||||
await page.goto('/')
|
||||
await page.locator('#bpmn-file-input').setInputFiles(resolve(BPMN_DIR, 'simple-linear.bpmn'))
|
||||
await page.waitForURL(/\/workspace\//, { timeout: 15_000 })
|
||||
await page.waitForSelector('button:has-text("Simular")', { timeout: 10_000 })
|
||||
await page.waitForTimeout(1_500)
|
||||
|
||||
// Hacer click en el primer task del BPMN para abrir el ActivityPanel
|
||||
await page.locator('[data-element-id="task1"]').first().click()
|
||||
await page.waitForTimeout(500)
|
||||
|
||||
// Encender el switch de automatización
|
||||
const toggle = page.getByRole('switch', { name: /automatizable/i })
|
||||
await toggle.click()
|
||||
await page.waitForTimeout(300)
|
||||
|
||||
await page.screenshot({ path: resolve(OUT_DIR, 'switch-on.png'), fullPage: false })
|
||||
})
|
||||
|
||||
test('screenshot report-tabs — tab activo naranja', async ({ page }) => {
|
||||
await page.goto('/')
|
||||
await page.locator('#bpmn-file-input').setInputFiles(resolve(BPMN_DIR, 'medium-with-gateways.bpmn'))
|
||||
await page.waitForURL(/\/workspace\//, { timeout: 15_000 })
|
||||
await page.waitForSelector('button:has-text("Simular")', { timeout: 10_000 })
|
||||
await page.waitForTimeout(1_500)
|
||||
|
||||
const simBtn = page.getByRole('button', { name: 'Simular' })
|
||||
await simBtn.click()
|
||||
await page.waitForURL(/\/report\//, { timeout: 20_000 })
|
||||
await page.waitForSelector('button:has-text("Exportar PDF")', { timeout: 20_000 })
|
||||
|
||||
await page.screenshot({ path: resolve(OUT_DIR, 'report-tabs.png'), fullPage: false })
|
||||
})
|
||||
21
tests/lib/format-payback.test.ts
Normal file
21
tests/lib/format-payback.test.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* Tests de formatPayback — Sprint 1.5 Etapa 2.
|
||||
*
|
||||
* Stubs preparados. La implementación se agrega en Etapa 2.
|
||||
* Los 7 casos están definidos en SPRINT_1_5_BRIEF_REDISENIO_VISUAL.md § 3.4.
|
||||
*
|
||||
* Regla: un payback de "0.0 meses" (como mostraba el sistema con costos
|
||||
* artificialmente bajos) es confuso. formatPayback resuelve esto con
|
||||
* una escala legible para el consultor y el cliente.
|
||||
*/
|
||||
import { describe, it } from 'vitest'
|
||||
|
||||
describe('formatPayback', () => {
|
||||
it.todo('0 → "Inmediato" (inversión cero con ahorro positivo)')
|
||||
it.todo('0.05 → "< 1 día" (payback de horas, prácticamente instantáneo)')
|
||||
it.todo('0.5 → "< 1 mes (0.50 meses)"')
|
||||
it.todo('6 → "6.0 meses"')
|
||||
it.todo('15 → "15.0 meses (~1.3 años)"')
|
||||
it.todo('30 → "2.5 años"')
|
||||
it.todo('Infinity → "No recupera en horizonte"')
|
||||
})
|
||||
BIN
tests/screenshots/etapa-1/report-tabs.png
Normal file
BIN
tests/screenshots/etapa-1/report-tabs.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 95 KiB |
BIN
tests/screenshots/etapa-1/switch-on.png
Normal file
BIN
tests/screenshots/etapa-1/switch-on.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 76 KiB |
BIN
tests/screenshots/etapa-1/workspace.png
Normal file
BIN
tests/screenshots/etapa-1/workspace.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 49 KiB |
Reference in New Issue
Block a user