F1e: complete-child case finds the child by search and reads hidden marks as attached

This commit is contained in:
2026-12-01 15:28:54 -06:00
parent a4bf48b60d
commit 08c447006c
+19 -12
View File
@@ -96,7 +96,7 @@ test('tea indicators: every tab loads, and the follow-up list exports to Excel',
test('tea complete child: every screen has data', async ({ page }) => {
const problems = watch(page);
const recordNumber = 'N-0011';
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();
@@ -104,12 +104,17 @@ test('tea complete child: every screen has data', async ({ page }) => {
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, exact: true }),
has: page.getByRole('cell', { name: recordNumber }),
});
await page.goto('/indicadores/tea');
@@ -136,6 +141,7 @@ test('tea complete child: every screen has data', async ({ page }) => {
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));
@@ -144,6 +150,7 @@ test('tea complete child: every screen has data', async ({ page }) => {
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');
@@ -157,9 +164,9 @@ test('tea complete child: every screen has data', async ({ page }) => {
await tab('Seguimiento');
await followUp.getByRole('link').click();
await expect(page.getByText(recordNumber, { exact: true })).toBeVisible();
await expect(page.getByText(recordNumber)).toBeVisible();
const gantt = section('Línea del tiempo');
await expect(gantt.locator('app-plot .barlayer .point').first()).toBeVisible();
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()) {
@@ -172,10 +179,10 @@ test('tea complete child: every screen has data', async ({ page }) => {
const alterations = section('Alteraciones');
await expect(
alterations.locator('h3:text-is("Norma por edad · p5–p95") + app-plot .point').first(),
).toBeVisible();
).toBeAttached();
await expect(
alterations.locator('h3:text-is("Mapa de la cabeza") + app-plot .contourlayer path').first(),
).toBeVisible();
).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();
@@ -183,18 +190,18 @@ test('tea complete child: every screen has data', async ({ page }) => {
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();
).toBeAttached();
await expect(
section('Razones de momios por par').locator('app-plot .point').first(),
).toBeVisible();
).toBeAttached();
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('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')).toHaveText(
await expect(page.getByRole('region', { name: 'Ejecución' }).getByRole('status')).toContainText(
'Disponible',
);
const models = page.getByRole('region', { name: 'Modelos' });
@@ -220,8 +227,8 @@ test('tea complete child: every screen has data', async ({ page }) => {
).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('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([]);