WP-02: contracts and failing tests for settings, mail, jobs and scheduler
Some checks failed
CI / backend (push) Has been cancelled
CI / frontend (push) Has been cancelled
CI / ui (push) Has been cancelled

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
Dennis Nemec
2026-09-02 22:08:23 +02:00
parent 12269051c4
commit 6113af0a19
21 changed files with 1115 additions and 0 deletions

View File

@ -0,0 +1,41 @@
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('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()
const cron = page.getByLabel('Package refresh schedule')
await cron.fill('0 */30 * * * *')
await page.getByRole('button', { name: 'Save schedules' }).click()
await expect(page.getByRole('status')).toContainText('Schedules saved')
})
test('admin runs a job manually and sees the log', async ({ page }) => {
await loginAdmin(page)
await page.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()
})