action #31198

Multi area needles: support needle-checks relative to previous matches

Added by nicksinger over 2 years ago. Updated 6 months ago.

Feature requests
Target version:
Start date:
Due date:
% Done:


Estimated time:



openQA already supports needles with more then one area to check. These needles can be used for e.g. assert_and_click while openQA will click in the last area created for the needle (from the docs: "[…] Then click $button in the middle of the last match region as defined in the needle JSON file.").


Right now the areas in the needle get matched independent of each other. It can happen that one area of the needle matches multiple places on a screenshot. If this smaller area gets (indirectly) used for an assert_and_click this can result in a click on the wrong UI element even though the bigger, second area of the needle matches the right region in the screenshot.

Suggested solution

Implement some mechanism/flag to make sure the second needle matches inside the first one


#1 Updated by StefanBruens over 2 years ago

So the click area is just a region fully contained in one of the other areas?

Wouldn't it be better to just allow an offset in this case?

#2 Updated by coolo over 2 years ago

that's a bit hard to support as is in the needle editor. But what this 2nd needle actually is, is a different type of area - it shouldn't be matched at all, but only used for clicking, no?

#3 Updated by nicksinger over 2 years ago

Most of the time you could say it is only relevant for clicks.
But I also see the use-case for "normal" needles. Take our check for the root-console as example ("cleared-console-root-20170404" e.g. I've seen fails of this where the two parts of the needle get matched completely independent of each other. Check-boxes are also a pretty good example where you've multiple of them on the screen but only want to check (as in "needle-check") a specific one but you cannot cover it as one big region.

#4 Updated by coolo over 2 years ago

this would make designing needles even more of an art - left aside designing an editor for that

#5 Updated by nicksinger over 2 years ago

No, this is the reason I created this feature request. To reduce the "art" needed in some cases. Especially in cases where the greatest "art" can not help - e.g. (again):
Also the editor could stay like it already is with the addition of a simple checkbox: "Match areas relative to each other" or "Keep distances between match areas".

#6 Updated by okurz over 1 year ago

  • Category set to Feature requests

#7 Updated by okurz 6 months ago

  • Priority changed from Normal to Low

#8 Updated by StefanBruens 6 months ago

  • Status changed from New to Feedback
  • Assignee set to nicksinger

I think the use case is completely covered by the click coordinates which can now be used.

Maybe we should check old needles for small areas completely contained in larger areas, and then migrate these to click points.

#9 Updated by okurz 6 months ago

  • Status changed from Feedback to Resolved

great to hear that. I think old needles will be eventually faded out, deleted, and recreated with click areas anyway when there is a mismatch.

Also available in: Atom PDF