Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

chore(build): add --install watch flag for automatic browser install (#35639)

Adam Gastineau2ece112cb301
diff --git a/utils/build/build.js b/utils/build/build.js
index e4a3d3378f..274a95faeb 100644
--- a/utils/build/build.js
+++ b/utils/build/build.js
@@ -63,6 +63,7 @@ const copyFiles = [];
const watchMode = process.argv.slice(2).includes('--watch');
const lintMode = process.argv.slice(2).includes('--lint');
const withSourceMaps = process.argv.slice(2).includes('--sourcemap') || watchMode;
+const installMode = process.argv.slice(2).includes('--install');
const ROOT = path.join(__dirname, '..', '..');
/**
@@ -405,6 +406,15 @@ onChanges.push({
script: 'utils/generate_types/index.js',
});
+if (installMode) {
+ // Keep browser installs up to date.
+ onChanges.push({
+ inputs: ['packages/playwright-core/browsers.json'],
+ command: 'npx',
+ args: ['playwright', 'install'],
+ });
+}
+
// The recorder and trace viewer have an app_icon.png that needs to be copied.
copyFiles.push({
files: 'packages/playwright-core/src/server/chromium/*.png',