diff --git a/e2e/pages.spec.ts b/e2e/pages.spec.ts index da62503..5fa2182 100644 --- a/e2e/pages.spec.ts +++ b/e2e/pages.spec.ts @@ -90,6 +90,19 @@ test("indicators: the KPIs are the API's MeasureReports, every tab and the patie await page.getByRole('option', { name: '12 meses' }).click(); const camaRows = page.locator('table.worklist tbody tr'); await expect(camaRows.first()).toContainText('BI-RADS'); + // the whole list and a record, each as its file + for (const [button, file] of [ + ['Exportar Excel', 'seguimiento-cama.xlsx'], + ['Exportar PDF', 'seguimiento-cama.pdf'], + ]) { + const saved = page.waitForEvent('download'); + await page.getByRole('button', { name: button }).click(); + expect((await saved).suggestedFilename()).toBe(file); + } + await camaRows.first().locator('a').first().click(); + const record = page.waitForEvent('download'); + await page.getByRole('button', { name: 'Exportar PDF' }).click(); + expect((await record).suggestedFilename()).toBe('expediente-cama.pdf'); await page.goto('/indicadores/tea'); await expect(page.getByRole('tab', { name: 'Indicadores' })).toBeVisible(); expect(problems).toEqual([]);