diff --git a/README.md b/README.md index 6b75fbed1b2c..9f73a0012bef 100644 --- a/README.md +++ b/README.md @@ -175,6 +175,7 @@ Often times in order to write a unit test, you may need to mock data, a componen to help run our Unit tests. * To run the **Jest unit tests**: `npm run test` +* UI tests guidelines can be found [here](tests/ui/README.md) ## Performance tests We use Reassure for monitoring performance regression. More detailed information can be found [here](tests/perf-test/README.md): diff --git a/tests/ui/README.md b/tests/ui/README.md new file mode 100644 index 000000000000..0dd7769dbefa --- /dev/null +++ b/tests/ui/README.md @@ -0,0 +1,131 @@ +# Getting Started + +## What are UI Tests? + +UI (User Interface) tests validate the visible and interactive parts of an application. They ensure that components render correctly, handle user interactions as expected, and provide a reliable user experience. + +### Prerequisites + +- Familiarity with the React Native Testing Library [RNTL](https://callstack.github.io/react-native-testing-library/). +- Basic understanding of [Jest](https://jestjs.io/). + +## Best practices + +### When to Add UI Tests: + +1. **User Interactions**: +- Why: When the component responds to user actions, it's essential to verify that the interactions are correctly handled. +- Example: Testing if a button calls its `onPress` handler correctly. + +``` javascript +test('calls onPress when button is clicked', () => { + render(