wix / Detox

Gray box end-to-end testing and automation framework for mobile apps
https://wix.github.io/Detox/
MIT License
11.19k stars 1.92k forks source link

How to choose flag for <PhoneInput> Component ? #3249

Closed lisa-gogo closed 2 years ago

lisa-gogo commented 2 years ago

Description

This is PhoneInput component, I want to choose other country' flag

<View testID="PhoneNumber>
         <PhoneInput
            value={phoneRegisteredUser.slice(2)}
            style={styles.InputContainer}
            textStyle={styles.phoneInputTextStyle}
            ref={phoneRef}
            initialCountry={'us'}
            onPressFlag={onPressFlag}
            allowZeroAfterCountryCode={false}
            textProps={{
              placeholder: IMLocalized('Phone Number'),
              placeholderTextColor: '#dcdcdc',
            }}
         />
</View>

After I tap this testID, I can't open flag list. It will only allow enter phone number.

Screen Shot 2022-03-05 at 9 32 50 PM

What should I do with detox ?

Your environment

Detox version: React Native version: Node version: Device model: OS: Test-runner (select one): jest-circus / jest+jasmine / mocha / other

asafkorem commented 2 years ago

Hey @lisa710junyi, I'm not familiar with this component, so I'm not sure what exactly are you trying to achieve UI-wise. However, I can only guess what is required here:

Please ask the team that maintains this dependency for the required test-IDs, or check in their documentation whether they already provide these.

lisa-gogo commented 2 years ago

Hi @asafkorem Thank you for helping me.

 <View testID="PhoneNumber">
          <PhoneInput
            value={phoneRegisteredUser.slice(2)}
            style={styles.InputContainer}
            textStyle={styles.phoneInputTextStyle}
            ref={phoneRef}
            initialCountry={'us'}
            onPressFlag={onPressFlag}
            allowZeroAfterCountryCode={false}
            textProps={{
              placeholder: IMLocalized('Phone Number'),
              placeholderTextColor: '#dcdcdc',
            }}
          />
        </View>
it('Enter phone number, tap send code and enter verification code',async()=>{
await element(by.id('PhoneNumber')).tap()
await element(by.id('PhoneNumber')).typeText('123456')
await element(by.id('sendCode')).tap()

})


I am not able to open flag list. I only allow for entering phone number. Thank you so much.
asafkorem commented 2 years ago

Hi @lisa710junyi, I'm closing the issue.

As I mentioned, in order to open the flag list you must be able to access the flag element by test-id, which should be provided by the maintainers of this component.

Let me know if there's anything help we can help with! 🙂