In my project, we are writing unit tests for our components and screens and we got stuck for a while because this library doesn't accept the testID property for the main View.
I think it would be great if you could add the ability to set a testID. If you want I can make the PR, I even tested it locally but I decided to go with a workaround, in case anyone else wants it, here is my current code:
const pagesViewWrapper = queryByTestId('pagesViewWrapperTestId');
expect(pagesViewWrapper).toBeTruthy();
const pagesView = pagesViewWrapper.children[0].children[0]; // this gets the view from Pages I want to add the testID to access directly to it
fireEvent(pagesView, 'layout', {
nativeEvent: { layout: { height: 100 } },
});
The last part is to trigger the onLayout function from the View, otherwise, it doesn't render the pages content.
In my project, we are writing unit tests for our components and screens and we got stuck for a while because this library doesn't accept the testID property for the main View.
I suggest to add the testID here:
I think it would be great if you could add the ability to set a testID. If you want I can make the PR, I even tested it locally but I decided to go with a workaround, in case anyone else wants it, here is my current code:
And in my test I do:
The last part is to trigger the onLayout function from the View, otherwise, it doesn't render the pages content.