Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/add appium detox test id support #1359

Conversation

galkahana
Copy link
Contributor

Summary

I'm looking to allow testing SVG elements with Appium or Detox automated testing tools.
To allow Detox, testID attribute must be implemented and relevant native attribute set.
Appium can use testID on IOS but the attribute is not available for Appium testers on Android, and then they use accessibilityLabel (which sets content-description which is available for Appium).
For both ios and android it is important to allow to set the "accessible" value (though for different usages and reasons) in order to make the element visible in Appium.

long story short. Support is required for:

  • testID
  • accessibliltyLabel
  • accessible

The attributes implement direct setters on native views, and you just need to know which attributes to set to match what is set for the base React Native views.

Test Plan

To test you can use Appium Desktop and see that setting the props makes the relevant props visible, in a similar manner to plain RN views. e.g. "content-description" would be set for "accessibiltyLabel" in android. "testID" would map the "name" in IOS.

For detox, in particular in Android, where it is different from Appium, it is possible to write a basic test in detox and run it.

What's required for testing (prerequisites)?

you will want detox and appium setups. and some basic tests.

What are the steps to reproduce (after prerequisites)?

For appium, best is to just view the relevant properties (testID and accessibilityLabel) in Appium desktop.

For detox, running a test successfully will work.

Compatibility

OS Implemented
iOS
Android

Checklist

  • [v ] I have tested this on a device and a simulator
  • I added documentation in README.md
  • [v ] I updated the typed files (typescript)
  • I added a test for the API in the __tests__ folder

@galkahana
Copy link
Contributor Author

There's one more thing i'm looking at now, to complement this effort.
At this point in time SVG elements give out erroneous bounds values in the Android implementation of appium inspector (uiautomation2 but also others). this means that while setting id's is possible with this PR, finding them now requires "show invisible elements" option, and also it's not possible to click on them. I believe,at this point, that this is tied to missing accessibility data and I will look to correct this too. I got a pointer to the computation in appium automater and will see what's missing. Other scenarios (detox, ios appium) should operate well.

Copy link
Contributor

@maxkomarychev maxkomarychev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

@galkahana galkahana mentioned this pull request May 5, 2020
4 tasks
@galkahana
Copy link
Contributor Author

About my comment here, I created a new PR to extend this one (and serve as replacement) that takes care of properly setting accessibility info so that elements are interactable in appium on android:
#1372

@gfirmacionpear
Copy link

Any chance we can get this merged in?

@iMaupin
Copy link

iMaupin commented May 31, 2022

I second @gfirmacionpear 's request to merge. Having the ability to use testIDs is much desired.

@WoLewicki
Copy link
Member

Closing since #2001 has been merged.

@WoLewicki WoLewicki closed this Mar 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants