Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion frontend/src/pages/Reports.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,24 @@ export default function Reports() {
</motion.div>
))}

{filteredReports.length === 0 && (
{filteredReports.length === 0 && reports.length === 0 && (
<div className="col-span-2 py-40 border-4 border-dashed border-rag-blue/10 text-center flex flex-col items-center gap-8 bg-charcoal/30">
<ReportIcon icon={Archive02Icon} size={120} className="text-rag-blue/15" aria-hidden="true" />
<div className="space-y-3 max-w-md">
<p className="text-xl font-black text-silver-bright uppercase tracking-[0.3em] italic">No Briefings Yet</p>
<p className="text-xs font-mono text-silver/30 uppercase tracking-widest leading-relaxed">
Run a scan from the Toolkit to generate your first report. Completed scans appear here automatically.
</p>
</div>
<Link
to={routes.toolkit}
className="bg-rag-blue border-4 border-black px-8 py-4 text-[10px] font-black uppercase tracking-[0.3em] text-black shadow-[6px_6px_0px_0px_rgba(0,0,0,1)] hover:shadow-none hover:translate-x-1 hover:translate-y-1 transition-all"
>
Launch_First_Scan
</Link>
</div>
)}
{filteredReports.length === 0 && reports.length > 0 && (
<div className="col-span-2 py-40 border-4 border-dashed border-black/5 text-center flex flex-col items-center gap-8 bg-charcoal/30">
<ReportIcon icon={Archive02Icon} size={120} className="text-silver/5" aria-hidden="true" />
<div className="space-y-2">
Expand Down
83 changes: 83 additions & 0 deletions frontend/testing/unit/pages/Reports.onboarding.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
import { render, screen } from '@testing-library/react'
import userEvent from '@testing-library/user-event'
import { MemoryRouter } from 'react-router-dom'
import Reports from '../../../src/pages/Reports'
import { getReports, getDashboardSummary } from '../../../src/api'

vi.mock('../../../src/api', () => ({
getReports: vi.fn(),
getDashboardSummary: vi.fn(),
API_BASE: 'http://127.0.0.1:8000',
}))

const readyReport = {
id: 'report-1',
task_id: 'task-abc-123',
name: 'Security Scan — example.com',
type: 'technical',
generated_at: '2026-05-14T10:00:00Z',
status: 'ready',
findings: 7,
assets: 3,
pages: 12,
}

const emptySummary = {
total_findings: 0,
total_assets: 0,
critical_findings: 0,
high_findings: 0,
total_attack_surface: 0,
}

function renderReports() {
return render(
<MemoryRouter>
<Reports />
</MemoryRouter>,
)
}

beforeEach(() => {
vi.mocked(getDashboardSummary).mockResolvedValue(emptySummary)
})

describe('Reports — onboarding empty state', () => {
it('shows the onboarding message when there are zero reports', async () => {
vi.mocked(getReports).mockResolvedValue({ reports: [] })
renderReports()

expect(await screen.findByText(/No Briefings Yet/i)).toBeInTheDocument()
expect(screen.getByText(/Run a scan from the Toolkit/i)).toBeInTheDocument()
})

it('shows a call-to-action link pointing to the toolkit route', async () => {
vi.mocked(getReports).mockResolvedValue({ reports: [] })
renderReports()

const cta = await screen.findByRole('link', { name: /launch_first_scan/i })
expect(cta).toHaveAttribute('href', '/toolkit')
})

it('does not show the onboarding message when reports exist but filters hide them all', async () => {
const user = userEvent.setup()
vi.mocked(getReports).mockResolvedValue({ reports: [readyReport] })
renderReports()

await screen.findByText(/Security Scan — example.com/i)
await user.click(screen.getByRole('button', { name: /executive briefings/i }))

expect(screen.queryByText(/No Briefings Yet/i)).not.toBeInTheDocument()
expect(await screen.findByText(/Archive Isolated/i)).toBeInTheDocument()
})

it('does not show the onboarding empty state once reports are loaded', async () => {
vi.mocked(getReports).mockResolvedValue({ reports: [readyReport] })
renderReports()

await screen.findByText(/Security Scan — example.com/i)

expect(screen.queryByText(/No Briefings Yet/i)).not.toBeInTheDocument()
expect(screen.queryByRole('link', { name: /launch_first_scan/i })).not.toBeInTheDocument()
})
})
5 changes: 3 additions & 2 deletions frontend/testing/unit/pages/Reports.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,10 @@
vi.mocked(getDashboardSummary).mockResolvedValue(emptySummary)
})

it('shows Archive Isolated when there are no reports at all', async () => {
it('shows onboarding empty state when there are no reports at all', async () => {
renderReports()
expect(await screen.findByText(/Archive Isolated/i)).toBeInTheDocument()
expect(await screen.findByText(/No Briefings Yet/i)).toBeInTheDocument()
expect(screen.getByRole('link', { name: /launch_first_scan/i })).toBeInTheDocument()
})

it('shows Archive Isolated when filter returns no matching reports', async () => {
Expand All @@ -129,14 +130,14 @@

it('shows PDF, HTML and CSV buttons for a ready report', async () => {
renderReports()
expect(await screen.findByRole('button', { name: /^pdf$/i })).toBeInTheDocument()

Check failure on line 133 in frontend/testing/unit/pages/Reports.test.tsx

View workflow job for this annotation

GitHub Actions / frontend-checks (22)

testing/unit/pages/Reports.test.tsx > Reports — export buttons on a ready report > shows PDF, HTML and CSV buttons for a ready report

TestingLibraryElementError: Found multiple elements with the role "button" and name `/^pdf$/i` Here are the matching elements: Ignored nodes: comments, script, style <button class="bg-rag-green border-4 border-black px-3 py-2 text-[9px] font-black uppercase tracking-widest text-black shadow-[4px_4px_0px_0px_rgba(0,0,0,1)] hover:shadow-none hover:translate-x-1 hover:translate-y-1 transition-all" title="Download PDF Report" > PDF </button> Ignored nodes: comments, script, style <button class="border-4 border-black px-3 py-2 text-[9px] font-black uppercase tracking-widest transition-all disabled:opacity-30 disabled:cursor-not-allowed disabled:group-hover:text-silver/20 disabled:group-hover:bg-charcoal-dark bg-charcoal-dark text-silver/20 group-hover:text-silver-bright group-hover:bg-black" title="Download PDF" > pdf </button> (If this is intentional, then use the `*AllBy*` variant of the query (like `queryAllByText`, `getAllByText`, or `findAllByText`)). Ignored nodes: comments, script, style <body> <div> <div class="min-h-screen bg-charcoal-dark text-silver p-6 md:p-12 space-y-12" > <header class="relative flex flex-col md:flex-row justify-between items-start md:items-end gap-8 pb-12 border-b-4 border-silver-bright/10 font-black" > <div class="space-y-4" > <div class="bg-rag-amber text-black px-4 py-1 text-xs uppercase tracking-widest inline-block shadow-[4px_4px_0px_0px_rgba(0,0,0,1)] font-black" > Archive_Matrix v8.2 </div> <h1 class="text-6xl md:text-8xl text-silver-bright uppercase tracking-tighter leading-none italic font-black" > Analytics <span class="text-transparent stroke-white" style="-webkit-text-stroke: 2px var(--accent-silver-bright);" > Archive </span> </h1> <p class="text-sm font-mono text-silver/40 uppercase tracking-widest italic leading-relaxed" > HISTORICAL_BRIEFINGS // ENCRYPTED_DOSSIERS // AUDIT_FEED </p> </div> <div class="flex items-center gap-6" > <a class="bg-rag-blue border-4 border-black px-6 py-4 text-[9px] font-black uppercase tracking-widest text-black shadow-[6px_6px_0px_0px_rgba(0,0,0,1)] hover:shadow-none hover:translate-x-1 hover:translate-y-1 transition-all" href="/reports/compare" > Compare Reports </a> <button aria-label="Download latest ready report PDF" class="bg-charcoal border-4 border-black p-4 text-silver-bright shadow-[6px_6px_0px_0px_rgba(0,0,0,1)] hover:shadow-none hover:translate-x-1 hover:translate-y-1 transition-all disabled:opacity-30 disabled:cursor-not-allowed" title="Download latest ready report PDF" > <svg class="block" color="currentColor" fill="none" height="20" stroke="currentColor" stroke-width="1.9" viewBox="0 0 24 24" width="20" xmlns="http://www.w3.org/2000/svg" > <path d="M2.99969 17.0002C2.99969 17.9302 2.99969 18.3952 3.10192 18.7767C3.37932 19.8119 4.18796 20.6206 5.22324 20.898C5.60474 21.0002 6.06972 21.0002 6.99969 21.0002L16.9997 21.0002C17.9297 21.0002 18.3947 21.0002 18.7762 20.898C19.8114 20.6206 20.6201 19.8119 20.8975 18.7767C20.9997 18.3952 20.9997 17.9302 20.9997 17.0002" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.9" /> <path d="M16.4998 11.5002C16.4998 11.5002 13.1856 16.0002 11.9997 16.0002C10.8139 16.0002 7.49976 11.5002 7.49976 11.5002M11.9997 15.0002V3.00016" stroke="currentColor" stroke-linecap="round" s
expect(screen.getByRole('button', { name: /^html$/i })).toBeInTheDocument()
expect(screen.getByRole('button', { name: /^csv$/i })).toBeInTheDocument()
})

it('export buttons are enabled for a ready report', async () => {
renderReports()
await screen.findByRole('button', { name: /^pdf$/i })

Check failure on line 140 in frontend/testing/unit/pages/Reports.test.tsx

View workflow job for this annotation

GitHub Actions / frontend-checks (22)

testing/unit/pages/Reports.test.tsx > Reports — export buttons on a ready report > export buttons are enabled for a ready report

TestingLibraryElementError: Found multiple elements with the role "button" and name `/^pdf$/i` Here are the matching elements: Ignored nodes: comments, script, style <button class="bg-rag-green border-4 border-black px-3 py-2 text-[9px] font-black uppercase tracking-widest text-black shadow-[4px_4px_0px_0px_rgba(0,0,0,1)] hover:shadow-none hover:translate-x-1 hover:translate-y-1 transition-all" title="Download PDF Report" > PDF </button> Ignored nodes: comments, script, style <button class="border-4 border-black px-3 py-2 text-[9px] font-black uppercase tracking-widest transition-all disabled:opacity-30 disabled:cursor-not-allowed disabled:group-hover:text-silver/20 disabled:group-hover:bg-charcoal-dark bg-charcoal-dark text-silver/20 group-hover:text-silver-bright group-hover:bg-black" title="Download PDF" > pdf </button> (If this is intentional, then use the `*AllBy*` variant of the query (like `queryAllByText`, `getAllByText`, or `findAllByText`)). Ignored nodes: comments, script, style <body> <div> <div class="min-h-screen bg-charcoal-dark text-silver p-6 md:p-12 space-y-12" > <header class="relative flex flex-col md:flex-row justify-between items-start md:items-end gap-8 pb-12 border-b-4 border-silver-bright/10 font-black" > <div class="space-y-4" > <div class="bg-rag-amber text-black px-4 py-1 text-xs uppercase tracking-widest inline-block shadow-[4px_4px_0px_0px_rgba(0,0,0,1)] font-black" > Archive_Matrix v8.2 </div> <h1 class="text-6xl md:text-8xl text-silver-bright uppercase tracking-tighter leading-none italic font-black" > Analytics <span class="text-transparent stroke-white" style="-webkit-text-stroke: 2px var(--accent-silver-bright);" > Archive </span> </h1> <p class="text-sm font-mono text-silver/40 uppercase tracking-widest italic leading-relaxed" > HISTORICAL_BRIEFINGS // ENCRYPTED_DOSSIERS // AUDIT_FEED </p> </div> <div class="flex items-center gap-6" > <a class="bg-rag-blue border-4 border-black px-6 py-4 text-[9px] font-black uppercase tracking-widest text-black shadow-[6px_6px_0px_0px_rgba(0,0,0,1)] hover:shadow-none hover:translate-x-1 hover:translate-y-1 transition-all" href="/reports/compare" > Compare Reports </a> <button aria-label="Download latest ready report PDF" class="bg-charcoal border-4 border-black p-4 text-silver-bright shadow-[6px_6px_0px_0px_rgba(0,0,0,1)] hover:shadow-none hover:translate-x-1 hover:translate-y-1 transition-all disabled:opacity-30 disabled:cursor-not-allowed" title="Download latest ready report PDF" > <svg class="block" color="currentColor" fill="none" height="20" stroke="currentColor" stroke-width="1.9" viewBox="0 0 24 24" width="20" xmlns="http://www.w3.org/2000/svg" > <path d="M2.99969 17.0002C2.99969 17.9302 2.99969 18.3952 3.10192 18.7767C3.37932 19.8119 4.18796 20.6206 5.22324 20.898C5.60474 21.0002 6.06972 21.0002 6.99969 21.0002L16.9997 21.0002C17.9297 21.0002 18.3947 21.0002 18.7762 20.898C19.8114 20.6206 20.6201 19.8119 20.8975 18.7767C20.9997 18.3952 20.9997 17.9302 20.9997 17.0002" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.9" /> <path d="M16.4998 11.5002C16.4998 11.5002 13.1856 16.0002 11.9997 16.0002C10.8139 16.0002 7.49976 11.5002 7.49976 11.5002M11.9997 15.0002V3.00016" stroke="currentColor" stroke-linecap="round" s
expect(screen.getByRole('button', { name: /^pdf$/i })).not.toBeDisabled()
expect(screen.getByRole('button', { name: /^html$/i })).not.toBeDisabled()
expect(screen.getByRole('button', { name: /^csv$/i })).not.toBeDisabled()
Expand All @@ -145,7 +146,7 @@
it('clicking PDF opens the correct backend URL', async () => {
const user = userEvent.setup()
renderReports()
await user.click(await screen.findByRole('button', { name: /^pdf$/i }))

Check failure on line 149 in frontend/testing/unit/pages/Reports.test.tsx

View workflow job for this annotation

GitHub Actions / frontend-checks (22)

testing/unit/pages/Reports.test.tsx > Reports — export buttons on a ready report > clicking PDF opens the correct backend URL

TestingLibraryElementError: Found multiple elements with the role "button" and name `/^pdf$/i` Here are the matching elements: Ignored nodes: comments, script, style <button class="bg-rag-green border-4 border-black px-3 py-2 text-[9px] font-black uppercase tracking-widest text-black shadow-[4px_4px_0px_0px_rgba(0,0,0,1)] hover:shadow-none hover:translate-x-1 hover:translate-y-1 transition-all" title="Download PDF Report" > PDF </button> Ignored nodes: comments, script, style <button class="border-4 border-black px-3 py-2 text-[9px] font-black uppercase tracking-widest transition-all disabled:opacity-30 disabled:cursor-not-allowed disabled:group-hover:text-silver/20 disabled:group-hover:bg-charcoal-dark bg-charcoal-dark text-silver/20 group-hover:text-silver-bright group-hover:bg-black" title="Download PDF" > pdf </button> (If this is intentional, then use the `*AllBy*` variant of the query (like `queryAllByText`, `getAllByText`, or `findAllByText`)). Ignored nodes: comments, script, style <body> <div> <div class="min-h-screen bg-charcoal-dark text-silver p-6 md:p-12 space-y-12" > <header class="relative flex flex-col md:flex-row justify-between items-start md:items-end gap-8 pb-12 border-b-4 border-silver-bright/10 font-black" > <div class="space-y-4" > <div class="bg-rag-amber text-black px-4 py-1 text-xs uppercase tracking-widest inline-block shadow-[4px_4px_0px_0px_rgba(0,0,0,1)] font-black" > Archive_Matrix v8.2 </div> <h1 class="text-6xl md:text-8xl text-silver-bright uppercase tracking-tighter leading-none italic font-black" > Analytics <span class="text-transparent stroke-white" style="-webkit-text-stroke: 2px var(--accent-silver-bright);" > Archive </span> </h1> <p class="text-sm font-mono text-silver/40 uppercase tracking-widest italic leading-relaxed" > HISTORICAL_BRIEFINGS // ENCRYPTED_DOSSIERS // AUDIT_FEED </p> </div> <div class="flex items-center gap-6" > <a class="bg-rag-blue border-4 border-black px-6 py-4 text-[9px] font-black uppercase tracking-widest text-black shadow-[6px_6px_0px_0px_rgba(0,0,0,1)] hover:shadow-none hover:translate-x-1 hover:translate-y-1 transition-all" href="/reports/compare" > Compare Reports </a> <button aria-label="Download latest ready report PDF" class="bg-charcoal border-4 border-black p-4 text-silver-bright shadow-[6px_6px_0px_0px_rgba(0,0,0,1)] hover:shadow-none hover:translate-x-1 hover:translate-y-1 transition-all disabled:opacity-30 disabled:cursor-not-allowed" title="Download latest ready report PDF" > <svg class="block" color="currentColor" fill="none" height="20" stroke="currentColor" stroke-width="1.9" viewBox="0 0 24 24" width="20" xmlns="http://www.w3.org/2000/svg" > <path d="M2.99969 17.0002C2.99969 17.9302 2.99969 18.3952 3.10192 18.7767C3.37932 19.8119 4.18796 20.6206 5.22324 20.898C5.60474 21.0002 6.06972 21.0002 6.99969 21.0002L16.9997 21.0002C17.9297 21.0002 18.3947 21.0002 18.7762 20.898C19.8114 20.6206 20.6201 19.8119 20.8975 18.7767C20.9997 18.3952 20.9997 17.9302 20.9997 17.0002" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.9" /> <path d="M16.4998 11.5002C16.4998 11.5002 13.1856 16.0002 11.9997 16.0002C10.8139 16.0002 7.49976 11.5002 7.49976 11.5002M11.9997 15.0002V3.00016" stroke="currentColor" stroke-linecap="round" s
expect(openSpy).toHaveBeenCalledWith(
expect.stringContaining('/task/' + readyReport.task_id + '/report/pdf'), '_blank')
})
Expand All @@ -169,7 +170,7 @@
it('does not use the old placeholder latest-report route', async () => {
const user = userEvent.setup()
renderReports()
await user.click(await screen.findByRole('button', { name: /^pdf$/i }))

Check failure on line 173 in frontend/testing/unit/pages/Reports.test.tsx

View workflow job for this annotation

GitHub Actions / frontend-checks (22)

testing/unit/pages/Reports.test.tsx > Reports — export buttons on a ready report > does not use the old placeholder latest-report route

TestingLibraryElementError: Found multiple elements with the role "button" and name `/^pdf$/i` Here are the matching elements: Ignored nodes: comments, script, style <button class="bg-rag-green border-4 border-black px-3 py-2 text-[9px] font-black uppercase tracking-widest text-black shadow-[4px_4px_0px_0px_rgba(0,0,0,1)] hover:shadow-none hover:translate-x-1 hover:translate-y-1 transition-all" title="Download PDF Report" > PDF </button> Ignored nodes: comments, script, style <button class="border-4 border-black px-3 py-2 text-[9px] font-black uppercase tracking-widest transition-all disabled:opacity-30 disabled:cursor-not-allowed disabled:group-hover:text-silver/20 disabled:group-hover:bg-charcoal-dark bg-charcoal-dark text-silver/20 group-hover:text-silver-bright group-hover:bg-black" title="Download PDF" > pdf </button> (If this is intentional, then use the `*AllBy*` variant of the query (like `queryAllByText`, `getAllByText`, or `findAllByText`)). Ignored nodes: comments, script, style <body> <div> <div class="min-h-screen bg-charcoal-dark text-silver p-6 md:p-12 space-y-12" > <header class="relative flex flex-col md:flex-row justify-between items-start md:items-end gap-8 pb-12 border-b-4 border-silver-bright/10 font-black" > <div class="space-y-4" > <div class="bg-rag-amber text-black px-4 py-1 text-xs uppercase tracking-widest inline-block shadow-[4px_4px_0px_0px_rgba(0,0,0,1)] font-black" > Archive_Matrix v8.2 </div> <h1 class="text-6xl md:text-8xl text-silver-bright uppercase tracking-tighter leading-none italic font-black" > Analytics <span class="text-transparent stroke-white" style="-webkit-text-stroke: 2px var(--accent-silver-bright);" > Archive </span> </h1> <p class="text-sm font-mono text-silver/40 uppercase tracking-widest italic leading-relaxed" > HISTORICAL_BRIEFINGS // ENCRYPTED_DOSSIERS // AUDIT_FEED </p> </div> <div class="flex items-center gap-6" > <a class="bg-rag-blue border-4 border-black px-6 py-4 text-[9px] font-black uppercase tracking-widest text-black shadow-[6px_6px_0px_0px_rgba(0,0,0,1)] hover:shadow-none hover:translate-x-1 hover:translate-y-1 transition-all" href="/reports/compare" > Compare Reports </a> <button aria-label="Download latest ready report CSV" class="bg-charcoal border-4 border-black p-4 text-silver-bright shadow-[6px_6px_0px_0px_rgba(0,0,0,1)] hover:shadow-none hover:translate-x-1 hover:translate-y-1 transition-all disabled:opacity-30 disabled:cursor-not-allowed" title="Download latest ready report CSV" > <svg class="block" color="currentColor" fill="none" height="20" stroke="currentColor" stroke-width="1.9" viewBox="0 0 24 24" width="20" xmlns="http://www.w3.org/2000/svg" > <path d="M2.99969 17.0002C2.99969 17.9302 2.99969 18.3952 3.10192 18.7767C3.37932 19.8119 4.18796 20.6206 5.22324 20.898C5.60474 21.0002 6.06972 21.0002 6.99969 21.0002L16.9997 21.0002C17.9297 21.0002 18.3947 21.0002 18.7762 20.898C19.8114 20.6206 20.6201 19.8119 20.8975 18.7767C20.9997 18.3952 20.9997 17.9302 20.9997 17.0002" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.9" /> <path d="M16.4998 11.5002C16.4998 11.5002 13.1856 16.0002 11.9997 16.0002C10.8139 16.0002 7.49976 11.5002 7.49976 11.5002M11.9997 15.0002V3.00016" stroke="currentColor" stroke-linecap="round" s
expect(openSpy).not.toHaveBeenCalledWith(expect.stringContaining('latest'), expect.anything())
})
})
Expand All @@ -186,7 +187,7 @@

renderReports()

await user.click(await screen.findByRole('button', { name: /download latest ready report pdf/i }))

Check failure on line 190 in frontend/testing/unit/pages/Reports.test.tsx

View workflow job for this annotation

GitHub Actions / frontend-checks (22)

testing/unit/pages/Reports.test.tsx > Reports — header export button > opens the newest ready report PDF from the header button

TestingLibraryElementError: Unable to find role="button" and name `/download latest ready report pdf/i` Ignored nodes: comments, script, style <body> <div> <div class="min-h-screen bg-charcoal-dark text-silver p-6 md:p-12 space-y-12" > <header class="relative flex flex-col md:flex-row justify-between items-start md:items-end gap-8 pb-12 border-b-4 border-silver-bright/10 font-black" > <div class="space-y-4" > <div class="bg-rag-amber text-black px-4 py-1 text-xs uppercase tracking-widest inline-block shadow-[4px_4px_0px_0px_rgba(0,0,0,1)] font-black" > Archive_Matrix v8.2 </div> <h1 class="text-6xl md:text-8xl text-silver-bright uppercase tracking-tighter leading-none italic font-black" > Analytics <span class="text-transparent stroke-white" style="-webkit-text-stroke: 2px var(--accent-silver-bright);" > Archive </span> </h1> <p class="text-sm font-mono text-silver/40 uppercase tracking-widest italic leading-relaxed" > HISTORICAL_BRIEFINGS // ENCRYPTED_DOSSIERS // AUDIT_FEED </p> </div> <div class="flex items-center gap-6" > <a class="bg-rag-blue border-4 border-black px-6 py-4 text-[9px] font-black uppercase tracking-widest text-black shadow-[6px_6px_0px_0px_rgba(0,0,0,1)] hover:shadow-none hover:translate-x-1 hover:translate-y-1 transition-all" href="/reports/compare" > Compare Reports </a> <button aria-label="Download latest ready report CSV" class="bg-charcoal border-4 border-black p-4 text-silver-bright shadow-[6px_6px_0px_0px_rgba(0,0,0,1)] hover:shadow-none hover:translate-x-1 hover:translate-y-1 transition-all disabled:opacity-30 disabled:cursor-not-allowed" title="Download latest ready report CSV" > <svg class="block" color="currentColor" fill="none" height="20" stroke="currentColor" stroke-width="1.9" viewBox="0 0 24 24" width="20" xmlns="http://www.w3.org/2000/svg" > <path d="M2.99969 17.0002C2.99969 17.9302 2.99969 18.3952 3.10192 18.7767C3.37932 19.8119 4.18796 20.6206 5.22324 20.898C5.60474 21.0002 6.06972 21.0002 6.99969 21.0002L16.9997 21.0002C17.9297 21.0002 18.3947 21.0002 18.7762 20.898C19.8114 20.6206 20.6201 19.8119 20.8975 18.7767C20.9997 18.3952 20.9997 17.9302 20.9997 17.0002" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.9" /> <path d="M16.4998 11.5002C16.4998 11.5002 13.1856 16.0002 11.9997 16.0002C10.8139 16.0002 7.49976 11.5002 7.49976 11.5002M11.9997 15.0002V3.00016" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.9" /> </svg> </button> <button class="bg-charcoal border-4 border-black p-4 text-silver-bright shadow-[6px_6px_0px_0px_rgba(0,0,0,1)] hover:shadow-none hover:translate-x-1 hover:translate-y-1 transition-all" title="Refresh Archive" > <svg class="block" color="currentColor" fill="none" height="20" stroke="currentColor" stroke-width="1.9" viewBox="0 0 24 24" width="20" xmlns="http://www.w3.org/2000/svg" > <path d="M20.4879 15C19.2524 18.4956 15.9187 21 12 21C7.02943 21 3 16.9706 3 12C3 7.02943 7.02943 3 12 3C15.7292 3 18.9286 5.26806 20.2941 8.5"

expect(openSpy).toHaveBeenCalledWith(
expect.stringContaining('/task/' + newerReadyReport.task_id + '/report/pdf'), '_blank')
Expand All @@ -199,7 +200,7 @@

renderReports()

const button = await screen.findByRole('button', { name: /download latest ready report pdf/i })

Check failure on line 203 in frontend/testing/unit/pages/Reports.test.tsx

View workflow job for this annotation

GitHub Actions / frontend-checks (22)

testing/unit/pages/Reports.test.tsx > Reports — header export button > disables the header export button when there is no ready report

TestingLibraryElementError: Unable to find role="button" and name `/download latest ready report pdf/i` Ignored nodes: comments, script, style <body> <div> <div class="min-h-screen bg-charcoal-dark text-silver p-6 md:p-12 space-y-12" > <header class="relative flex flex-col md:flex-row justify-between items-start md:items-end gap-8 pb-12 border-b-4 border-silver-bright/10 font-black" > <div class="space-y-4" > <div class="bg-rag-amber text-black px-4 py-1 text-xs uppercase tracking-widest inline-block shadow-[4px_4px_0px_0px_rgba(0,0,0,1)] font-black" > Archive_Matrix v8.2 </div> <h1 class="text-6xl md:text-8xl text-silver-bright uppercase tracking-tighter leading-none italic font-black" > Analytics <span class="text-transparent stroke-white" style="-webkit-text-stroke: 2px var(--accent-silver-bright);" > Archive </span> </h1> <p class="text-sm font-mono text-silver/40 uppercase tracking-widest italic leading-relaxed" > HISTORICAL_BRIEFINGS // ENCRYPTED_DOSSIERS // AUDIT_FEED </p> </div> <div class="flex items-center gap-6" > <a class="bg-rag-blue border-4 border-black px-6 py-4 text-[9px] font-black uppercase tracking-widest text-black shadow-[6px_6px_0px_0px_rgba(0,0,0,1)] hover:shadow-none hover:translate-x-1 hover:translate-y-1 transition-all" href="/reports/compare" > Compare Reports </a> <button aria-label="Download latest ready report CSV" class="bg-charcoal border-4 border-black p-4 text-silver-bright shadow-[6px_6px_0px_0px_rgba(0,0,0,1)] hover:shadow-none hover:translate-x-1 hover:translate-y-1 transition-all disabled:opacity-30 disabled:cursor-not-allowed" disabled="" title="No ready report available" > <svg class="block" color="currentColor" fill="none" height="20" stroke="currentColor" stroke-width="1.9" viewBox="0 0 24 24" width="20" xmlns="http://www.w3.org/2000/svg" > <path d="M2.99969 17.0002C2.99969 17.9302 2.99969 18.3952 3.10192 18.7767C3.37932 19.8119 4.18796 20.6206 5.22324 20.898C5.60474 21.0002 6.06972 21.0002 6.99969 21.0002L16.9997 21.0002C17.9297 21.0002 18.3947 21.0002 18.7762 20.898C19.8114 20.6206 20.6201 19.8119 20.8975 18.7767C20.9997 18.3952 20.9997 17.9302 20.9997 17.0002" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.9" /> <path d="M16.4998 11.5002C16.4998 11.5002 13.1856 16.0002 11.9997 16.0002C10.8139 16.0002 7.49976 11.5002 7.49976 11.5002M11.9997 15.0002V3.00016" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.9" /> </svg> </button> <button class="bg-charcoal border-4 border-black p-4 text-silver-bright shadow-[6px_6px_0px_0px_rgba(0,0,0,1)] hover:shadow-none hover:translate-x-1 hover:translate-y-1 transition-all" title="Refresh Archive" > <svg class="block" color="currentColor" fill="none" height="20" stroke="currentColor" stroke-width="1.9" viewBox="0 0 24 24" width="20" xmlns="http://www.w3.org/2000/svg" > <path d="M20.4879 15C19.2524 18.4956 15.9187 21 12 21C7.02943 21 3 16.9706 3 12C3 7.02943 7.02943 3 12 3C15.7292 3 18.9286 5.26806 20.2941
expect(button).toBeDisabled()

await user.click(button)
Expand All @@ -218,7 +219,7 @@

it('export buttons are disabled when report is generating', async () => {
renderReports()
await screen.findByRole('button', { name: /^pdf$/i })

Check failure on line 222 in frontend/testing/unit/pages/Reports.test.tsx

View workflow job for this annotation

GitHub Actions / frontend-checks (22)

testing/unit/pages/Reports.test.tsx > Reports — export buttons on a generating report > export buttons are disabled when report is generating

TestingLibraryElementError: Found multiple elements with the role "button" and name `/^pdf$/i` Here are the matching elements: Ignored nodes: comments, script, style <button class="bg-rag-green border-4 border-black px-3 py-2 text-[9px] font-black uppercase tracking-widest text-black shadow-[4px_4px_0px_0px_rgba(0,0,0,1)] hover:shadow-none hover:translate-x-1 hover:translate-y-1 transition-all" title="Download PDF Report" > PDF </button> Ignored nodes: comments, script, style <button class="border-4 border-black px-3 py-2 text-[9px] font-black uppercase tracking-widest transition-all disabled:opacity-30 disabled:cursor-not-allowed disabled:group-hover:text-silver/20 disabled:group-hover:bg-charcoal-dark bg-charcoal-dark text-silver/20 group-hover:text-silver-bright group-hover:bg-black" disabled="" title="Export unavailable while report is generating" > pdf </button> (If this is intentional, then use the `*AllBy*` variant of the query (like `queryAllByText`, `getAllByText`, or `findAllByText`)). Ignored nodes: comments, script, style <body> <div> <div class="min-h-screen bg-charcoal-dark text-silver p-6 md:p-12 space-y-12" > <header class="relative flex flex-col md:flex-row justify-between items-start md:items-end gap-8 pb-12 border-b-4 border-silver-bright/10 font-black" > <div class="space-y-4" > <div class="bg-rag-amber text-black px-4 py-1 text-xs uppercase tracking-widest inline-block shadow-[4px_4px_0px_0px_rgba(0,0,0,1)] font-black" > Archive_Matrix v8.2 </div> <h1 class="text-6xl md:text-8xl text-silver-bright uppercase tracking-tighter leading-none italic font-black" > Analytics <span class="text-transparent stroke-white" style="-webkit-text-stroke: 2px var(--accent-silver-bright);" > Archive </span> </h1> <p class="text-sm font-mono text-silver/40 uppercase tracking-widest italic leading-relaxed" > HISTORICAL_BRIEFINGS // ENCRYPTED_DOSSIERS // AUDIT_FEED </p> </div> <div class="flex items-center gap-6" > <a class="bg-rag-blue border-4 border-black px-6 py-4 text-[9px] font-black uppercase tracking-widest text-black shadow-[6px_6px_0px_0px_rgba(0,0,0,1)] hover:shadow-none hover:translate-x-1 hover:translate-y-1 transition-all" href="/reports/compare" > Compare Reports </a> <button aria-label="Download latest ready report CSV" class="bg-charcoal border-4 border-black p-4 text-silver-bright shadow-[6px_6px_0px_0px_rgba(0,0,0,1)] hover:shadow-none hover:translate-x-1 hover:translate-y-1 transition-all disabled:opacity-30 disabled:cursor-not-allowed" disabled="" title="No ready report available" > <svg class="block" color="currentColor" fill="none" height="20" stroke="currentColor" stroke-width="1.9" viewBox="0 0 24 24" width="20" xmlns="http://www.w3.org/2000/svg" > <path d="M2.99969 17.0002C2.99969 17.9302 2.99969 18.3952 3.10192 18.7767C3.37932 19.8119 4.18796 20.6206 5.22324 20.898C5.60474 21.0002 6.06972 21.0002 6.99969 21.0002L16.9997 21.0002C17.9297 21.0002 18.3947 21.0002 18.7762 20.898C19.8114 20.6206 20.6201 19.8119 20.8975 18.7767C20.9997 18.3952 20.9997 17.9302 20.9997 17.0002" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.9" /> <path d="M16.4998 11.5002C16.4998 11.5002 13.1856 16.0002 11.9997 16.0002C10.8139 16.0002 7.49976 11.5002 7.49976 11.5002M11.9997 15.0002V3.00016" stroke="curren
expect(screen.getByRole('button', { name: /^pdf$/i })).toBeDisabled()
expect(screen.getByRole('button', { name: /^html$/i })).toBeDisabled()
expect(screen.getByRole('button', { name: /^csv$/i })).toBeDisabled()
Expand Down
Loading