Detox: Example of Using Contact Picker, Date Picker

Created on 11 Oct 2017  路  4Comments  路  Source: wix/Detox

Any example on how to work with

  1. Contact Picker
  2. Date Picker

Thanks!

questiostack overflow

Most helpful comment

@rengarima we are testing the react-native-modal-datetime-picker in our project using by.text().

add a testID to your datepicker and then run:

    await element(by.id('datepicker')).tap();
    await element(by.text('2017')).tap();
    await element(by.text('2016')).tap();
    await expect(element(by.text('OK'))).toBeVisible();
    await element(by.text('OK')).tap();

Hope this helps!

All 4 comments

@rengarima we are testing the react-native-modal-datetime-picker in our project using by.text().

add a testID to your datepicker and then run:

    await element(by.id('datepicker')).tap();
    await element(by.text('2017')).tap();
    await element(by.text('2016')).tap();
    await expect(element(by.text('OK'))).toBeVisible();
    await element(by.text('OK')).tap();

Hope this helps!

@SMJ93 That is not a scalable solution. If you had a large range of years, such as 1901-2051 and you wanted to pick 1973, that element does not exist to be selected by text (internally, the picker view reuses views to only hold the visible views in memory).

Thanks @SMJ93 this works!

Would you have some idea for Contact Picker, I have tried searching by text, label but not sure if Detox can handle that?

Since iOS 9, all contact view controllers render in a different process. That is not supported by Detox.

Was this page helpful?
0 / 5 - 0 ratings