From 762821ac56b52eeb770e92250044936469685b3a Mon Sep 17 00:00:00 2001 From: Leonie Koch Date: Tue, 31 Dec 2024 19:08:59 +0100 Subject: [PATCH] Fix e2e test RISDEV-5721 --- .../shortAndLongTexts/short-and-long-texts.spec.ts | 6 +----- frontend/test/e2e/caselaw/e2e-utils.ts | 5 ++++- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/frontend/test/e2e/caselaw/categories/shortAndLongTexts/short-and-long-texts.spec.ts b/frontend/test/e2e/caselaw/categories/shortAndLongTexts/short-and-long-texts.spec.ts index fcd3bbb1f..11afbb4d4 100644 --- a/frontend/test/e2e/caselaw/categories/shortAndLongTexts/short-and-long-texts.spec.ts +++ b/frontend/test/e2e/caselaw/categories/shortAndLongTexts/short-and-long-texts.spec.ts @@ -634,11 +634,7 @@ test.describe("short and long texts", () => { ) await expect(page.getByText(testId, { exact: true })).toBeVisible() - await expect( - page.getByText(value, { - exact: true, - }), - ).toBeVisible() + await expect(page.getByText(value)).toBeVisible() }) } diff --git a/frontend/test/e2e/caselaw/e2e-utils.ts b/frontend/test/e2e/caselaw/e2e-utils.ts index 33c6c5629..fbaaf4a79 100644 --- a/frontend/test/e2e/caselaw/e2e-utils.ts +++ b/frontend/test/e2e/caselaw/e2e-utils.ts @@ -615,7 +615,10 @@ export async function getRequest(url: string, page: Page): Promise { export async function clickCategoryButton(testId: string, page: Page) { await test.step(`click '${testId}' button to open category`, async () => { const button = page.getByRole("button", { name: testId, exact: true }) - await button.click() + + if (await button.isVisible()) { + await button.click() + } await expect(page.getByTestId(testId)).toBeVisible() }) }