Phase 5.4-5.11: Playwright E2E test infrastructure with 7 spec files

- playwright.config.ts: chromium project, webServer, baseURL, trace/screenshot/video
- e2e/helpers.ts: API mock setup, login/logout helpers, mock data for all entities
- 7 E2E spec files (1164 lines total):
  - auth.spec.ts: login/logout workflow
  - contact-crud.spec.ts: create/edit/delete contacts, add persons
  - search.spec.ts: global search, filter, results
  - plugin-toggle.spec.ts: enable/disable plugins, UI changes
  - mail.spec.ts: mail account setup, folders, mail viewing
  - dms.spec.ts: folder creation, file upload, preview, share
  - calendar.spec.ts: appointment creation, calendar switch, kanban view
- @playwright/test added as devDependency
- e2e scripts added to package.json
- TSC: 0 new errors (only pre-existing Dms.tsx)
This commit is contained in:
Agent Zero
2026-07-23 22:35:03 +02:00
parent 7a034b3124
commit 42b19040ce
11 changed files with 1256 additions and 2 deletions
+94
View File
@@ -0,0 +1,94 @@
import { test, expect } from '@playwright/test';
import { setupApiMocks, login, navigateTo } from './helpers';
test.describe('DMS E2E', () => {
test.beforeEach(async ({ page }) => {
await setupApiMocks(page);
await login(page);
});
test('dms page renders with source tree and explorer', async ({ page }) => {
await navigateTo(page, '/dms');
await expect(page.locator('[data-testid="dms-page"]')).toBeVisible({ timeout: 10_000 });
// Source tree and explorer should be visible on desktop
await expect(page.locator('[data-testid="dms-source-pane"], [data-testid="source-tree"], [data-testid="source-tree-loading"]')).toBeVisible({ timeout: 10_000 });
await expect(page.locator('[data-testid="dms-explorer-pane"], [data-testid="file-explorer-list"], [data-testid="file-explorer-table"], [data-testid="file-explorer-empty"], [data-testid="file-explorer-loading"]')).toBeVisible({ timeout: 10_000 });
});
test('create a new folder', async ({ page }) => {
await navigateTo(page, '/dms');
await expect(page.locator('[data-testid="dms-page"]')).toBeVisible({ timeout: 10_000 });
// Click new folder button in toolbar
const newFolderBtn = page.locator('[data-testid="plugin-toolbar"] button').filter({ hasText: /new.*folder|neuer.*ordner|ordner.*erstellen/i }).first();
await newFolderBtn.click();
// New folder form should appear
await expect(page.locator('[data-testid="new-folder-form"]')).toBeVisible({ timeout: 10_000 });
// Fill in folder name
await page.locator('[data-testid="new-folder-form"] input').first().fill('Test Folder');
// Click create button
const createBtn = page.locator('[data-testid="new-folder-form"] button').filter({ hasText: /create|erstellen|speichern|save/i }).first();
await createBtn.click();
// Form should close after creation
await expect(page.locator('[data-testid="new-folder-form"]')).not.toBeVisible({ timeout: 10_000 });
});
test('upload section appears when upload button clicked', async ({ page }) => {
await navigateTo(page, '/dms');
await expect(page.locator('[data-testid="dms-page"]')).toBeVisible({ timeout: 10_000 });
// Click upload button in toolbar
const uploadBtn = page.locator('[data-testid="plugin-toolbar"] button').filter({ hasText: /upload|hochladen/i }).first();
await uploadBtn.click();
// Upload section should appear
await expect(page.locator('[data-testid="upload-section"]')).toBeVisible({ timeout: 10_000 });
await expect(page.locator('[data-testid="upload-dropzone"]')).toBeVisible();
});
test('file preview modal opens on double-click', async ({ page }) => {
await navigateTo(page, '/dms');
await expect(page.locator('[data-testid="dms-page"]')).toBeVisible({ timeout: 10_000 });
// Wait for file explorer to load
await expect(page.locator('[data-testid="dms-explorer-pane"], [data-testid="file-explorer-list"], [data-testid="file-explorer-table"], [data-testid="file-explorer-empty"], [data-testid="file-explorer-loading"]')).toBeVisible({ timeout: 10_000 });
// Double-click first file if available
const fileRow = page.locator('[data-testid^="file-row-"], [data-testid^="file-card-"]').first();
if (await fileRow.isVisible({ timeout: 5_000 })) {
await fileRow.dblclick();
// Preview modal should appear
await expect(page.locator('[data-testid="file-preview-modal"]')).toBeVisible({ timeout: 10_000 });
}
});
test('share dialog opens for a file', async ({ page }) => {
await navigateTo(page, '/dms');
await expect(page.locator('[data-testid="dms-page"]')).toBeVisible({ timeout: 10_000 });
// Wait for files to load
await expect(page.locator('[data-testid="dms-explorer-pane"], [data-testid="file-explorer-list"], [data-testid="file-explorer-table"], [data-testid="file-explorer-empty"], [data-testid="file-explorer-loading"]')).toBeVisible({ timeout: 10_000 });
// Find share button on first file (if file actions are available)
const fileRow = page.locator('[data-testid^="file-row-"], [data-testid^="file-card-"]').first();
if (await fileRow.isVisible({ timeout: 5_000 })) {
// Look for share button within the file row
const shareBtn = fileRow.locator('button').filter({ hasText: /share|teilen/i }).first();
if (await shareBtn.isVisible({ timeout: 3_000 })) {
await shareBtn.click();
await expect(page.locator('[data-testid="share-dialog"]')).toBeVisible({ timeout: 10_000 });
}
}
});
});