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

[Unit Testing] Configure react-testing-library queries to use Kibana's data-test-subj instead of default data-testid #59445

Merged
merged 14 commits into from
Mar 10, 2020

Conversation

Dosant
Copy link
Contributor

@Dosant Dosant commented Mar 5, 2020

Summary

I was working on a bunch of react components and noticed we don't have react-testing-library configured properly.

Originally I tried to add this configuration in this pr, but after moving components to x-pack realised that unrelated code changes have to be done to make it pass. So extracted to separate pr

  • This pr configures testing-library to use Kibana's data-test-subj instead of data-testid for it's assertions. Cleans up occasional places where testid was used or where subj workaround was introduced
  • There are couple problems with our current setup which I had to workaround right now. I think I discovered a larger problem which is contributing into jest unit tests flakiness: PLEASE SEE: [Unit Testing][Flaky] Jest suite and react-testing-library registration race condition #59469

Checklist

Delete any items that are not applicable to this PR.

For maintainers

@Dosant
Copy link
Contributor Author

Dosant commented Mar 6, 2020

@elasticmachine merge upstream

@Dosant Dosant added v8.0.0 v7.7.0 release_note:skip Skip the PR/issue when compiling release notes Feature:Unit Testing labels Mar 6, 2020
@Dosant Dosant marked this pull request as ready for review March 6, 2020 05:51
@Dosant Dosant requested review from a team as code owners March 6, 2020 05:51
@Dosant Dosant changed the title [wip] try configure react testing library [Unit Testing] Configure react-testing-library queries to use Kibana's data-test-subj instead of default data-testid Mar 6, 2020
Copy link
Contributor

@walterra walterra left a comment

Choose a reason for hiding this comment

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

Oh, that's a nice fix, thanks for doing this! ML changes LGTM 🎉

Copy link
Contributor

@smith smith left a comment

Choose a reason for hiding this comment

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

APM changes look good. Thanks!

@Dosant
Copy link
Contributor Author

Dosant commented Mar 6, 2020

@elasticmachine merge upstream

@elasticmachine elasticmachine requested a review from a team as a code owner March 6, 2020 18:50
Copy link
Contributor

@oatkiller oatkiller left a comment

Choose a reason for hiding this comment

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

Thanks!

@Dosant Dosant requested a review from mistic March 9, 2020 12:03
Copy link
Contributor

@streamich streamich left a comment

Choose a reason for hiding this comment

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

nice

Copy link
Member

@mistic mistic left a comment

Choose a reason for hiding this comment

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

lgtm

@Dosant
Copy link
Contributor Author

Dosant commented Mar 10, 2020

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@Dosant Dosant merged commit 8a3e9c6 into elastic:master Mar 10, 2020
Dosant added a commit to Dosant/kibana that referenced this pull request Mar 10, 2020
…s data-test-subj instead of default data-testid (elastic#59445)

# Conflicts:
#	x-pack/plugins/endpoint/public/applications/endpoint/view/managing/index.test.tsx
Dosant added a commit that referenced this pull request Mar 10, 2020
…s data-test-subj instead of default data-testid (#59445) (#59742)

# Conflicts:
#	x-pack/plugins/endpoint/public/applications/endpoint/view/managing/index.test.tsx
gmmorris added a commit to gmmorris/kibana that referenced this pull request Mar 10, 2020
* master:
  Add a retry to dashboard test for a sometimes slow async operation (elastic#59600)
  [Endpoint] Sample data generator for endpoint app (elastic#58936)
  [Vis Editor] Refactoring metrics axes (elastic#59135)
  [DOCS] Changed Discover app to Discover (elastic#59769)
  [Metrics Alerts] Add support for search query and groupBy on alerts (elastic#59388)
  Enhancement - EUICodeEditor for Visualize JSON  (elastic#58679)
  [ML] Transforms: Data grid fixes. (elastic#59538)
  [SIEM] Fix and consolidate handling of error responses in the client (elastic#59438)
  [Maps] convert tooltip classes to typescript (elastic#59589)
  [ML] Functional tests - re-activate date_nanos test (elastic#59649)
  Move canvas to use NP Expressions service (elastic#58387)
  Update misc dependencies (elastic#59542)
  [Unit Testing] Configure react-testing-library queries to use Kibana's data-test-subj instead of default data-testid (elastic#59445)
  [Console] Remove unused code (elastic#59554)
  [Logs / Metrics UI] Link handling / stop page reloads (elastic#58478)
  Add SavedObject management section registration in core  (elastic#59291)
jkelastic pushed a commit to jkelastic/kibana that referenced this pull request Mar 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Unit Testing release_note:skip Skip the PR/issue when compiling release notes v7.7.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants