Skip to content
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:

e2e:
name: Playwright e2e
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
Expand Down
50 changes: 50 additions & 0 deletions e2e/upload.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,54 @@ test.describe('upload flow detects and alerts', () => {
await page.getByRole('button', {name: /see your report/i}).click()
await expect(page.getByText('Your redaction report')).toBeVisible()
})

test('groups each page and shows every distinct finding in one preview', async ({
page,
}) => {
await page.goto('/')
await page
.locator('input[type=file]')
.setInputFiles(`${examplesDir}/12-page-findings.pdf`)
const first = page.getByRole('region', {
name: 'Problems on page 1',
exact: true,
})
const second = page.getByRole('region', {
name: 'Problems on page 2',
exact: true,
})
await expect(
page.getByRole('region', {name: /Problems on page/})
).toHaveCount(2)
await expect(first.getByText('4 findings', {exact: true})).toBeVisible()
await expect(second.getByText('1 finding', {exact: true})).toBeVisible()
await expect(
first.getByText('This redaction leaks its length')
).toBeVisible()
await expect(first.getByText('Northwind', {exact: true})).toHaveCount(0)
const reveal = first.getByRole('button', {
name: 'Reveal what was under the box',
})
await expect(reveal).toHaveCount(3)
// Revealing one passage must not reveal the other passages.
await reveal.first().click()
await expect(first.getByText('Northwind', {exact: true})).toHaveCount(1)
await reveal.first().click()
await reveal.first().click()
await expect(first.getByText('Northwind', {exact: true})).toHaveCount(2)
await expect(
first.getByText('Project Cardinal', {exact: true})
).toBeVisible()
await first
.getByRole('button', {name: 'Show all findings on this page'})
.click()
await expect(
first.getByRole('img', {name: 'Page 1', exact: true})
).toHaveCount(1)
await expect(first.locator('[aria-label^="Finding "]')).toHaveCount(4)
await expect(first.getByText(/Annotation marks are hidden/)).toBeVisible()
await expect(
second.getByRole('img', {name: 'Page 2', exact: true})
).toHaveCount(0)
})
})
Binary file added examples/12-page-findings.pdf
Binary file not shown.
38 changes: 38 additions & 0 deletions examples/generate.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,44 @@ const add = (file, title, bytes, expect) => {
)
}

// 12) Multiple findings per page, including a repeated drawing operation.
{
const secret = 'Northwind'
const w = tw(secret, SIZE)
const first = `${textAt(X, 700, secret)}0 0 0 rg\n${blackBox(X, 700, w)} f\n`
let c = first
c += `${blackBox(X, 700, w)} f\n` // duplicate cover, not another leak
c += textAt(320, 700, secret)
c += `${blackBox(320, 700, w)} f\n`
c += textAt(X, 600, 'Project Cardinal')
c += textAt(X, 500, 'The code is ')
const gapX = X + tw('The code is ', SIZE)
c += textAt(gapX + 50, 500, ' for this project.')
c += `${blackBox(gapX, 500, 50)} f\n`
const objs = [
'<< /Type /Catalog /Pages 2 0 R >>',
'<< /Type /Pages /Kids [3 0 R 7 0 R] /Count 2 >>',
page(' /Annots [6 0 R]'),
stream(c),
FONT,
`<< /Type /Annot /Subtype /Square /Rect [72 597 ${(X + tw('Project Cardinal', SIZE)).toFixed(1)} 612] /C [0 0 0] /IC [0 0 0] /CA 1 >>`,
page('', 8),
stream(first),
]
add(
'12-page-findings.pdf',
'Grouped pages with distinct and duplicate findings',
serialize(objs),
{
grade: 'F',
expectChecks: ['superficial-mark', 'removable-annotation', 'word-size'],
minLeaks: 4,
minWarnings: 1,
recoveredIncludes: ['Northwind', 'Project Cardinal'],
}
)
}

writeFileSync(join(OUT, 'manifest.json'), JSON.stringify(fixtures, null, 2))
console.log(`Wrote ${fixtures.length} example PDFs + manifest.json to ${OUT}`)
for (const f of fixtures) console.log(` ${f.file} — grade ${f.grade}`)
16 changes: 16 additions & 0 deletions examples/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,5 +93,21 @@
"recoveredIncludes": [
"2,750,000"
]
},
{
"file": "12-page-findings.pdf",
"title": "Grouped pages with distinct and duplicate findings",
"grade": "F",
"expectChecks": [
"superficial-mark",
"removable-annotation",
"word-size"
],
"minLeaks": 4,
"minWarnings": 1,
"recoveredIncludes": [
"Northwind",
"Project Cardinal"
]
}
]
Loading
Loading