0

I am having troubles with changing date on Android, on iOS its easy since there is inbuild function in detox for it.

      async setDateOnAgeGate(date, dateformat, year, month, day){
      if (device.getPlatform() === 'android') {
      await actions.selectDateAndroid(this.ageGateDatePicker, year, month, day )
      } else {
      await actions.selectDate(this.ageGateDatePicker, date, dateformat)
    }

not working

      const selectDateAndroid = async (target, androidYear, androidMonth, androidDay) => {
      const today = new Date();
      const month = today.toLocaleString('default', { month: 'long' });
      const day = today.toLocaleString('default', { day: 'numeric' });
      const year = today.toLocaleString('default', { year: 'numeric' });
      await waitForElement(target);
      await element(by.text(day)).tap();
      await element(by.text(day)).replaceText(androidDay);
      await element(by.text(year)).tap();
      await element(by.text(year)).replaceText(androidYear);
      await element(by.text(month)).tap();
      await element(by.text(month)).replaceText(androidMonth);
      };

Its not seeing any of the text values of day,month,year. Does anyone have any method to target these?

Datepicker

0 Answers0