This repository has been archived on 2026-02-15. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
breakpilot-pwa/admin-v2/e2e/specs/export.spec.ts
Benjamin Admin bfdaf63ba9 fix: Restore all files lost during destructive rebase
A previous `git pull --rebase origin main` dropped 177 local commits,
losing 3400+ files across admin-v2, backend, studio-v2, website,
klausur-service, and many other services. The partial restore attempt
(660295e2) only recovered some files.

This commit restores all missing files from pre-rebase ref 98933f5e
while preserving post-rebase additions (night-scheduler, night-mode UI,
NightModeWidget dashboard integration).

Restored features include:
- AI Module Sidebar (FAB), OCR Labeling, OCR Compare
- GPU Dashboard, RAG Pipeline, Magic Help
- Klausur-Korrektur (8 files), Abitur-Archiv (5+ files)
- Companion, Zeugnisse-Crawler, Screen Flow
- Full backend, studio-v2, website, klausur-service
- All compliance SDKs, agent-core, voice-service
- CI/CD configs, documentation, scripts

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 09:51:32 +01:00

154 lines
5.2 KiB
TypeScript

/**
* E2E Tests: Export Functionality
*
* Tests for PDF and ZIP export features.
*/
import { test, expect, selectors, navigateToStep } from '../fixtures/sdk-fixtures'
test.describe('Export Functionality', () => {
test('export button is visible', async ({ withDemoData }) => {
// Navigate to dashboard or any step
await navigateToStep(withDemoData, 'use-case-workshop')
// Look for export button in header or command bar
const exportButton = withDemoData.locator(selectors.exportButton)
if (await exportButton.isVisible()) {
await expect(exportButton).toBeVisible()
}
})
test('can trigger PDF export from command bar', async ({ withDemoData }) => {
// Open command bar
await withDemoData.keyboard.press('Meta+k')
// Type export command
await withDemoData.fill(selectors.commandInput, 'PDF Export')
// Wait for export suggestion
await withDemoData.waitForSelector(selectors.commandSuggestion(0), { timeout: 5000 })
// Set up download listener
const downloadPromise = withDemoData.waitForEvent('download', { timeout: 30000 })
// Click export suggestion
await withDemoData.click(selectors.commandSuggestion(0))
// Verify download started
try {
const download = await downloadPromise
expect(download.suggestedFilename()).toMatch(/\.pdf$/i)
} catch {
// If download doesn't happen, that's acceptable for this test
// (export might open in new tab or have different behavior)
}
})
test('can trigger ZIP export from command bar', async ({ withDemoData }) => {
await withDemoData.keyboard.press('Meta+k')
await withDemoData.fill(selectors.commandInput, 'ZIP Export')
await withDemoData.waitForSelector(selectors.commandSuggestion(0), { timeout: 5000 })
const downloadPromise = withDemoData.waitForEvent('download', { timeout: 30000 })
await withDemoData.click(selectors.commandSuggestion(0))
try {
const download = await downloadPromise
expect(download.suggestedFilename()).toMatch(/\.zip$/i)
} catch {
// Acceptable if download behavior differs
}
})
test('can export JSON data', async ({ withDemoData }) => {
await withDemoData.keyboard.press('Meta+k')
await withDemoData.fill(selectors.commandInput, 'JSON Export')
await withDemoData.waitForSelector(selectors.commandSuggestion(0), { timeout: 5000 })
const downloadPromise = withDemoData.waitForEvent('download', { timeout: 30000 })
await withDemoData.click(selectors.commandSuggestion(0))
try {
const download = await downloadPromise
expect(download.suggestedFilename()).toMatch(/\.json$/i)
} catch {
// Acceptable
}
})
})
test.describe('Export Content Verification', () => {
test('PDF export contains expected content', async ({ withDemoData }) => {
// This test verifies the export process completes without errors
// Actual PDF content verification would require additional tools
await withDemoData.keyboard.press('Meta+k')
await withDemoData.fill(selectors.commandInput, 'PDF')
await withDemoData.waitForSelector(selectors.commandSuggestion(0), { timeout: 5000 })
// Just verify the action is available
const suggestion = withDemoData.locator(selectors.commandSuggestion(0))
await expect(suggestion).toContainText(/PDF|Export/i)
})
test('export with no data shows appropriate message', async ({ sdkPage }) => {
// Without demo data, export might show warning or be disabled
await navigateToStep(sdkPage, 'use-case-workshop')
// Open command bar
await sdkPage.keyboard.press('Meta+k')
await sdkPage.fill(selectors.commandInput, 'Export')
// Export should still be available, but might show "no data" message
await sdkPage.waitForSelector(selectors.commandSuggestion(0), { timeout: 5000 })
})
})
test.describe('Export Button Direct Access', () => {
test('clicking export button opens export options', async ({ withDemoData }) => {
await navigateToStep(withDemoData, 'vvt')
const exportButton = withDemoData.locator(selectors.exportButton)
if (await exportButton.isVisible()) {
await exportButton.click()
// Should show export options dropdown or modal
const pdfOption = withDemoData.locator(selectors.exportPdfButton)
const zipOption = withDemoData.locator(selectors.exportZipButton)
const pdfVisible = await pdfOption.isVisible({ timeout: 2000 })
const zipVisible = await zipOption.isVisible({ timeout: 2000 })
expect(pdfVisible || zipVisible).toBe(true)
}
})
})
test.describe('Export API Integration', () => {
test('API export endpoint is accessible', async ({ withDemoData }) => {
// Test direct API call
const response = await withDemoData.evaluate(async () => {
try {
const res = await fetch('/api/sdk/v1/export?format=json', {
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
})
return { status: res.status, ok: res.ok }
} catch (error) {
return { status: 0, ok: false, error: String(error) }
}
})
// API should respond (status might vary based on implementation)
expect(response.status).toBeGreaterThanOrEqual(200)
})
})