40 lines
2.0 KiB
TypeScript
40 lines
2.0 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('link', { name: 'Backups' }).click()
|
|
|
|
await page.getByRole('button', { name: 'New target' }).click()
|
|
const name = `NAS ${Date.now()}`
|
|
await page.getByLabel('Name').fill(name)
|
|
await page.getByLabel('Host').fill('nas.local')
|
|
await page.getByLabel('Share').fill('backups')
|
|
await page.getByLabel('Directory').fill('softvisor')
|
|
await page.getByLabel('Username').fill('backup')
|
|
await page.getByLabel('Password').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.getByRole('status')).toContainText('Connection ok')
|
|
|
|
await page.getByRole('button', { name: 'New strategy' }).click()
|
|
await page.getByLabel('Strategy name').fill('Gitea database')
|
|
await page.getByLabel('Source type').selectOption('postgres_dump')
|
|
await page.getByLabel('Namespace').fill('gitea')
|
|
await page.getByLabel('Pod').fill('gitea-postgresql-0')
|
|
await page.getByLabel('Schedule').fill('0 0 2 * * *')
|
|
await page.getByLabel('Target').selectOption({ label: name })
|
|
await page.getByLabel('Keep last').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')
|
|
})
|