PedroBern / react-native-collapsible-tab-view

A cross-platform Collapsible Tab View component for React Native
MIT License
834 stars 162 forks source link

Automated tests #81

Open andreialecu opened 3 years ago

andreialecu commented 3 years ago

Feature request

It would be great if a test suite could verify that everything is working properly. The interactions are pretty finicky and things can break in odd places by doing minor changes in others.

This would make the library much more maintainable and easier to refactor in the future, while giving more peace of mind to users that upgrades are safe.

Should be relatively easy to add gray box e2e testing using: https://github.com/wix/Detox

Tests could be added to initiate scrolls and touches, then assert whether things are positioned correctly.

Another possibility is to convert the Example app to use Storybook: https://storybook.js.org/ https://www.learnstorybook.com/intro-to-storybook/react-native/en/get-started/

It would then be possible to use loki to do screenshot diff testing for the stories (this wouldn't really test dynamic interactions though, only static rendering): https://github.com/oblador/loki

PedroBern commented 3 years ago

@andreialecu we really need this. It was an issue with v1 and v2 (#2) to pass a ref and initiate programmatically scrolling from the tests, but now it should be easy. I'm experienced with storybook, jest, and enzyme, but not with detox. I will be looking into it thought the week to see how to set up things.

This would make the library much more maintainable and easier to refactor in the future, while giving more peace of mind to users that upgrades are safe.

❤️ 🚀

PedroBern commented 3 years ago

React navigation uses detox with circle. We can use it as starting point.

PedroBern commented 3 years ago

Here is a nice article about adding detox: https://medium.com/@oriharel/how-i-learned-to-stop-worrying-and-love-merging-to-master-a7e2edc0924e