You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2022/11/10 17:47:01 UTC

[GitHub] [superset] corbinrobb opened a new pull request, #22093: test(sqllab): Convert tests to RTL for SqlEditor

corbinrobb opened a new pull request, #22093:
URL: https://github.com/apache/superset/pull/22093

   <!---
   Please write the PR title following the conventions at https://www.conventionalcommits.org/en/v1.0.0/
   Example:
   fix(dashboard): load charts correctly
   -->
   
   ### 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
   - cd into `superset-frontend`
   - `npm run test -- src/SqlLab/components/SqlEditor/SqlEditor.test.jsx`
   - Check for passing tests and act errors
   
   ### ADDITIONAL INFORMATION
   <!--- Check any relevant boxes with "x" -->
   <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] Migration is atomic, supports rollback & is backwards-compatible
     - [ ] Confirm DB migration upgrade and downgrade tested
     - [ ] Runtime estimates and downtime expectations provided
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] corbinrobb commented on pull request #22093: test(sqllab): Convert tests to RTL for SqlEditor

Posted by GitBox <gi...@apache.org>.
corbinrobb commented on PR #22093:
URL: https://github.com/apache/superset/pull/22093#issuecomment-1310875502

   Hey! @EugeneTorap Thank you and thanks for the review!
   
   I would like to remove the `mount` import on line 20 and also the `buildWrapper` function on line 120 but they are still being used inside of the two skipped tests lines 235 - 260. I am not sure what is going one with those two or whether we want to keep them or not.
   
   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?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] EugeneTorap commented on a diff in pull request #22093: test(sqllab): Convert tests to RTL for SqlEditor

Posted by GitBox <gi...@apache.org>.
EugeneTorap commented on code in PR #22093:
URL: https://github.com/apache/superset/pull/22093#discussion_r1019549309


##########
superset-frontend/src/SqlLab/components/SqlEditor/SqlEditor.test.jsx:
##########
@@ -263,8 +262,8 @@ describe('SqlEditor', () => {
   it('render a Limit Dropdown', async () => {
     const defaultQueryLimit = 101;
     const updatedProps = { ...mockedProps, defaultQueryLimit };
-    const wrapper = buildWrapper(updatedProps);
-    await waitForComponentToPaint(wrapper);
-    expect(wrapper.find(AntdDropdown)).toExist();
+    const { findByText } = setup(updatedProps, store);
+    fireEvent.click(await findByText('LIMIT:'));

Review Comment:
   > Most projects have a few use cases for fireEvent, but the majority of the time you should probably use [@testing-library/user-event](https://testing-library.com/docs/user-event/intro).
   
   Should we use `user-event` here?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] EugeneTorap commented on pull request #22093: test(sqllab): Convert tests to RTL for SqlEditor

Posted by GitBox <gi...@apache.org>.
EugeneTorap commented on PR #22093:
URL: https://github.com/apache/superset/pull/22093#issuecomment-1310882793

   Can we try to convert them to RTL?
   @michael-s-molina @kgabryje What do you think about it?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] corbinrobb commented on pull request #22093: test(sqllab): Convert tests to RTL for SqlEditor

Posted by GitBox <gi...@apache.org>.
corbinrobb commented on PR #22093:
URL: https://github.com/apache/superset/pull/22093#issuecomment-1318972131

   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. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] michael-s-molina merged pull request #22093: test(sqllab): Convert tests to RTL for SqlEditor

Posted by GitBox <gi...@apache.org>.
michael-s-molina merged PR #22093:
URL: https://github.com/apache/superset/pull/22093


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] EugeneTorap commented on pull request #22093: test(sqllab): Convert tests to RTL for SqlEditor

Posted by GitBox <gi...@apache.org>.
EugeneTorap commented on PR #22093:
URL: https://github.com/apache/superset/pull/22093#issuecomment-1318870061

   Hi @corbinrobb!
   Can we merge your PR or you're working on rewriting skipped tests?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] michael-s-molina commented on pull request #22093: test(sqllab): Convert tests to RTL for SqlEditor

Posted by GitBox <gi...@apache.org>.
michael-s-molina commented on PR #22093:
URL: https://github.com/apache/superset/pull/22093#issuecomment-1310892791

   > Can we try to convert them to RTL? @michael-s-molina @kgabryje What do you think about it?
   
   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.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] corbinrobb commented on a diff in pull request #22093: test(sqllab): Convert tests to RTL for SqlEditor

Posted by GitBox <gi...@apache.org>.
corbinrobb commented on code in PR #22093:
URL: https://github.com/apache/superset/pull/22093#discussion_r1019598984


##########
superset-frontend/src/SqlLab/components/SqlEditor/SqlEditor.test.jsx:
##########
@@ -263,8 +262,8 @@ describe('SqlEditor', () => {
   it('render a Limit Dropdown', async () => {
     const defaultQueryLimit = 101;
     const updatedProps = { ...mockedProps, defaultQueryLimit };
-    const wrapper = buildWrapper(updatedProps);
-    await waitForComponentToPaint(wrapper);
-    expect(wrapper.find(AntdDropdown)).toExist();
+    const { findByText } = setup(updatedProps, store);
+    fireEvent.click(await findByText('LIMIT:'));

Review Comment:
   I think we should!  I will switch that over and push up the changes.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org