Files
Infrastruktur-Monitoring-Sy…/frontend/e2e/settings-jobs.spec.ts
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

46 lines
2.3 KiB
TypeScript

import { test, expect, type Page } from '@playwright/test'
async function loginAdmin(page: 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).toHaveURL('/')
}
test('admin saves SMTP settings and a schedule', async ({ page }) => {
await loginAdmin(page)
await page.getByRole('navigation').getByRole('link', { name: 'Settings' }).click()
await page.getByLabel('SMTP host').fill('mail.example.com')
await page.getByLabel('Port').fill('587')
await page.getByLabel('Username').fill('bot')
await page.getByLabel('Password').fill('secret-password')
await page.getByLabel('From address').fill('monitoring@example.com')
await page.getByLabel('Notification recipients').fill('ops@example.com')
await page.getByRole('button', { name: 'Save SMTP settings' }).click()
await expect(page.getByRole('status')).toContainText('SMTP settings saved')
await page.reload()
await expect(page.getByLabel('SMTP host')).toHaveValue('mail.example.com')
await expect(page.getByText('leave empty to keep')).toBeVisible()
await expect(page.getByTestId('schedule-summary').first()).toHaveText('Every hour')
await page.getByLabel('Repeat').first().selectOption('daily')
await expect(page.getByTestId('schedule-summary').first()).toContainText('Every day at')
await page.getByLabel('At', { exact: true }).first().fill('04:30')
await page.getByRole('button', { name: 'Save schedules' }).click()
await expect(page.getByText(/Schedules saved/)).toBeVisible()
await page.reload()
await expect(page.getByLabel('At', { exact: true }).first()).toHaveValue('04:30')
})
test('admin runs a job manually and sees the log', async ({ page }) => {
await loginAdmin(page)
await page.getByRole('navigation').getByRole('link', { name: 'Jobs' }).click()
await page.getByLabel('Job').selectOption('package_refresh')
await page.getByRole('button', { name: 'Run now' }).click()
const row = page.getByRole('row', { name: /package_refresh/ }).first()
await expect(row).toContainText(/success|running/)
await row.getByRole('button', { name: 'Log' }).click()
await expect(page.getByTestId('job-log')).not.toBeEmpty()
})