-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
test(sqllab): Convert tests to RTL for SqlEditor #22093
test(sqllab): Convert tests to RTL for SqlEditor #22093
Conversation
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.
Hi @corbinrobb! Thank you for this nice PR!
Can we remove import { mount } from 'enzyme';
on 20 line?
await waitForComponentToPaint(wrapper); | ||
expect(wrapper.find(AntdDropdown)).toExist(); | ||
const { findByText } = setup(updatedProps, store); | ||
fireEvent.click(await findByText('LIMIT:')); |
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.
Most projects have a few use cases for fireEvent, but the majority of the time you should probably use @testing-library/user-event.
Should we use user-event
here?
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 we should! I will switch that over and push up the changes.
Hey! @EugeneTorap Thank you and thanks for the review! I would like to remove the I notice there is a comment by @eschutho to convert them to RTL. What do you all think? Should I try to convert those two, delete them, or leave them alone? |
Can we try to convert them to RTL? |
I think we can try to convert them to RTL but I'm not sure if it will be easy because they are testing overflowing behavior. If it becomes too hard, then we can remove them from the file and write those tests using Cypress. |
Hi @corbinrobb! |
Hey @EugeneTorap! I was planning on working on it this week but i have been pretty busy. I am okay with merging it if you think that is best! I can open another PR if I am able to figure out how to convert those. |
SUMMARY
Main goal of this PR is to convert
SqlEditor
's Enzyme tests to React Testing Library with a secondary goal of removing act errors.Most tests were checking if a component rendered or not. So the changes made were to render with RTL and check if a visual element that the user would only see if the component were or weren't there, instead of checking whether the component itself exists.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A
TESTING INSTRUCTIONS
superset-frontend
npm run test -- src/SqlLab/components/SqlEditor/SqlEditor.test.jsx
ADDITIONAL INFORMATION