Allow testID prop
Jules Randolph
testID
can only be applied to host components, and RenderHTML
doesn't render itself any host component directly. The first host component in any subtree of RenderHTML
will always be the root (html) renderer, which will have the 'html'
testID
. This host component receives the baseStyle
prop.To support this feature, we could render a top-level
View
, and allow any prop that can be passed to a View
to be passed to RenderHTML
, but that would be a breaking change as it will affect the React tree hierarchy (most notably, it could break style properties applied to the html
renderer which depend directly on the parent, such as alignSelf: 'stretch'
.We could also opt to support specifically
rootTestID
to override html renderer own testID
, but that would obscure responsibilities of this renderer, and you wouldn't be able to query the RenderHTML
React node easily to do assertions. Depending on your test case, that could be an issue.In the meantime, you could choose to wrap
RenderHTML
with a View
, and assign a testID
to this view for testing purposes.Final point: as I am not familiar with detox, I suggest you lay out arguments in favor of
testID
, by explaining how it is used by this tool, to make sure any solution, were it implemented, would satisfy the use case.