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

Can't define headers testIDs #9232

Open
paulatomasi opened this issue Jan 19, 2021 · 5 comments
Open

Can't define headers testIDs #9232

paulatomasi opened this issue Jan 19, 2021 · 5 comments

Comments

@paulatomasi
Copy link

paulatomasi commented Jan 19, 2021

I'm using detox to E2E tests, for that I need to inform testID props to the components I'm interacting with. Since I started using this new approach to stack navigator, I couldn't find a way to use testID.

const HomeStack = createStackNavigator<HomeStackParamsList>()

const HomeNavigator = (): ReactNode => {
  return (
    <HomeStack.Navigator
      initialRouteName={Screens.HomeScreen}
      screenOptions={({ navigation }) => ({
        ...TransitionPresets.SlideFromRightIOS,
        ...getHeaderOptions({ navigation }),
      })}
    >
      [...]
      <HomeStack.Screen
        name={Screens.FindSellerScreen}
        component={FindSellerScreenConnected}
        options={{
          title: 'Find a seller',
        }}
      />
      <HomeStack.Screen
        name={Screens.StoresListScreen}
        component={StoresListScreenConnected}
        options={{
          title: 'Stores list',
        }}
      />
    </HomeStack.Navigator>
  )

In the docs, I only find about it here, but it's from bottom tab navigator, which is not the case.

I thought about something like this:

<HomeStack.Screen
  name={Screens.FindSellerScreen}
  component={FindSellerScreenConnected}
  options={{
    headerRight: () => null,
    title: 'Find a seller',
    testID: 'nav_bar.find_seller',
  }}
/>

Is it possible?

Versions
@react-navigation/bottom-tabs: 5.11.2
@react-navigation/native: 5.8.10
@react-navigation/stack: 5.12.8

@github-actions
Copy link

Couldn't find version numbers for the following packages in the issue:

  • @react-navigation/native

Can you update the issue to include version numbers for those packages? The version numbers must match the format 1.2.3.

@github-actions
Copy link

The versions mentioned in the issue for the following packages differ from the latest versions on npm:

  • @react-navigation/bottom-tabs (found: 5.11.2, latest: 5.11.3)
  • @react-navigation/native (found: 5.8.10, latest: 5.9.0)
  • @react-navigation/stack (found: 5.12.8, latest: 5.13.0)

Can you verify that the issue still exists after upgrading to the latest versions of these packages?

@jerimiah797
Copy link

jerimiah797 commented Jan 31, 2022

Still occurring with:

  • @react-navigation/bottom-tabs 5.11.15
  • @react-navigation/native 5.9.8
  • @react-navigation/stack 5.14.9

I can't test my app (easily) in other languages as long as there is no single string representing the header text, such as testID.

Thanks!

@arttumat
Copy link

arttumat commented Jan 3, 2023

Still an issue with:

"@react-navigation/drawer": "^6.5.0",
"@react-navigation/native": "^6.0.2",
"@react-navigation/native-stack": "^6.1.0",

I am trying to write e2e tests using appium, and it looks like Appium cannot see the header at all.

@barrymichaeldoyle
Copy link

Still an issue 😢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants