-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
fix: enzyme testing replaced by react tester #36159
base: master
Are you sure you want to change the base?
Conversation
Thanks for the pull request, @jciasenza! This repository is currently maintained by Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review.
|
I don't understand, locally the changes pass all the tests and those that appear as failures are not files that have been modified. |
|
for example in this case, quality checks/Quality Others (ubuntu-24.04, 3.11, 20) (pull_request), I have not changed anything |
You need to click the "Details" link to see what the actual failures are. There are ESlint failures.
|
@robrap Now they passed the tests!!! Thaks!!! |
[inform] I create the following ticket to fix the flaky test failure issue: |
Hello @brian-smith-tcril, when you can check, I think this PR would be resolved now, Thanks ! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall this looks great! Super happy to see things moving to RTL!
One thing I noticed is that the new tests that are replacing the snapshot tests aren't verifying the "Create a report of problem responses" button exists.
I also left a couple comments in the tests themselves. Nothing big, but definitely a couple spots where the tests could be more robust.
Thank you so much for doing this!
}); | ||
|
||
test('render with selected block', () => { | ||
const component = renderer.create( | ||
test('display dropdown on toggling dropdown', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems this test isn't quite living up to the "display dropdown on toggling dropdown" name.
The only expect
I see in here is checking that before the user clicks the toggleButton
'Some expected block name' doesn't appear on the screen.
This should be updated to verify the dropdown is actually displayed when it is toggled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check this out
await userEvent.click(toggleButton); | ||
|
||
await userEvent.click(toggleButton); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think an extra expect
in between these to verify the dropdown actually opens and closes (as opposed to just not ever opening) would probably be good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @brian-smith-tcril for giving me the feedback, I will review those points and upload the changes again.
Hello, @brian-smith-tcril, |
expect(screen.queryByText('Some expected block name')).toBeNull(); | ||
const toggleButton = screen.getByRole('button', { name: 'Select a section or problem' }); | ||
await userEvent.click(toggleButton); | ||
const blockName = screen.queryByText('Some expected block name'); | ||
expect(blockName).toBeNull(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems a bit odd to me, it's expecting the query for 'Some expected block name'
to be null both before and after clicking the toggle button?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know if the way I modified it is right, but the tests passed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know if the way I modified it is right, but the tests passed.
const toggleButton = screen.getByRole('button', { name: 'Select a section or problem' }); | ||
await userEvent.click(toggleButton); | ||
await waitFor(() => { | ||
expect(screen.queryByText('Select a section or problem')).not.toBeNull(); | ||
}); | ||
await userEvent.click(toggleButton); | ||
await waitFor(() => { | ||
expect(screen.queryByText('Some expected block name')).toBeNull(); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great now!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thaks you !!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually sorry it doesn't. I missed the fact that you're now checking for 'Select a section or problem'
to not be null, it should be 'Some expected block name'
that is not null when toggling the dropdown
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had my doubts about what you told me but it gives me errors like it doesn't find "Some expected block name", but hey it's progress
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in this case
expect(screen.queryByText('Select a section or problem')).not.toBeNull();
This is where I get the error arrives null or not found'Some expected block name'
ProblemBrowser Main component › hide dropdown on second toggle
expect(received).not.toBeNull()
Received: null
can you think of a solution?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After looking at this more my main question is: where is 'Some expected block name'
coming from? I don't see anything in the tests putting that string anywhere.
The previous implementation of this test just looked for BlockBrowserContainer
, it'd be helpful to know what is actually being rendered in that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know if it is a good solution but replace the texts with data-testid="block-browser-container"
Replaced enzyme display dropdown on toggling dropdown test in Main file for react-renderer tests.
I made PR of this issue #35245
And Testing OK
If something needs to be modified, let me know, thank you!!!
Atte
Juan Carlos (Aulasneo)
Developer Checklist
Test suites passing
Documentation and test plan updated, if applicable
Received code-owner approving review