Slow getByRole leads to test timeouts
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 25/100
- Tipo de issue
- Error
- Claridad
- Necesita aclaración
- Estado de actividad
- Estancado
- Stack tecnológico
- javascript, react
- Área
- performance, testing-qa
Línea de trabajo
Comienza con la reproducción enlazada de Testing Playground y el punto de entrada getByRole indicado; después, perfila las llamadas repetidas usando el render proporcionado al estilo de Ant Design. Compara el tiempo de ejecución actual con los aproximadamente 1,6 segundos por llamada reportados; se considera terminado cuando la reproducción ya no provoca tiempos de espera agotados en las pruebas sin cambiar el comportamiento previsto de la prueba.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
@testing-library/reactversion: 13.4.0- Testing Framework and version: "@nrwl/jest": "14.8.6"
- DOM Environment: "@testing-library/jest-dom": "5.16.5"
Relevant code or config:
instance.getByRole('button', {
name: 'tests.actions.add', hidden: true
})
).toBeEnabled();
What you did:
I create rederresult with act<RenderResult> and try to find some elements on the screen.
This, with other buttons, is called like 6 times in this one test
What happened:
We migrate our code from andt4 to antd5. As we did this we noticed a lot of our test time out. They time out, because getByRole() takes a lot of time. Sure, Antd is part of the problem, but the rendered result is a rendered result and that should work. The Test, I send in the reproduction part, is just rendering, with some fetchMocks, so no UI changes after the setup.
Reproduction:
I tried to create a good reproduction, but with all our setup code, its complex. So I created a playground with the actual screen render.
Problem description:
getByRole() takes a lot of time in this jest test. I used the profiler to get a feeling, on how long.
As you can see, for one getByRole() it takes around 1.6second. This adds up and leads to tests, that time out.
Suggested solution:
make getByRole fast 😅 I read a lot in the past weeks and someone said, this is slow (coudn't find the Issue again, sorry). I guess this could be improved.
cc @MLB00N
- Lenguaje dominante
- JavaScript
- Estrellas
- 19.7k
- Forks
- 1.2k
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de testing-library/react-testing-library
-
fireEvent.select does not wrap its automatic native focus in actPosiblemente ocupada @sergioperezcheco la tomó hace 5 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
-
bug: calling configure() without reactStrictMode resets it to undefined, silently disabling strict modeQuizá libre de nuevo @suhailopensource la tomó hace 75 días y no hay ningún pull request abierto. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 35/100
testing-library/react-testing-library#1466 · 1 comentario ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 30/100
testing-library/react-testing-library#1459 · 2 comentarios ·
-
perf: optimize container lookup with early exitQuizá libre de nuevo @Ch-Abhinav-Chowdary la tomó hace 301 días y no hay ningún pull request abierto. Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 35/100
testing-library/react-testing-library#1430 · 1 comentario ·
-
`fireEvent.mouseEnter` does not forward `relatedTarget` (relatedTarget is the window instead)Posiblemente ocupada @swarnim02 la tomó hace 318 días. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 55/100
Todos los issues de testing-library/react-testing-library
Issues similares
-
[Bug]: [A11y] Missing accessible name on icon-only standalone links (WCAG 2.1 SC 2.4.4, 4.1.2)Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
jaegertracing/jaeger-ui#4596 ·
Los mantenedores suelen responder en 1 día
-
Add: CNC Region Calima [CO]Abiertochannels:add check:passed
Dificultad 1/5 Menos de una hora Aptitud para principiantes 72/100
Los mantenedores suelen responder en 9 días
-
module: core
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
bigbluebutton/bigbluebutton#26028 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 91/100
twbs/bootstrap#43050 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
status:untriaged
Dificultad 1/5 Menos de una hora Aptitud para principiantes 78/100
midnightntwrk/servicedesk#248 ·
Los mantenedores suelen responder en 1 día