wswebcreation / wdio-ocr-service

Using Tesseract OCR with WebdriverIO and Appium Native App tests

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

There is a case that the image creation could not be created using a rectangle in options.

gromanas opened this issue · comments

Environment:

  • Node.js version: 14.18.1
  • Platform name and version: Chrome
  • WebdriverIO version: 7.16.4
  • wdio-ocr-service version: 1.1.0

Config of WebdriverIO + wdio-ocr-service

 services: ['image-comparison', {
            baselineFolder: join(process.cwd(), './test/imageComparisonBaseline/'),
            formatImageName: '{tag}-{width}x{height}',
            screenshotPath: join(process.cwd(), '.tmp/'),
            savePerInstance: true,
            autoSaveBaseline: true,
            hideScrollBars: true,
            scaleImagesToSameSize: true,
        }], [ 'ocr', {
                
                ocrImagesPath: 'ocr-images/',
            },
        ]
    ],

Describe
I have tried to use ocrGetText() with the options and more specific with iOSRectangles. In my case, I was trying to get an element closer to the bottom of the screen. The issue that occurred An error happened when parsing the getNodeOcrData, see: Error: No text was found for the OCR, please verify the stored image. And also the image that is created has no content (like an empty image).

To Reproduce
You have to provide in the options of the iOSRectangles for top > bottom or left > right

expect(await browser.ocrGetText({
            iOSRectangles: {
                top: 700,
                left: 1000,
                right: 300,
                bottom: 400,
            },
        })).toContain('SUBMIT');

Expected behavior
The image that is created should have some content.

Log

Error: An error happened when parsing the getNodeOcrData, see: Error: No text was found for the OCR, please verify the stored image.
Error: Error: An error happened when parsing the getNodeOcrData, see: Error: No text was found for the OCR, please verify the stored image.
    at Object.<anonymous> (/Users/usr/Projects/demo-app/node_modules/wdio-ocr-service/build/utils/
    at step (/Users/usr/Projects/demo-app/node_modules/wdio-ocr-service/build/utils/ocrGetData.js:44:23)
    at Object.throw (/Users/usr/Projects/demo-app/node_modules/wdio-ocr-service/build/utils/ocrGetData.js:25:53)
    at rejected (/Users/usr/Projects/demo-app/node_modules/wdio-ocr-service/build/utils/ocrGetData.js:17:65)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)