70 lines
3.2 KiB
TypeScript
70 lines
3.2 KiB
TypeScript
import { expect, test } from '@playwright/test';
|
|
|
|
test.beforeEach(async ({ page }) => {
|
|
const form = { username: 'admin@isssteleon.mx', password: 'solo-para-pruebas' };
|
|
expect((await page.request.post('/api/auth/login', { form })).status()).toBe(204);
|
|
});
|
|
|
|
test('indicadores cacu: its sections in order, each card read one mode at a time', async ({
|
|
page,
|
|
}) => {
|
|
await page.goto('/indicadores/cacu');
|
|
const tab = page.locator('app-tab-indicadores');
|
|
await expect(tab.getByRole('heading', { name: 'Indicadores clínicos' })).toBeVisible();
|
|
await expect(tab.locator('app-loading')).toHaveCount(0, { timeout: 5 * 60_000 });
|
|
const headings = await tab
|
|
.locator('h2, app-readings h3')
|
|
.evaluateAll((els) => els.map((e) => (e as HTMLElement).innerText.trim()));
|
|
expect(headings.slice(headings.indexOf('Indicadores de oportunidad'))).toEqual([
|
|
'Indicadores de oportunidad',
|
|
'Tiempos de la ruta del tamizaje',
|
|
'Indicadores clínicos',
|
|
'Resultados de citología, VPH y biopsia',
|
|
'Distribución de resultados citológicos',
|
|
'Resultados de VPH por genotipo',
|
|
'Resultados de biopsia cervical',
|
|
'Pacientes evaluadas por resultado de VPH',
|
|
'Tasa de confirmación histopatológica',
|
|
'Valor predictivo positivo de la colposcopía',
|
|
]);
|
|
const route = tab.locator('app-readings').first();
|
|
for (const mode of ['Por pasos', 'Por CIE-10', 'Acumulado desde la toma']) {
|
|
await route.getByRole('radio', { name: mode }).click();
|
|
await expect(
|
|
route.getByRole('table', { name: mode }).or(route.getByText('Sin datos en el periodo.')),
|
|
).toBeVisible();
|
|
}
|
|
await tab.getByRole('radio', { name: 'Biopsia', exact: true }).click();
|
|
await expect(
|
|
tab.getByRole('heading', { name: 'Valor predictivo positivo de la biopsia' }),
|
|
).toBeVisible();
|
|
await tab.getByRole('radio', { name: 'Solicitudes' }).click();
|
|
});
|
|
|
|
test('riesgos cacu: ages filter the whole list and a row opens its stages', async ({ page }) => {
|
|
await page.goto('/indicadores/cacu');
|
|
await page.getByRole('tab', { name: 'Análisis de riesgos' }).click();
|
|
const list = page.locator('table.worklist tbody tr');
|
|
await expect(list.first().locator('app-stages li')).toHaveCount(5);
|
|
await list.first().getByRole('button', { name: 'Detalle' }).click();
|
|
await expect(page.locator('tr.stage-detail')).toContainText('Toma de muestra');
|
|
const answer = page.waitForResponse((r) => r.url().includes('birthdate=le'));
|
|
await page.getByLabel('Edad mínima').fill('45');
|
|
expect((await answer).ok()).toBe(true);
|
|
for (const age of await list.locator('td:nth-child(2)').allInnerTexts())
|
|
expect(parseInt(age)).toBeGreaterThanOrEqual(45);
|
|
for (const [button, file] of [
|
|
['Exportar Excel', 'seguimiento-cacu.xlsx'],
|
|
['Exportar PDF', 'seguimiento-cacu.pdf'],
|
|
]) {
|
|
const saved = page.waitForEvent('download');
|
|
await page.getByRole('button', { name: button }).click();
|
|
expect((await saved).suggestedFilename()).toBe(file);
|
|
}
|
|
await list.first().locator('a').first().click();
|
|
await expect(page.locator('[data-section=etapas]')).toContainText('Reporte de biopsia');
|
|
const record = page.waitForEvent('download');
|
|
await page.getByRole('button', { name: 'Exportar PDF' }).click();
|
|
expect((await record).suggestedFilename()).toBe('expediente-cacu.pdf');
|
|
});
|