From 6a6691bdd5d9dcc82066f9ed8d6f79ee07e7a7c3 Mon Sep 17 00:00:00 2001 From: alberto Date: Tue, 1 Dec 2026 14:05:40 -0600 Subject: [PATCH] F1e: page case for the complete child; Gobernanza case without the removed sections --- e2e/pages.spec.ts | 141 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 137 insertions(+), 4 deletions(-) diff --git a/e2e/pages.spec.ts b/e2e/pages.spec.ts index e44a3bf..056ac45 100644 --- a/e2e/pages.spec.ts +++ b/e2e/pages.spec.ts @@ -81,7 +81,7 @@ test('tea indicators: every tab loads, and the follow-up list exports to Excel', ]); 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 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'); @@ -94,6 +94,135 @@ test('tea indicators: every tab loads, and the follow-up list exports to Excel', 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 childRow = (table: string) => + page + .locator(table) + .getByRole('row') + .filter({ + has: page.getByRole('cell', { name: recordNumber, exact: true }), + }); + + await page.goto('/indicadores/tea'); + const summary = page.locator('app-tab-indicadores'); + 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()).toBeVisible(); + } + 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()).toBeVisible(); + } + await expect(history.getByText('Sin datos para el periodo.')).toHaveCount(0); + + await tab('Seguimiento'); + 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 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, { exact: true })).toBeVisible(); + const gantt = section('Línea del tiempo'); + await expect(gantt.locator('app-plot .barlayer .point').first()).toBeVisible(); + 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(), + ).toBeVisible(); + await expect( + alterations.locator('h3:text-is("Mapa de la cabeza") + app-plot .contourlayer path').first(), + ).toBeVisible(); + 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(), + ).toBeVisible(); + await expect( + section('Razones de momios por par').locator('app-plot .point').first(), + ).toBeVisible(); + await expect( + section('Probabilidad frente a la referencia').locator('tbody tr').first(), + ).toBeVisible(); + await expect(section('Probabilidad según z').locator('app-plot .point').first()).toBeVisible(); + await expect(section('Limitaciones').locator('p').first()).toHaveText(/cohorte/); + + await page.goto('/gobernanza/tea'); + await expect(page.getByRole('region', { name: 'Ejecución' }).getByRole('status')).toHaveText( + '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 models.getByRole('button', { name: 'Evaluar un solo estudio' }).click(); + const preview = page.locator('app-eeg-preview'); + await expect(preview.getByLabel('EDF')).toBeVisible(); + await expect(preview.getByLabel('ADOS-2 (PDF)')).toBeVisible(); + 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'); @@ -239,9 +368,13 @@ test('tea gobernanza: every section in sync mode, and the preview saved as PDF', 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([]); + 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 }) => {