Skip to content

Ws/add bidi screenshot support#831

Merged
wswebcreation merged 4 commits intows/new-major-releasesfrom
ws/add-bidi-screenshot-support
Apr 14, 2025
Merged

Ws/add bidi screenshot support#831
wswebcreation merged 4 commits intows/new-major-releasesfrom
ws/add-bidi-screenshot-support

Conversation

@wswebcreation
Copy link
Copy Markdown
Member

@wswebcreation wswebcreation commented Apr 5, 2025

With BiDi support, passing extra options when capturing screenshots is possible.
For example, full-page screenshots can now be generated more easily — see the browsingContextCaptureScreenshot docs.

This PR

  • simplifies logic
  • speeds up execution with more than 50% 🚀 🤯 image

by using BiDi for Full Page Desktop Web screenshots.

This can be enabled and disabled on the service

// wdio.conf.ts
export const config = {
    // ...
    // =====
    // Setup
    // =====
    services: [
        [
            "visual",
            {
                // Some options, see the docs for more
                createBidiFullPageScreenshots: true // Default is `true
                // ... more options
            },
        ],
    ],
    // ...
};

or on the test level

await expect(browser).toMatchFullPageSnapshot('fullPage', {
  createBidiFullPageScreenshots: true, // `true` by default
})

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 5, 2025

🦋 Changeset detected

Latest commit: 2ede803

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

This PR includes changesets to release 2 packages
Name Type
webdriver-image-comparison Minor
@wdio/visual-service Minor

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

@wswebcreation wswebcreation changed the base branch from main to ws/new-major-releases April 6, 2025 05:13
@wswebcreation wswebcreation marked this pull request as ready for review April 6, 2025 06:28
@wswebcreation wswebcreation requested a review from Copilot April 6, 2025 06:29
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 14 out of 16 changed files in this pull request and generated no comments.

Files not reviewed (2)
  • packages/webdriver-image-comparison/src/snapshots/base.test.ts.snap: Language not supported
  • packages/webdriver-image-comparison/src/helpers/snapshots/options.test.ts.snap: Language not supported

@wswebcreation wswebcreation merged commit 86cf6b8 into ws/new-major-releases Apr 14, 2025
19 checks passed
@wswebcreation wswebcreation deleted the ws/add-bidi-screenshot-support branch April 14, 2025 07:23
wswebcreation added a commit that referenced this pull request Apr 18, 2025
* Ws/fix-747-improve-mobile-webview-screenshot (#777)

* chore: update deps

* chore: revert major eslint

* feat: initial setup for device layer calculations

- this is work in progress

* chore: fixed some stuff and updated some broken UT's

* fix: right import and export

* fix: fix mocks

* chore: optimise code a bit and add docs

* chore: fix linking and types

* fix: fix return data from overlay

* feat: add Android support for blockouts based on device rectangles

* feat: support ios and android for checkScreen

- simplify determineStatusAddressToolBarRectangles
- reduce rectangle tests
- fix data url loading in Safari

* feat: add checkElement support

* fix: optimise code and fix UTs for element

* feat: support savefullpagescreenshot with new viewport data for Android

* feat: support fullpage for iOS portrait

* test: fix tests

* fix: multiple fixes for fullpage

- iOS had issues on landscape
- removed not needed code and files

* chore: remove logs

* fix: fix Android Appium 1 issues

- add fallback
- remove logs
- update images for android phones

* chore: update iOS stuff

- add LANDSCAPE for local android

* chore: updated safari desktop screenshots

* test: update snapshots

* feat: move the new logic to the webdriver-image-comparison module

* fix: fix unit tests

* breaking: taking element screenshot for iOS

- some other small fixes

* chore: optimise deviceRectangles

- remove devicePlatformRect
- enrich deviceRectangles with statusBar and homeBar
- change devicePlatformRect output to x/y instead of left/top to match a coordinate system
- fix UTs

* chore: refactor stuff

- rename function
- add screendata for deviceRectangles

* chore: improve readability for vars in utils

* chore: update baseline and workflow

* chore: last image updates

* chore: update latest deps

* fix: add fallback for Android and iOS mobile screensize

- add more UT's

* test: add more UT's

* fix: fix orientation and update ios images

* Add viewport context manager for managing device rectangles (#833)

* feat: add viewport context manager

* feat: add new context manager

- revert old one
- add a wrapper for each command that checks for changes
- fix screensizes when the orientation changes and provide better fallback

There is a TODO regarding Multiremote on the global browser

* chore: fix UT's

* chore: add a last test

* feat: enhance context manager

- add mobile context
- add wrapper per command
- add and fix UT's

* fix: multiple fixes

- fix capabilities, should be requested
- assumed that the `'mobile: deviceInfo` didn't return landscape info
- added new images for android

* fix: reset orientation

* Fix: fix iOS orientation and make it generic

* chore: new iOS images

* fix: support proper appium cap present

- add new images
- add nativeWebScreenshot for proper webviews screenshots

* test: add iOS for webview tests

- add new images

* fix: fix tests

* Ws/add bidi screenshot support (#831)

* feat: add bidi fullpage screenshot support

* chore: code optimizations

* chore: add changeset

* feat: deprecate root compare options (#832)

* feat: deprecate root compare options

* chore: add changeset

* Update packages/webdriver-image-comparison/src/helpers/options.ts

Co-authored-by: alcpereira <48070464+alcpereira@users.noreply.github.com>

* Update packages/webdriver-image-comparison/src/helpers/utils.ts

Co-authored-by: alcpereira <48070464+alcpereira@users.noreply.github.com>

* Update packages/webdriver-image-comparison/src/helpers/utils.ts

Co-authored-by: alcpereira <48070464+alcpereira@users.noreply.github.com>

* chore: updated the options docs

* chore: updated tests after feedback

---------

Co-authored-by: alcpereira <48070464+alcpereira@users.noreply.github.com>

* chore: rename new bidi flag

* chore: update deps

* chore: provide changelogs

---------

Co-authored-by: alcpereira <48070464+alcpereira@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants