Skip to content

Conversation

nilayarya
Copy link
Contributor

@nilayarya nilayarya commented Jul 30, 2025

Description of Change

Note

This PR is part of GSoC 2025 [project] [rfc]

Description of Change

This PR adds a new native addon fixture for testing virtual display functionality in Electron. The virtual-display addon provides programmatic virtual display creation capabilities on macOS for comprehensive display testing scenarios.

Example usage:

const virtualDisplay = require('@electron-ci/virtual-display');
const displayId = virtualDisplay.create();
virtualDisplay.destroy(displayId);

Checklist

Release Notes

Notes: none

@electron-cation electron-cation bot added the new-pr 🌱 PR opened recently label Jul 30, 2025
@dsanders11 dsanders11 added GSoC 2025 Google Summer of Code 2025 semver/none no-backport backport-check-skip Skip trop's backport validity checking labels Jul 30, 2025
@electron-cation electron-cation bot removed the new-pr 🌱 PR opened recently label Jul 30, 2025
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Hello @nilayarya! It looks like this pull request touches one of our dependency files, and per our contribution policy we do not accept these types of changes in PRs.

@nilayarya nilayarya marked this pull request as draft August 1, 2025 14:32
@nilayarya nilayarya marked this pull request as ready for review August 3, 2025 15:14
@codebytere codebytere dismissed github-actions[bot]’s stale review August 4, 2025 08:35

Permitted in this case.

Copy link
Contributor

@georgexu99 georgexu99 left a comment

Choose a reason for hiding this comment

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

Docs: approved

Copy link
Member

@erickzhao erickzhao left a comment

Choose a reason for hiding this comment

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

I think this should be a test: prefix PR and be stacked on top of #47781, right?

@nilayarya
Copy link
Contributor Author

I think this should be a test: prefix PR and be stacked on top of #47781, right?

Since this is a new independent API to create virtual displays wouldn’t it make more sense to label it as feat:?
I might have branched off incorrectly sorry for that.

@codebytere codebytere changed the title feat: support for multimonitor tests test: support for multimonitor tests Aug 6, 2025
@nilayarya nilayarya force-pushed the multi-display-test branch from 81beead to 94463ad Compare August 7, 2025 16:38
Copy link
Member

@VerteDinde VerteDinde left a comment

Choose a reason for hiding this comment

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

Looks great!

@VerteDinde
Copy link
Member

Failing test is a known flake on main, safe to merge

@codebytere codebytere merged commit 88531c4 into electron:gsoc-2025 Aug 11, 2025
54 of 55 checks passed
@release-clerk
Copy link

release-clerk bot commented Aug 11, 2025

No Release Notes

VerteDinde pushed a commit that referenced this pull request Aug 20, 2025
* test: support for multimonitor tests

* fix: update yarn.lock file

* test: support any resolution for new displays

* test: support display positioning

* docs: multi-monitor tests

