d8b9452870
Replace the risk introduction with the reviewed text, name severe ADOS-2 probabilities in the risk section and record table, and place the TEA clarification below the risk probability table through section content. Use one shared decimal log-axis builder in the patient forest and both governance OR charts. Add builder and patient logic coverage and update the page case for the section, column headers and clarification. Choices left open by the spec: - Name the builder logAxis and mirror valueAxis's iterable input signature; put its logic spec in indicadores/figures.spec.ts beside the builder. - Generate the 1-2-3-5-7 sequence from the floor of the minimum log10 to the ceiling of the maximum log10, including only 1 in the last decade. Whole-decade bounds retain labels for narrow and single-value ranges. - Ignore missing, nonfinite and nonpositive input; return empty tick arrays when no positive finite data remain. Discard generated zero or nonfinite ticks at floating-point limits. - Construct tick values from decimal exponent strings to avoid binary multiplication artifacts; use explicit array ticks and SHORT hovers. - Let the existing private decimal formatter accept optional Intl options, retaining its existing defaults. For log labels use its es-MX locale, one significant digit and no grouping, preserving small decimals and avoiding scientific notation and trailing zeros. - Include estimates and confidence bounds in each chart's input, plus 1 in the two charts that draw the reference line. - Represent the risk table note as a following text block so the existing page and PDF renderers both place it below the table. - Cover decimal sequences, whole-decade bounds, singleton and iterable input, invalid input, small and large labels, patient confidence bounds, probability labels and the clarification's PDF inclusion in logic tests. Add page assertions for the probability headers and clarification. Validation: ruff check . passed; ruff format --check . passed (144 files); git diff --check passed. A Node smoke check of the source logAxis function passed nine assertions. Prettier was skipped because this worktree has no WebApp/node_modules/.bin/prettier. Angular tests/build and Playwright page tests were not run here, as the spec reserves them for milkpc/the VM. Python imports and the API did not change; lint-imports and API generation were not needed.
465 lines
22 KiB
TypeScript
465 lines
22 KiB
TypeScript
import { expect } from '@playwright/test';
|
||
import { downloaded, test, watch } from './support';
|
||
|
||
test('tea indicators: every tab loads, and the follow-up list exports to Excel', async ({
|
||
page,
|
||
}) => {
|
||
const problems = watch(page);
|
||
const listed = page.waitForResponse(
|
||
(r) => r.url().includes('/tea/fhir/Measure') && !r.url().includes('MeasureReport'),
|
||
);
|
||
await page.goto('/indicadores/tea');
|
||
const measures = (await (await listed).json()).entry.length;
|
||
expect(measures).toBe(11);
|
||
await expect(page.getByRole('tab', { name: 'Resumen' })).toBeVisible();
|
||
const indicators = page.locator('app-tab-indicadores');
|
||
await expect(indicators.locator('[data-measure]')).toHaveCount(10);
|
||
await expect(indicators.locator('[data-figure="sankey"] .sankey')).toBeVisible();
|
||
await expect(indicators.locator('[data-measure="M31_PREVALENCIA"] .barlayer')).toBeVisible();
|
||
await expect(
|
||
indicators.locator('[data-measure="M24_CONFIRMACION_DIAGNOSTICO"] app-plot'),
|
||
).toHaveCount(1);
|
||
await expect(
|
||
indicators.locator('[data-measure="M23_PACIENTES_EVALUADOS"] mat-button-toggle-group'),
|
||
).toHaveCount(0);
|
||
await expect(
|
||
indicators.getByRole('heading', { name: 'Porcentaje de EEG normal y anormal' }),
|
||
).toHaveCount(0);
|
||
|
||
await page.getByRole('tab', { name: 'Trazabilidad' }).click();
|
||
const history = page.locator('app-tab-trazabilidad');
|
||
await expect(history.locator('[data-measure]')).toHaveCount(11);
|
||
await expect(
|
||
history.getByRole('heading', { name: 'Prevalencia registrada de TEA' }),
|
||
).toBeVisible();
|
||
await expect(
|
||
history.getByRole('heading', { name: 'Porcentaje de EEG normal y anormal' }),
|
||
).toBeVisible();
|
||
await expect(page.locator('app-tab-trazabilidad app-plot').first()).toBeVisible();
|
||
|
||
await page.getByRole('tab', { name: 'Seguimiento' }).click();
|
||
const rows = page.locator('app-tab-seguimiento-tea table tbody tr');
|
||
await expect(rows.first().locator('td').first()).toHaveText(/^N-?\d{4}$/);
|
||
await expect(rows.first().locator('app-tea-stepper li')).toHaveCount(4);
|
||
await expect(page.locator('app-tab-seguimiento-tea').getByRole('columnheader')).toHaveText([
|
||
'Expediente',
|
||
'Nombre',
|
||
'Sexo',
|
||
'Edad (meses)',
|
||
'Etapa',
|
||
'Puntaje M-CHAT',
|
||
'CSS ADOS-2',
|
||
'Estatus de EEG',
|
||
'Alteraciones encontradas',
|
||
]);
|
||
const name = await downloaded(
|
||
page,
|
||
page.getByRole('button', { name: 'Exportar a Excel' }),
|
||
'xlsx',
|
||
);
|
||
expect(name).toMatch(/^tea-seguimiento-/);
|
||
|
||
await page.getByRole('tab', { name: 'Análisis de riesgo' }).click();
|
||
const risk = page.locator('app-tab-riesgos-tea');
|
||
await expect(
|
||
risk.getByRole('heading', { name: 'EEG de los pacientes del periodo' }),
|
||
).toBeVisible();
|
||
await expect(risk.locator('table.worklist tbody tr').first().locator('td').first()).toHaveText(
|
||
/^N-?\d{4}$/,
|
||
);
|
||
await expect(risk.locator('table.worklist > thead').getByRole('columnheader')).toHaveText([
|
||
'Expediente',
|
||
'Nombre',
|
||
'Sexo',
|
||
'Edad (meses)',
|
||
'Asociación principal',
|
||
'Razón de momios',
|
||
'IC 95 %',
|
||
'q',
|
||
'Probabilidad',
|
||
'Probabilidad de referencia',
|
||
]);
|
||
await risk.getByRole('combobox', { name: 'Modelo de asociación' }).click();
|
||
await page.getByRole('option', { name: 'Con resultados' }).click();
|
||
await expect(risk.locator('table.worklist tbody tr').first()).toBeVisible();
|
||
|
||
await page.getByRole('tab', { name: 'Datos y definiciones' }).click();
|
||
const definitions = page.locator('app-tab-definiciones');
|
||
await expect(definitions.locator('details')).toHaveCount(measures);
|
||
await expect(
|
||
definitions.getByText('Porcentaje de EEG normal y anormal', { exact: true }),
|
||
).toBeVisible();
|
||
await definitions.getByText('Prevalencia registrada de TEA', { exact: true }).click();
|
||
await expect(definitions.getByText(/Every child loaded on the platform/)).toBeVisible();
|
||
expect(problems).toEqual([]);
|
||
});
|
||
|
||
test('tea complete child: every screen has data', async ({ page }) => {
|
||
const problems = watch(page);
|
||
const recordNumber = /^N-?0011$/;
|
||
const filled = /^\s*(?!—\s*$)\S/;
|
||
const mark = '.point, .slice path, .sankey-node, .box';
|
||
const tab = (name: string) => page.getByRole('tab', { name }).click();
|
||
const section = (title: string) =>
|
||
page.locator('app-tea-section').filter({
|
||
has: page.locator('mat-card-title').getByText(title, { exact: true }),
|
||
});
|
||
const find = async (host: string) => {
|
||
const search = page.locator(host).getByRole('searchbox', { name: 'Buscar paciente' });
|
||
await search.fill('N0011');
|
||
await search.press('Enter');
|
||
};
|
||
const childRow = (table: string) =>
|
||
page
|
||
.locator(table)
|
||
.getByRole('row')
|
||
.filter({
|
||
has: page.getByRole('cell', { name: recordNumber }),
|
||
});
|
||
|
||
await page.goto('/indicadores/tea');
|
||
const summary = page.locator('app-tab-indicadores');
|
||
await summary.getByText('Semestral', { exact: true }).click();
|
||
await summary.getByRole('combobox', { name: 'Periodo seleccionado' }).click();
|
||
await page.getByRole('option', { name: '2025-S2', exact: true }).click();
|
||
await summary.getByRole('button', { name: 'Aplicar' }).click();
|
||
await expect(summary.locator('.summary mark').first()).toHaveText(/\d/);
|
||
const summaryFigures = summary.locator('.figure-card, .box-card');
|
||
await expect(summaryFigures).toHaveCount(10);
|
||
for (const card of await summaryFigures.all()) {
|
||
await expect(card.locator(`app-plot :is(${mark})`).first()).toBeAttached();
|
||
}
|
||
await expect(summary.getByText('Sin datos publicados')).toHaveCount(0);
|
||
|
||
await tab('Trazabilidad');
|
||
const history = page.locator('app-tab-trazabilidad');
|
||
const panels = history.locator('[data-measure]');
|
||
await expect(panels).toHaveCount(11);
|
||
for (const panel of await panels.all()) {
|
||
await expect(panel.locator(`app-plot :is(${mark})`).first()).toBeAttached();
|
||
}
|
||
await expect(history.getByText('Sin datos para el periodo.')).toHaveCount(0);
|
||
|
||
await tab('Seguimiento');
|
||
await find('app-tab-seguimiento-tea');
|
||
const followUp = childRow('app-tab-seguimiento-tea table.worklist');
|
||
await expect(followUp.getByRole('cell')).toHaveCount(9);
|
||
await expect(followUp.locator('td:not(:nth-child(5))')).toHaveText(Array(8).fill(filled));
|
||
await expect(followUp.locator('app-tea-stepper li.completed')).toHaveCount(4);
|
||
await expect(followUp.getByRole('cell').last()).toHaveText(/^[1-9]\d*$/);
|
||
|
||
await tab('Análisis de riesgo');
|
||
const risk = page.locator('app-tab-riesgos-tea');
|
||
await find('app-tab-riesgos-tea');
|
||
await risk.getByRole('combobox', { name: 'Modelo de asociación' }).click();
|
||
await page.getByRole('option', { name: 'Con resultados' }).click();
|
||
const riskRow = childRow('app-tab-riesgos-tea table.worklist');
|
||
await expect(riskRow.getByRole('cell')).toHaveText(Array(10).fill(filled));
|
||
|
||
await tab('Datos y definiciones');
|
||
const definitions = page.locator('app-tab-definiciones');
|
||
await expect(definitions.locator('details')).toHaveCount(11);
|
||
await definitions.getByText('Prevalencia registrada de TEA', { exact: true }).click();
|
||
await expect(definitions.getByText(/Every child loaded on the platform/)).toBeVisible();
|
||
|
||
await tab('Seguimiento');
|
||
await followUp.getByRole('link').click();
|
||
await expect(page.getByText(recordNumber)).toBeVisible();
|
||
const gantt = section('Línea del tiempo');
|
||
await expect(gantt.locator('app-plot .barlayer .point').first()).toBeAttached();
|
||
const diamonds = gantt.locator('app-plot .scatterlayer path.point');
|
||
await expect(diamonds).toHaveCount(4);
|
||
for (const diamond of await diamonds.all()) {
|
||
await expect(diamond).toHaveAttribute('d', /^M[\d.]+,0L0,[\d.]+L-/);
|
||
}
|
||
await expect(section('ADOS-2').locator('tbody tr').first().locator('td').nth(2)).toHaveText(
|
||
/^[AB]-\d+$/,
|
||
);
|
||
await expect(section('Calidad del EEG').locator('tbody tr').first()).toBeVisible();
|
||
const alterations = section('Alteraciones');
|
||
await expect(
|
||
alterations.locator('h3:text-is("Norma por edad · p5–p95") + app-plot .point').first(),
|
||
).toBeAttached();
|
||
await expect(
|
||
alterations.locator('h3:text-is("Mapa de la cabeza") + app-plot .contourlayer path').first(),
|
||
).toBeAttached();
|
||
await expect(section('Relación con el ADOS-2').locator('tbody tr').first()).toBeVisible();
|
||
|
||
await page.getByRole('link', { name: 'Análisis de riesgo' }).click();
|
||
await expect(page.getByRole('heading', { name: 'Análisis de riesgo TEA' })).toBeVisible();
|
||
await expect(section('Qué calcula').locator('p').first()).toHaveText(/ADOS-2/);
|
||
await expect(
|
||
section('Puntuaciones z por métrica y zona').locator('app-plot .point').first(),
|
||
).toBeAttached();
|
||
await expect(
|
||
section('Razones de momios por par').locator('app-plot .point').first(),
|
||
).toBeAttached();
|
||
await expect(
|
||
section('Probabilidad de un puntaje ADOS-2 severo').locator('tbody tr').first(),
|
||
).toBeVisible();
|
||
await expect(
|
||
section('Probabilidad de un puntaje ADOS-2 severo').getByRole('columnheader'),
|
||
).toHaveText(['Par', 'Prob. ADOS-2 severo', 'Referencia']);
|
||
await expect(section('Probabilidad de un puntaje ADOS-2 severo').locator('p')).toHaveText(
|
||
'No es la probabilidad de TEA.',
|
||
);
|
||
await expect(section('Probabilidad según z').locator('app-plot .point').first()).toBeAttached();
|
||
await expect(section('Limitaciones').locator('p').first()).toHaveText(/cohorte/);
|
||
|
||
await page.goto('/gobernanza/tea');
|
||
await expect(page.getByRole('region', { name: 'Ejecución' }).getByRole('status')).toContainText(
|
||
'Disponible',
|
||
);
|
||
const models = page.getByRole('region', { name: 'Modelos' });
|
||
const modelCards = models.locator('section.model');
|
||
await expect(modelCards).toHaveCount(8);
|
||
for (const model of await modelCards.all()) {
|
||
await expect(model.getByText('champion', { exact: true })).toBeVisible();
|
||
}
|
||
await expect(page.locator('app-governance-training formly-form')).toBeVisible();
|
||
await expect(page.getByText('Subir archivos', { exact: true })).toHaveCount(0);
|
||
const bundles = page.getByRole('region', { name: 'Bundles' });
|
||
await expect(bundles.getByRole('combobox', { name: 'Versiones' })).toHaveText('En producción');
|
||
await expect(bundles.getByRole('button', { name: 'Exportar bundle' })).toBeEnabled();
|
||
const studies = page.locator('app-eeg-studies');
|
||
const completeEeg = studies.getByRole('row').filter({ hasText: 'LAB-N-0011-1' });
|
||
await expect(completeEeg).toContainText(/\bVálido\b/);
|
||
await completeEeg.getByRole('button').click();
|
||
await expect(
|
||
studies
|
||
.locator('table.plain:not(.eegs) tbody tr td')
|
||
.filter({ hasText: /^tea\./ })
|
||
.first(),
|
||
).toBeVisible();
|
||
await studies.getByRole('button', { name: 'Evaluar un solo estudio' }).click();
|
||
const preview = page.locator('app-eeg-preview');
|
||
await expect(preview.getByLabel('EDF')).toBeAttached();
|
||
await expect(preview.getByLabel('ADOS-2 (PDF)')).toBeAttached();
|
||
await expect(preview.getByLabel('Fecha de nacimiento')).toBeVisible();
|
||
await expect(page.getByRole('heading', { name: 'Vista previa', level: 2 })).toHaveCount(0);
|
||
expect(problems).toEqual([]);
|
||
});
|
||
|
||
test('tea patient: the record and the risk page load and export to PDF', async ({ page }) => {
|
||
const problems = watch(page);
|
||
await page.goto('/indicadores/tea');
|
||
await page.getByRole('tab', { name: 'Seguimiento' }).click();
|
||
const first = page.locator('app-tab-seguimiento-tea table tbody tr').first();
|
||
await expect(first.locator('td').first()).toHaveText(/^N-?\d{4}$/);
|
||
await first.getByRole('link').click();
|
||
|
||
await expect(page).toHaveURL(/\/indicadores\/tea\/pacientes\/[^/]+$/);
|
||
await expect(page.getByRole('heading', { level: 1 })).toBeVisible();
|
||
const timeline = page.locator('app-tea-section').first();
|
||
await expect(timeline.getByText('Línea del tiempo', { exact: true })).toBeVisible();
|
||
await expect(timeline.locator('app-plot .scatterlayer .point').first()).toBeVisible();
|
||
await expect(timeline.getByRole('table')).toHaveCount(0);
|
||
const record = await downloaded(page, page.getByRole('button', { name: 'Exportar PDF' }), 'pdf');
|
||
expect(record).toMatch(/^tea-seguimiento-/);
|
||
|
||
await page.getByRole('link', { name: 'Regresar' }).click();
|
||
const focused = page.locator('app-tab-seguimiento-tea');
|
||
await expect(focused.getByRole('button', { name: 'Ver todos los pacientes' })).toBeVisible();
|
||
const focusedRows = focused.locator('table tbody tr');
|
||
await expect(focusedRows).toHaveCount(1);
|
||
await expect(focusedRows.first().locator('td')).toHaveCount(9);
|
||
await expect(focusedRows.first().locator('app-tea-stepper')).toBeVisible();
|
||
await focusedRows.first().getByRole('link').click();
|
||
|
||
await page.getByRole('link', { name: 'Análisis de riesgo' }).click();
|
||
await expect(page.getByRole('heading', { name: 'Análisis de riesgo TEA' })).toBeVisible();
|
||
await expect(page.locator('app-tea-section').first()).toBeVisible();
|
||
expect(await downloaded(page, page.getByRole('button', { name: 'Exportar PDF' }), 'pdf')).toMatch(
|
||
/^tea-riesgos-/,
|
||
);
|
||
await page.goto('/indicadores/tea');
|
||
await page.getByRole('tab', { name: 'Análisis de riesgo' }).click();
|
||
const riskList = page.locator('app-tab-riesgos-tea table.worklist');
|
||
const patientLink = riskList.getByRole('row').nth(1).getByRole('link');
|
||
await expect(patientLink).toHaveAttribute(
|
||
'href',
|
||
/\/indicadores\/tea\/pacientes\/[^/]+\/riesgo$/,
|
||
);
|
||
await patientLink.click();
|
||
await expect(page).toHaveURL(/\/indicadores\/tea\/pacientes\/[^/]+\/riesgo$/);
|
||
await expect(page.getByRole('heading', { name: 'Análisis de riesgo TEA' })).toBeVisible();
|
||
expect(problems).toEqual([]);
|
||
});
|
||
|
||
test('tea gobernanza: every section in sync mode, and the preview saved as PDF', async ({
|
||
page,
|
||
}) => {
|
||
const problems = watch(page);
|
||
await page.goto('/gobernanza/tea');
|
||
await expect(page.locator('app-gobernanza').getByRole('heading', { level: 2 })).toHaveText([
|
||
'Ejecución',
|
||
'Modelos',
|
||
'Entrenamiento',
|
||
'Bundles',
|
||
'Estudios EEG',
|
||
]);
|
||
await expect(page.getByRole('heading', { name: 'Subir archivos', exact: true })).toHaveCount(0);
|
||
await expect(page.getByText('Archivos de entrenamiento', { exact: true })).toHaveCount(0);
|
||
await page.getByRole('combobox', { name: 'Modo' }).click();
|
||
await page.getByRole('option', { name: 'Sync' }).click();
|
||
await expect(page.getByRole('status').filter({ hasText: 'Disponible' })).toBeVisible();
|
||
|
||
await page.getByRole('button', { name: 'Entrenar modelos' }).click();
|
||
const training = page.getByRole('heading', { name: 'Entrenamiento', level: 2 });
|
||
await expect(training).toBeVisible();
|
||
await expect(training).toBeFocused();
|
||
await expect(page.locator('app-governance-training formly-form')).toBeVisible();
|
||
|
||
const source = page.getByRole('combobox', { name: 'Origen' });
|
||
const folder = page.getByRole('textbox', { name: 'Carpeta', exact: true });
|
||
const line = page.getByRole('combobox', { name: 'Frecuencia de la red eléctrica (Hz)' });
|
||
await expect(source).toHaveText('Niños del sitio sin el diagnóstico');
|
||
await expect(folder).toBeHidden();
|
||
await expect(line).toBeHidden();
|
||
await source.click();
|
||
await page.getByRole('option', { name: 'Carpeta de EDF con edades' }).click();
|
||
await expect(folder).toBeVisible();
|
||
await expect(line).toBeVisible();
|
||
await source.click();
|
||
await page.getByRole('option', { name: 'Niños del sitio sin el diagnóstico' }).click();
|
||
await expect(folder).toBeHidden();
|
||
await expect(line).toBeHidden();
|
||
|
||
await expect(page.getByRole('button', { name: 'Calcular riesgos' })).toHaveCount(0);
|
||
await page.getByRole('button', { name: 'Analizar EEG' }).click();
|
||
await expect(page.getByRole('heading', { name: 'Estudios EEG', level: 2 })).toBeFocused();
|
||
await page.getByRole('button', { name: 'Promover candidatas' }).click();
|
||
await expect(page.getByText('No hay candidatas que se puedan promover.')).toBeVisible();
|
||
|
||
const studies = page.locator('app-eeg-studies');
|
||
await expect(studies.locator('input[type=file]')).toHaveCount(0);
|
||
await expect(studies.locator('table.eegs tbody tr').first()).toContainText(/Válido|No válido/);
|
||
await studies.locator('table.eegs tbody button:enabled').first().click();
|
||
await expect(studies.getByRole('heading', { name: /^EEG .* meses$/ })).toBeVisible();
|
||
await studies.getByRole('button', { name: 'Analizar', exact: true }).click();
|
||
await expect(studies.locator('app-run-monitor').first().getByRole('status')).toHaveText(
|
||
'SUCCESS',
|
||
{ timeout: 10 * 60_000 },
|
||
);
|
||
|
||
const toggle = studies.getByRole('button', { name: 'Evaluar un solo estudio' });
|
||
const preview = studies.locator('app-eeg-preview');
|
||
const edf = preview.getByRole('button', { name: 'EDF', exact: true });
|
||
const ados = preview.getByRole('button', { name: 'ADOS-2 (PDF)', exact: true });
|
||
const birth = preview.getByLabel('Fecha de nacimiento');
|
||
await expect(toggle).toHaveAttribute('aria-pressed', 'false');
|
||
await expect(edf).toBeHidden();
|
||
await expect(ados).toBeHidden();
|
||
await expect(birth).toBeHidden();
|
||
await toggle.click();
|
||
await expect(toggle).toHaveAttribute('aria-pressed', 'true');
|
||
await expect(page.getByRole('heading', { name: 'Vista previa', exact: true })).toHaveCount(0);
|
||
await expect(edf).toBeVisible();
|
||
await expect(ados).toBeVisible();
|
||
await expect(birth).toBeVisible();
|
||
await toggle.click();
|
||
await expect(toggle).toHaveAttribute('aria-pressed', 'false');
|
||
await expect(edf).toBeHidden();
|
||
await expect(ados).toBeHidden();
|
||
await expect(birth).toBeHidden();
|
||
await toggle.click();
|
||
await preview.getByLabel('EDF').setInputFiles(process.env['TEA_EDF']!);
|
||
await preview.getByLabel('ADOS-2 (PDF)').setInputFiles(process.env['TEA_ADOS2']!);
|
||
await preview.getByLabel('Fecha de nacimiento').fill(process.env['TEA_BIRTH']!);
|
||
await preview.getByRole('button', { name: 'Vista previa' }).click();
|
||
const dialog = page.getByRole('dialog', { name: 'Vista previa del estudio' });
|
||
await expect(dialog.getByText('Resultado de la vista previa')).toBeVisible({
|
||
timeout: 10 * 60_000,
|
||
});
|
||
await expect(dialog.locator('dt').first()).toHaveText(/^[AB]-\d+ \S/);
|
||
expect(
|
||
await downloaded(page, dialog.getByRole('button', { name: 'Guardar como PDF' }), 'pdf'),
|
||
).toMatch(/^tea-gobernanza-/);
|
||
await dialog.getByRole('button', { name: 'Cerrar' }).click();
|
||
|
||
const bundles = page.locator('app-governance-bundles');
|
||
await bundles.getByRole('combobox', { name: 'Versiones' }).click();
|
||
await page.getByRole('option', { name: 'Todas' }).click();
|
||
const [bundle] = await Promise.all([
|
||
page.waitForEvent('download'),
|
||
bundles.getByRole('button', { name: 'Exportar bundle' }).click(),
|
||
]);
|
||
expect(bundle.suggestedFilename()).toMatch(/^tea-models-[0-9a-f]{12}\.zip$/);
|
||
await expect(bundles.locator('code')).toHaveText(/^[0-9a-f]{64}$/);
|
||
expect(problems).toEqual([]);
|
||
});
|
||
|
||
test('conectar: the tea pipeline on the canvas, and a node form', async ({ page }) => {
|
||
const problems = watch(page);
|
||
await page.goto('/conectar');
|
||
const pipelines = page.locator('aside.pipelines a');
|
||
await expect(pipelines).toHaveCount(1);
|
||
await expect(pipelines.first()).toContainText('tea');
|
||
await pipelines.first().click();
|
||
|
||
const canvas = page.locator('.canvas');
|
||
await expect(page.getByRole('button', { name: 'Leer EDF' })).toBeVisible();
|
||
const extract = canvas.locator('.node-caption', { hasText: 'Extraer datos' });
|
||
await expect(extract).toBeVisible();
|
||
await extract.click();
|
||
|
||
const panel = page.locator('aside.panel');
|
||
await expect(panel.getByRole('heading', { name: 'Extraer datos · ados2_results' })).toBeVisible();
|
||
await expect(panel.locator('formly-form')).toBeVisible();
|
||
expect(problems).toEqual([]);
|
||
});
|
||
|
||
test('revision: the unrecognised-documents tab mirrors the pipeline', async ({ page }) => {
|
||
const problems = watch(page);
|
||
const answer = page.waitForResponse((r) => r.url().includes('/review/unrecognised'));
|
||
await page.goto('/revision');
|
||
await expect(page.getByRole('heading', { name: 'Revisión' })).toBeVisible();
|
||
const count = ((await (await answer).json()) as unknown[]).length;
|
||
const tab = page.getByRole('tab', { name: 'Documentos no reconocidos' });
|
||
await expect(tab).toHaveText(`Documentos no reconocidos (${count})`);
|
||
await tab.click();
|
||
if (count === 0) {
|
||
await expect(page.getByText('Sin documentos no reconocidos.')).toBeVisible();
|
||
} else {
|
||
await expect(page.locator('table.plain:not(.card) tbody tr')).toHaveCount(count);
|
||
}
|
||
expect(problems).toEqual([]);
|
||
});
|
||
|
||
test('cacu and cama indicators: the four tabs over domains without data', async ({ page }) => {
|
||
const problems = watch(page);
|
||
expect(await (await page.request.get('/api/domains')).json()).toEqual(['cacu', 'cama', 'tea']);
|
||
for (const [domain, title] of [
|
||
['cacu', 'Cáncer cervicouterino'],
|
||
['cama', 'Cáncer de mama'],
|
||
]) {
|
||
await page.goto(`/indicadores/${domain}`);
|
||
await expect(page.getByRole('heading', { name: title, level: 1 })).toBeVisible();
|
||
await expect(page.getByRole('tab')).toHaveText([
|
||
'Indicadores',
|
||
'Trazabilidad',
|
||
'Análisis de riesgos',
|
||
'Datos y definiciones',
|
||
]);
|
||
await expect(page.getByText('Sin datos en el periodo.').first()).toBeVisible();
|
||
}
|
||
expect(problems).toEqual([]);
|
||
});
|
||
|
||
test('cacu gobernanza: the shared sections only, none of the TEA ones', async ({ page }) => {
|
||
const problems = watch(page);
|
||
await page.goto('/gobernanza/cacu');
|
||
await expect(page.locator('app-gobernanza').getByRole('heading', { level: 2 })).toHaveText([
|
||
'Ejecución',
|
||
'Modelos',
|
||
'Entrenamiento',
|
||
'Bundles',
|
||
]);
|
||
await expect(page.locator('app-eeg-studies')).toHaveCount(0);
|
||
await expect(page.locator('app-eeg-preview')).toHaveCount(0);
|
||
const nav = page.getByRole('navigation', { name: 'Dominios' });
|
||
await expect(nav.getByRole('link', { name: 'Cáncer de mama' })).toBeVisible();
|
||
await expect(nav.getByRole('link', { name: 'Trastorno del espectro autista' })).toBeVisible();
|
||
expect(problems.filter((p) => !p.startsWith('console: Failed to load'))).toEqual([]);
|
||
});
|