Xamarin.UITest: how to set date on DatePicker component?

  android, emulation, testing, xamarin, xamarin.forms

I want to write some functional tests on my app. I have simple window with on DatePicker component:

<DatePicker AutomationId="PlanWyborDaty" Date="{Binding Data, Mode=TwoWay}" Format="dddd, dd-MM-yyyy" Margin="8, 0" DateSelected="OnDateChange"  />

I tried these codes in my test method:

app.Query(x => x.Marked("PlanWyborDaty").Invoke("updateDate", 2020, 9, 2));
app.Query(x => x.Class("DatePicker").Invoke("updateDate", 2020, 9, 2));

but date in picker is still the same. I searched a lot, and found only these methods. Any ideas?

Emulator is Pixel 2 API 28 Android 9.0

Source: Android Questions

LEAVE A COMMENT