I am trying to pass in contentDescription into a custom step definition, with little success and I am not sure I can do it, there is very little help out there, so I am a bit lost.
so I have started calabash-android console then start_test_server_in_background then query("TextView") which returns a list of elements in the textView, in this list are contentDescription, each has a string value, e.g "thisIsValue"
now I have written a step in my feature file as:
Then I touch contentDescription "thisIsValue" text
the syntax of my custom step method is:
Then /^I touch contentDescription text (\d+)$/ do |text, contentDescription| tap_when_element_exists("contentDescription contentDescription:#{arg1}")
I'm starting to think passing in contentDescription just isn't possible for multiple values of the same text on a form, using ID is not possible due to the way xamarin forms are generated in our instance, another option would be on index, however that is not really good moving forward.
thanks all.
Graeme
There are few possibly wrong details about your step definition.
(\d+)
regular expression indicates, that you are looking only for elements with digits in contentDescription. text
and contentDescription
).TextView
, ImageView
, *
etc., but you want to tap contentDescription
element. contentDescription
with value of arg1
, but there is none arg1
inside your block. contentDescription
's value in your query.So, your step definition possibly should look something like that:
Then /^I touch contentDescription text: (.*?)$/ do |arg1|
tap_when_element_exists("TextView contentDescription:'#{arg1}'")
end