testID property does not map from NativeBase component to the react-native base component class
Hi! Thanks for trying out NativeBase! Due to the overwhelming requests and issues/questions we ask you to add the following details with your issue.
Please check the existing open/closed issues for a possible duplicate before creating a new issue :)
Also DO fill out the below form to give us a better idea about your environment and help us debug it quicker. Issues without the required details will mostly be unattended to.
There were two issues opened/closed on this but the fix is still not present in the latest release.
#1230 XCUITest is failing because testID cannot be found when using native base components Opened by cutemachine Sep 14, 2017 5 comments
#1352 Not able to automate the app due to missing "accessibilityLabel" or "testID"
Opened by sasasa42 Nov 8, 2017 1 comment
react-native, react and native-base version
"native-base": "^2.3.10", "react-native": "0.54.2", "react": "^16.3.0-alpha.1"
Expected behaviour
When setting testID on NativeBase components the inspector displays the test id
Actual behaviour
testID is not propagated to the base react component is as such is hidden from the inspector and cannot be used when doing automation tests using Detox
Steps to reproduce (code snippet or screenshot)
import { Container, Content, Text, List, ListItem } from "native-base"; import VersionNumber from 'react-native-version-number'; import {logOut} from "../../screens/Login/actions"; import {changeMenuOptions} from "./actions"; import { connect } from "react-redux"; import styles from "./styles";
class MenuDrawer extends React.Component {
componentWillMount() {
}
render() {
return (
</Content>
</Container>
);
}
Screenshot of emulator/device
Is the bug present in both ios and android or in any one of them?
Both iOS and Android
Any other additional info which would help us debug the issue quicker.
import React from 'react'
import { Text } from 'react-native'
//map testID to the base component
export const Counter = ({value, testID}) =>
After using Nuclide inspector, testID's are visible on NativeBase components.
@jrryhrtn I don't understand your last comment. how do we fix this issue with nuclide?
@ktajpuri did you manage to fix it? We're having similar problem with Tabs
I was faced with the same issue and found such workaround:
<Tab
key={tab.heading}
heading={
<TabHeading>
<Text
accessibilityLabel="My Tab"
testID="My Tab"
>
{tab.heading}
</Text>
</TabHeading>
}
>
{tab.content}
</Tab>
I was faced with the same issue and found such workaround:
<Tab key={tab.heading} heading={ <TabHeading> <Text accessibilityLabel="My Tab" testID="My Tab" > {tab.heading} </Text> </TabHeading> } > {tab.content} </Tab>
This workaround worked for me. Btw, if you want to customize heading text style, you can read this thread. https://stackoverflow.com/questions/43113859/customise-tabs-of-native-base