Skip to content

Commit

Permalink
Test validation behaviour
Browse files Browse the repository at this point in the history
RISDEV-5240
  • Loading branch information
HPrinz committed Dec 13, 2024
1 parent b2fffc0 commit 87ede4a
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions frontend/test/e2e/caselaw/categories/references.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,16 +245,21 @@ test.describe(
)

test(
"Literature references can be added to documentation unit",
"Literature references input is validated against required fields",
{
tag: "@RISDEV-5236 @RISDEV-5454",
tag: ["@RISDEV-5236", "@RISDEV-5454", "@RISDEV-5240"],
},
async ({ page, prefilledDocumentUnit }) => {
await test.step("Literature references are validated for required inputs", async () => {
await navigateToReferences(
page,
prefilledDocumentUnit.documentNumber ?? "",
)

await expect(
page.locator("[aria-label='Literaturfundstelle speichern']"),
).toBeDisabled()

await fillInput(page, "Periodikum Literaturfundstelle", "AllMBl")
await page
.getByText("AllMBl | Allgemeines Ministerialblatt", {
Expand All @@ -275,23 +280,24 @@ test.describe(
await expect(
page.locator("text=Pflichtfeld nicht befüllt"),
).toHaveCount(2)
})

await test.step("Save literature reference, verify that it is shown in the list", async () => {
await fillInput(page, "Autor Literaturfundstelle", "Bilen, Ulviye")
await fillInput(page, "Autor Literaturfundstelle", "Einstein, Albert")

await expect(
page.locator("text=Pflichtfeld nicht befüllt"),
).toHaveCount(1)

await fillInput(page, "Dokumenttyp Literaturfundstelle", "Ean")
await page.getByText("Ean", { exact: true }).click()
await waitForInputValue(
page,
"[aria-label='Dokumenttyp Literaturfundstelle']",
"Anmerkung",
)
await page
.locator("[aria-label='Literaturfundstelle speichern']")
.click()

await expect(
page.getByText("Bilen, Ulviye, AllMBl 2024, 2 (Ean)"),
).toBeVisible()
page.locator("text=Pflichtfeld nicht befüllt"),
).toBeHidden()
})
},
)
Expand Down

0 comments on commit 87ede4a

Please sign in to comment.