Text matching queries are returning substring matches in addition to exact matches

34 views
Skip to first unread message

David van der Bokke

unread,
Jul 12, 2011, 3:33:57 PM7/12/11
to Frank
I noticed that text matching queries return substring matches as well
as exact matches. Is there a way to force exact match only?

For example.. if I have frankly_map("label text:'Sign In'", "touch")
it will try to touch "Sign In using facebook" as well as "Sign In".

The offending code seems to be in UISpec's UIFilter.m line 59 which is
explicitly checking for rangeOfString(substring match) instead of
using compare(exact match)

Stewart Gleadow

unread,
Jul 12, 2011, 5:24:59 PM7/12/11
to frank-...@googlegroups.com
I've noticed that before. It's often a problem on my current project where you might have two buttons containing some of the same text. The solution so far has been to tweak the accessibility labels to be more descriptive and hence differentiate the two.

Maybe we should extend the 'marked' capability to just to also have 'markedExactly' or something else to check that.

In the mean time, you could do the checking on the Ruby side for an exact match... written without running, but something like:

views = frankly_map("view", "accessibilityLabel")
views.each do |view|
# check exact match here
end

- Stew

David van der Bokke

unread,
Jul 12, 2011, 5:29:43 PM7/12/11
to frank-...@googlegroups.com
Thanks for the info/suggestion.  I strongly feel that this is something we should consider fixing at the Frank/UISpec level in the long term.  Otherwise we are doing more things that should be framework features within our test code.

Pete Hodgson

unread,
Jul 12, 2011, 6:11:47 PM7/12/11
to frank-...@googlegroups.com

I agree that the substring matching by default is annoying. We inherited this from UISpec, and unfortunately at this point it would break too much stuff if we changed the semantics. I like Stew's suggestion of a new markedExactly: method on UIQuery.

Cheers,
Pete
--
Typed on a teeny tiny keyboard

Pete Hodgson

unread,
Jul 13, 2011, 11:00:19 AM7/13/11
to frank-...@googlegroups.com
I added an issue in Github for adding a new markedExactly: method. Any takers? :)

--
Pete Hodgson
Señor Consultant!

cell: 707-206-8897
skype: thepete

Reply all
Reply to author
Forward
0 new messages