Skip to content

Commit

Permalink
fix: nativeID -> testID
Browse files Browse the repository at this point in the history
  • Loading branch information
kirillzyusko committed Nov 19, 2024
1 parent 51db401 commit dc983fa
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/components/BigNumberPad.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ function BigNumberPad({numberPressed, longPressHandlerStateChanged = () => {}, i
e.preventDefault();
}}
isLongPressDisabled={isLongPressDisabled}
nativeID={`button_${column}`}
testID={`button_${column}`}
/>
);
})}
Expand Down
8 changes: 4 additions & 4 deletions src/components/Button/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ type ButtonProps = Partial<ChildrenProps> & {
/** Whether the Enter keyboard listening is active whether or not the screen that contains the button is focused */
isPressOnEnterActive?: boolean;

/** The nativeID of the button */
nativeID?: string;
/** The testID of the button. Used to locate this view in end-to-end tests. */
testID?: string;
};

type KeyboardShortcutComponentProps = Pick<ButtonProps, 'isDisabled' | 'isLoading' | 'onPress' | 'pressOnEnter' | 'allowBubble' | 'enterKeyEventListenerPriority' | 'isPressOnEnterActive'>;
Expand Down Expand Up @@ -245,7 +245,7 @@ function Button(
link = false,
isContentCentered = false,
isPressOnEnterActive,
nativeID,
testID,
...rest
}: ButtonProps,
ref: ForwardedRef<View>,
Expand Down Expand Up @@ -414,7 +414,7 @@ function Button(
hoverDimmingValue={1}
onHoverIn={() => setIsHovered(true)}
onHoverOut={() => setIsHovered(false)}
nativeID={nativeID}
testID={testID}
>
{renderContent()}
{isLoading && (
Expand Down
14 changes: 7 additions & 7 deletions src/components/Pressable/GenericPressable/index.e2e.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@ import type PressableProps from './types';

const pressableRegistry = new Map<string, PressableProps>();

function getPressableProps(nativeID: string): PressableProps | undefined {
return pressableRegistry.get(nativeID);
function getPressableProps(testId: string): PressableProps | undefined {
return pressableRegistry.get(testId);
}

function E2EGenericPressableWrapper(props: PressableProps, ref: PressableRef) {
useEffect(() => {
const nativeId = props.nativeID;
if (!nativeId) {
const testId = props.testID;
if (!testId) {
return;
}
console.debug(`[E2E] E2EGenericPressableWrapper: Registering pressable with nativeID: ${nativeId}`);
pressableRegistry.set(nativeId, props);
console.debug(`[E2E] E2EGenericPressableWrapper: Registering pressable with testID: ${testId}`);
pressableRegistry.set(testId, props);

DeviceEventEmitter.emit('onBecameVisible', nativeId);
DeviceEventEmitter.emit('onBecameVisible', testId);
}, [props]);

return (
Expand Down
2 changes: 1 addition & 1 deletion src/components/Search/SearchRouter/SearchButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function SearchButton({style}: SearchButtonProps) {
return (
<Tooltip text={translate('common.search')}>
<PressableWithoutFeedback
nativeID="searchButton"
testID="searchButton"
accessibilityLabel={translate('common.search')}
style={[styles.flexRow, styles.touchableButtonImage, style]}
onPress={Session.checkIfActionIsAllowed(() => {
Expand Down
4 changes: 2 additions & 2 deletions src/components/SelectionList/BaseListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function BaseListItem<TItem extends ListItem>({
onFocus = () => {},
hoverStyle,
onLongPressRow,
nativeID,
testID,
}: BaseListItemProps<TItem>) {
const theme = useTheme();
const styles = useThemeStyles();
Expand Down Expand Up @@ -107,7 +107,7 @@ function BaseListItem<TItem extends ListItem>({
onMouseLeave={handleMouseLeave}
tabIndex={item.tabIndex}
wrapperStyle={pressableWrapperStyle}
nativeID={nativeID}
testID={testID}
>
<View
style={[
Expand Down
2 changes: 1 addition & 1 deletion src/components/SelectionList/InviteMemberListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ function InviteMemberListItem<TItem extends ListItem>({
onFocus={onFocus}
shouldSyncFocus={shouldSyncFocus}
shouldDisplayRBR={!shouldShowCheckBox}
nativeID={item.text}
testID={item.text}
>
{(hovered?: boolean) => (
<>
Expand Down
4 changes: 2 additions & 2 deletions src/components/SelectionList/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -312,8 +312,8 @@ type BaseListItemProps<TItem extends ListItem> = CommonListItemProps<TItem> & {
hoverStyle?: StyleProp<ViewStyle>;
/** Errors that this user may contain */
shouldDisplayRBR?: boolean;
/** Native ID of the component */
nativeID?: string;
/** Test ID of the component. Used to locate this view in end-to-end tests. */
testID?: string;
};

type UserListItemProps<TItem extends ListItem> = ListItemProps<TItem> & {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/iou/MoneyRequestAmountForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ function MoneyRequestAmountForm(
style={[styles.w100, canUseTouchScreen ? styles.mt5 : styles.mt3]}
onPress={() => submitAndNavigateToNextPage()}
text={buttonText}
nativeID="next-button"
testID="next-button"
/>
)}
</View>
Expand Down

0 comments on commit dc983fa

Please sign in to comment.