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

docs(threat-hunting): add ADR 0002 on usage of slow accessibility selectors in Jest RTL tests #200324

Conversation

kapral18
Copy link
Contributor

This PR introduces a new ADR concerning the usage of heavy react-testing-library selectors like ByRole, ByLabelText and ByText.

This ADR is images-heavy and also contains a separate tests benchmarking repo https://github.com/kapral18/rtl-selectors-perf-test to further expand on the findings in the "problem and context" section.

The decision will be finalized after team/cross-team discussion and before merging this PR

@kapral18 kapral18 self-assigned this Nov 16, 2024
@kapral18 kapral18 requested a review from a team as a code owner November 16, 2024 21:10
@kapral18 kapral18 added the Team:Threat Hunting Security Solution Threat Hunting Team label Nov 16, 2024
@elasticmachine
Copy link
Contributor

Pinging @elastic/security-threat-hunting (Team:Threat Hunting)

@kapral18 kapral18 added release_note:skip Skip the PR/issue when compiling release notes backport:skip This commit does not require backporting backport:prev-major Backport to (8.x, 8.18, 8.17, 8.16) the previous major branch and other branches in development and removed backport:skip This commit does not require backporting labels Nov 16, 2024
@kapral18 kapral18 force-pushed the docs/adr/add-rtl-accessibility-selectors-adr branch 4 times, most recently from b3c3e72 to 96e2f72 Compare November 19, 2024 12:06
@kapral18 kapral18 force-pushed the docs/adr/add-rtl-accessibility-selectors-adr branch from 96e2f72 to 2cbc208 Compare November 19, 2024 13:54
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

✅ unchanged

History

cc @kapral18

@kapral18 kapral18 marked this pull request as draft November 19, 2024 22:14
@elasticmachine
Copy link
Contributor

🤖 Jobs for this PR can be triggered through checkboxes. 🚧

ℹ️ To trigger the CI, please tick the checkbox below 👇

  • Click to trigger kibana-pull-request for this PR!
  • Click to trigger kibana-deploy-project-from-pr for this PR!

Copy link
Contributor

@PhilippeOberti PhilippeOberti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an amazing write up, thank you!

A few thoughts:

  • while option 3 would ensure that tests are running extremely fast, it would - like you mentioned - go against RTL best practices, which is not good.
  • option 1 seems to me that we would basically not changed anything to what we're doing today. It is a viable option. Tickets are automatically created when tests take more than 5s to load/run, so these tests could be investigated individually and we could work on improving only the offenders...
  • option 2 seems to me the best but like you said difficult to enforce...

I know it's not the answer you'd like to hear, but it seems to me that we could not change anything to what we're doing right now, and just focus on improving the tests that do take more than 5 seconds to run today...
I don't see option #3 being enforced, and I also don't see another good alternative...

@kapral18 kapral18 closed this Feb 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:prev-major Backport to (8.x, 8.18, 8.17, 8.16) the previous major branch and other branches in development release_note:skip Skip the PR/issue when compiling release notes Team:Threat Hunting Security Solution Threat Hunting Team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants