-
Notifications
You must be signed in to change notification settings - Fork 115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Integrating with wix/react-native-navigation #61
Comments
Hmm interesting. There's not really going to be a solution for that. Cavy is really designed to be in pure React Native land, and so That's a shame, but I don't have an answer for how we could support it right now. I'll leave this issue open for now. |
@jalada Fair enough, I think for now, I will look into other methods of testing. Thought I would at least put this here for anyone else that has a similar experience. Thanks for responding! |
@kkjdaniel thank you for reporting it! It's useful to know what libraries people are using and trying to use Cavy with. Appreciate it 🌟 |
@jalada when you register your screen, wrap it with a HOC. You need to repeat this operation as often you have screens import { withE2E } from './hoc';
import AppSpec from './specs/AppSpec';
Navigation.registerComponent(CONSTANTS.SCREENS.LOGIN.id, () =>
withE2E(LoginScreen, AppSpec)
); the code of withE2E HOC import React, { PureComponent } from 'react';
import { Tester, TestHookStore } from 'cavy';
const testHookStore = new TestHookStore();
export default (WrappedComponent, ...specs) => {
class Enhance extends PureComponent {
render() {
return (
<Tester
clearAsyncStorage
specs={[...specs]}
store={testHookStore}
waitTime={4000}
startDelay={1000}
sendReport={true}
>
<WrappedComponent {...this.props} />
</Tester>
);
}
}
return Enhance;
}; |
Hey @padupuy , did you have any luck with this solution? |
You'd need to have a single test runner and test hooks store. From looking at the Codebase this wouldn't be possible with the tester, but you could simply build your own component that is similar to tester from providing the cavy context and then star the test runner imperatively. I'm not using react native navigation anymore, but cavy has a pretty easy to understand and small Codebase, so extending it to this use case should be easily possible, if you are experienced enough. |
I'm investigating Cavy for potential use in apps at my company. Kind of surprised this isn't addressed in the docs for alternative use cases, to encourage adoption. |
@freerangenerd Apologies I'm not quite sure I understand your comment. What do you mean by 'addressed in the docs for alternative use cases, to encourage adoption'? |
I'm referring to MrLoh's comment. I'm evaluating Cavy for use by a wide range of teams. This issue, asked three year ago, asks what to do if you have multiple RCTRootViews. It seems like a very reasonable use case to me. Not that Cavy has to support it, but if it aspires to wide-scale adoption like Detox, IMO, it should eliminate developer friction for this use case. So, it surprises me that the documentation doesn't cover it. A single app developer may decide to invest time to solve the problem so they can try out Cavy. Others may just gloss past it. As I look at whether to recommend Cavy to a wide array of teams, I'm asking questions, like How well has it been supported? How hard is it to integrate? Does it impact performance?
|
Thanks @freerangenerd. Basically, you think the docs (cavy.app) should include something about And you also think perhaps we should find a way of supporting it. As mentioned above, because |
I'm not concerned with wix/react-native-navigation in specific. That is just one possible way of hitting the problem. I'm concerned with handling multiple root views. There are other reasons (overlays) why you might have more than one. |
Our app is using wix/react-native-navigation which as per the diagram below changes the implementation of the app. Which means, wrapping the app under a single shared
Tester
component doesn't work in the same way.Just wondering if anyone here has any ideas or solutions to this?
The text was updated successfully, but these errors were encountered: