xamarinxamarin.androidnunitui-testinglong-click

How to trigger an Android LongClick in Xamarin UI Test


I've got a RecyclerView with a ActionMode which can be activated by a long click on a RecyclerView item.

How to trigger a long click in Android with Xamarin UI tests? AndroidApp contains a method TouchAndHold(Func query) but this one seems not to trigger a long click.

Anyone here have a solution?

My code:

   Func<AppQuery, AppQuery> test = c => c.Marked("Test");
   app.WaitForElement (test);
   app.TouchAndHold (test);

Solution

  • TouchAndHold should trigger a LongClick.

    I forgot to build a new release apk where i implemented the OnLongClick functionality. After building a new apk the TouchAndHold worked as expected