Is it possible to test the contents of a TextInput? #905
-
I'm trying to test whether some text inputs get preloaded with data. So far I've tried:
but this doesn't work for some reason.
That initalValue 'Youspan' is exactly what I was testing for. I even tried putting What is supposed to work in this situation? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Not sure if I understand your question correctly, but let's try. Your goal is to check whether the I'm getting this test to pass correctly:
Things to note:
Hope that helps, if you no, please provide repro repository so we have a concrete example to work in. |
Beta Was this translation helpful? Give feedback.
-
While this is an older thread, just wanted to leave this here for future visitors. At least the newer versions of RNTL allow this check to be performed in a more idiomatic way, without directly accessing props: expect(screen.getByDisplayValue('Youspan')).toBeOnTheScreen(); (assuming |
Beta Was this translation helpful? Give feedback.
Not sure if I understand your question correctly, but let's try. Your goal is to check whether the
TextInput
value is as you expected after some test initialization.I'm getting this test to pass correctly: