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
docs: clarify the null value for the viewport (#20333)
Pavel Feldman5761a62b1c0a
diff --git a/docs/src/api/params.md b/docs/src/api/params.mdindex a58da7d775..75873e02c2 100644--- a/docs/src/api/params.md+++ b/docs/src/api/params.md@@ -276,7 +276,14 @@ When using [`method: Page.goto`], [`method: Page.route`], [`method: Page.waitFor- `width` <[int]> page width in pixels.- `height` <[int]> page height in pixels.-Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. `null` disables the default viewport.+Emulates consistent viewport for each page. Defaults to an 1280x720 viewport.+Use `null` to disable the consistent viewport emulation.++:::note+The `null` value opts out from the default presets, makes viewport depend on the+host window size defined by the operating system. It makes the execution of the+tests non-deterministic.+:::## csharp-context-option-viewport* langs: csharp@@ -285,7 +292,14 @@ Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. `n- `width` <[int]> page width in pixels.- `height` <[int]> page height in pixels.-Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. Use `ViewportSize.NoViewport` to disable the default viewport.+Emulates consistent viewport for each page. Defaults to an 1280x720 viewport.+Use `ViewportSize.NoViewport` to disable the consistent viewport emulation.++:::note+The `ViewportSize.NoViewport` value opts out from the default presets,+makes viewport depend on the host window size defined by the operating system.+It makes the execution of the tests non-deterministic.+:::## context-option-screen* langs:diff --git a/packages/playwright-core/types/types.d.ts b/packages/playwright-core/types/types.d.tsindex b497f8d60f..e61b6edf83 100644--- a/packages/playwright-core/types/types.d.ts+++ b/packages/playwright-core/types/types.d.ts@@ -12514,7 +12514,11 @@ export interface BrowserType<Unused = {}> {videosPath?: string;/**- * Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. `null` disables the default viewport.+ * Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. Use `null` to disable the consistent+ * viewport emulation.+ *+ * **NOTE** The `null` value opts out from the default presets, makes viewport depend on the host window size defined+ * by the operating system. It makes the execution of the tests non-deterministic.*/viewport?: null|{/**@@ -13877,7 +13881,11 @@ export interface AndroidDevice {videosPath?: string;/**- * Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. `null` disables the default viewport.+ * Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. Use `null` to disable the consistent+ * viewport emulation.+ *+ * **NOTE** The `null` value opts out from the default presets, makes viewport depend on the host window size defined+ * by the operating system. It makes the execution of the tests non-deterministic.*/viewport?: null|{/**@@ -15779,7 +15787,11 @@ export interface Browser extends EventEmitter {videosPath?: string;/**- * Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. `null` disables the default viewport.+ * Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. Use `null` to disable the consistent+ * viewport emulation.+ *+ * **NOTE** The `null` value opts out from the default presets, makes viewport depend on the host window size defined+ * by the operating system. It makes the execution of the tests non-deterministic.*/viewport?: null|{/**@@ -18820,7 +18832,11 @@ export interface BrowserContextOptions {videosPath?: string;/**- * Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. `null` disables the default viewport.+ * Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. Use `null` to disable the consistent+ * viewport emulation.+ *+ * **NOTE** The `null` value opts out from the default presets, makes viewport depend on the host window size defined+ * by the operating system. It makes the execution of the tests non-deterministic.*/viewport?: null|ViewportSize;}diff --git a/packages/playwright-test/types/test.d.ts b/packages/playwright-test/types/test.d.tsindex 77ce9df68d..4612371ae2 100644--- a/packages/playwright-test/types/test.d.ts+++ b/packages/playwright-test/types/test.d.ts@@ -3523,7 +3523,11 @@ export interface PlaywrightTestOptions {*/userAgent: string | undefined;/**- * Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. `null` disables the default viewport.+ * Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. Use `null` to disable the consistent+ * viewport emulation.+ *+ * **NOTE** The `null` value opts out from the default presets, makes viewport depend on the host window size defined+ * by the operating system. It makes the execution of the tests non-deterministic.*/viewport: ViewportSize | null | undefined;/**