Files
Infrastruktur-Monitoring-Sy…/frontend/e2e/backups.spec.ts
Dennis Nemec 9234e1ba47 WP-40/41/42: dashboard, security hardening, deployment and operations docs
Dashboard endpoint and page aggregating inventory, vulnerabilities, cluster
health, backups and recent jobs. Security headers (CSP, nosniff, DENY,
referrer policy), 1 MB body limit, configurable login rate limit, audit
steps in CI. Installer script, systemd unit, install/architecture docs.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-02 23:26:01 +02:00

40 lines
2.2 KiB
TypeScript

import { test, expect } from '@playwright/test'
test('admin creates a target and a strategy, runs it and sees the backup', async ({ page }) => {
await page.goto('/login')
await page.getByLabel('Email').fill('admin@example.com')
await page.getByLabel('Password').fill('admin-password-123')
await page.getByRole('button', { name: 'Sign in' }).click()
await page.getByRole('navigation').getByRole('link', { name: 'Backups' }).click()
await page.getByRole('button', { name: 'New target' }).click()
const name = `NAS ${Date.now()}`
await page.getByLabel('Name', { exact: true }).fill(name)
await page.getByLabel('Host', { exact: true }).fill('nas.local')
await page.getByLabel('Share').fill('backups')
await page.getByLabel('Directory').fill('softvisor')
await page.getByLabel('Username', { exact: true }).fill('backup')
await page.getByLabel('Password', { exact: true }).fill('smb-secret')
await page.getByRole('button', { name: 'Save target' }).click()
const targetRow = page.getByRole('row', { name: new RegExp(name) })
await expect(targetRow).toBeVisible()
await targetRow.getByRole('button', { name: 'Test' }).click()
await expect(page.getByText(/Connection ok/)).toBeVisible()
await page.getByRole('button', { name: 'New strategy' }).click()
await page.getByLabel('Strategy name', { exact: true }).fill('Gitea database')
await page.getByLabel('Source type', { exact: true }).selectOption('postgres_dump')
await page.getByLabel('Namespace', { exact: true }).fill('gitea')
await page.getByLabel('Pod', { exact: true }).fill('gitea-postgresql-0')
await page.getByLabel('Schedule', { exact: true }).fill('0 0 2 * * *')
await page.getByLabel('Target', { exact: true }).selectOption({ label: name })
await page.getByLabel('Keep last', { exact: true }).fill('3')
await page.getByRole('button', { name: 'Save strategy' }).click()
const row = page.getByRole('row', { name: /Gitea database/ })
await expect(row).toBeVisible()
await row.getByRole('button', { name: 'Run now' }).click()
await expect(row).toContainText(/gitea-database_.*\.sql\.gz/, { timeout: 20_000 })
await row.getByRole('button', { name: 'History' }).click()
await expect(page.getByTestId('backup-records')).toContainText('sql.gz')
})