Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(image-plugin): Make it possible to find elements inside of other elements #18555

Merged
merged 23 commits into from Apr 24, 2023

Conversation

mykola-mokhnach
Copy link
Collaborator

Proposed changes

appium/java-client#1891

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update (if none of the other choices apply)

@mykola-mokhnach mykola-mokhnach changed the title feat(image-plugin): Make it possible to find elements inside of other elements WIP: feat(image-plugin): Make it possible to find elements inside of other elements Apr 20, 2023
@github-actions github-actions bot added the chore refactoring, overhead, tests, etc. label Apr 21, 2023
@github-actions github-actions bot added @appium/opencv Dependencies issues with dependencies labels Apr 22, 2023
@mykola-mokhnach mykola-mokhnach changed the title WIP: feat(image-plugin): Make it possible to find elements inside of other elements feat(image-plugin): Make it possible to find elements inside of other elements Apr 22, 2023
@mykola-mokhnach
Copy link
Collaborator Author

@jlipps Could you please check the PR one more time?

I did some more changes. I've also replaced jimp with sharp for opencv module (the first one was failing to decode some pictures with weird errors).

I would like to get rid of jimp completely for this plugin in favour of sharp and it would probably be a good idea to do the same in appium/support. I believe @boneskull will also be happy about that

this.imgElCache = new LRU({
max: MAX_CACHE_ITEMS,
maxSize,
sizeCalculation: (el) => el.template.length,
sizeCalculation: (el) => el.template.length + (el.matchedImage?.length ?? 0),
Copy link
Member

Choose a reason for hiding this comment

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

ah so here's the source of the memory leak? nice find!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

no, it is not, but this is anyway more precise than before

@jlipps
Copy link
Member

jlipps commented Apr 24, 2023

we should probably release this as a major version bump

@mykola-mokhnach
Copy link
Collaborator Author

we should probably release this as a major version bump

why so? I did not do any breaking changes

@jlipps
Copy link
Member

jlipps commented Apr 24, 2023

drivers used with the plugin must now implement getWindowRect instead of getWindowSize

@mykola-mokhnach
Copy link
Collaborator Author

drivers used with the plugin must now implement getWindowRect instead of getWindowSize

Ok, let me put the getWindowSize as a fallback

Copy link
Member

@jlipps jlipps left a comment

Choose a reason for hiding this comment

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

OK great!

@mykola-mokhnach mykola-mokhnach merged commit 2796639 into appium:master Apr 24, 2023
8 checks passed
@mykola-mokhnach mykola-mokhnach deleted the el_from_el branch April 24, 2023 20:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@appium/images-plugin @appium/opencv chore refactoring, overhead, tests, etc. Dependencies issues with dependencies Enhancement feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants