|
1 | 1 | # @wdio/visual-service
|
2 | 2 |
|
| 3 | +## 7.0.0 |
| 4 | + |
| 5 | +### Major Changes |
| 6 | + |
| 7 | +- 42956e4: ## 💥 BREAKING CHANGES |
| 8 | + |
| 9 | + ### 🔍 Viewport Screenshot Logic Reworked for Mobile Web & Hybrid Apps |
| 10 | + |
| 11 | + #### What was the problem? |
| 12 | + |
| 13 | + Screenshots for mobile devices were inconsistent due to platform differences. iOS captures the entire device screen (including status and address bars), while Android (using ChromeDriver) only captures the webview, unless the capability `"appium:nativeWebScreenshot": true` is used. |
| 14 | + |
| 15 | + #### What changed? |
| 16 | + |
| 17 | + We’ve reimplemented the logic to correctly handle both platforms by default. |
| 18 | + This fix addresses [[#747](https://github.com/webdriverio/visual-testing/pull/747)](https://github.com/webdriverio/visual-testing/pull/747). |
| 19 | + |
| 20 | + 💡 Credit to [Benjamin Karran (@ebekebe)](https://github.com/ebekebe) for pointing us in the right direction to improve this logic! |
| 21 | + |
| 22 | + #### What’s the advantage? |
| 23 | + |
| 24 | + ✅ More **accurate full-page and element screenshots** on both Android and iOS. |
| 25 | + ⚠️ But this change may **break your current baselines**, especially on Android and iOS. |
| 26 | + |
| 27 | + *** |
| 28 | + |
| 29 | + ### 🍏 iOS Element Screenshot Strategy Changed |
| 30 | + |
| 31 | + #### What was the problem? |
| 32 | + |
| 33 | + iOS element screenshots were previously cut from full-device screenshots, which could lead to misalignment or off-by-a-few-pixels issues. |
| 34 | + |
| 35 | + #### What changed? |
| 36 | + |
| 37 | + We now use the element screenshot endpoint directly. |
| 38 | + |
| 39 | + #### What’s the advantage? |
| 40 | + |
| 41 | + ✅ More accurate iOS element screenshots. |
| 42 | + ⚠️ But again, this may affect your existing baselines. |
| 43 | + |
| 44 | + *** |
| 45 | + |
| 46 | + ### 🖥️ New Full-Page Screenshot Strategy for **Desktop Web** |
| 47 | + |
| 48 | + #### What was the problem? |
| 49 | + |
| 50 | + The "previous" scroll-and-stitch method simulated user interaction by scrolling the page, waiting, taking a screenshot, and repeating until the entire page was captured. |
| 51 | + This works well for **lazy-loaded content**, but it is **slow and unstable** on other pages. |
| 52 | + |
| 53 | + #### What changed? |
| 54 | + |
| 55 | + We now use WebDriver BiDi’s [`[browsingContext.captureScreenshot](https://webdriver.io/docs/api/webdriverBidi#browsingcontextcapturescreenshot)`] to capture **full-page screenshots in one go**. This is the new **default strategy for desktop web browsers**. |
| 56 | + |
| 57 | + 📌 **Mobile platforms (iOS/Android)** still use the scroll-and-stitch approach for now. |
| 58 | + |
| 59 | + #### What’s the advantage? |
| 60 | + |
| 61 | + ✅ Execution time reduced by **50%+** |
| 62 | + ✅ Logic is greatly simplified |
| 63 | + ✅ More consistent and stable results on static or non-lazy pages |
| 64 | + 📸  |
| 65 | + |
| 66 | + **Still want the old scroll-and-stitch behavior or need fullpage screenshots for pages who have lazy-loading?** |
| 67 | + |
| 68 | + Use the `userBasedFullPageScreenshot` option to simulate user-like scrolling. This remains the **better choice for pages with lazy-loading**: |
| 69 | + |
| 70 | + ```ts |
| 71 | + // wdio.conf.ts |
| 72 | + services: [ |
| 73 | + [ |
| 74 | + "visual", |
| 75 | + { |
| 76 | + userBasedFullPageScreenshot: true, |
| 77 | + }, |
| 78 | + ], |
| 79 | + ]; |
| 80 | + ``` |
| 81 | + |
| 82 | + Or per test: |
| 83 | + |
| 84 | + ```ts |
| 85 | + await expect(browser).toMatchFullPageSnapshot("homepage", { |
| 86 | + userBasedFullPageScreenshot: true, |
| 87 | + }); |
| 88 | + ``` |
| 89 | + |
| 90 | + *** |
| 91 | + |
| 92 | + ## 💅 Polish |
| 93 | + |
| 94 | + ### ⚠️ Deprecated Root-Level Compare Options |
| 95 | + |
| 96 | + #### What was the problem? |
| 97 | + |
| 98 | + Compare options were allowed at the root level of the service config, making them harder to group or discover. |
| 99 | + |
| 100 | + #### What changed? |
| 101 | + |
| 102 | + You now get a warning if you still use root-level keys. Please move them under the `compareOptions` property instead. |
| 103 | + |
| 104 | + **Example warning:** |
| 105 | + |
| 106 | + ```log |
| 107 | + WARN The following root-level compare options are deprecated and should be moved under 'compareOptions': |
| 108 | + - blockOutStatusBar |
| 109 | + - ignoreColors |
| 110 | + In the next major version, these options will be removed from the root level. |
| 111 | + ``` |
| 112 | + |
| 113 | + 📘 See: [[compareOptions docs](https://webdriver.io/docs/visual-testing/service-options#compare-options)](https://webdriver.io/docs/visual-testing/service-options#compare-options) |
| 114 | + |
| 115 | + *** |
| 116 | + |
| 117 | + ## 🐛 Bug Fixes |
| 118 | + |
| 119 | + - ✅ [[#747](https://github.com/your-repo/issues/747)](https://github.com/your-repo/issues/747): Fixed incorrect mobile webview context data. |
| 120 | + |
| 121 | + *** |
| 122 | + |
| 123 | + ## 🔧 Other |
| 124 | + |
| 125 | + - 🆙 Updated dependencies |
| 126 | + - 🧪 Improved test coverage |
| 127 | + - 📸 Refreshed image baselines |
| 128 | + |
| 129 | + *** |
| 130 | + |
| 131 | + ## Committers: 1 |
| 132 | + |
| 133 | + - Wim Selles ([@wswebcreation](https://github.com/wswebcreation)) |
| 134 | + |
| 135 | +### Patch Changes |
| 136 | + |
| 137 | +- Updated dependencies [42956e4] |
| 138 | + - webdriver-image-comparison@8.0.0 |
| 139 | + |
3 | 140 | ## 6.4.0
|
4 | 141 |
|
5 | 142 | ### Minor Changes
|
|
0 commit comments