Skip to content

Commit

Permalink
Try fix flaky behaviour of category-import test
Browse files Browse the repository at this point in the history
RISDEV-6681
  • Loading branch information
leonie-koch committed Feb 7, 2025
1 parent ef95c0a commit 6f2f2be
Showing 1 changed file with 91 additions and 33 deletions.
124 changes: 91 additions & 33 deletions frontend/test/e2e/caselaw/category-import.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -575,9 +575,14 @@ test.describe("category import", () => {
await expect(
page.getByLabel("Titelzeile übernehmen", { exact: true }),
).toBeDisabled()
await page.getByTestId("Titelzeile").click()
await page.keyboard.press(`ControlOrMeta+A`)
await page.keyboard.press(`ControlOrMeta+Backspace`)
// Click the input field and clear its content
const input = page.getByTestId("Titelzeile")
await input.click()
await page.keyboard.press("ControlOrMeta+A")
await page.keyboard.press("ControlOrMeta+Backspace")
await expect(page.getByText("Test Titelzeile")).toBeHidden()

// Check if the button becomes enabled again after clearing
await expect(
page.getByLabel("Titelzeile übernehmen", {
exact: true,
Expand Down Expand Up @@ -620,9 +625,14 @@ test.describe("category import", () => {
await expect(
page.getByLabel("Leitsatz übernehmen", { exact: true }),
).toBeDisabled()
await page.getByTestId("Leitsatz").click()
await page.keyboard.press(`ControlOrMeta+A`)
await page.keyboard.press(`ControlOrMeta+Backspace`)
// Click the input field and clear its content
const input = page.getByTestId("Leitsatz")
await input.click()
await page.keyboard.press("ControlOrMeta+A")
await page.keyboard.press("ControlOrMeta+Backspace")
await expect(page.getByText("Test Leitsatz")).toBeHidden()

// Check if the button becomes enabled again after clearing
await expect(
page.getByLabel("Leitsatz übernehmen", {
exact: true,
Expand Down Expand Up @@ -670,9 +680,14 @@ test.describe("category import", () => {
await expect(
page.getByLabel("Orientierungssatz übernehmen", { exact: true }),
).toBeDisabled()
await page.getByTestId("Orientierungssatz").click()
await page.keyboard.press(`ControlOrMeta+A`)
await page.keyboard.press(`ControlOrMeta+Backspace`)
// Click the input field and clear its content
const input = page.getByTestId("Orientierungssatz")
await input.click()
await page.keyboard.press("ControlOrMeta+A")
await page.keyboard.press("ControlOrMeta+Backspace")
await expect(page.getByText("Test Orientierungssatz")).toBeHidden()

// Check if the button becomes enabled again after clearing
await expect(
page.getByLabel("Orientierungssatz übernehmen", {
exact: true,
Expand Down Expand Up @@ -720,9 +735,16 @@ test.describe("category import", () => {
await expect(
page.getByLabel("Sonstiger Orientierungssatz übernehmen"),
).toBeDisabled()
await page.getByTestId("Sonstiger Orientierungssatz").click()
await page.keyboard.press(`ControlOrMeta+A`)
await page.keyboard.press(`ControlOrMeta+Backspace`)
// Click the input field and clear its content
const input = page.getByTestId("Sonstiger Orientierungssatz")
await input.click()
await page.keyboard.press("ControlOrMeta+A")
await page.keyboard.press("ControlOrMeta+Backspace")
await expect(
page.getByText("Test Sonstiger Orientierungssatz"),
).toBeHidden()

// Check if the button becomes enabled again after clearing
await expect(
page.getByLabel("Sonstiger Orientierungssatz übernehmen"),
).toBeEnabled()
Expand Down Expand Up @@ -762,9 +784,14 @@ test.describe("category import", () => {

await test.step("import not possible anymore, when target category filled", async () => {
await expect(page.getByLabel("Tenor übernehmen")).toBeDisabled()
await page.getByTestId("Tenor").click()
await page.keyboard.press(`ControlOrMeta+A`)
await page.keyboard.press(`ControlOrMeta+Backspace`)
// Click the input field and clear its content
const input = page.getByTestId("Tenor")
await input.click()
await page.keyboard.press("ControlOrMeta+A")
await page.keyboard.press("ControlOrMeta+Backspace")
await expect(page.getByText("Test Tenor")).toBeHidden()

// Check if the button becomes enabled again after clearing
await expect(page.getByLabel("Tenor übernehmen")).toBeEnabled()
})
},
Expand Down Expand Up @@ -804,9 +831,15 @@ test.describe("category import", () => {
await expect(
page.getByLabel("Gründe übernehmen", { exact: true }),
).toBeDisabled()
await page.getByTestId("Gründe").click()
await page.keyboard.press(`ControlOrMeta+A`)
await page.keyboard.press(`ControlOrMeta+Backspace`)

// Click the input field and clear its content
const input = page.getByTestId("Gründe")
await input.click()
await page.keyboard.press("ControlOrMeta+A")
await page.keyboard.press("ControlOrMeta+Backspace")
await expect(page.getByText("Test Gründe")).toBeHidden()

// Check if the button becomes enabled again after clearing
await expect(
page.getByLabel("Gründe übernehmen", { exact: true }),
).toBeEnabled()
Expand Down Expand Up @@ -844,9 +877,14 @@ test.describe("category import", () => {

await test.step("import not possible anymore, when target category filled", async () => {
await expect(page.getByLabel("Tatbestand übernehmen")).toBeDisabled()
await page.getByTestId("Tatbestand").click()
await page.keyboard.press(`ControlOrMeta+A`)
await page.keyboard.press(`ControlOrMeta+Backspace`)
// Click the input field and clear its content
const input = page.getByTestId("Tatbestand")
await input.click()
await page.keyboard.press("ControlOrMeta+A")
await page.keyboard.press("ControlOrMeta+Backspace")
await expect(page.getByText("Test Tatbestand")).toBeHidden()

// Check if the button becomes enabled again after clearing
await expect(page.getByLabel("Tatbestand übernehmen")).toBeEnabled()
})
},
Expand Down Expand Up @@ -888,9 +926,14 @@ test.describe("category import", () => {
await expect(
page.getByLabel("Entscheidungsgründe übernehmen"),
).toBeDisabled()
await page.getByTestId("Entscheidungsgründe").click()
await page.keyboard.press(`ControlOrMeta+A`)
await page.keyboard.press(`ControlOrMeta+Backspace`)
// Click the input field and clear its content
const input = page.getByTestId("Entscheidungsgründe")
await input.click()
await page.keyboard.press("ControlOrMeta+A")
await page.keyboard.press("ControlOrMeta+Backspace")
await expect(page.getByText("Test Entscheidungsgründe")).toBeHidden()

// Check if the button becomes enabled again after clearing
await expect(
page.getByLabel("Entscheidungsgründe übernehmen"),
).toBeEnabled()
Expand Down Expand Up @@ -934,9 +977,14 @@ test.describe("category import", () => {
await expect(
page.getByLabel("Abweichende Meinung übernehmen"),
).toBeDisabled()
await page.getByTestId("Abweichende Meinung").click()
await page.keyboard.press(`ControlOrMeta+A`)
await page.keyboard.press(`ControlOrMeta+Backspace`)
// Click the input field and clear its content
const input = page.getByTestId("Abweichende Meinung")
await input.click()
await page.keyboard.press("ControlOrMeta+A")
await page.keyboard.press("ControlOrMeta+Backspace")
await expect(page.getByText("Test Abweichende Meinung")).toBeHidden()

// Check if the button becomes enabled again after clearing
await expect(
page.getByLabel("Abweichende Meinung übernehmen"),
).toBeEnabled()
Expand Down Expand Up @@ -1026,9 +1074,14 @@ test.describe("category import", () => {
await expect(
page.getByLabel("Sonstiger Langtext übernehmen"),
).toBeDisabled()
await page.getByTestId("Sonstiger Langtext").click()
await page.keyboard.press(`ControlOrMeta+A`)
await page.keyboard.press(`ControlOrMeta+Backspace`)
// Click the input field and clear its content
const input = page.getByTestId("Sonstiger Langtext")
await input.click()
await page.keyboard.press("ControlOrMeta+A")
await page.keyboard.press("ControlOrMeta+Backspace")
await expect(page.getByText("Test Sonstiger Langtext")).toBeHidden()

// Check if the button becomes enabled again after clearing
await expect(
page.getByLabel("Sonstiger Langtext übernehmen"),
).toBeEnabled()
Expand Down Expand Up @@ -1066,9 +1119,14 @@ test.describe("category import", () => {

await test.step("import not possible anymore, when target category filled", async () => {
await expect(page.getByLabel("Gliederung übernehmen")).toBeDisabled()
await page.getByTestId("Gliederung").click()
await page.keyboard.press(`ControlOrMeta+A`)
await page.keyboard.press(`ControlOrMeta+Backspace`)
// Click the input field and clear its content
const input = page.getByTestId("Gliederung")
await input.click()
await page.keyboard.press("ControlOrMeta+A")
await page.keyboard.press("ControlOrMeta+Backspace")
await expect(page.getByText("Test Gliederung")).toBeHidden()

// Check if the button becomes enabled again after clearing
await expect(page.getByLabel("Gliederung übernehmen")).toBeEnabled()
})
},
Expand Down

0 comments on commit 6f2f2be

Please sign in to comment.