openreader/tests/delete.spec.ts
Richard Roberson 21870ed576 fix(api): stabilize DOCX to PDF conversion and cleanup
- Isolate concurrent LibreOffice runs with per-job profile directories
  (soffice -env:UserInstallation) and per-job temp folders
- Poll for generated PDF and verify stable file size before reading
- Consolidate temp artifacts under docstore/tmp and clean up via rm -r
- Add headless/nologo flags and improve error handling

ui(accessibility):
- ConfirmDialog exposes proper dialog roles
- DocumentFolder toggle adds type, aria-expanded, aria-controls, and title;
  associate content panel with an id
- HTMLViewer wraps content in .html-container for HTML/TXT views

test: add comprehensive Playwright specs and helpers
- Accessibility, API health, deletion flows, folders, navigation, playback,
  and upload scenarios
- Add sample.md and unsupported.xyz; update sample.pdf; extend helpers

ci: run Playwright workflow on version1.0.0 branch
2025-11-12 16:21:11 -07:00

48 lines
No EOL
1.7 KiB
TypeScript

import { test, expect } from '@playwright/test';
import { setupTest, uploadFile, expectDocumentListed, expectNoDocumentLink, deleteDocumentByName, deleteAllLocalDocuments, ensureDocumentsListed } from './helpers';
test.describe('Document deletion flow', () => {
test.beforeEach(async ({ page }) => {
await setupTest(page);
});
test('deletes a document and updates list', async ({ page }) => {
// Upload two documents
await uploadFile(page, 'sample.pdf');
await uploadFile(page, 'sample.txt');
// Verify both appear
await expectDocumentListed(page, 'sample.pdf');
await expectDocumentListed(page, 'sample.txt');
// Delete the TXT document via row action
await deleteDocumentByName(page, 'sample.txt');
// Assert the TXT document is removed, PDF remains
await expectNoDocumentLink(page, 'sample.txt');
await expectDocumentListed(page, 'sample.pdf');
// Optional: summary exists (best-effort)
const summary = page.locator('[data-doc-summary]');
await expect(summary).toBeVisible();
});
test('deletes all local documents from Settings modal', async ({ page }) => {
// Upload multiple docs (PDF + EPUB)
await uploadFile(page, 'sample.pdf');
await uploadFile(page, 'sample.epub');
// Verify both appear
await ensureDocumentsListed(page, ['sample.pdf', 'sample.epub']);
// Delete all local documents via Settings
await deleteAllLocalDocuments(page);
// Assert both documents are removed
await expectNoDocumentLink(page, 'sample.pdf');
await expectNoDocumentLink(page, 'sample.epub');
// Uploader should be visible when no docs remain
await expect(page.locator('input[type=file]')).toBeVisible({ timeout: 10000 });
});
});