Files
GerbilManager/gerbil-manager-web/e2e/rennmauspro-import.spec.ts

50 lines
2.0 KiB
TypeScript
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/** RPRO3: RennmausPro-III-Import-Rubrik unter „Hilfe" — Auswerten → Import durchführen. */
import { de, expect, skipUnlessMock, test } from './fixtures'
const t = de.pages.rpro3Import
const h = de.hilfe
test('Hilfe verlinkt auf den RennmausPro-Import', async ({ page }) => {
skipUnlessMock()
await page.goto('/hilfe')
// Den Abschnitt aufklappen und dem Link folgen.
await page.getByText(h.sections.rpro3Import).click()
await page.getByRole('link', { name: new RegExp(h.rpro3Link.button) }).click()
await expect(page).toHaveURL(/\/hilfe\/rennmauspro-import$/)
await expect(page.getByRole('heading', { name: t.title })).toBeVisible()
})
test('Auswerten zeigt die Übersicht, danach importiert "Import durchführen"', async ({ page }) => {
skipUnlessMock()
await page.goto('/hilfe/rennmauspro-import')
// Auswerten ohne Datei ist deaktiviert.
const analyzeBtn = page.getByRole('button', { name: t.analyzeButton })
await expect(analyzeBtn).toBeDisabled()
// Eine (Pseudo-).backup-Datei auswählen.
await page.getByLabel(t.backupLabel).setInputFiles({
name: 'RennmausPro.backup',
mimeType: 'application/octet-stream',
buffer: Buffer.from('PK fake-zip'),
})
await expect(analyzeBtn).toBeEnabled()
await analyzeBtn.click()
// Auswertung erscheint (Zählungen + Abgleich).
await expect(page.getByRole('heading', { name: t.step2Title })).toBeVisible()
await expect(page.getByText(t.counts.ownAnimals)).toBeVisible()
await expect(page.getByText('303')).toBeVisible()
await expect(page.getByText(t.newCount(280))).toBeVisible()
// Mehrdeutige Namen sind aufklappbar.
await page.getByText(t.ambiguousTitle).click()
await expect(page.getByText('Merlin')).toBeVisible()
// Import durchführen.
await page.getByRole('button', { name: t.executeButton }).click()
await expect(page.getByRole('heading', { name: t.successTitle })).toBeVisible()
await expect(page.getByText('3694')).toBeVisible()
await expect(page.getByText(t.resultCounts.gerbils)).toBeVisible()
})