Skip to content

docs(electron): document mocking the native main-process dialog API#40952

Merged
yury-s merged 1 commit into
microsoft:mainfrom
yury-s:docs-electron-dialog-mock
May 21, 2026
Merged

docs(electron): document mocking the native main-process dialog API#40952
yury-s merged 1 commit into
microsoft:mainfrom
yury-s:docs-electron-dialog-mock

Conversation

@yury-s
Copy link
Copy Markdown
Member

@yury-s yury-s commented May 21, 2026

Summary

Adds a recipe to class-electron.md showing how to stub dialog.showOpenDialog / showSaveDialog / showMessageBox (and their sync variants) via electronApplication.evaluate(), since Playwright doesn't intercept the native Electron Dialog API automatically.

Replaces #40911.

Follow-up

If users need more sophisticated dialog interceptors with callbacks handled on the Playwright side (e.g. dynamic responses driven by test state, not just static stubs), we can later expose ElectronApplication.exposeBinding — a main-process equivalent of BrowserContext.exposeBinding — so the Electron main process can call into the test directly without going through webContents.executeJavaScript.

Refs #8278

Adds a recipe to class-electron.md showing how to stub
`dialog.showOpenDialog` / `showSaveDialog` / `showMessageBox` (and their
sync variants) via `electronApplication.evaluate()`, since Playwright
does not intercept the native Electron Dialog API automatically.

Refs microsoft#8278
@github-actions
Copy link
Copy Markdown
Contributor

Test results for "MCP"

7181 passed, 1113 skipped


Merge workflow run.

@github-actions
Copy link
Copy Markdown
Contributor

Test results for "tests 1"

3 flaky ⚠️ [chromium-library] › library/video.spec.ts:719 › screencast › should work with video+trace `@chromium-ubuntu-22.04-arm-node20`
⚠️ [chromium-library] › library/video.spec.ts:275 › screencast › should capture navigation `@chromium-ubuntu-22.04-node22`
⚠️ [firefox-library] › library/inspector/cli-codegen-3.spec.ts:224 › cli codegen › should generate frame locators (4) `@firefox-ubuntu-22.04-node20`

42061 passed, 850 skipped


Merge workflow run.

@yury-s yury-s requested a review from dgozman May 21, 2026 21:27
@yury-s yury-s merged commit c1b1aa6 into microsoft:main May 21, 2026
45 checks passed
@yury-s yury-s deleted the docs-electron-dialog-mock branch May 21, 2026 23:04
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