Skip to content
This repository has been archived by the owner on Oct 25, 2023. It is now read-only.

feat: Support multiple image match in findByImage #449

Merged
merged 18 commits into from
Feb 19, 2021
Merged

feat: Support multiple image match in findByImage #449

merged 18 commits into from
Feb 19, 2021

Conversation

khaong
Copy link
Contributor

@khaong khaong commented Jan 6, 2021

Hi,

For my appium use case, there may be multiple places on the screen which has the same image and I'd like to find them all.

I am not a javascript dev by trade, so would definitely welcome any comments on this!

Thanks
Alex

Depends on these changes in appium-support: appium/appium-support#212 -> now published in 2.50
TODO: bump the appium-support version number to bring in those changes

@khaong khaong changed the title Support multiple image match in findByImage feat: Support multiple image match in findByImage Jan 6, 2021
@khaong khaong marked this pull request as ready for review January 6, 2021 05:13
@khaong khaong marked this pull request as draft January 6, 2021 05:13
@mykola-mokhnach
Copy link
Contributor

Please bump the minimum version of the appium-support module in package.json

refactor: remove MATCH_TEMPLATE_MULTIPLE and use the options instead to denote multiple match behaviour
fix: don't mess with the result for the  other modes
@khaong khaong marked this pull request as ready for review January 15, 2021 02:50
@mykola-mokhnach
Copy link
Contributor

@khaong Do you have time to finish the PR?

@khaong
Copy link
Contributor Author

khaong commented Feb 18, 2021

Apologies, things got busy (we came out of lockdown in Melbourne 😅) - I'll spend some time on it this weekend

@@ -45,17 +60,34 @@ commands.compareImages = async function compareImages (mode, firstImage, secondI
case MATCH_TEMPLATE_MODE.toLowerCase():
// firstImage/img1 is the full image and secondImage/img2 is the partial one
result = await imageUtil.getImageOccurrence(img1, img2, options);

if (options.multiple) {
return result.multiple.map(convertVisualizationToBase64);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants