Files
Dennis Nemec 6796634906 Pick and show schedules as plain time instead of cron
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>
2026-09-03 21:47:56 +02:00

42 lines
2.1 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { test, expect } from '@playwright/test'
test('an admin backs up Gitea data and database in one flow', 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 expect(page.getByRole('heading', { name: 'Dashboard' })).toBeVisible()
await page.goto('/backups')
// a target is needed first
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('Username', { exact: true }).fill('backup')
await page.getByLabel('Password', { exact: true }).fill('smb-secret')
await page.getByRole('button', { name: 'Save target' }).click()
await expect(page.getByRole('row', { name: new RegExp(name) })).toBeVisible()
// the discovered applications are shown with what they offer
const gitea = page.getByTestId('application-k8s:gitea/gitea')
await expect(gitea).toContainText('Gitea')
await expect(gitea).toContainText('Data + DB')
await expect(page.getByTestId('application-host:monitoring.service')).toContainText('Monitoring')
// Gitea → select → schedule → target → save
await gitea.getByRole('button', { name: 'Back up' }).click()
await expect(page.getByRole('dialog')).toContainText('gitea-shared-storage')
// the schedule reads as time, not as cron
await expect(page.getByRole('dialog')).toContainText('Every day at 03:00')
await page.getByLabel('Target', { exact: true }).selectOption({ label: name })
await page.getByRole('button', { name: 'Create backup plan' }).click()
await expect(page.getByText(/2 backup strategies created/)).toBeVisible()
await expect(page.getByRole('row', { name: /Gitea – Gitea volume/ })).toBeVisible()
await expect(page.getByRole('row', { name: /Gitea – PostgreSQL dump/ })).toContainText(
'Every day at 03:00',
)
})