consolidate playwright tests
Continuous Integration / backend-tests (push) Successful in 25s
Continuous Integration / frontend-check (push) Successful in 15s
Continuous Integration / e2e-tests (push) Successful in 13m15s

This commit is contained in:
2026-05-04 18:42:01 -04:00
parent b92d0e7e63
commit adb036a2f4
6 changed files with 214 additions and 273 deletions
-48
View File
@@ -12,54 +12,6 @@ test.describe('Backup & Restore', () => {
fs.writeFileSync(path.join(SOURCE_ROOT, 'subdir', 'nested.txt'), 'nested content');
});
test('auto-backup to registered media completes', async ({}) => {
const requestContext = await setupRequestContext();
await configureBackend(requestContext);
const registerResp = await requestContext.post(`${API_URL}/inventory/media`, {
data: {
identifier: 'BACKUP_TAPE_001',
media_type: 'mock_lto',
generation_tier: 'LTO-8',
capacity: 12000,
location: 'Test Lab',
config: {}
}
});
expect(registerResp.ok()).toBe(true);
const media = await registerResp.json();
const initResp = await requestContext.post(`${API_URL}/inventory/media/${media.id}/initialize`);
expect(initResp.ok()).toBe(true);
const scanResp = await requestContext.post(`${API_URL}/system/scan`);
expect(scanResp.ok()).toBe(true);
await waitForScanComplete(requestContext);
const backupResp = await requestContext.post(`${API_URL}/backups/trigger/auto`);
expect(backupResp.ok()).toBe(true);
const backupResult = await backupResp.json();
expect(backupResult.job_id).toBeDefined();
await expect(async () => {
const jobsResp = await requestContext.get(`${API_URL}/system/jobs`);
const jobs = await jobsResp.json();
const backupJob = (jobs as Array<any>).find((j: any) => j.job_type === 'BACKUP');
expect(backupJob).toBeDefined();
expect(backupJob.status).toBe('COMPLETED');
}).toPass({ timeout: 30000 });
const metaResp = await requestContext.get(`${API_URL}/archive/metadata`, {
params: { path: path.join(SOURCE_ROOT, 'backup_test.txt') }
});
expect(metaResp.ok()).toBe(true);
const meta = await metaResp.json();
expect(meta.versions.length).toBeGreaterThan(0);
await requestContext.delete(`${API_URL}/inventory/media/${media.id}`);
await requestContext.dispose();
});
test('backup to specific media works', async ({}) => {
const requestContext = await setupRequestContext();
await configureBackend(requestContext);
-19
View File
@@ -79,25 +79,6 @@ test.describe('Discrepancies', () => {
// No automatic cleanup needed - tests use separate files
});
test('missing files are detected and can be confirmed', async ({}) => {
const requestContext = await request.newContext();
const fileId = fileIds['confirm_missing.txt'];
expect(fileId).toBeDefined();
console.log('Step 1: Confirm the file as deleted');
const confirmResp = await requestContext.post(`${API_URL}/system/discrepancies/${fileId}/confirm`);
expect(confirmResp.ok()).toBe(true);
console.log('Step 2: Verify item appears in discrepancies as deleted');
const discResp = await requestContext.get(`${API_URL}/system/discrepancies`);
const discrepancies = await discResp.json();
const found = (discrepancies as Array<any>).find((d: any) => d.path === path.join(SOURCE_ROOT, 'confirm_missing.txt'));
expect(found).toBeDefined();
expect(found.is_deleted).toBe(true);
await requestContext.dispose();
});
test('dismiss discrepancy', async ({}) => {
const requestContext = await request.newContext();
const fileId = fileIds['dismiss_test.txt'];
-79
View File
@@ -35,20 +35,6 @@ test.describe('Settings & System', () => {
await requestContext.dispose();
});
test('source roots setting configures browse endpoint', async ({ page }) => {
const requestContext = await setupRequestContext();
configureBackend(requestContext);
const browseResp = await requestContext.get(`${API_URL}/system/browse?path=ROOT`);
expect(browseResp.ok()).toBe(true);
const browseData = await browseResp.json();
const roots = (browseData as any).files;
const sourceRoot = (roots as Array<any>).find((r: any) => r.path === SOURCE_ROOT);
expect(sourceRoot).toBeDefined();
await requestContext.dispose();
});
test('dashboard stats reflect system state', async ({ page }) => {
const requestContext = await setupRequestContext();
configureBackend(requestContext);
@@ -81,71 +67,6 @@ test.describe('Settings & System', () => {
await requestContext.dispose();
});
test('hardware discovery returns empty when nothing configured', async ({ page }) => {
const requestContext = await setupRequestContext();
const discoverResp = await requestContext.get(`${API_URL}/system/hardware/discover`);
expect(discoverResp.ok()).toBe(true);
const devices = await discoverResp.json();
expect(Array.isArray(devices)).toBe(true);
await requestContext.dispose();
});
test('scan and indexing workflow', async ({ page }) => {
const requestContext = await setupRequestContext();
configureBackend(requestContext);
// Trigger scan
const scanResp = await requestContext.post(`${API_URL}/system/scan`);
expect(scanResp.ok()).toBe(true);
// Wait for scan to complete
await new Promise(r => setTimeout(r, 3000));
const statusResp = await requestContext.get(`${API_URL}/system/scan/status`);
const status = await statusResp.json();
expect(status.is_running).toBe(false);
// Trigger indexing
const indexResp = await requestContext.post(`${API_URL}/system/index/hash`);
expect(indexResp.ok()).toBe(true);
await new Promise(r => setTimeout(r, 2000));
const afterIndex = await requestContext.get(`${API_URL}/system/scan/status`);
const indexStatus = await afterIndex.json();
// Hashing runs in background, just verify it started without error
expect(indexStatus.is_throttled).toBeDefined();
await requestContext.dispose();
});
test('search returns results after scan and hash', async ({ page }) => {
const requestContext = await setupRequestContext();
configureBackend(requestContext);
// Create a searchable file
const fs = await import('fs');
const path = await import('path');
fs.writeFileSync(path.join(SOURCE_ROOT, 'searchable_file.txt'), 'searchable content here');
const scanResp = await requestContext.post(`${API_URL}/system/scan`);
expect(scanResp.ok()).toBe(true);
// Wait for scan and hashing
await new Promise(r => setTimeout(r, 5000));
// Search requires at least 3 chars and hashed files
const searchResp = await requestContext.get(`${API_URL}/system/search?q=searchable`);
expect(searchResp.ok()).toBe(true);
const results = await searchResp.json();
expect(Array.isArray(results)).toBe(true);
// Results may be empty if hashing hasn't completed; API is functional either way
await requestContext.dispose();
});
test('tree endpoint returns source roots', async ({ page }) => {
const requestContext = await setupRequestContext();
configureBackend(requestContext);
+8
View File
@@ -38,6 +38,14 @@ test.describe('Source Management', () => {
expect(status.is_running).toBe(false);
expect(status.total_files_found).toBeGreaterThan(0);
console.log('Step 4: Verify browse endpoint reflects source roots');
const browseResp = await requestContext.get(`${API_URL}/system/browse?path=ROOT`);
expect(browseResp.ok()).toBe(true);
const browseData = await browseResp.json();
const roots = (browseData as any).files;
const sourceRoot = (roots as Array<any>).find((r: any) => r.path === SOURCE_ROOT);
expect(sourceRoot).toBeDefined();
await requestContext.dispose();
});