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

Chore: update more unit tests to work with react 18 #64812

Merged
merged 1 commit into from
Mar 16, 2023

Conversation

ashharrison90
Copy link
Contributor

What is this feature?

  • many unit tests fail when attempting to update to react 18 (see Chore: Upgrade to react 18 #64428)
  • adjusts unit tests so they work with react 18
    • a lot of these are moving from fireEvent to userEvent

Why do we need this feature?

  • so we can move to react 18!

Who is this feature for?

  • grafana devs

Which issue(s) does this PR fix?:

Fixes #

Special notes for your reviewer:

follow on from #64698 and #64759

@ashharrison90 ashharrison90 added type/chore no-backport Skip backport of PR no-changelog Skip including change in changelog/release notes labels Mar 15, 2023
@ashharrison90 ashharrison90 added this to the 9.5.0 milestone Mar 15, 2023
@ashharrison90 ashharrison90 requested a review from a team as a code owner March 15, 2023 13:44
@ashharrison90 ashharrison90 self-assigned this Mar 15, 2023
@ashharrison90 ashharrison90 requested review from a team as code owners March 15, 2023 13:44
@ashharrison90 ashharrison90 requested review from asimpson, aangelisc, leventebalogh, joshhunt and tskarhed and removed request for a team March 15, 2023 13:44
@github-actions
Copy link
Contributor

Backend code coverage report for PR #64812
No changes

@github-actions
Copy link
Contributor

github-actions bot commented Mar 15, 2023

Frontend code coverage report for PR #64812

Plugin Main PR Difference
correlations 87.23% 87.23% 0%
explore 86.42% 86.42% 0%

Copy link
Contributor

@leventebalogh leventebalogh left a comment

Choose a reason for hiding this comment

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

LGTM 👍

expect(screen.queryByText('Loading...')).not.toBeInTheDocument();
const selection = await screen.findAllByLabelText('web-server');
Copy link
Contributor

Choose a reason for hiding this comment

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

Question: do we still need to wait here for the web-server label?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes - in react 18 the selection comes back with a length of 1 initially. subsequent rerenders change this to 2, but if it's not in a waitFor the test will have already failed 😓

@ashharrison90 ashharrison90 merged commit b19f7bb into main Mar 16, 2023
@ashharrison90 ashharrison90 deleted the ash/react-18-unit-tests-p3 branch March 16, 2023 10:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/explore area/frontend datasource/Azure Azure Monitor Datasource datasource/Tempo no-backport Skip backport of PR no-changelog Skip including change in changelog/release notes type/chore
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants