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