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

Ws/create separate service #325

Merged
merged 62 commits into from
May 23, 2024
Merged

Ws/create separate service #325

merged 62 commits into from
May 23, 2024

Conversation

wswebcreation
Copy link
Member

@wswebcreation wswebcreation commented May 5, 2024

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:

  • wait
  • search
  • and interact

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

Polish 💅

Copy link

changeset-bot bot commented May 5, 2024

🦋 Changeset detected

Latest commit: da83d14

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@wdio/ocr-service Major
@wdio/visual-service Patch

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

Copy link
Member

@christian-bromann christian-bromann left a 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"
Copy link
Member

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?

Copy link
Member Author

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?

@wswebcreation
Copy link
Member Author

One comment:

  • can we remove the ocr prefix in the function and file names? I think it is clear to what they belong to

@christian-bromann

I called the files the same name as the functions that reflect the browser commands. Is this a bad practice? I removed the ocr prefix for all other files

@christian-bromann
Copy link
Member

I called the files the same name as the functions that reflect the browser commands.

Oh, that makes sense 👍

Copy link
Member

@christian-bromann christian-bromann left a comment

Choose a reason for hiding this comment

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

LGTM 👍 :shipit:

@wswebcreation wswebcreation merged commit a924dfc into main May 23, 2024
18 checks passed
@wswebcreation wswebcreation deleted the ws/create-separate-service branch May 23, 2024 04:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants