towerops/e2e/tests/mikrotik-backups.spec.ts
Graham McIntire 0832abf33a
feat: comprehensive e2e test coverage for all user-facing features
- Added e2e tests for agents, insights, maintenance windows, maps, help pages
- Added e2e tests for organization settings, config timeline, MikroTik backups
- Added comprehensive search functionality tests
- Added dashboard and sites navigation tests
- Updated existing tests to handle sudo verification redirects
- Fixed navigation tests to be more defensive about missing data
- All 301 tests passing across chromium, firefox, and webkit
2026-03-06 16:58:06 -06:00

111 lines
3.1 KiB
TypeScript

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();
}
});
});