wswebcreation / webdriver-image-comparison

MIT License
43 stars 36 forks source link

check* functions not compatible with newer iPad devices #65

Closed seanuleh closed 4 years ago

seanuleh commented 4 years ago

Environment (please complete the following information):

Config of the automation framework + plugin Testing on BrowserStack - capability looks like this: capabilities: [ { 'bstack:options' : { "osVersion" : "13", "deviceName" : "iPad 7th", "realMobile" : "true", "local" : "false", }, "browserName" : "[iOS] iPad 7th", } ],

Describe the bug calling check* (e.g. checkScreen()) functions fail due to this library not being able to determine the majorVersion in the getIosStatusAddressToolBarHeight function

To Reproduce execute any check* function with the wdio-image-comparison-service for a newer ipad device (ipad pro 2nd or ipad 7th) with browser stack.

Expected behavior the check* functions should not fail.

Log

[iPad 7th MAC 12.1 #0-0] An unknown server-side error occurred while processing the command. Original error: null is not an object (evaluating 'match[1]') [iPad 7th MAC 12.1 #0-0] unknown error: An unknown server-side error occurred while processing the command. Original error: null is not an object (evaluating 'match[1]') [iPad 7th MAC 12.1 #0-0] at processTicksAndRejections (internal/process/task_queues.js:97:5) [iPad 7th MAC 12.1 #0-0] at Object. (/Users/sel-sayed/work/automation-testing/node_modules/webdriver-image-comparison/build/methods/screenshots.js:86:32) [iPad 7th MAC 12.1 #0-0] at step (/Users/sel-sayed/work/automation-testing/node_modules/webdriver-image-comparison/build/methods/screenshots.js:44:23) [iPad 7th MAC 12.1 #0-0] at Object.next (/Users/sel-sayed/work/automation-testing/node_modules/webdriver-image-comparison/build/methods/screenshots.js:25:53) [iPad 7th MAC 12.1 #0-0] at /Users/sel-sayed/work/automation-testing/node_modules/webdriver-image-comparison/build/methods/screenshots.js:19:71 [iPad 7th MAC 12.1 #0-0] at Object.getBase64FullPageScreenshotsData (/Users/sel-sayed/work/automation-testing/node_modules/webdriver-image-comparison/build/methods/screenshots.js:60:12) [iPad 7th MAC 12.1 #0-0] at Object. (/Users/sel-sayed/work/automation-testing/node_modules/webdriver-image-comparison/build/commands/saveFullPageScreen.js:87:46) [iPad 7th MAC 12.1 #0-0] at step (/Users/sel-sayed/work/automation-testing/node_modules/webdriver-image-comparison/build/commands/saveFullPageScreen.js:33:23) [iPad 7th MAC 12.1 #0-0] at Object.next (/Users/sel-sayed/work/automation-testing/node_modules/webdriver-image-comparison/build/commands/saveFullPageScreen.js:14:53) [iPad 7th MAC 12.1 #0-0] at fulfilled (/Users/sel-sayed/work/automation-testing/node_modules/webdriver-image-comparison/build/commands/saveFullPageScreen.js:5:58) [iPad 7th MAC 12.1 #0-0] at Browser.next [as checkFullPageScreen] (/Users/sel-sayed/work/automation-testing/node_modules/webdriver/node_modules/@wdio/utils/build/monad.js:116:27) [iPad 7th MAC 12.1 #0-0] at World. (/Users/sel-sayed/work/automation-testing/automation/step_definitions/step.js:21:18)

Additional context The problem seems to be in this line here: https://github.com/wswebcreation/webdriver-image-comparison/blob/9ea2e22feea1cd35718d9b55eb0b9d03bb001eda/lib/clientSideScripts/getIosStatusAddressToolBarHeight.ts#L9

The regex fails for newer ipad devices and the subsequent line which extracts the major version fails. If I modify the major version to 13 then the library works as expected. I am unsure how to retrieve the values of navigator.appVersion to re-write the regex as a solution myself.

wswebcreation commented 4 years ago

Hi @seanuleh

Thanks for filing an issue, I need to look at my time when I can fix this, but if you already have time please do

seanuleh commented 4 years ago

Made a small change to the regex which parses the UA to support the new iPadOS User Agent strings. Added some superficial test case, could probably do with proper data for newer iPad devices, but unsure where to attain this information.

67

wswebcreation commented 4 years ago

Thanks @seanuleh

I've merged it, will release it soon

wswebcreation commented 4 years ago

Hi @seanuleh

I've release a new version https://github.com/wswebcreation/wdio-image-comparison-service/releases/tag/v1.13.1, can you verify and close the issue if it's fixed, thanks for your support

seanuleh commented 4 years ago

Looks like it's working now! thanks for the quick release.