iOS screenshot error in JIMP when cropping an image received from Appium
メンテナーはふだん 1 日以内に返信
@wswebcreation がすでに取り組んでいます。
2025年3月21日 から。
評価
この issue はまだ評価されていません。
説明
Environment (please complete the following information):
- Node.js version: 20.10.0
- NPM version: 10.2.3
- Browser name and version: Safari
- Platform name and version: iOS phone
- WebdriverIO version: 9.12.0
@wdio/visual-serviceversion: 6.3.3
Config of WebdriverIO + @wdio/visual-service
[
'visual',
{
// Service options
autoSaveBaseline: true,
createJsonReportFiles: true,
} satisfies VisualServiceOptions, // Ensures type safety
]
Describe the bug
Taking a screenshot of a real iPhone 12 fails when Jimp tries to crop the image.
The take screenshot command is sent succesfully and is received by webdriverIO:
but when it tries to call the image-comparison logic Jimp breaks:
To Reproduce
Steps to reproduce the behavior:
The case that I'm testing is similar to the following:
- Setup a Selenium grid with an appium node that is connected to an iPhone
- Capability should be 'safari'
- Configure webdriverio to have a test that runs this:
await expect(browser).toMatchScreenSnapshot(
`video-playing-${browserName}`,
0,
{ scaleImagesToSameSize: false }
)
Expected behavior
- The image is able to be saved and processed by webdriverIO.
Log
[0-0] 2025-03-18T19:52:22.944Z INFO webdriver: [POST] http://localhost:4444/wd/hub/session/bff1e65d-9f59-4abb-89d4-23e1d279301d/execute/sync
[0-0] 2025-03-18T19:52:22.944Z INFO webdriver: DATA {
[0-0] script: 'setCustomCss(...) [1975 bytes]',
[0-0] args: [
[0-0] {
[0-0] addressBarPadding: 0,
[0-0] disableBlinkingCursor: false,
[0-0] disableCSSAnimation: false,
[0-0] id: 'pic-css',
[0-0] toolBarPadding: 0
[0-0] }
[0-0] ]
[0-0] }
[0-0] 2025-03-18T19:52:23.081Z INFO webdriver: RESULT null
[0-0] 2025-03-18T19:52:23.583Z INFO webdriver: COMMAND executeScript(<fn>, <object>)
[0-0] 2025-03-18T19:52:23.584Z INFO webdriver: [POST] http://localhost:4444/wd/hub/session/bff1e65d-9f59-4abb-89d4-23e1d279301d/execute/sync
[0-0] 2025-03-18T19:52:23.584Z INFO webdriver: DATA { script: 'getScreenDimensions(...) [1668 bytes]', args: [] }
[0-0] 2025-03-18T19:52:23.664Z INFO webdriver: RESULT {
[0-0] dimensions: {
[0-0] body: { scrollHeight: 260, offsetHeight: 260 },
[0-0] html: {
[0-0] clientHeight: 260,
[0-0] clientWidth: 375,
[0-0] scrollHeight: 260,
[0-0] scrollWidth: 375,
[0-0] offsetHeight: 260
[0-0] },
[0-0] window: {
[0-0] innerWidth: 375,
[0-0] innerHeight: 260,
[0-0] isLandscape: true,
[0-0] outerHeight: 260,
[0-0] outerWidth: 375,
[0-0] devicePixelRatio: 3,
[0-0] screenWidth: 375,
[0-0] screenHeight: 812
[0-0] }
[0-0] }
[0-0] }
[0-0] 2025-03-18T19:52:23.665Z INFO webdriver: COMMAND takeScreenshot()
[0-0] 2025-03-18T19:52:23.665Z INFO webdriver: [GET] http://localhost:4444/wd/hub/session/bff1e65d-9f59-4abb-89d4-23e1d279301d/screenshot
[0-0] 2025-03-18T19:52:24.037Z INFO webdriver: RESULT iVBORw0KGgoAAAANSUhEUgAABGQAAAmECAIAAADMhS/QAAAAAXNSR0IArs4c6...
[0-0] 2025-03-18T19:52:24.458Z WARN @wdio/visual-service:webdriver-image-comparison:images:
[0-0] #####################################################################################
[0-0] THE RESIZE DIMENSION RIGHT=0 MADE THE CROPPING GO OUT OF THE SCREEN SIZE
[0-0] RESULTING IN A RIGHT CROP POSITION=2436.
[0-0] THIS HAS BEEN DEFAULTED TO '1124'
[0-0] #####################################################################################
[0-0]
[0-0] RangeError in "DRM Tests.should validate DRM in iOS Safari"
RangeError [ERR_OUT_OF_RANGE]: The value of "offset" is out of range. It must be >= 0 and <= 10952252. Received 10952256
at boundsError (node:internal/buffer:88:9)
at Buffer.readUInt32BE (node:internal/buffer:311:5)
at Jimp.<anonymous> (/Users/andres.f.losada/Documents/Repositories/videoplayertesting/webdriverIO/node_modules/@jimp/plugin-crop/src/index.ts:73:40)
at scan (/Users/andres.f.losada/Documents/Repositories/videoplayertesting/webdriverIO/node_modules/@jimp/utils/src/index.ts:76:7)
at Object.crop (/Users/andres.f.losada/Documents/Repositories/videoplayertesting/webdriverIO/node_modules/@jimp/plugin-crop/src/index.ts:72:7)
at Jimp.Jimp.<computed> (/Users/andres.f.losada/Documents/Repositories/videoplayertesting/webdriverIO/node_modules/@jimp/core/src/index.ts:200:42)
at cropAndConvertToDataURL (file:///Users/andres.f.losada/Documents/Repositories/videoplayertesting/webdriverIO/node_modules/webdriver-image-comparison/dist/methods/images.js:174:32)
at async saveWebScreen (file:///Users/andres.f.losada/Documents/Repositories/videoplayertesting/webdriverIO/node_modules/webdriver-image-comparison/dist/commands/saveWebScreen.js:59:32)
at async checkWebScreen (file:///Users/andres.f.losada/Documents/Repositories/videoplayertesting/webdriverIO/node_modules/webdriver-image-comparison/dist/commands/checkWebScreen.js:22:57)
[0-0] 2025-03-18T19:52:24.614Z INFO webdriver: COMMAND deleteSession()
Additional context
My test is a bit more complex, as is runs inside a webview that is embedded within an app, but the issue seems to be only for this plugin. I am using selenium to do a similar test and there is no error. The same happens when trying nightwatch, so I guess there might be a bug in the Jimp implementation that crops the images.
- 主要言語
- TypeScript
- スター
- 156
- フォーク
- 62
- 平均マージ
- 2時間 2分
- マージ済み PR(30日)
- 111
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
webdriverio/visual-testing のほかの issue
-
Proposal: a noise-tolerant compare mode with pixelmatch 8's windowSize対応中かも @plum117 が 3 日前に担当しました。 オープンenhancement
webdriverio/visual-testing#1311 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
bug: the visual service fails on Android Chrome through Appium 3 in the default WebDriver BiDi session (workaround: `wdio:enforceWebDriverClassic`)対応中かも @plum117 が 3 日前に担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
webdriverio/visual-testing#1232 · コメント 2 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
feat: support element screenshots of elements in a frame in WebDriver BiDi sessions (v9 `switchFrame()`, v10 `context.frame()`)対応中かも @plum117 が 3 日前に担当しました。 オープン
難易度 5/5 1週間以上 初心者へのやさしさ 50/100
webdriverio/visual-testing#1228 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
Wait for Screenshot to Match対応中かも @plum117 が 1 日前に担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
webdriverio/visual-testing#690 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
Using checkFullPageScreen method, capturing images with duplicate viewport and is not scrolling to the bottom of the page対応中かも @plum117 が 1 日前に担当しました。 オープンhelp wanted
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
webdriverio/visual-testing#125 · コメント 2 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
webdriverio/visual-testing の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
apache/rocketmq-dashboard#6610 ·
メンテナーはふだん 3 日以内に返信
-
nextjs-tracking
難易度 2/5 1〜3時間 初心者へのやさしさ 69/100
cloudflare/vinext#3920 ·
メンテナーはふだん 1 日以内に返信
-
Team:Dashboards
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
elastic/kibana#297299 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
analytics beginner friendly community contributions-welcome good first issue hacktoberfest help wanted up-for-grabs
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
affected/v17 affected/v18 area/frontend type/bug
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
umbraco/Umbraco-CMS#24186 ·
メンテナーはふだん 2 日以内に返信