Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
doc: document mocking read-only browser apis (#30122)
Pavel Feldman4cce7e5bffa2
diff --git a/docs/src/mock-browser-js.md b/docs/src/mock-browser-js.mdindex 26f76f6363..9647e0a151 100644--- a/docs/src/mock-browser-js.md+++ b/docs/src/mock-browser-js.md@@ -60,6 +60,23 @@ test('show battery status', async ({ page }) => {```+## Mocking read-only APIs++Some APIs are read-only so you won't be able to assign to a navigator property. For example,++```js+// Following line will have no effect.+navigator.cookieEnabled = true;+```++However, if the property is [configurable](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty#configurable), you can still override it using the plain JavaScript:++```js+await page.addInitScript(() => {+ Object.defineProperty(Object.getPrototypeOf(navigator), 'cookieEnabled', { value: false });+});+```+## Verifying API callsSometimes it is useful to check if the page made all expected APIs calls. You can