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
feat: make `playwright` package not install browsers automatically (#26672)
Dmitry Gozman36347e7feac4
diff --git a/docs/src/browsers.md b/docs/src/browsers.mdindex bf83ad8af3..526fce5f06 100644--- a/docs/src/browsers.md+++ b/docs/src/browsers.md@@ -468,31 +468,17 @@ Sometimes companies maintain an internal proxy that blocks direct access to theresources. In this case, Playwright can be configured to download browsers via a proxy server.```bash tab=bash-bash lang=js-# For Playwright TestHTTPS_PROXY=https://192.0.2.1 npx playwright install--# For Playwright Library-HTTPS_PROXY=https://192.0.2.1 npm install playwright``````batch tab=bash-batch lang=js-# For Playwright Testset HTTPS_PROXY=https://192.0.2.1npx playwright install--# For Playwright Library-set HTTPS_PROXY=https://192.0.2.1-npm install playwright``````powershell tab=bash-powershell lang=js-# For Playwright Test$Env:HTTPS_PROXY="https://192.0.2.1"npx playwright install--# For Playwright Library-$Env:HTTPS_PROXY="https://192.0.2.1"-npm install playwright``````bash tab=bash-bash lang=python@@ -614,6 +600,7 @@ pwsh bin/Debug/netX/playwright.ps1 install$Env:PLAYWRIGHT_DOWNLOAD_CONNECTION_TIMEOUT="120000"pwsh bin/Debug/netX/playwright.ps1 install```+## Download from artifact repositoryBy default, Playwright downloads browsers from Microsoft's CDN.@@ -623,31 +610,17 @@ binaries. In this case, Playwright can be configured to download from a customlocation using the `PLAYWRIGHT_DOWNLOAD_HOST` env variable.```bash tab=bash-bash lang=js-# For Playwright TestPLAYWRIGHT_DOWNLOAD_HOST=192.0.2.1 npx playwright install--# For Playwright Library-PLAYWRIGHT_DOWNLOAD_HOST=192.0.2.1 npm install playwright``````batch tab=bash-batch lang=js-# For Playwright Testset PLAYWRIGHT_DOWNLOAD_HOST=192.0.2.1npx playwright install--# For Playwright Library-set PLAYWRIGHT_DOWNLOAD_HOST=192.0.2.1-npm install playwright``````powershell tab=bash-powershell lang=js-# For Playwright Test$Env:PLAYWRIGHT_DOWNLOAD_HOST="192.0.2.1"npx playwright install--# For Playwright Library-$Env:PLAYWRIGHT_DOWNLOAD_HOST="192.0.2.1"-npm install playwright``````bash tab=bash-bash lang=python@@ -699,35 +672,19 @@ It is also possible to use a per-browser download hosts using `PLAYWRIGHT_CHROMItake precedence over `PLAYWRIGHT_DOWNLOAD_HOST`.```bash tab=bash-bash lang=js-# For Playwright TestPLAYWRIGHT_FIREFOX_DOWNLOAD_HOST=203.0.113.3 PLAYWRIGHT_DOWNLOAD_HOST=192.0.2.1 npx playwright install--# For Playwright Library-PLAYWRIGHT_FIREFOX_DOWNLOAD_HOST=203.0.113.3 PLAYWRIGHT_DOWNLOAD_HOST=192.0.2.1 npm install playwright``````batch tab=bash-batch lang=js-# For Playwright Testset PLAYWRIGHT_FIREFOX_DOWNLOAD_HOST=203.0.113.3set PLAYWRIGHT_DOWNLOAD_HOST=192.0.2.1npx playwright install--# For Playwright Library-set PLAYWRIGHT_FIREFOX_DOWNLOAD_HOST=203.0.113.3-set PLAYWRIGHT_DOWNLOAD_HOST=192.0.2.1-npm install playwright``````powershell tab=bash-powershell lang=js-# For Playwright Test$Env:PLAYWRIGHT_FIREFOX_DOWNLOAD_HOST="203.0.113.3"$Env:PLAYWRIGHT_DOWNLOAD_HOST="192.0.2.1"npx playwright install--# For Playwright Library-$Env:PLAYWRIGHT_FIREFOX_DOWNLOAD_HOST="203.0.113.3"-$Env:PLAYWRIGHT_DOWNLOAD_HOST="192.0.2.1"-npm install playwright``````bash tab=bash-bash lang=pythondiff --git a/docs/src/library-js.md b/docs/src/library-js.mdindex d85c28c1ac..29ace98ba3 100644--- a/docs/src/library-js.md+++ b/docs/src/library-js.md@@ -99,8 +99,8 @@ The key differences to note are as follows:| | Library | Test || - | - | - || Installation | `npm install playwright` | `npm init playwright@latest` - note `install` vs. `init` |-| Install browsers | Chromium, Firefox, WebKit are installed by default | `npx playwright install` or `npx playwright install chromium` for a single one |-| `import`/`require` name | `playwright` | `@playwright/test` |+| Install browsers | Install `@playwright/browser-chromium`, `@playwright/browser-firefox` and/or `@playwright/browser-webkit` | `npx playwright install` or `npx playwright install chromium` for a single one |+| `import` from | `playwright` | `@playwright/test` || Initialization | Explicitly need to: <ol><li>Pick a browser to use, e.g. `chromium`</li><li>Launch browser with [`method: BrowserType.launch`]</li><li>Create a context with [`method: Browser.newContext`], <em>and</em> pass any context options explicitly, e.g. `devices['iPhone 11']`</li><li>Create a page with [`method: BrowserContext.newPage`]</li></ol> | An isolated `page` and `context` are provided to each test out-of the box, along with other [built-in fixtures](./test-fixtures.md#built-in-fixtures). No explicit creation. If referenced by the test in it's arguments, the Test Runner will create them for the test. (i.e. lazy-initialization) || Assertions | No built-in Web-First Assertions | [Web-First assertions](./test-assertions.md) like: <ul><li>[`method: PageAssertions.toHaveTitle`]</li><li>[`method: PageAssertions.toHaveScreenshot#1`]</li></ul> which auto-wait and retry for the condition to be met.|| Cleanup | Explicitly need to: <ol><li>Close context with [`method: BrowserContext.close`]</li><li>Close browser with [`method: Browser.close`]</li></ol> | No explicit close of [built-in fixtures](./test-fixtures.md#built-in-fixtures); the Test Runner will take care of it.@@ -124,9 +124,19 @@ Use npm or Yarn to install Playwright library in your Node.js project. See [systnpm i -D playwright```-This single command downloads the Playwright NPM package and browser binaries for Chromium, Firefox and WebKit. To modify this behavior see [managing browsers](./browsers.md#managing-browser-binaries).+You will also need to install browsers - either manually or by adding a package that will do it for you automatically.-Once installed, you can `require` Playwright in a Node.js script, and launch any of the 3 browsers (`chromium`, `firefox` and `webkit`).+```bash+# Download the Chromium, Firefox and WebKit browser+npx playwright install chromium firefox webkit++# Alternatively, add packages that will download a browser upon npm install+npm i -D @playwright/browser-chromium @playwright/browser-firefox @playwright/browser-webkit+```++See [managing browsers](./browsers.md#managing-browser-binaries) for more options.++Once installed, you can import Playwright in a Node.js script, and launch any of the 3 browsers (`chromium`, `firefox` and `webkit`).```jsconst { chromium } = require('playwright');@@ -179,25 +189,114 @@ npx playwright codegen wikipedia.org## Browser downloads-By default, `playwright` automatically downloads Chromium, Firefox and WebKit during package installation.+To download Playwright browsers run:++```bash+# Explicitly download browsers+npx playwright install+```++Alternatively, you can add `@playwright/browser-chromium`, `@playwright/browser-firefox` and `@playwright/browser-webkit` packages to automatically download the respective browser during the package installation.++```bash+# Use a helper package that downloads a browser on npm install+npm install @playwright/browser-chromium+```++**Download behind a firewall or a proxy**++Pass `HTTPS_PROXY` environment variable to download through a proxy.++```bash tab=bash-bash lang=js+# Manual+HTTPS_PROXY=https://192.0.2.1 npx playwright install++# Through @playwright/browser-chromium, @playwright/browser-firefox+# and @playwright/browser-webkit helper packages+HTTPS_PROXY=https://192.0.2.1 npm install+```++```batch tab=bash-batch lang=js+# Manual+set HTTPS_PROXY=https://192.0.2.1+npx playwright install++# Through @playwright/browser-chromium, @playwright/browser-firefox+# and @playwright/browser-webkit helper packages+set HTTPS_PROXY=https://192.0.2.1+npm install+```++```powershell tab=bash-powershell lang=js+# Manual+$Env:HTTPS_PROXY=https://192.0.2.1+npx playwright install++# Through @playwright/browser-chromium, @playwright/browser-firefox+# and @playwright/browser-webkit helper packages+$Env:HTTPS_PROXY=https://192.0.2.1+npm install+```++**Download from artifact repository**++By default, Playwright downloads browsers from Microsoft's CDN. Pass `PLAYWRIGHT_DOWNLOAD_HOST` environment variable to download from an internal artifacts repository instead.++```bash tab=bash-bash lang=js+# Manual+PLAYWRIGHT_DOWNLOAD_HOST=192.0.2.1 npx playwright install++# Through @playwright/browser-chromium, @playwright/browser-firefox+# and @playwright/browser-webkit helper packages+PLAYWRIGHT_DOWNLOAD_HOST=192.0.2.1 npm install+```++```batch tab=bash-batch lang=js+# Manual+set PLAYWRIGHT_DOWNLOAD_HOST=192.0.2.1+npx playwright install++# Through @playwright/browser-chromium, @playwright/browser-firefox+# and @playwright/browser-webkit helper packages+set PLAYWRIGHT_DOWNLOAD_HOST=192.0.2.1+npm install+```++```powershell tab=bash-powershell lang=js+# Manual+$Env:PLAYWRIGHT_DOWNLOAD_HOST=192.0.2.1+npx playwright install++# Through @playwright/browser-chromium, @playwright/browser-firefox+# and @playwright/browser-webkit helper packages+$Env:PLAYWRIGHT_DOWNLOAD_HOST=192.0.2.1+npm install+```++**Skip browser download**In certain cases, it is desired to avoid browser downloads altogether because browser binaries are managed separately. This can be done by setting `PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD` variable before installing packages.```bash tab=bash-bash lang=js+# When using @playwright/browser-chromium, @playwright/browser-firefox+# and @playwright/browser-webkit helper packagesPLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 npm install``````batch tab=bash-batch lang=js+# When using @playwright/browser-chromium, @playwright/browser-firefox+# and @playwright/browser-webkit helper packagesset PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1npm install``````powershell tab=bash-powershell lang=js+# When using @playwright/browser-chromium, @playwright/browser-firefox+# and @playwright/browser-webkit helper packages$Env:PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1npm install```-## TypeScript supportPlaywright includes built-in support for TypeScript. Type definitions will be imported automatically. It is recommended to use type-checking to improve the IDE experience.diff --git a/package-lock.json b/package-lock.jsonindex 7f26e86342..1c01f7dc6e 100644--- a/package-lock.json+++ b/package-lock.json@@ -1396,6 +1396,18 @@"node": ">= 8"}},+ "node_modules/@playwright/browser-chromium": {+ "resolved": "packages/playwright-browser-chromium",+ "link": true+ },+ "node_modules/@playwright/browser-firefox": {+ "resolved": "packages/playwright-browser-firefox",+ "link": true+ },+ "node_modules/@playwright/browser-webkit": {+ "resolved": "packages/playwright-browser-webkit",+ "link": true+ },"node_modules/@playwright/experimental-ct-core": {"resolved": "packages/playwright-ct-core","link": true@@ -6278,7 +6290,6 @@},"packages/playwright": {"version": "1.38.0-next",- "hasInstallScript": true,"license": "Apache-2.0","dependencies": {"playwright-core": "1.38.0-next"@@ -6290,6 +6301,42 @@"node": ">=16"}},+ "packages/playwright-browser-chromium": {+ "name": "@playwright/browser-chromium",+ "version": "1.38.0-next",+ "hasInstallScript": true,+ "license": "Apache-2.0",+ "dependencies": {+ "playwright-core": "1.38.0-next"+ },+ "engines": {+ "node": ">=16"+ }+ },+ "packages/playwright-browser-firefox": {+ "name": "@playwright/browser-firefox",+ "version": "1.38.0-next",+ "hasInstallScript": true,+ "license": "Apache-2.0",+ "dependencies": {+ "playwright-core": "1.38.0-next"+ },+ "engines": {+ "node": ">=16"+ }+ },+ "packages/playwright-browser-webkit": {+ "name": "@playwright/browser-webkit",+ "version": "1.38.0-next",+ "hasInstallScript": true,+ "license": "Apache-2.0",+ "dependencies": {+ "playwright-core": "1.38.0-next"+ },+ "engines": {+ "node": ">=16"+ }+ },"packages/playwright-chromium": {"version": "1.38.0-next","hasInstallScript": true,@@ -7402,6 +7449,24 @@"fastq": "^1.6.0"}},+ "@playwright/browser-chromium": {+ "version": "file:packages/playwright-browser-chromium",+ "requires": {+ "playwright-core": "1.38.0-next"+ }+ },+ "@playwright/browser-firefox": {+ "version": "file:packages/playwright-browser-firefox",+ "requires": {+ "playwright-core": "1.38.0-next"+ }+ },+ "@playwright/browser-webkit": {+ "version": "file:packages/playwright-browser-webkit",+ "requires": {+ "playwright-core": "1.38.0-next"+ }+ },"@playwright/experimental-ct-core": {"version": "file:packages/playwright-ct-core","requires": {diff --git a/packages/playwright-browser-chromium/README.md b/packages/playwright-browser-chromium/README.mdnew file mode 100644index 0000000000..03e8c5de08--- /dev/null+++ b/packages/playwright-browser-chromium/README.md@@ -0,0 +1,3 @@+# @playwright/browser-chromium++This package automatically installs [Chromium](https://www.chromium.org/) browser for [Playwright](http://github.com/microsoft/playwright) library. If you want to write end-to-end tests, we recommend [@playwright/test](https://playwright.dev/docs/intro).diff --git a/packages/playwright-browser-chromium/index.d.ts b/packages/playwright-browser-chromium/index.d.tsnew file mode 100644index 0000000000..89d098eaca--- /dev/null+++ b/packages/playwright-browser-chromium/index.d.ts@@ -0,0 +1,17 @@+/**+ * Copyright (c) Microsoft Corporation.+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */++export {};diff --git a/packages/playwright-browser-chromium/index.js b/packages/playwright-browser-chromium/index.jsnew file mode 100644index 0000000000..c391f5c267--- /dev/null+++ b/packages/playwright-browser-chromium/index.js@@ -0,0 +1,15 @@+/**+ * Copyright (c) Microsoft Corporation.+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */diff --git a/packages/playwright-browser-chromium/index.mjs b/packages/playwright-browser-chromium/index.mjsnew file mode 100644index 0000000000..c391f5c267--- /dev/null+++ b/packages/playwright-browser-chromium/index.mjs@@ -0,0 +1,15 @@+/**+ * Copyright (c) Microsoft Corporation.+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */diff --git a/packages/playwright-browser-chromium/install.js b/packages/playwright-browser-chromium/install.jsnew file mode 100644index 0000000000..8ceef68b95--- /dev/null+++ b/packages/playwright-browser-chromium/install.js@@ -0,0 +1,27 @@+/**+ * Copyright (c) Microsoft Corporation.+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */++let install;++try {+ if (!require('playwright-core/lib/utils').isLikelyNpxGlobal())+ install = require('playwright-core/lib/server').installBrowsersForNpmInstall;+} catch (e) {+ // Dev build, don't install browsers by default.+}++if (install)+ install(['chromium', 'ffmpeg']);diff --git a/packages/playwright-browser-chromium/package.json b/packages/playwright-browser-chromium/package.jsonnew file mode 100644index 0000000000..793eeecee4--- /dev/null+++ b/packages/playwright-browser-chromium/package.json@@ -0,0 +1,29 @@+{+ "name": "@playwright/browser-chromium",+ "version": "1.38.0-next",+ "description": "Playwright package that automatically installs Chromium",+ "repository": "github:Microsoft/playwright",+ "homepage": "https://playwright.dev",+ "engines": {+ "node": ">=16"+ },+ "author": {+ "name": "Microsoft Corporation"+ },+ "license": "Apache-2.0",+ "exports": {+ ".": {+ "types": "./index.d.ts",+ "import": "./index.mjs",+ "require": "./index.js",+ "default": "./index.js"+ },+ "./package.json": "./package.json"+ },+ "scripts": {+ "install": "node install.js"+ },+ "dependencies": {+ "playwright-core": "1.38.0-next"+ }+}diff --git a/packages/playwright-browser-firefox/README.md b/packages/playwright-browser-firefox/README.mdnew file mode 100644index 0000000000..38bc7cb03f--- /dev/null+++ b/packages/playwright-browser-firefox/README.md@@ -0,0 +1,3 @@+# @playwright/browser-firefox++This package automatically installs [Firefox](https://www.mozilla.org/firefox/) browser for [Playwright](http://github.com/microsoft/playwright) library. If you want to write end-to-end tests, we recommend [@playwright/test](https://playwright.dev/docs/intro).diff --git a/packages/playwright-browser-firefox/index.d.ts b/packages/playwright-browser-firefox/index.d.tsnew file mode 100644index 0000000000..89d098eaca--- /dev/null+++ b/packages/playwright-browser-firefox/index.d.ts@@ -0,0 +1,17 @@+/**+ * Copyright (c) Microsoft Corporation.+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */++export {};diff --git a/packages/playwright-browser-firefox/index.js b/packages/playwright-browser-firefox/index.jsnew file mode 100644index 0000000000..c391f5c267--- /dev/null+++ b/packages/playwright-browser-firefox/index.js@@ -0,0 +1,15 @@+/**+ * Copyright (c) Microsoft Corporation.+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */diff --git a/packages/playwright-browser-firefox/index.mjs b/packages/playwright-browser-firefox/index.mjsnew file mode 100644index 0000000000..c391f5c267--- /dev/null+++ b/packages/playwright-browser-firefox/index.mjs@@ -0,0 +1,15 @@+/**+ * Copyright (c) Microsoft Corporation.+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */diff --git a/packages/playwright-browser-firefox/install.js b/packages/playwright-browser-firefox/install.jsnew file mode 100644index 0000000000..a917664fc0--- /dev/null+++ b/packages/playwright-browser-firefox/install.js@@ -0,0 +1,27 @@+/**+ * Copyright (c) Microsoft Corporation.+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */++let install;++try {+ if (!require('playwright-core/lib/utils').isLikelyNpxGlobal())+ install = require('playwright-core/lib/server').installBrowsersForNpmInstall;+} catch (e) {+ // Dev build, don't install browsers by default.+}++if (install)+ install(['firefox']);diff --git a/packages/playwright-browser-firefox/package.json b/packages/playwright-browser-firefox/package.jsonnew file mode 100644index 0000000000..3695ba72a9--- /dev/null+++ b/packages/playwright-browser-firefox/package.json@@ -0,0 +1,29 @@+{+ "name": "@playwright/browser-firefox",+ "version": "1.38.0-next",+ "description": "Playwright package that automatically installs Firefox",+ "repository": "github:Microsoft/playwright",+ "homepage": "https://playwright.dev",+ "engines": {+ "node": ">=16"+ },+ "author": {+ "name": "Microsoft Corporation"+ },+ "license": "Apache-2.0",+ "exports": {+ ".": {+ "types": "./index.d.ts",+ "import": "./index.mjs",+ "require": "./index.js",+ "default": "./index.js"+ },+ "./package.json": "./package.json"+ },+ "scripts": {+ "install": "node install.js"+ },+ "dependencies": {+ "playwright-core": "1.38.0-next"+ }+}diff --git a/packages/playwright-browser-webkit/README.md b/packages/playwright-browser-webkit/README.mdnew file mode 100644index 0000000000..c8196534f4--- /dev/null+++ b/packages/playwright-browser-webkit/README.md@@ -0,0 +1,3 @@+# @playwright/browser-webkit++This package automatically installs [WebKit](https://www.webkit.org/) browser for [Playwright](http://github.com/microsoft/playwright) library. If you want to write end-to-end tests, we recommend [@playwright/test](https://playwright.dev/docs/intro).diff --git a/packages/playwright-browser-webkit/index.d.ts b/packages/playwright-browser-webkit/index.d.tsnew file mode 100644index 0000000000..89d098eaca--- /dev/null+++ b/packages/playwright-browser-webkit/index.d.ts@@ -0,0 +1,17 @@+/**+ * Copyright (c) Microsoft Corporation.+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */++export {};diff --git a/packages/playwright-browser-webkit/index.js b/packages/playwright-browser-webkit/index.jsnew file mode 100644index 0000000000..c391f5c267--- /dev/null+++ b/packages/playwright-browser-webkit/index.js@@ -0,0 +1,15 @@+/**+ * Copyright (c) Microsoft Corporation.+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */diff --git a/packages/playwright-browser-webkit/index.mjs b/packages/playwright-browser-webkit/index.mjsnew file mode 100644index 0000000000..c391f5c267--- /dev/null+++ b/packages/playwright-browser-webkit/index.mjs@@ -0,0 +1,15 @@+/**+ * Copyright (c) Microsoft Corporation.+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */diff --git a/packages/playwright/install.js b/packages/playwright-browser-webkit/install.jssimilarity index 87%rename from packages/playwright/install.jsrename to packages/playwright-browser-webkit/install.jsindex d325c22096..237ee38d63 100644--- a/packages/playwright/install.js+++ b/packages/playwright-browser-webkit/install.js@@ -18,10 +18,10 @@ let install;try {if (!require('playwright-core/lib/utils').isLikelyNpxGlobal())- install = require('playwright-core/lib/server').installDefaultBrowsersForNpmInstall;+ install = require('playwright-core/lib/server').installBrowsersForNpmInstall;} catch (e) {// Dev build, don't install browsers by default.}if (install)- install();+ install(['webkit']);diff --git a/packages/playwright-browser-webkit/package.json b/packages/playwright-browser-webkit/package.jsonnew file mode 100644index 0000000000..4a8f58a4f6--- /dev/null+++ b/packages/playwright-browser-webkit/package.json@@ -0,0 +1,29 @@+{+ "name": "@playwright/browser-webkit",+ "version": "1.38.0-next",+ "description": "Playwright package that automatically installs WebKit",+ "repository": "github:Microsoft/playwright",+ "homepage": "https://playwright.dev",+ "engines": {+ "node": ">=16"+ },+ "author": {+ "name": "Microsoft Corporation"+ },+ "license": "Apache-2.0",+ "exports": {+ ".": {+ "types": "./index.d.ts",+ "import": "./index.mjs",+ "require": "./index.js",+ "default": "./index.js"+ },+ "./package.json": "./package.json"+ },+ "scripts": {+ "install": "node install.js"+ },+ "dependencies": {+ "playwright-core": "1.38.0-next"+ }+}diff --git a/packages/playwright/package.json b/packages/playwright/package.jsonindex 59a141f981..2b9123043f 100644--- a/packages/playwright/package.json+++ b/packages/playwright/package.json@@ -25,7 +25,6 @@"playwright": "./cli.js"},"scripts": {- "install": "node install.js"},"dependencies": {"playwright-core": "1.38.0-next"diff --git a/tests/installation/android-types.spec.ts b/tests/installation/android-types.spec.tsindex e8e84004d1..f45268c487 100755--- a/tests/installation/android-types.spec.ts+++ b/tests/installation/android-types.spec.ts@@ -16,7 +16,7 @@import { test } from './npmTest';test('android types', async ({ exec, tsc, writeFiles }) => {- await exec('npm i --foreground-scripts playwright', { env: { PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: '1' } });+ await exec('npm i --foreground-scripts playwright');await writeFiles({'test.ts':`import { AndroidDevice, _android, AndroidWebView, Page } from 'playwright';`,diff --git a/tests/installation/driver-should-work.spec.ts b/tests/installation/driver-should-work.spec.tsindex 7c30bcee6b..99c57e27c7 100755--- a/tests/installation/driver-should-work.spec.ts+++ b/tests/installation/driver-should-work.spec.ts@@ -16,7 +16,7 @@import { test, expect } from './npmTest';test('driver should work', async ({ exec }) => {- await exec('npm i --foreground-scripts playwright', { env: { PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: '1' } });+ await exec('npm i --foreground-scripts playwright');await exec('npx playwright install');await exec('node driver-client.js');});@@ -24,7 +24,7 @@ test('driver should work', async ({ exec }) => {test('driver should ignore SIGINT', async ({ exec }) => {test.skip(process.platform === 'win32', 'Only relevant for POSIX');test.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright-python/issues/1843' });- await exec('npm i --foreground-scripts playwright', { env: { PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: '1' } });+ await exec('npm i --foreground-scripts playwright');await exec('npx playwright install chromium');const output = await exec('node driver-client-sigint.js');const lines = output.split('\n').filter(l => l.trim());diff --git a/tests/installation/electron-types.spec.ts b/tests/installation/electron-types.spec.tsindex a2257f9459..ccb1eae7d9 100755--- a/tests/installation/electron-types.spec.ts+++ b/tests/installation/electron-types.spec.ts@@ -16,7 +16,7 @@import { test } from './npmTest';test('electron types', async ({ exec, tsc, writeFiles }) => {- await exec('npm i --foreground-scripts playwright electron@12', { env: { PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: '1' } });+ await exec('npm i --foreground-scripts playwright electron@12');await writeFiles({'test.ts':`import { Page, _electron, ElectronApplication, Electron } from 'playwright';`diff --git a/tests/installation/fixture-scripts/browser-only.js b/tests/installation/fixture-scripts/browser-only.jsnew file mode 100644index 0000000000..3642923c36--- /dev/null+++ b/tests/installation/fixture-scripts/browser-only.js@@ -0,0 +1,27 @@+/**+ * Copyright (c) Microsoft Corporation.+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */++const requireName = process.argv[2];+const pkg = require(requireName);++for (const key of ['chromium', 'firefox', 'webkit', 'test', 'devices']) {+ if (pkg[key] !== undefined) {+ console.error(`Package ${requireName} should not export ${key}`);+ process.exit(1);+ }+}++console.log(`${requireName} SUCCESS`);diff --git a/tests/installation/fixture-scripts/sanity.js b/tests/installation/fixture-scripts/sanity.jsindex 92ea51a9b6..3b714f8d4c 100644--- a/tests/installation/fixture-scripts/sanity.js+++ b/tests/installation/fixture-scripts/sanity.js@@ -15,20 +15,7 @@*/const requireName = process.argv[2];-let success = {- 'playwright': ['chromium', 'firefox', 'webkit'],- 'playwright-chromium': ['chromium'],- 'playwright-firefox': ['firefox'],- 'playwright-webkit': ['webkit'],- '@playwright/test': ['chromium', 'firefox', 'webkit'],-}[requireName];-if (process.argv[3] === 'none')- success = [];-else if (process.argv[3] === 'all')- success = ['chromium', 'firefox', 'webkit'];-else if (process.argv[3])- success = process.argv.slice(3)-+const success = process.argv.slice(3);const playwright = require(requireName);const packageJSON = require(requireName + '/package.json');diff --git a/tests/installation/fixture-scripts/screencast.js b/tests/installation/fixture-scripts/screencast.jsindex 2c6dd77a6f..cc2083f68f 100644--- a/tests/installation/fixture-scripts/screencast.js+++ b/tests/installation/fixture-scripts/screencast.js@@ -15,16 +15,7 @@*/const requireName = process.argv[2];-let success = {- 'playwright': ['chromium', 'firefox', 'webkit'],- 'playwright-chromium': ['chromium'],- 'playwright-firefox': ['firefox'],- 'playwright-webkit': ['webkit'],-}[requireName];-if (process.argv[3] === 'none')- success = [];-if (process.argv[3] === 'all')- success = ['chromium', 'firefox', 'webkit'];+const success = process.argv.slice(3);const playwright = require(requireName);const fs = require('fs');diff --git a/tests/installation/globalSetup.ts b/tests/installation/globalSetup.tsindex 8224b29e70..f9cc7b1756 100644--- a/tests/installation/globalSetup.ts+++ b/tests/installation/globalSetup.ts@@ -50,6 +50,9 @@ async function globalSetup() {build('playwright-chromium'),build('playwright-firefox'),build('playwright-webkit'),+ build('playwright-browser-chromium', '@playwright/browser-chromium'),+ build('playwright-browser-firefox', '@playwright/browser-firefox'),+ build('playwright-browser-webkit', '@playwright/browser-webkit'),]);await fs.promises.writeFile(path.join(__dirname, '.registry.json'), JSON.stringify(Object.fromEntries(builds)));diff --git a/tests/installation/npm-installs-local-packages.spec.ts b/tests/installation/npm-installs-local-packages.spec.tsindex 1645d805bb..01e88baaa8 100755--- a/tests/installation/npm-installs-local-packages.spec.ts+++ b/tests/installation/npm-installs-local-packages.spec.ts@@ -18,7 +18,7 @@ import { test, expect } from './npmTest';import fs from 'fs';test('installs local packages', async ({ registry, exec, tmpWorkspace }) => {- const packages = ['playwright', 'playwright-core', 'playwright-chromium', 'playwright-firefox', 'playwright-webkit', '@playwright/test'];+ const packages = ['playwright', 'playwright-core', 'playwright-chromium', 'playwright-firefox', 'playwright-webkit', '@playwright/test', '@playwright/browser-chromium', '@playwright/browser-firefox', '@playwright/browser-webkit'];await exec('npm i --foreground-scripts', ...packages, { env: { PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: '1' } });const output = await exec('node', path.join(__dirname, '..', '..', 'utils', 'workspace.js'), '--get-version');diff --git a/tests/installation/npx-global-install.spec.ts b/tests/installation/npx-global-install.spec.tsindex 0643903c09..81f84e60c5 100755--- a/tests/installation/npx-global-install.spec.ts+++ b/tests/installation/npx-global-install.spec.ts@@ -17,6 +17,7 @@ import { test, expect } from './npmTest';test('npx playwright install global', async ({ exec, installedSoftwareOnDisk }) => {test.skip(process.platform === 'win32', 'isLikelyNpxGlobal() does not work in this setup on our bots');+const result = await exec('npx playwright install', { env: { npm_config_prefix: '' } }); // global npx and npm_config_prefix do not work together nicely (https://github.com/npm/cli/issues/5268)expect(result).toHaveLoggedSoftwareDownload(['chromium', 'ffmpeg', 'firefox', 'webkit']);expect(await installedSoftwareOnDisk()).toEqual(['chromium', 'ffmpeg', 'firefox', 'webkit']);diff --git a/tests/installation/playwright-cdn-failover-should-work.spec.ts b/tests/installation/playwright-cdn-failover-should-work.spec.tsindex 74dd05166b..9df7433607 100644--- a/tests/installation/playwright-cdn-failover-should-work.spec.ts+++ b/tests/installation/playwright-cdn-failover-should-work.spec.ts@@ -35,13 +35,14 @@ const parsedDownloads = (rawLogs: string) => {for (const cdn of CDNS) {test(`playwright cdn failover should work (${cdn})`, async ({ exec, nodeMajorVersion, installedSoftwareOnDisk }) => {- const result = await exec('npm i --foreground-scripts playwright', { env: { PW_TEST_CDN_THAT_SHOULD_WORK: cdn, DEBUG: 'pw:install' } });+ await exec('npm i --foreground-scripts playwright');+ const result = await exec('npx playwright install', { env: { PW_TEST_CDN_THAT_SHOULD_WORK: cdn, DEBUG: 'pw:install' } });expect(result).toHaveLoggedSoftwareDownload(['chromium', 'ffmpeg', 'firefox', 'webkit']);expect(await installedSoftwareOnDisk()).toEqual(['chromium', 'ffmpeg', 'firefox', 'webkit']);const dls = parsedDownloads(result);for (const software of ['chromium', 'ffmpeg', 'firefox', 'webkit'])expect(dls).toContainEqual({ status: 200, name: software, url: expect.stringContaining(cdn) });- await exec('node sanity.js playwright');+ await exec('node sanity.js playwright chromium firefox webkit');if (nodeMajorVersion >= 14)await exec('node esm-playwright.mjs');const stdio = await exec('npx playwright', 'test', '-c', '.', { expectToExitWithError: true });diff --git a/tests/installation/playwright-cdn-should-race-with-timeout.spec.ts b/tests/installation/playwright-cdn-should-race-with-timeout.spec.tsindex e24f18328b..95ce79cb55 100644--- a/tests/installation/playwright-cdn-should-race-with-timeout.spec.ts+++ b/tests/installation/playwright-cdn-should-race-with-timeout.spec.ts@@ -21,7 +21,8 @@ test(`playwright cdn should race with a timeout`, async ({ exec }) => {const server = http.createServer(() => {});await new Promise<void>(resolve => server.listen(0, resolve));try {- const result = await exec('npm i --foreground-scripts playwright', {+ await exec('npm i --foreground-scripts playwright');+ const result = await exec('npx playwright install', {env: {PLAYWRIGHT_DOWNLOAD_HOST: `http://127.0.0.1:${(server.address() as AddressInfo).port}`,DEBUG: 'pw:install',diff --git a/tests/installation/playwright-cli-codegen.spec.ts b/tests/installation/playwright-cli-codegen.spec.tsindex ecaa0470be..64657555b3 100755--- a/tests/installation/playwright-cli-codegen.spec.ts+++ b/tests/installation/playwright-cli-codegen.spec.ts@@ -17,6 +17,7 @@ import { test, expect } from './npmTest';test('codegen should work', async ({ exec }) => {await exec('npm i --foreground-scripts playwright');+ await exec('npx playwright install chromium');await test.step('codegen without arguments', async () => {const result = await exec('npx playwright codegen', {diff --git a/tests/installation/playwright-cli-install-should-work-with-languages.spec.ts b/tests/installation/playwright-cli-install-should-work-with-languages.spec.tsindex 9dd44b75ea..0ef07c8dbe 100755--- a/tests/installation/playwright-cli-install-should-work-with-languages.spec.ts+++ b/tests/installation/playwright-cli-install-should-work-with-languages.spec.ts@@ -16,7 +16,7 @@import { test, expect } from './npmTest';test('codegen should print the right install command without browsers', async ({ exec }) => {- await exec('npm i --foreground-scripts playwright', { env: { PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: '1' } });+ await exec('npm i --foreground-scripts playwright');const pwLangName2InstallCommand = {'java': 'mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="install"',diff --git a/tests/installation/playwright-cli-install-should-work.spec.ts b/tests/installation/playwright-cli-install-should-work.spec.tsindex d5f3013913..8001dbaec3 100755--- a/tests/installation/playwright-cli-install-should-work.spec.ts+++ b/tests/installation/playwright-cli-install-should-work.spec.ts@@ -15,7 +15,7 @@*/import { test, expect } from './npmTest';-test('codegen should work', async ({ exec, installedSoftwareOnDisk }) => {+test('install command should work', async ({ exec, installedSoftwareOnDisk }) => {await exec('npm i --foreground-scripts playwright', { env: { PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: '1' } });await test.step('playwright install chromium', async () => {@@ -30,12 +30,12 @@ test('codegen should work', async ({ exec, installedSoftwareOnDisk }) => {expect(await installedSoftwareOnDisk()).toEqual(['chromium', 'ffmpeg', 'firefox', 'webkit']);});- await exec('node sanity.js playwright none', { env: { PLAYWRIGHT_BROWSERS_PATH: undefined } });- await exec('node sanity.js playwright');+ await exec('node sanity.js playwright', { env: { PLAYWRIGHT_BROWSERS_PATH: undefined } });+ await exec('node sanity.js playwright chromium firefox webkit');});test('should be able to remove browsers', async ({ exec, installedSoftwareOnDisk }) => {- await exec('npm i --foreground-scripts playwright', { env: { PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: '1' } });+ await exec('npm i --foreground-scripts playwright');await exec('npx playwright install chromium');expect(await installedSoftwareOnDisk()).toEqual(['chromium', 'ffmpeg']);await exec('npx playwright uninstall');diff --git a/tests/installation/playwright-cli-screenshot-should-work.spec.ts b/tests/installation/playwright-cli-screenshot-should-work.spec.tsindex 5cbcb486f8..49d5beaf62 100755--- a/tests/installation/playwright-cli-screenshot-should-work.spec.ts+++ b/tests/installation/playwright-cli-screenshot-should-work.spec.ts@@ -19,6 +19,7 @@ import path from 'path';test('playwright cli screenshot should work', async ({ exec, tmpWorkspace }) => {await exec('npm i --foreground-scripts playwright');+ await exec('npx playwright install chromium');await exec(path.join('node_modules', '.bin', 'playwright'), 'screenshot about:blank one.png');await fs.promises.stat(path.join(tmpWorkspace, 'one.png'));diff --git a/tests/installation/playwright-electron-should-work.spec.ts b/tests/installation/playwright-electron-should-work.spec.tsindex 085389ccb5..6b7fdfbdcf 100755--- a/tests/installation/playwright-electron-should-work.spec.ts+++ b/tests/installation/playwright-electron-should-work.spec.ts@@ -16,6 +16,6 @@import { test } from './npmTest';test('electron should work', async ({ exec }) => {- await exec('npm i --foreground-scripts playwright [email protected]', { env: { PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: '1' } });+ await exec('npm i --foreground-scripts playwright [email protected]');await exec('node sanity-electron.js');});diff --git a/tests/installation/playwright-global-installation-cross-package.spec.ts b/tests/installation/playwright-global-installation-cross-package.spec.tsindex 2a002b7969..0f494d849a 100755--- a/tests/installation/playwright-global-installation-cross-package.spec.ts+++ b/tests/installation/playwright-global-installation-cross-package.spec.ts@@ -19,10 +19,10 @@ test('global installation cross package', async ({ exec, installedSoftwareOnDiskconst packages = ['playwright-chromium', 'playwright-firefox', 'playwright-webkit'];for (const pkg of packages)await exec('npm i --foreground-scripts', pkg, { env: { PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: '1' } });- const result = await exec('npm i --foreground-scripts playwright');+ const result = await exec('npx playwright install');expect(result).toHaveLoggedSoftwareDownload(['chromium', 'ffmpeg', 'firefox', 'webkit']);expect(await installedSoftwareOnDisk()).toEqual(['chromium', 'ffmpeg', 'firefox', 'webkit']);for (const pkg of packages)- await test.step(pkg, () => exec('node sanity.js', pkg, 'all'));+ await test.step(pkg, () => exec('node sanity.js', pkg, 'chromium firefox webkit'));});diff --git a/tests/installation/playwright-global-installation.spec.ts b/tests/installation/playwright-global-installation.spec.tsindex b51c92b6c0..438247d398 100755--- a/tests/installation/playwright-global-installation.spec.ts+++ b/tests/installation/playwright-global-installation.spec.ts@@ -16,9 +16,14 @@import { test, expect } from './npmTest';test('global installation', async ({ exec, installedSoftwareOnDisk }) => {- const result = await exec('npm i --foreground-scripts playwright');- expect(result).toHaveLoggedSoftwareDownload(['chromium', 'ffmpeg', 'firefox', 'webkit']);+ const result1 = await exec('npm i --foreground-scripts playwright');+ expect(result1).toHaveLoggedSoftwareDownload([]);+ expect(await installedSoftwareOnDisk()).toEqual([]);++ const result2 = await exec('npx playwright install');+ expect(result2).toHaveLoggedSoftwareDownload(['chromium', 'ffmpeg', 'firefox', 'webkit']);expect(await installedSoftwareOnDisk()).toEqual(['chromium', 'ffmpeg', 'firefox', 'webkit']);- await exec('node sanity.js playwright none', { env: { PLAYWRIGHT_BROWSERS_PATH: undefined } });- await exec('node sanity.js playwright');++ await exec('node sanity.js playwright', { env: { PLAYWRIGHT_BROWSERS_PATH: undefined } });+ await exec('node sanity.js playwright chromium firefox webkit');});diff --git a/tests/installation/playwright-global-subsequent-installs.spec.ts b/tests/installation/playwright-global-subsequent-installs.spec.tsindex 4db5ac1704..06dcda1ef9 100755--- a/tests/installation/playwright-global-subsequent-installs.spec.ts+++ b/tests/installation/playwright-global-subsequent-installs.spec.ts@@ -18,11 +18,11 @@ import path from 'path';test('subsequent installs works', async ({ exec }) => {test.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/1651' });- await exec('npm i --foreground-scripts playwright');+ await exec('npm i --foreground-scripts @playwright/browser-chromium');// Note: the `npm install` would not actually crash, the error// is merely logged to the console. To reproduce the error, we should make// sure that script's install.js can be run subsequently without unhandled promise rejections.// Note: the flag `--unhandled-rejections=strict` will force node to terminate in case// of UnhandledPromiseRejection.- await exec('node --unhandled-rejections=strict', path.join('node_modules', 'playwright', 'install.js'));+ await exec('node --unhandled-rejections=strict', path.join('node_modules', '@playwright', 'browser-chromium', 'install.js'));});diff --git a/tests/installation/playwright-should-work-with-relative-browsers-path.spec.ts b/tests/installation/playwright-should-work-with-relative-browsers-path.spec.tsindex 9d6388f21b..ef48d46527 100755--- a/tests/installation/playwright-should-work-with-relative-browsers-path.spec.ts+++ b/tests/installation/playwright-should-work-with-relative-browsers-path.spec.ts@@ -21,5 +21,6 @@ test('playwright should work with relative home path', async ({ exec, tmpWorkspaawait fs.promises.mkdir(path.join(tmpWorkspace, 'foo'));// Make sure that browsers path is resolved relative to the `npm install` call location.await exec('npm i --foreground-scripts playwright', { cwd: path.join(tmpWorkspace, 'foo'), env: { PLAYWRIGHT_BROWSERS_PATH: path.join('..', 'relative') } });- await exec('node sanity.js playwright', { env: { PLAYWRIGHT_BROWSERS_PATH: path.join('.', 'relative') } });+ await exec('npx playwright install', { cwd: path.join(tmpWorkspace, 'foo'), env: { PLAYWRIGHT_BROWSERS_PATH: path.join('..', 'relative') } });+ await exec('node sanity.js playwright chromium firefox webkit', { env: { PLAYWRIGHT_BROWSERS_PATH: path.join('.', 'relative') } });});diff --git a/tests/installation/playwright-should-work-with-relative-home-path.spec.ts b/tests/installation/playwright-should-work-with-relative-home-path.spec.tsindex 6e4daac128..b6295ede4c 100755--- a/tests/installation/playwright-should-work-with-relative-home-path.spec.ts+++ b/tests/installation/playwright-should-work-with-relative-home-path.spec.ts@@ -20,7 +20,7 @@ test('playwright should work with relative home path', async ({ exec }) => {test.skip(os.platform().startsWith('win'));const env = { PLAYWRIGHT_BROWSERS_PATH: '0', HOME: '.' };- await exec('npm i --foreground-scripts playwright', { env });+ await exec('npm i --foreground-scripts playwright @playwright/browser-chromium @playwright/browser-webkit', { env });// Firefox does not work with relative HOME.await exec('node sanity.js playwright chromium webkit', { env });});diff --git a/tests/installation/playwright-should-work.spec.ts b/tests/installation/playwright-should-work.spec.tsindex 72d5bcedd2..79d76b8284 100755--- a/tests/installation/playwright-should-work.spec.ts+++ b/tests/installation/playwright-should-work.spec.ts@@ -16,10 +16,15 @@import { test, expect } from './npmTest';test(`playwright should work`, async ({ exec, nodeMajorVersion, installedSoftwareOnDisk }) => {- const result = await exec('npm i --foreground-scripts playwright');- expect(result).toHaveLoggedSoftwareDownload(['chromium', 'ffmpeg', 'firefox', 'webkit']);+ const result1 = await exec('npm i --foreground-scripts playwright');+ expect(result1).toHaveLoggedSoftwareDownload([]);+ expect(await installedSoftwareOnDisk()).toEqual([]);++ const result2 = await exec('npm i --foreground-scripts @playwright/browser-chromium @playwright/browser-firefox @playwright/browser-webkit');+ expect(result2).toHaveLoggedSoftwareDownload(['chromium', 'ffmpeg', 'firefox', 'webkit']);expect(await installedSoftwareOnDisk()).toEqual(['chromium', 'ffmpeg', 'firefox', 'webkit']);- await exec('node sanity.js playwright');++ await exec('node sanity.js playwright chromium firefox webkit');if (nodeMajorVersion >= 14)await exec('node esm-playwright.mjs');const stdio = await exec('npx playwright', 'test', '-c', '.', { expectToExitWithError: true });diff --git a/tests/installation/playwright-test-should-work.spec.ts b/tests/installation/playwright-test-should-work.spec.tsindex bacbc0a247..0fb5242641 100755--- a/tests/installation/playwright-test-should-work.spec.ts+++ b/tests/installation/playwright-test-should-work.spec.ts@@ -23,7 +23,7 @@ test('@playwright/test should work', async ({ exec, nodeMajorVersion, tmpWorkspaawait exec('npx playwright install');await exec('npx playwright test -c . --browser=all --reporter=list,json sample.spec.js', { env: { PLAYWRIGHT_JSON_OUTPUT_NAME: 'report.json' } });await exec('node read-json-report.js', path.join(tmpWorkspace, 'report.json'));- await exec('node sanity.js @playwright/test');+ await exec('node sanity.js @playwright/test chromium firefox webkit');if (nodeMajorVersion >= 14)await exec('node', 'esm-playwright-test.mjs');});diff --git a/tests/installation/playwright-xyz-should-work.spec.ts b/tests/installation/playwright-xyz-should-work.spec.tsindex a5a888e920..11df8613d1 100755--- a/tests/installation/playwright-xyz-should-work.spec.ts+++ b/tests/installation/playwright-xyz-should-work.spec.ts@@ -16,8 +16,9 @@*/import { test, expect } from './npmTest';-for (const pkg of ['playwright-chromium', 'playwright-firefox', 'playwright-webkit']) {- test(`${pkg} should work`, async ({ exec, nodeMajorVersion, installedSoftwareOnDisk }) => {+for (const browser of ['chromium', 'firefox', 'webkit']) {+ test(`playwright-${browser} should work`, async ({ exec, nodeMajorVersion, installedSoftwareOnDisk }) => {+ const pkg = `playwright-${browser}`;const result = await exec('npm i --foreground-scripts', pkg);const browserName = pkg.split('-')[1];const expectedSoftware = [browserName];@@ -26,8 +27,29 @@ for (const pkg of ['playwright-chromium', 'playwright-firefox', 'playwright-webkexpect(result).toHaveLoggedSoftwareDownload(expectedSoftware as any);expect(await installedSoftwareOnDisk()).toEqual(expectedSoftware);expect(result).not.toContain(`To avoid unexpected behavior, please install your dependencies first`);- await exec('node sanity.js', pkg);+ await exec('node sanity.js', pkg, browser);if (nodeMajorVersion >= 14)await exec('node', `esm-${pkg}.mjs`);});}++for (const browser of ['chromium', 'firefox', 'webkit']) {+ test(`@playwright/browser-${browser} should work`, async ({ exec, installedSoftwareOnDisk }) => {+ const pkg = `@playwright/browser-${browser}`;+ const expectedSoftware = [browser];+ if (browser === 'chromium')+ expectedSoftware.push('ffmpeg');++ const result1 = await exec('npm i --foreground-scripts', pkg);+ expect(result1).toHaveLoggedSoftwareDownload(expectedSoftware as any);+ expect(await installedSoftwareOnDisk()).toEqual(expectedSoftware);+ expect(result1).not.toContain(`To avoid unexpected behavior, please install your dependencies first`);++ const result2 = await exec('npm i --foreground-scripts playwright');+ expect(result2).toHaveLoggedSoftwareDownload([]);+ expect(await installedSoftwareOnDisk()).toEqual(expectedSoftware);++ await exec('node sanity.js playwright', browser);+ await exec('node browser-only.js', pkg);+ });+}diff --git a/tests/installation/screencast.spec.ts b/tests/installation/screencast.spec.tsindex 5913b5a125..96ccbde981 100755--- a/tests/installation/screencast.spec.ts+++ b/tests/installation/screencast.spec.ts@@ -16,8 +16,8 @@import { test } from './npmTest';test('screencast works', async ({ exec }) => {- const packages = ['playwright', 'playwright-chromium', 'playwright-firefox', 'playwright-webkit'];- await exec('npm i --foreground-scripts', ...packages);- for (const pkg of packages)- await test.step(pkg, () => exec('node screencast.js', pkg));+ await exec('npm i --foreground-scripts', 'playwright', 'playwright-chromium', 'playwright-firefox', 'playwright-webkit');+ await test.step('playwright', () => exec('node screencast.js playwright chromium firefox webkit'));+ for (const browser of ['chromium', 'firefox', 'webkit'])+ await test.step(browser, () => exec(`node screencast.js playwright-${browser} ${browser}`));});diff --git a/tests/installation/skip-browser-download-inspect-with-custom-executable.spec.ts b/tests/installation/skip-browser-download-inspect-with-custom-executable.spec.tsindex 9d08416698..1a394d6a0f 100755--- a/tests/installation/skip-browser-download-inspect-with-custom-executable.spec.ts+++ b/tests/installation/skip-browser-download-inspect-with-custom-executable.spec.ts@@ -16,7 +16,7 @@import { test, expect } from './npmTest';test('should skip download', async ({ exec }) => {- const installOutput = await exec('npm i --foreground-scripts playwright', { env: { PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: '1' } });+ const installOutput = await exec('npm i --foreground-scripts playwright @playwright/browser-chromium', { env: { PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: '1' } });expect(installOutput).toContain('Skipping browsers download because');if (process.platform === 'linux') {const output = await exec('node inspector-custom-executable.js', { env: { PWDEBUG: '1' } });diff --git a/tests/installation/skip-browser-download.spec.ts b/tests/installation/skip-browser-download.spec.tsindex 715e5fd5d9..98a016411d 100755--- a/tests/installation/skip-browser-download.spec.ts+++ b/tests/installation/skip-browser-download.spec.ts@@ -16,7 +16,7 @@import { test, expect } from './npmTest';test('PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD should skip browser installs', async ({ exec, installedSoftwareOnDisk }) => {- const result = await exec('npm i --foreground-scripts playwright', { env: { PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: '1' } });+ const result = await exec('npm i --foreground-scripts @playwright/browser-firefox', { env: { PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: '1' } });expect(result).toHaveLoggedSoftwareDownload([]);expect(await installedSoftwareOnDisk()).toEqual([]);expect(result).toContain(`Skipping browsers download because`);diff --git a/tests/installation/validate-dependencies.spec.ts b/tests/installation/validate-dependencies.spec.tsindex f8a56b7d48..f68eb84ee3 100644--- a/tests/installation/validate-dependencies.spec.ts+++ b/tests/installation/validate-dependencies.spec.ts@@ -18,12 +18,14 @@ import { test, expect } from './npmTest';test.describe('validate dependencies', () => {test('default (on)', async ({ exec }) => {await exec('npm i --foreground-scripts playwright');+ await exec('npx playwright install chromium');const result = await exec('node validate-dependencies.js');expect(result).toContain(`PLAYWRIGHT_SKIP_VALIDATE_HOST_REQUIREMENTS`);});test('disabled (off)', async ({ exec }) => {await exec('npm i --foreground-scripts playwright');+ await exec('npx playwright install chromium');const result = await exec('node validate-dependencies-skip-executable-path.js');expect(result).not.toContain(`PLAYWRIGHT_SKIP_VALIDATE_HOST_REQUIREMENTS`);});diff --git a/utils/workspace.js b/utils/workspace.jsindex c5e94803c3..a452523085 100755--- a/utils/workspace.js+++ b/utils/workspace.js@@ -178,6 +178,21 @@ const workspace = new Workspace(ROOT_PATH, [path: path.join(ROOT_PATH, 'packages', 'playwright-chromium'),files: LICENCE_FILES,}),+ new PWPackage({+ name: '@playwright/browser-webkit',+ path: path.join(ROOT_PATH, 'packages', 'playwright-browser-webkit'),+ files: LICENCE_FILES,+ }),+ new PWPackage({+ name: '@playwright/browser-firefox',+ path: path.join(ROOT_PATH, 'packages', 'playwright-browser-firefox'),+ files: LICENCE_FILES,+ }),+ new PWPackage({+ name: '@playwright/browser-chromium',+ path: path.join(ROOT_PATH, 'packages', 'playwright-browser-chromium'),+ files: LICENCE_FILES,+ }),new PWPackage({name: '@playwright/experimental-ct-core',path: path.join(ROOT_PATH, 'packages', 'playwright-ct-core'),