Skip to content

How to mock different scenarios with Detox? #2935

Answered by d4vidi
lukebrandonfarrell asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @lukebrandonfarrell, that's a very interesting topic.
Mocking is not something Detox is suppose to support per se (no Detox feature is associated with that, explicitly). However, it is something so fundamental in testing, that we care about helping out with it as if was a core feature.

In general, the recommended mocking technique is described in our mocking guide. As for the use case you're describing, it sounds to me that it aligns with the technique pretty well. Largely, I think these principles sum it up:

  1. Assuming your main React component for image picking is implemented in a file called ImagePicker.jsx -- create a mock equivalent in a file called ImagePicker.e2e.jsx.
  2. To me it s…

Replies: 2 comments 9 replies

Comment options

You must be logged in to vote
9 replies
@lukebrandonfarrell
Comment options

@d4vidi
Comment options

@lukebrandonfarrell
Comment options

@d4vidi
Comment options

@pke
Comment options

Answer selected by lukebrandonfarrell
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants