4929def121
Share the integer tick rule between Trazabilidad and TEA record figures. Use the plotted extent, including stacked totals or interval bounds, to target four divisions. Round spacing up to a 1/2/5 step with a minimum of one, anchor ticks at zero, ignore nonfinite values, and include integer bounds when a fractional extent contains no integer. Point the existing patient link at the TEA risk route and remove the details accordion and separate risk action. Exercise the link from the risk list in the existing patient page case. Connect completed diamonds in step order on the existing marker trace, using its color for the dotted line and retaining the duration bars and annotations. The scalp figure used the ear electrodes as markers outside the circle, omitted the ears, and masked sample centers without clipping Plotly's rendered contour cells at the scalp boundary. Its interpolation also colored distant areas with no adjacent sample. Use the reference's 19 scalp positions, nose and ear paths, and reverse-wound mask painted in the card's white surface color beneath the outline. Derive the mask and the existing 41-point grid in headMapGeometry. Use the reference's 0.45 interpolation reach with inverse squared distance, taking a coincident sample directly and preserving the existing zone inputs and z color scale. Test mirror positions, scalp bounds, and plotted contour values. Prettier, Ruff check, Ruff format check, and git diff --check passed. Angular and Playwright execution are reserved for the test machines.
309 lines
14 KiB
TypeScript
309 lines
14 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-figure="sex-donut"] .pielayer')).toBeVisible();
|
|
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.getByText('No hay registros para los filtros aplicados.')).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 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',
|
|
'Subir archivos',
|
|
'Bundles',
|
|
'Estudios EEG',
|
|
]);
|
|
await expect(page.locator('app-eeg-preview')).toHaveCount(0);
|
|
await expect(page.getByText('Archivos de entrenamiento', { exact: true })).toHaveCount(0);
|
|
const uploads = page.getByRole('region', { name: 'Subir archivos' });
|
|
await expect(uploads.getByLabel('Conjunto')).toBeVisible();
|
|
await expect(uploads.getByRole('button', { name: 'Archivos', exact: true })).toBeVisible();
|
|
await expect(uploads.getByRole('button', { name: 'Subir archivos' })).toBeDisabled();
|
|
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();
|
|
|
|
const monitor = page.locator('app-governance-models app-run-monitor');
|
|
await page.getByRole('button', { name: 'Analizar EEG' }).click();
|
|
await expect(page.getByRole('heading', { name: 'Análisis de EEG' })).toBeVisible();
|
|
await expect(monitor.getByRole('status')).toHaveText('SUCCESS', { timeout: 10 * 60_000 });
|
|
await page.getByRole('button', { name: 'Calcular riesgos' }).click();
|
|
await expect(page.getByRole('heading', { name: 'Cálculo de riesgos' })).toBeVisible();
|
|
await expect(monitor.getByRole('status')).toHaveText('SUCCESS', { timeout: 10 * 60_000 });
|
|
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 },
|
|
);
|
|
|
|
await page
|
|
.locator('app-governance-models')
|
|
.getByRole('button', {
|
|
name: 'Evaluar un solo estudio',
|
|
})
|
|
.click();
|
|
const preview = page.locator('app-eeg-preview');
|
|
await expect(preview.getByRole('heading', { name: 'Vista previa' })).toBeVisible();
|
|
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();
|
|
await bundles.getByRole('button', { name: 'Exportar bundle' }).click();
|
|
await expect(bundles.getByRole('alert')).toContainText('nothing to export');
|
|
expect(problems.filter((p) => !p.includes('409'))).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.endsWith('/models/cacu/all/inputs') && !p.startsWith('console: Failed to load'),
|
|
),
|
|
).toEqual([]);
|
|
});
|