* test: remove dummy test
VerteDinde added a commit that referenced this pull request Aug 20, 2025
* feat: save window state (#47425)

* feat: save/restore window state

* cleanup

* remove constructor option

* refactor: apply suggestions from code review

Co-authored-by: Charles Kerr <[email protected]>

* refactor: forward declare prefservice

* refactor: remove constructor option

* refactor: save window state on move/resize instead of moved/resized

* feat: resave window state after construction

* test: add basic window save tests

* test: add work area tests

* test: asynchronous batching behavior

* docs: add windowStateRestoreOptions to BaseWindowConstructorOptions

* chore: move includes to main block

* Update spec/api-browser-window-spec.ts

Co-authored-by: David Sanders <[email protected]>

* docs: update docs/api/structures/base-window-options.md

Co-authored-by: Erick Zhao <[email protected]>

* fix: preserve original bounds during window state save in special modes

* feat: save kiosk state in window preferences

* chore: remove ts-expect-error

* test: check hasCapturableScreen before running tests

* test: remove multimonitor tests

* test: add missing hasCapturableScreen checks before tests

* docs: add blurb on saving mechanism

* feat: add debounce window of 200ms to saveWindowState

* docs: remove blurb until finalized

* style: convert constants from snake_case to camelCase

* refactor: initialize prefs_ only if window state is configured to be saved/restored

* refactor: rename window states key

* refactor: store in application-level Local State instead of browser context

* refactor: switch to more accurate function names

* fix: add dcheck for browser_process

* fix: flush window state to avoid race condition

* refactor: change stateId to name

* refactor: change windowStateRestoreOptions to windowStatePersistence

* Update docs/api/structures/base-window-options.md

Co-authored-by: David Sanders <[email protected]>

* fix: add warning when window state persistence enabled without window name

* docs: lowercase capital B for consistency

---------

Co-authored-by: Charles Kerr <[email protected]>
Co-authored-by: David Sanders <[email protected]>
Co-authored-by: Erick Zhao <[email protected]>

* feat: restore window state

* feat: flush display modes on show

* refactor: move utility functions to common area

* feat: clear window state

* fix: wait for the prefs to update

* test: clearWindowState extra test

* test: refine clear window state tests

* test: single monitor restore window tests

chore: rebase on gsoc-2025

* refactor: refine clearWindowState test

* fix: revert default_app back to original

* docs: add comment linking AdjustBoundsToBeVisibleOnDisplay to Chromium code

* fix: add correct permalink

* refactor: ci friendly

* fix: disable windowStatePersistence when no display

* refactor: use reference instead pointer

* fix: skip window state persistence for invalid/fake displays

* refactor: better flag placement

* test: add test to verify window state is not saved when no display

* fix: restore display mode inside show()

* feat: save window state (#47425)

* feat: save/restore window state

* cleanup

* remove constructor option

* refactor: apply suggestions from code review

Co-authored-by: Charles Kerr <[email protected]>

* refactor: forward declare prefservice

* refactor: remove constructor option

* refactor: save window state on move/resize instead of moved/resized

* feat: resave window state after construction

* test: add basic window save tests

* test: add work area tests

* test: asynchronous batching behavior

* docs: add windowStateRestoreOptions to BaseWindowConstructorOptions

* chore: move includes to main block

* Update spec/api-browser-window-spec.ts

Co-authored-by: David Sanders <[email protected]>

* docs: update docs/api/structures/base-window-options.md

Co-authored-by: Erick Zhao <[email protected]>

* fix: preserve original bounds during window state save in special modes

* feat: save kiosk state in window preferences

* chore: remove ts-expect-error

* test: check hasCapturableScreen before running tests

* test: remove multimonitor tests

* test: add missing hasCapturableScreen checks before tests

* docs: add blurb on saving mechanism

* feat: add debounce window of 200ms to saveWindowState

* docs: remove blurb until finalized

* style: convert constants from snake_case to camelCase

* refactor: initialize prefs_ only if window state is configured to be saved/restored

* refactor: rename window states key

* refactor: store in application-level Local State instead of browser context

* refactor: switch to more accurate function names

* fix: add dcheck for browser_process

* fix: flush window state to avoid race condition

* refactor: change stateId to name

* refactor: change windowStateRestoreOptions to windowStatePersistence

* Update docs/api/structures/base-window-options.md

Co-authored-by: David Sanders <[email protected]>

* fix: add warning when window state persistence enabled without window name

* docs: lowercase capital B for consistency

---------

Co-authored-by: Charles Kerr <[email protected]>
Co-authored-by: David Sanders <[email protected]>
Co-authored-by: Erick Zhao <[email protected]>

* test: clear sharedUserPath before and test

* refactor: hasInvalidDisplay function

* debug: add display info logging for CI

* fix: do not save/restore when window is 0x0

* test: support for multimonitor tests (#47911)

* test: support for multimonitor tests

* fix: update yarn.lock file

* test: support any resolution for new displays

* test: support display positioning

* docs: multi-monitor tests

* test: remove dummy test

* feat: enforce unique window names across BaseWindow and BrowserWindow (#47764)

* feat: save window state (#47425)

* feat: save/restore window state

* cleanup

* remove constructor option

* refactor: apply suggestions from code review

Co-authored-by: Charles Kerr <[email protected]>

* refactor: forward declare prefservice

* refactor: remove constructor option

* refactor: save window state on move/resize instead of moved/resized

* feat: resave window state after construction

* test: add basic window save tests

* test: add work area tests

* test: asynchronous batching behavior

* docs: add windowStateRestoreOptions to BaseWindowConstructorOptions

* chore: move includes to main block

* Update spec/api-browser-window-spec.ts

Co-authored-by: David Sanders <[email protected]>

* docs: update docs/api/structures/base-window-options.md

Co-authored-by: Erick Zhao <[email protected]>

* fix: preserve original bounds during window state save in special modes

* feat: save kiosk state in window preferences

* chore: remove ts-expect-error

* test: check hasCapturableScreen before running tests

* test: remove multimonitor tests

* test: add missing hasCapturableScreen checks before tests

* docs: add blurb on saving mechanism

* feat: add debounce window of 200ms to saveWindowState

* docs: remove blurb until finalized

* style: convert constants from snake_case to camelCase

* refactor: initialize prefs_ only if window state is configured to be saved/restored

* refactor: rename window states key

* refactor: store in application-level Local State instead of browser context

* refactor: switch to more accurate function names

* fix: add dcheck for browser_process

* fix: flush window state to avoid race condition

* refactor: change stateId to name

* refactor: change windowStateRestoreOptions to windowStatePersistence

* Update docs/api/structures/base-window-options.md

Co-authored-by: David Sanders <[email protected]>

* fix: add warning when window state persistence enabled without window name

* docs: lowercase capital B for consistency

---------

Co-authored-by: Charles Kerr <[email protected]>
Co-authored-by: David Sanders <[email protected]>
Co-authored-by: Erick Zhao <[email protected]>

* feat: enforce unique window names across BaseWindow and BrowserWindow

* docs: update docs for name property

* fix: linter issue with symbol

---------

Co-authored-by: Charles Kerr <[email protected]>
Co-authored-by: David Sanders <[email protected]>
Co-authored-by: Erick Zhao <[email protected]>

* test: remove invalid display test

---------

Co-authored-by: Charles Kerr <[email protected]>
Co-authored-by: David Sanders <[email protected]>
Co-authored-by: Erick Zhao <[email protected]>
Co-authored-by: Keeley Hammond <[email protected]>
VerteDinde pushed a commit that referenced this pull request Aug 26, 2025
* test: support for multimonitor tests

* fix: update yarn.lock file

* test: support any resolution for new displays

* test: support display positioning

* docs: multi-monitor tests

* test: remove dummy test
VerteDinde added a commit that referenced this pull request Aug 26, 2025
* feat: save window state (#47425)

* feat: save/restore window state

* cleanup

* remove constructor option

* refactor: apply suggestions from code review

Co-authored-by: Charles Kerr <[email protected]>

* refactor: forward declare prefservice

* refactor: remove constructor option

* refactor: save window state on move/resize instead of moved/resized

* feat: resave window state after construction

* test: add basic window save tests

* test: add work area tests

* test: asynchronous batching behavior

* docs: add windowStateRestoreOptions to BaseWindowConstructorOptions

* chore: move includes to main block

* Update spec/api-browser-window-spec.ts

Co-authored-by: David Sanders <[email protected]>

* docs: update docs/api/structures/base-window-options.md

Co-authored-by: Erick Zhao <[email protected]>

* fix: preserve original bounds during window state save in special modes

* feat: save kiosk state in window preferences

* chore: remove ts-expect-error

* test: check hasCapturableScreen before running tests

* test: remove multimonitor tests

* test: add missing hasCapturableScreen checks before tests

* docs: add blurb on saving mechanism

* feat: add debounce window of 200ms to saveWindowState

* docs: remove blurb until finalized

* style: convert constants from snake_case to camelCase

* refactor: initialize prefs_ only if window state is configured to be saved/restored

* refactor: rename window states key

* refactor: store in application-level Local State instead of browser context

* refactor: switch to more accurate function names

* fix: add dcheck for browser_process

* fix: flush window state to avoid race condition

* refactor: change stateId to name

* refactor: change windowStateRestoreOptions to windowStatePersistence

* Update docs/api/structures/base-window-options.md

Co-authored-by: David Sanders <[email protected]>

* fix: add warning when window state persistence enabled without window name

* docs: lowercase capital B for consistency

---------

Co-authored-by: Charles Kerr <[email protected]>
Co-authored-by: David Sanders <[email protected]>
Co-authored-by: Erick Zhao <[email protected]>

* feat: restore window state

* feat: flush display modes on show

* refactor: move utility functions to common area

* feat: clear window state

* fix: wait for the prefs to update

* test: clearWindowState extra test

* test: refine clear window state tests

* test: single monitor restore window tests

chore: rebase on gsoc-2025

* refactor: refine clearWindowState test

* fix: revert default_app back to original

* docs: add comment linking AdjustBoundsToBeVisibleOnDisplay to Chromium code

* fix: add correct permalink

* refactor: ci friendly

* fix: disable windowStatePersistence when no display

* refactor: use reference instead pointer

* fix: skip window state persistence for invalid/fake displays

* refactor: better flag placement

* test: add test to verify window state is not saved when no display

* fix: restore display mode inside show()

* feat: save window state (#47425)

* feat: save/restore window state

* cleanup

* remove constructor option

* refactor: apply suggestions from code review

Co-authored-by: Charles Kerr <[email protected]>

* refactor: forward declare prefservice

* refactor: remove constructor option

* refactor: save window state on move/resize instead of moved/resized

* feat: resave window state after construction

* test: add basic window save tests

* test: add work area tests

* test: asynchronous batching behavior

* docs: add windowStateRestoreOptions to BaseWindowConstructorOptions

* chore: move includes to main block

* Update spec/api-browser-window-spec.ts

Co-authored-by: David Sanders <[email protected]>

* docs: update docs/api/structures/base-window-options.md

Co-authored-by: Erick Zhao <[email protected]>

* fix: preserve original bounds during window state save in special modes

* feat: save kiosk state in window preferences

* chore: remove ts-expect-error

* test: check hasCapturableScreen before running tests

* test: remove multimonitor tests

* test: add missing hasCapturableScreen checks before tests

* docs: add blurb on saving mechanism

* feat: add debounce window of 200ms to saveWindowState

* docs: remove blurb until finalized

* style: convert constants from snake_case to camelCase

* refactor: initialize prefs_ only if window state is configured to be saved/restored

* refactor: rename window states key

* refactor: store in application-level Local State instead of browser context

* refactor: switch to more accurate function names

* fix: add dcheck for browser_process

* fix: flush window state to avoid race condition

* refactor: change stateId to name

* refactor: change windowStateRestoreOptions to windowStatePersistence

* Update docs/api/structures/base-window-options.md

Co-authored-by: David Sanders <[email protected]>

* fix: add warning when window state persistence enabled without window name

* docs: lowercase capital B for consistency

---------

Co-authored-by: Charles Kerr <[email protected]>
Co-authored-by: David Sanders <[email protected]>
Co-authored-by: Erick Zhao <[email protected]>

* test: clear sharedUserPath before and test

* refactor: hasInvalidDisplay function

* debug: add display info logging for CI

* fix: do not save/restore when window is 0x0

* test: support for multimonitor tests (#47911)

* test: support for multimonitor tests

* fix: update yarn.lock file

* test: support any resolution for new displays

* test: support display positioning

* docs: multi-monitor tests

* test: remove dummy test

* feat: enforce unique window names across BaseWindow and BrowserWindow (#47764)

* feat: save window state (#47425)

* feat: save/restore window state

* cleanup

* remove constructor option

* refactor: apply suggestions from code review

Co-authored-by: Charles Kerr <[email protected]>

* refactor: forward declare prefservice

* refactor: remove constructor option

* refactor: save window state on move/resize instead of moved/resized

* feat: resave window state after construction

* test: add basic window save tests

* test: add work area tests

* test: asynchronous batching behavior

* docs: add windowStateRestoreOptions to BaseWindowConstructorOptions

* chore: move includes to main block

* Update spec/api-browser-window-spec.ts

Co-authored-by: David Sanders <[email protected]>

* docs: update docs/api/structures/base-window-options.md

Co-authored-by: Erick Zhao <[email protected]>

* fix: preserve original bounds during window state save in special modes

* feat: save kiosk state in window preferences

* chore: remove ts-expect-error

* test: check hasCapturableScreen before running tests

* test: remove multimonitor tests

* test: add missing hasCapturableScreen checks before tests

* docs: add blurb on saving mechanism

* feat: add debounce window of 200ms to saveWindowState

* docs: remove blurb until finalized

* style: convert constants from snake_case to camelCase

* refactor: initialize prefs_ only if window state is configured to be saved/restored

* refactor: rename window states key

* refactor: store in application-level Local State instead of browser context

* refactor: switch to more accurate function names

* fix: add dcheck for browser_process

* fix: flush window state to avoid race condition

* refactor: change stateId to name

* refactor: change windowStateRestoreOptions to windowStatePersistence

* Update docs/api/structures/base-window-options.md

Co-authored-by: David Sanders <[email protected]>

* fix: add warning when window state persistence enabled without window name

* docs: lowercase capital B for consistency

---------

Co-authored-by: Charles Kerr <[email protected]>
Co-authored-by: David Sanders <[email protected]>
Co-authored-by: Erick Zhao <[email protected]>

* feat: enforce unique window names across BaseWindow and BrowserWindow

* docs: update docs for name property

* fix: linter issue with symbol

---------

Co-authored-by: Charles Kerr <[email protected]>
Co-authored-by: David Sanders <[email protected]>
Co-authored-by: Erick Zhao <[email protected]>

* test: remove invalid display test

---------

Co-authored-by: Charles Kerr <[email protected]>
Co-authored-by: David Sanders <[email protected]>
Co-authored-by: Erick Zhao <[email protected]>
Co-authored-by: Keeley Hammond <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-check-skip Skip trop's backport validity checking GSoC 2025 Google Summer of Code 2025 no-backport semver/none
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants