instea / react-native-popup-menu

Popup menu component for React Native
ISC License
1.48k stars 248 forks source link

Unable to find MenuOption by testID #253

Open plambir93kek opened 2 years ago

plambir93kek commented 2 years ago

Hi, i use Jest framework and RNTL for e2e testing, and i faced with the problem. No MenuOption in snapshots, also unable to find MenuOption by testID after fireEvent.press(trigger). Is there any way to have e2e tests with this library?

<MenuOption
      customStyles={{ optionTouchable: { testID: 'option' }}}
      disabled={isDisabled}
      value={value}
      onSelect={handleSelect}>
      {icon && <View style={[style.icon, iconStyle]}>{icon}</View>}
      <AppText style={titleStyle}>{title}</AppText>
    </MenuOption>
pramahaditamaputra commented 1 year ago

Hi @plambir93kek did you found any solution for this ? because i'm facing this the same issue right now

sodik82 commented 1 year ago

just curious, what everything is under your test?

because MenuOptions are rendered inside MenuProvider component normally

kkaplinski commented 1 year ago

I'm facing the same issue. Even when I manually set opened={true}, there is no menu options in the snapshot. I render menu component inside Menu Provider in my tests.

daves28 commented 1 day ago

This is still an issue. The MenuOptions component, and therefore all MenuOption components, do not appear in the screen.debug snapshot from @testing-library/react-native.