Yes
This issues is related to #2621 but it seems that the solution for this isn't properly implemented
On iOS since the update to {N} 2.4 our automation tests with appium are broken. This is because the Value of the accesibilityLabel now is the same as the identifier. This means we can't retrieve the values in the elements anymore.
iOS
Add an automationText to a Label element and then run your app in the iOS emulator
Open Xcode
In the menu go to Xcode -> Open Developer Tool -> Accesibility Inspector
Then select the Label on which you added the automationText
Notice that the value in Basic -> Value is now showing the automationText
As stated in the original issue report i think there should be a seperate property for changing the accesibilityLabel. And if there isn't one specified it should just set the text of the Label as accesibilityLabel.
From their documentation:
asccessiblityIdentifier:
An identifier can be used to uniquely identify an element in the scripts you write using the UI Automation interfaces. Using an identifier allows you to avoid inappropriately setting or accessing an element’s accessibility label.
accessibilityLabel:
If you implement a custom control or view or if you display a custom icon on a UIKit control, set this property to make sure your accessibility elements have appropriate labels. If an accessibility element does not display a descriptive label, set this property to supply a short, localized label that succinctly identifies the element. For example, a “Play music” button might display an icon that shows sighted users what it does. To be accessible, however, the button should have the accessibility label “Play” or “Play music” so that an assistive application can provide this information to users with disabilities. Note, however, that the label should never include the control type (such as “button”) because this information is contained in the traits associated with the accessibility element.
Hi @m-abs,
We are aware of these differences that is why we did only automationText. There is no way to change the android implementation that is why @tsonevn suggested to change the current implementation to set both properties on ios. Adding new property will probably confuse people - they might think that setting both is good practise but in the end on android we will set only contentDescriptor and this will generate more support.
Do you think setting both properties for ios will be a problem?
Right now it is indeed a problem for us.
Unless we should use a different way in appium to retrieve the real value from the elements. But please let me know how we should achieve that as currently we can't find any other property or method to retrieve the texts inside the elements with an automationText.
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
For our needs, accessibilityLabel could be implemented in our plugin @nota/nativescript-accessibility-ext and the PR #2678 for {N} could be reverted.
We chose not to add it to @nota/nativescript-accessibility-ext because we already had gotten it under automationText in {N}.
I still think that using android:contentDescription on android for the same purpose as accessibilityIdentifieron iOS is strange, as they serve very different purposes. Setting accessibilityLabel made it less strange.
Could you give a code example of how to set the accessibility label? Correct me if I'm wrong, but the accessibility label is going to provide the same value for android:contentDescription and iOS accessibilityIdentifier?
for nativescript 3.0 we used the following workaround:
import * as viewCommon from 'ui/core/view';
viewCommon.View.prototype[viewCommon.automationTextProperty.setNative] = function (value) {
this.nativeView.accessibilityIdentifier = value;
// Disable setting accessibilityLabel so labels still have there original text
// this.nativeView.accessibilityLabel = value;
};
With @nota/nativescript-accessibility-ext from 3.0.0-alpha.7 support setting accessibilityIdentifier and accessibilityLabel separately.
Most helpful comment
With
@nota/nativescript-accessibility-extfrom 3.0.0-alpha.7 support settingaccessibilityIdentifierandaccessibilityLabelseparately.