Expand description
Opt-in test fakes for browser APIs Playwright cannot drive natively.
The File System Access API (window.showSaveFilePicker /
showOpenFilePicker) opens native OS dialogs with no DOM presence, so no
locator or dialog handler can reach them. The standard cross-binding
pattern is to install a deterministic fake before the app’s JS runs;
FakeFileSystem packages that pattern so consumers don’t hand-roll it.
Nothing here is installed unless a test asks for it: a page that never
calls Page::fake_file_system
keeps the browser’s real (or absent) picker functions, so
feature-detection and fallback paths stay testable.
§Example
let fs = page.fake_file_system().await?;
// Seed a file the app's Open dialog will "pick":
fs.set_open_file("plan.json", br#"{"rooms": []}"#).await?;
// ... drive the app's Save As flow, then assert what it wrote:
page.goto("https://localhost:8080", None).await?;
let saved = fs.last_saved_bytes().await?;
assert!(saved.is_some());Structs§
- Fake
File System - Handle to the fake File System Access API installed on a
PagebyPage::fake_file_system.