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

Accessibility Label for Tab Navigator on Android not found #4000

Closed
ahmad2smile opened this issue Apr 17, 2018 · 1 comment
Closed

Accessibility Label for Tab Navigator on Android not found #4000

ahmad2smile opened this issue Apr 17, 2018 · 1 comment

Comments

@ahmad2smile
Copy link

Current Behavior

  • What code are you running and what is happening?
    I'm trying to access Tab Components of Tab Navigator using testID or accessibilityLabel. It is working fine on iOS and Recording Tests on Xcode works.
    But on android Test recorder doesn't capture accessibilityLabel or testID. Which are provided like following:
       static navigationOptions = {
		tabBarTestIDProps: {
			testID            : "tasksTab",
			accessibilityLabel: "tasksTab"
		},
		tabBarIcon: ({ tintColor }) => (
			<View accessible accessibilityLabel="tasksTabIcon" testID="tasksTabIcon">
				<TabIcon tintColor={tintColor} name="tasks" />
			</View>
		)
	}

Trying to access accessibilityLabel with:

ViewInteraction tasksTab = onView(withContentDescription("tasksTab"));

results in error:

android.support.test.espresso.NoMatchingViewException: No views in hierarchy found matching: with content description: is "tasksTab"

But if I access tasksTabIcon it works but action click() has no joy on it. Also I have to select the 1st element as it finds multiple instances for tasksTabIcon.

ViewInteraction tasksTab = onView(first(withContentDescription("tasksTabIcon")));
tasksTab.perform(click());

I've also checked it with Layout Inspector but the behavior is the same. Label for tasksTabIcon is present but label for tasksTab is not.

  • Include a screenshot if it makes sense.
    No.

Expected Behavior

  • What do you expect should be happening?

Tab Components should be available in Android for Espresso with withContentDescription as they are in iOS.

  • Include a screenshot if it makes sense.
    No.

How to reproduce

Just assign accessibilityLabel to any Tab Component in Tab Navigator and try to check if isDisplayed() with Android Studio's Espresso.

Your Environment

software version
react-navigation 1.5.11
react-navigation-redux-helpers 1.0.5
react-native 0.51.0
node 9.5.0
npm or yarn 5.6.0 / 1.5.1
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

No branches or pull requests

2 participants