Hi,
Our app has a menu button on the navigation bar but our tests don't seem to be able to select it.
We are setting the accessibility identifier for the UIBarButtonItem like this:
var menuButton = new UIBarButtonItem(UIImage.FromBundle("MenuIcon"), UIBarButtonItemStyle.Plain, ShowMenu)
{
AccessibilityIdentifier = NavigationMenuButtonIdentifier
};
NavigationItem.RightBarButtonItem = menuButton;
But when I capture the controls that are currently visible on the screen we see this:
ID:
Class: UINavigationButton
Description: >
Rect: 272 x 26, 43 x 30
Enabled: True
Label: MenuIcon
Because the accessibility identifier doesn’t appear to be set our tests that are trying to open the menu are failing. Can anyone give any guidance on why the ID doesn’t appear to be getting set?
Or some more general advice on how to write tests that interact with a UIBarButtonItem?
Answers
Any resolution to this? I see AccessbilityIdentifier on UIBarButtonItem BUT ONLY on the simulator builds. If I run a device build, a lot of my AccessibilityIdentifiers are blank.