sbycrosz / react-native-credit-card-input

Easy, cross-platform credit-card input for your React Native Project! Start accepting payment 💰 in your app today!
MIT License
1.46k stars 699 forks source link

Can't pass testID to run my e2e test #161

Closed smakosh closed 2 years ago

smakosh commented 4 years ago

Details

Example

<LiteCreditCardInput
  onChange={handleCreditCardInput}
  additionalInputsProps={{
    number: {
      testID: 'stripe-input-credit-card',
    },
    expiry: {
      testID: 'stripe-input-expiry',
    },
    cvc: {
      testID: 'stripe-input-cvc',
    },
  }}
/>
smakosh commented 4 years ago

@sbycrosz 👀

Damimd10 commented 4 years ago

Hi @smakosh I test it with the same component and works for me, can you paste an example of your test code, please?

smakosh commented 4 years ago

Hi @smakosh I test it with the same component and works for me, can you paste an example of your test code, please?

Sure will do tomorrow morning

smakosh commented 4 years ago

Hey @Damimd10, Could you share your code snippet here.

I'm using Detox and here's the error log:

Screen Shot 2020-01-22 at 19 55 42

And here's my code snippet

<LiteCreditCardInput
  onChange={handleCreditCardInput}
  inputStyle={styles.creditCardInput}
  additionalInputsProps={{
    number: {
      testID: 'stripe-input-credit-card',
    },
    expiry: {
      testID: 'stripe-input-expiry',
    },
    cvc: {
      testID: 'stripe-input-cvc',
    },
  }}
/>

my e2e test snippet code responsible for that

....
await element(by.id('stripe-input-credit-card')).typeText(
  '5111111111111118'
)
await element(by.id('stripe-input-expiry')).typeText('1221')
await element(by.id('stripe-input-cvc')).typeText('123')
await element(by.id('confirm-payment')).tap()
....

Credit card credentials have been taken from Stripe docs

designervoid commented 3 years ago

@smakosh this is working on Android, but not working on iOS

designervoid commented 3 years ago

@smakosh are you using javascript in your e2e tests?

smakosh commented 3 years ago

@smakosh are you using javascript in your e2e tests?

Detox

designervoid commented 3 years ago

@smakosh yeah i understanding that. me too. but my tests written on typescript.

designervoid commented 3 years ago

here an example