import { test, expect } from '@playwright/test'; test.describe('MikroTik Backups', () => { test('can access backups page', async ({ page }) => { await page.goto('/backups'); await expect(page).toHaveURL(/\/backups/); await expect(page.locator('body')).toBeVisible(); }); test('can view list of backups', async ({ page }) => { await page.goto('/backups'); // Look for backup entries const backupEntry = page.locator( '[data-backup], tr, [role="listitem"]' ).first(); if (await backupEntry.isVisible({ timeout: 2000 }).catch(() => false)) { await expect(backupEntry).toBeVisible(); } }); test('can filter backups by device', async ({ page }) => { await page.goto('/backups'); // Look for device filter const deviceFilter = page.locator( 'select[name*="device"], button:has-text("Filter"), input[type="search"]' ).first(); if (await deviceFilter.isVisible()) { await deviceFilter.click(); await page.waitForTimeout(500); } }); test('can filter backups by date range', async ({ page }) => { await page.goto('/backups'); // Look for date range filter const dateFilter = page.locator( 'input[type="date"], button:has-text("Date Range")' ).first(); if (await dateFilter.isVisible()) { await expect(dateFilter).toBeVisible(); } }); test('can download a backup file', async ({ page }) => { await page.goto('/backups'); // Look for download button const downloadButton = page.locator( 'button:has-text("Download"), a[download], a:has-text("Download")' ).first(); if (await downloadButton.isVisible()) { await expect(downloadButton).toBeVisible(); } }); test('can view backup details', async ({ page }) => { await page.goto('/backups'); // Find first backup const firstBackup = page.locator( 'a[href*="/backups/"], tr, [data-backup]' ).first(); if (await firstBackup.isVisible()) { await firstBackup.click(); await page.waitForTimeout(500); } }); test('can trigger manual backup', async ({ page }) => { await page.goto('/backups'); // Look for backup now button const backupButton = page.locator( 'button:has-text("Backup Now"), button:has-text("Create Backup"), button:has-text("New Backup")' ).first(); if (await backupButton.isVisible()) { await backupButton.click(); await page.waitForTimeout(500); } }); test('can configure automatic backups', async ({ page }) => { await page.goto('/backups/settings'); await expect(page).toHaveURL(/\/backups\/settings/); await expect(page.locator('body')).toBeVisible(); }); test('can view backup schedule', async ({ page }) => { await page.goto('/backups/settings'); // Look for schedule settings const scheduleSection = page.locator( ':has-text("Schedule"), :has-text("Frequency"), select[name*="schedule"]' ).first(); if (await scheduleSection.isVisible({ timeout: 2000 }).catch(() => false)) { await expect(scheduleSection).toBeVisible(); } }); });