Schedules were entered and displayed as six field cron expressions. A picker now offers a frequency, a weekday or day of the month and a time, and turns that into the expression the backend stores; tables and the dashboard show wording like "Every day at 03:00". An expression the picker cannot express stays editable as cron. This also fixes a broken preset: the backend's cron dialect counts Sunday as 1 and rejects 0, so the "every Sunday" choice in the application backup form produced an invalid expression. The picker emits weekday names, and a test pins the dialect down. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
41 lines
2.3 KiB
TypeScript
41 lines
2.3 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('At', { exact: true }).fill('02:00')
|
|
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')
|
|
await expect(row).toContainText('Every day at 02:00')
|
|
})
|