feat: improve case brief classification flow

This commit is contained in:
2026-08-14 16:18:13 +02:00
parent a51b508118
commit 46bb2ba5ec
4 changed files with 63 additions and 23 deletions
+13 -4
View File
@@ -27,6 +27,9 @@ async function waitForSave(page: Page, action: () => Promise<void>) {
test('move, folder expansion, hand pan, desktop wheel zoom, mobile pinch, and reload persistence', async ({ page }) => {
await page.goto('/?level=e2e-level&edit=1')
await expect(page.getByRole('heading', { name: 'Browser Safety Test' })).toBeVisible()
await expect(page.locator('.brief-panel')).toBeVisible()
await expect(page.getByRole('button', { name: 'Case brief', exact: true })).toContainText('2')
await page.getByRole('button', { name: 'BEGIN INVESTIGATION', exact: true }).click()
const folder = page.locator('[data-temporal-id="widget:11111111-1111-4111-8111-111111111111"]')
const file = page.locator('[data-temporal-id="file:contains:11111111-1111-4111-8111-111111111111:22222222-2222-4222-8222-222222222222"]')
@@ -102,22 +105,28 @@ test('move, folder expansion, hand pan, desktop wheel zoom, mobile pinch, and re
await boardViewport.dispatchEvent('pointerup', { pointerId: 42, pointerType: 'touch', isPrimary: false, button: 0, clientX: touchOrigin.x + 150, clientY: touchOrigin.y })
await boardViewport.dispatchEvent('pointerup', { pointerId: 41, pointerType: 'touch', isPrimary: true, button: 0, clientX: touchOrigin.x, clientY: touchOrigin.y })
await page.getByRole('button', { name: 'BRIEF', exact: true }).click()
await page.getByRole('button', { name: 'Case brief', exact: true }).click()
await expect(page.locator('.brief-panel')).toContainText('Ada Lovelace')
const personConcept = page.locator('.brief-concepts section').filter({ hasText: 'Ada Lovelace' })
await personConcept.getByRole('button', { name: 'PERSON', exact: true }).click()
await waitForSave(page, () => personConcept.getByRole('button', { name: 'PERSON', exact: true }).click())
await expect(page.locator('.brief-panel')).toBeVisible()
await expect(page.locator('.evidence-card.party.arriving')).toContainText('Ada Lovelace')
await personConcept.getByRole('button', { name: 'EDIT DOSSIER', exact: true }).click()
await expect(page.getByText('Edit person dossier')).toBeVisible()
await page.getByLabel('Party aliases').fill('A. A. L.')
await page.locator('.party-editor .folder-members input[type="checkbox"]').first().check()
await waitForSave(page, () => page.getByRole('button', { name: 'SAVE DOSSIER', exact: true }).click())
await expect(page.locator('.evidence-card.party')).toContainText('Ada Lovelace')
await page.getByRole('button', { name: 'BRIEF', exact: true }).click()
const organizationConcept = page.locator('.brief-concepts section').filter({ hasText: 'Difference Engine Bureau' })
await organizationConcept.getByRole('button', { name: 'ORGANIZATION', exact: true }).click()
await waitForSave(page, () => organizationConcept.getByRole('button', { name: 'ORGANIZATION', exact: true }).click())
await expect(page.locator('.brief-panel')).toBeVisible()
await organizationConcept.getByRole('button', { name: 'EDIT DOSSIER', exact: true }).click()
await page.getByLabel('Organization type').selectOption('public_body')
await waitForSave(page, () => page.getByRole('button', { name: 'SAVE DOSSIER', exact: true }).click())
await page.getByRole('button', { name: 'RETURN TO BOARD', exact: true }).click()
await page.reload()
await expect(page.locator('.brief-panel')).toBeHidden()
await expect(page.locator('.evidence-card.party')).toHaveCount(2)
await expect(page.locator('.evidence-card.party')).toContainText(['Ada Lovelace', 'Difference Engine Bureau'])
+6 -2
View File
@@ -7,9 +7,12 @@ async function waitForSave(page: Page, action: () => Promise<void>) {
}
async function classify(page: Page, name: string, kind: 'PERSON' | 'ORGANIZATION', summary: string) {
await page.getByRole('button', { name: 'BRIEF', exact: true }).click()
if (!await page.locator('.brief-panel').isVisible()) await page.getByRole('button', { name: 'Case brief', exact: true }).click()
const concept = page.locator('.brief-concepts section').filter({ hasText: name })
await concept.getByRole('button', { name: kind, exact: true }).click()
await waitForSave(page, () => concept.getByRole('button', { name: kind, exact: true }).click())
await expect(page.locator('.brief-panel')).toBeVisible()
await expect(concept).toHaveClass(/\bjust-resolved\b/)
await concept.getByRole('button', { name: 'EDIT DOSSIER', exact: true }).click()
await page.getByLabel('Party summary').fill(summary)
await waitForSave(page, () => page.getByRole('button', { name: 'SAVE DOSSIER', exact: true }).click())
}
@@ -52,6 +55,7 @@ test('a cloned Glass Harbor level can be solved without modifying its template',
await classify(page, 'Calder Optical Works', 'ORGANIZATION', 'Supplier that released sealed crate CO-771 to the approved carrier.')
await classify(page, 'Harbor & Fell Logistics', 'ORGANIZATION', 'Approved carrier whose vehicle delivered the crate to the wrong address.')
await classify(page, 'Voss Antiquities Ltd', 'ORGANIZATION', 'Mara Vosss company, based at Warehouse 3 and named as auction consignor.')
await page.getByRole('button', { name: 'RETURN TO BOARD', exact: true }).click()
await createEvent(page, 'CO-771 left Calder for North Quay', 'Calder released the sealed lens to Elias Vale in H&F 14 with no alternate delivery authority.', '1987-10-16T16:40', ['Carrier Dispatch Manifest'])
await createEvent(page, 'CO-771 was diverted to Warehouse 3', 'Mara Voss sponsored access; H&F 14 entered loaded and left empty. The next-day memorandum was retrospective.', '1987-10-17T22:08', ['Old Glass Harbor Gate Ledger', 'Warehouse 3 Security Photograph', 'Delivery Redirection Memorandum'])