Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flaky unit test for CodeListPage #14766

Open
Jondyr opened this issue Feb 21, 2025 · 0 comments
Open

Flaky unit test for CodeListPage #14766

Jondyr opened this issue Feb 21, 2025 · 0 comments
Labels
added-to-sprint kind/bug Used when there is a defect / something is not working as it should. status/triage team/studio-domain1

Comments

@Jondyr
Copy link
Member

Jondyr commented Feb 21, 2025

Description of the bug

One or more unit test in CodeListPage.test.tsx seems to be failing sporadically.

Example of the GitHub action Frontend Test where the unit test fails:
https://github.com/Altinn/altinn-studio/actions/runs/13453008182/job/37590866336

Trace

FAIL libs/studio-content-library/src/ContentLibrary/LibraryBody/pages/CodeListPage/CodeListPage.test.tsx (21.043 s)
   CodeListPage  Calls onUpdateTextResource with the new text resource and the default language when a text resource is changed in the create dialog

    Unable to find role="radio" and name "[mockedText(code_list_editor.text_resource.label.edit_mode, {"number":1})]"
      276 | const openEditModeForFirstLabel = async (user: UserEvent, area: HTMLElement): Promise<void> => {
      277 |   const radioLabel = textMock('code_list_editor.text_resource.label.edit_mode', { number: 1 });
    > 278 |   const radio = await within(area).findByRole('radio', { name: radioLabel });
          |                                    ^
      279 |   await user.click(radio);
      280 | };
      281 |

      at waitForWrapper (../node_modules/@testing-library/dom/dist/wait-for.js:163:27)
      at ../node_modules/@testing-library/dom/dist/query-helpers.js:86:33
      at findByRole (libs/studio-content-library/src/ContentLibrary/LibraryBody/pages/CodeListPage/CodeListPage.test.tsx:278:36)
      at Object.openEditModeForFirstLabel (libs/studio-content-library/src/ContentLibrary/LibraryBody/pages/CodeListPage/CodeListPage.test.tsx:210:11)

Steps To Reproduce

  1. Trigger the github action frontend test on a PR
  2. Rerun until it fails (in my experience about 50% of runs fail)

Additional Information

No response

@Jondyr Jondyr added kind/bug Used when there is a defect / something is not working as it should. status/triage team/studio-domain1 labels Feb 21, 2025
@Jondyr Jondyr moved this to 📈 Todo in Team Studio Feb 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
added-to-sprint kind/bug Used when there is a defect / something is not working as it should. status/triage team/studio-domain1
Projects
Status: 📈 Todo
Development

No branches or pull requests

1 participant