aws-amplify / docs

AWS Amplify Framework Documentation
https://docs.amplify.aws
Apache License 2.0
483 stars 1.03k forks source link

Testing components with react-test-library #2832

Open wooller opened 3 years ago

wooller commented 3 years ago

It would be great to have some documentation on using Amplify with react-testing-library (RTL). RTL has 13k+ stars on github and is now the recommended library to use when testing react components.

As a start i think it would be good to have some examples on testing Amplify UI components and components that use an Amplify API. Where we can mock the API service with JEST, so we can test them.

Maybe it could be a stage of the React - Getting started guide? Which has an API as well as Amplify UI components

There is documentation on Mocking Amplify services using amplify mock and how to set up end-to-end tests but i think that leaves a gap of how to perform fast unit tests which can be run in a CI environment.

Would love to hear further thoughts and recommendations.

dabit3 commented 3 years ago

This is a great proposal. I think it would make sense for us to have a "Testing" section in the guides to show how to do this as well as maybe go into Cypress and other testing with the Amplify Console.

mo-mdebashi commented 3 years ago

It would be great to have any kind of documentation, we want to use amplify but without being able to test the gql queries it seems like we won't be able to use amplify