Repository navigation
Add support for resource-id #9777
Description
Activity
@tuckerconnelly referenced
BaseViewManagerhere. I'm thinking it could be modified to do something like this:@ReactProp(name = PROP_TEST_ID) public void setTestId(T view, String testId) { try { view.setId(R.id.class.getField(testId).getInt(null)); } catch (Exception e) { // swallow } view.setTag(testId); }
The trick is gaining access to
Rwhich resides in the application's package.If that were in place, the only thing you'd need to do is create a resource file for the ids you'll be referencing:
<?xml version="1.0" encoding="utf-8"?> <resources> <item name="something" type="id"/> </resources>
cc @jasonfma @talarari @sondremare @sijicl @JuliusMalisauskasDB @atom992 @jdeff
52 remaining items
- addedRan CommandsOne of our bots successfully processed a command.One of our bots successfully processed a command.
on Nov 14, 2016 I am testing a react-native application and I do feel I require the support for resource-id. Can you guys open up this ticket again?
Reacted by David Perrenoud, Vetalyo, Roman Kholiavko, Gustavo David de Oliveira Souza, Erik Jonsson Thorén, TOUCH Nguonchhay, Adrian Theodorescu, Gowroji Sunil, Shiva Srinivasan, Maik Kuntze and 4 moreI have the same trouble, for Robo tests needed resource-id for each page component.
Any news about this? Very need this functional. 😞Reacted by Roman Kholiavko, Gustavo David de Oliveira Souza, Erik Jonsson Thorén, TOUCH Nguonchhay, Gowroji Sunil, Shiva Srinivasan, Peter and edreyyoYes we need this as well.
Something new about this issue?
My testing crew is stuck without this. ;/Reacted by Shiva Srinivasan, Victor Vucicevich (Vic Vu), Peter and edreyyo+1 that this will help testing
+1 need this for testing
PLZ, make us happy. Add resource-id support
+1, Please. It will make life easier.
+1
My workaround for testing right now is accessibility Label. However, this does not help with prelaunch Google Play testing :(
+1 our team finds this feature really helpful. Are there any plans on moving this forward?
- locked as resolved and limited conversation to collaborators
on May 24, 2018 - addedResolution: LockedThis issue was locked by the bot.This issue was locked by the bot.
on Jul 19, 2018
Issue Description
There currently isn't a way to find elements by resource-id using appium/uiautomatorviewer.
react-nativecurrently supportscontentDescriptionviaaccessibilityLabel. This is great for clickable elements, but not so great for testing other things like splash screen visibility.I'd be more than willing to add support for this, but am currently not aware of how
react-nativebuilds the android views. If someone could give me some guidance on howandroid:idcould be added to a view then I'd most certainly be willing to give it a shot. My understanding ofandroid:id(per the View docs on IDs), is that it must be set in the XML prior to view creation.I don't believe this is a duplicate of #7135, because I'm not proposing that we break the way testID currently works, more that I feel it would be nice if
testIDcould add it's value to the corresponding view component in the XML.Steps to Reproduce / Code Snippets
testID="something"to any component (e.g.View)uiautomatorviewerYou'll notice that
resource-idis emptyExpected Results
resource-idhas a value likecom.myApp:id/somethingAdditional Information
0.32