CodeVetter · Repo Unpack · Data flow
microsoft/playwright
Commands enter through CLI parsing or client APIs and are normalized before reaching execution owners. Protocol messages carry object identities, parameters, timeouts, and metadata, with validation on both dispatch and response paths. Test state flows through project phases and workers to reporters and persisted selection metadata. Browser storage travels between injected page code, server context state, and client-owned JSON files.
- runTests converts CLI options to overrides, loads configuration, builds TestRunOptions, validates project filters, then branches to UI, watch, or ordinary execution.
- Connection.sendMessageToServer creates id/guid/method/params messages with timeout/location metadata, tracks callbacks, and emits __abort__ when a supplied signal aborts.
- DispatcherConnection resolves the target GUID, validates parameters and metadata, invokes the dispatcher under a ProgressController timeout, and validates the returned result.
- During test phases, dependency-produced environment variables are merged into downstream projects; failed dependencies prevent their test groups from being dispatched.
- LastRunReporter persists status and failed/unrun test IDs to .last-run.json or an override path, skips writes in list mode, and treats unreadable prior state as unavailable.
- storageState collects cookies, tries utility-world collection on live pages, then visits remaining origins through an intercepted blank page; the client optionally writes the returned object as formatted JSON.
- prepareStorageState accepts an object or parses a client-side file; setStorageState restores cookies/credentials and invokes StorageScript.restore for the union of old and new origins.
- API fetch merges default/request headers, resolves baseURL and query parameters, serializes the request body, sends with retry handling, and stores the response body under a fetch UID.