test(transcription): harden annotation-delete specs and e2e (#722)
Some checks failed
CI / Unit & Component Tests (pull_request) Failing after 2m42s
CI / OCR Service Tests (pull_request) Successful in 23s
CI / Backend Unit Tests (pull_request) Successful in 3m43s
CI / fail2ban Regex (pull_request) Successful in 48s
CI / Semgrep Security Scan (pull_request) Successful in 23s
CI / Compose Bucket Idempotency (pull_request) Successful in 1m6s
Some checks failed
CI / Unit & Component Tests (pull_request) Failing after 2m42s
CI / OCR Service Tests (pull_request) Successful in 23s
CI / Backend Unit Tests (pull_request) Successful in 3m43s
CI / fail2ban Regex (pull_request) Successful in 48s
CI / Semgrep Security Scan (pull_request) Successful in 23s
CI / Compose Bucket Idempotency (pull_request) Successful in 1m6s
- Fix a stale test title that still claimed a delete button is visible. - Strengthen the two "never renders a delete button" contract tests (AnnotationShape + AnnotationLayer specs) to assert the annotation element has zero descendant <button> elements, not just the absence of the removed testid (a near-tautology now that the testid is gone). - Harden the e2e delete test: guard countBefore > 0 so a missing seed fails clearly instead of asserting toHaveCount(-1), and capture the deleted annotation's testid to assert that specific element is gone (identity check) alongside the count drop. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -110,6 +110,10 @@ describe('AnnotationLayer', () => {
|
||||
});
|
||||
|
||||
await expect.element(page.getByTestId('annotation-ann-1')).toBeInTheDocument();
|
||||
// Positive control: the previously-removed testid must stay absent.
|
||||
await expect.element(page.getByTestId('annotation-delete-ann-1')).not.toBeInTheDocument();
|
||||
// Real invariant: the annotation must contain no clickable delete control at all.
|
||||
const annotationEl = page.getByTestId('annotation-ann-1').element() as HTMLElement;
|
||||
expect(annotationEl.querySelectorAll('button').length).toBe(0);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -240,7 +240,7 @@ describe('AnnotationLayer', () => {
|
||||
expect(document.querySelector('[data-testid="annotation-ann-1"]')).not.toBeNull();
|
||||
});
|
||||
|
||||
it('renders without throwing when canDraw is true (delete button visible)', async () => {
|
||||
it('renders without throwing when canDraw is true (no delete button)', async () => {
|
||||
expect(() =>
|
||||
render(AnnotationLayer, {
|
||||
annotations: [annotation],
|
||||
|
||||
@@ -50,7 +50,11 @@ describe('AnnotationShape', () => {
|
||||
});
|
||||
|
||||
await expect.element(page.getByTestId('annotation-ann-1')).toBeInTheDocument();
|
||||
// Positive control: the previously-removed testid must stay absent.
|
||||
await expect.element(page.getByTestId('annotation-delete-ann-1')).not.toBeInTheDocument();
|
||||
// Real invariant: the annotation must contain no clickable delete control at all.
|
||||
const annotationEl = page.getByTestId('annotation-ann-1').element() as HTMLElement;
|
||||
expect(annotationEl.querySelectorAll('button').length).toBe(0);
|
||||
});
|
||||
|
||||
it('calls onDeleteRequest when Delete key is pressed on the annotation', async () => {
|
||||
|
||||
Reference in New Issue
Block a user