-
-
Notifications
You must be signed in to change notification settings - Fork 37
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
Ws/create separate service #325
Conversation
- add ocrGetText command
- update deps
- return filepath
- refactor code a bit - fix properly cropping
- completely remove the node-canvas dependency to draw OCR images
- change element to haystack
- restructure tests
🦋 Changeset detectedLatest commit: da83d14 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One comment:
- can we remove the
ocr
prefix in the function and file names? I think it is clear to what they belong to
"url": "https://github.com/webdriverio/visual-testing.git" | ||
}, | ||
"bin": { | ||
"ocr-service": "./dist/cli.js" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
usually for CLIs I create a bin/index.js
file that imports ../dist/cli.js
because afaik these files need to be excutedable (e.g. chmod +x ./bin/index.js
) which we can't do for compiled files. Can you verify this works, maybe this is not needed anymore?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good one, when I use the current config (npm run watch
) and call npx ocr-service
it works without changing any rights.
Any other suggestions on how to test this?
I called the files the same name as the functions that reflect the browser commands. Is this a bad practice? I removed the |
Oh, that makes sense 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
returned text from system tesseract had unescaped txt in the result which resulted in a parsing error, now the text is abstracted differently
Note
This PR replaces this PR and addresses the feedback
This PR will migrate the OCR service, from https://github.com/wswebcreation/wdio-ocr-service, to the Visual service
🚀 New Feature
Sometimes it can be hard to find an element in a mobile native app or desktop site, with an interactable Canvas, with the default WebdriverIO selectors. In that case, it would be nice if you would be able to use something like OCR (Optical Character Recognition) to interact with elements on your device/screen.
The new
@wdio/ocr-service
service provides you with the option to interact with elements based on visible text. It will provide multiple commands to:with an element, all based on text.
The following commands will be added
ocrGetText
ocrGetElementPositionByText
ocrWaitForTextDisplayed
ocrClickOnText
ocrSetValue
A CLI command will also be provided to pre-check text received form image. For a demo check this video
visual-service-ocr.mp4
🐛 Bug Fixes
appium:app
behaves as web session and fails #333Polish 💅
Error: Module did not self-register: '/Users/Git/wdio/visual-testing/node_modules/.pnpm/canvas@2.11.2/node_modules/canvas/build/Release/canvas.node'
. Setting the threads to 1 will prevent this error from happening. It slows down the tests, but it's better than having them fail