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 2021/09/27 15:58:26 UTC

[GitHub] [superset] geido commented on issue #16792: [Proposal] Superset Frontend Testing Guidelines

geido commented on issue #16792:
URL: https://github.com/apache/superset/issues/16792#issuecomment-928009954


   ### RTL
   
   > https://kentcdodds.com/blog/avoid-nesting-when-youre-testing 
   +1
   
   > Our test files use the test suffix. We should migrate those that use the spec suffix. 
   +1
   
   #### Priorities
   I think priorities should be remarked as it is a common mistake:
   https://testing-library.com/docs/queries/about/#priority
   
   #### Using `act` unnecessarily
   > render and fireEvent are already wrapped in act
   https://kentcdodds.com/blog/fix-the-not-wrapped-in-act-warning
   
   #### Using `*ByRole`
   By using the `name` option we can point to the items by their accessible name. 
   
   `screen.getByRole('button', {name: /hello world/i})`
   
   Roles reference: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles
   
   #### Prefer userEvent over fireEvent
   The user-event library better represents the actual user actions.
   @testing-library/user-event
   
   #### Usage of `waitFor`
   Do not use it for elements that can be queried with `find`
   It should only have one assertion at a time
   Do not perform side-effects actions inside `waitFor`. Use it only for assertions
   
   ####  Materials:
   https://kentcdodds.com/blog/common-mistakes-with-react-testing-library
   
   .....to be continued
   


-- 
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