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: actually bundle FFMPEG binaries with NPM packages (#3804)
Andrey Lushnikov355ea73a0bce
diff --git a/packages/common/.npmignore b/packages/common/.npmignoreindex 9bee594746..e0c22c99f7 100644--- a/packages/common/.npmignore+++ b/packages/common/.npmignore@@ -11,8 +11,8 @@# Exclude injected files. A preprocessed version of these is included via lib/generated.# See src/server/injected/README.md.lib/server/injected/-# Include Windows dependency checker executable.-!bin/PrintDeps.exe+# Include all binaries that we ship with the package.+!bin/*# Include generated types and entrypoint.!types/*!index.d.tsdiff --git a/packages/installation-tests/installation-tests.sh b/packages/installation-tests/installation-tests.shindex 8ac512c667..e123b8264d 100755--- a/packages/installation-tests/installation-tests.sh+++ b/packages/installation-tests/installation-tests.sh@@ -29,6 +29,7 @@ NODE_VERSION="$(node --version)"function copy_test_scripts {cp "${SCRIPTS_PATH}/sanity.js" .+ cp "${SCRIPTS_PATH}/screencast.js" .cp "${SCRIPTS_PATH}/esm.mjs" .cp "${SCRIPTS_PATH}/esm-playwright.mjs" .cp "${SCRIPTS_PATH}/esm-playwright-chromium.mjs" .@@ -39,6 +40,7 @@ function copy_test_scripts {}function run_tests {+ test_screencasttest_typescript_typestest_skip_browser_downloadtest_playwright_global_installation_subsequent_installs@@ -52,6 +54,22 @@ function run_tests {test_electron_types}+function test_screencast {+ initialize_test "${FUNCNAME[0]}"+ copy_test_scripts++ local BROWSERS="$(pwd -P)/browsers"+ PLAYWRIGHT_BROWSERS_PATH="${BROWSERS}" npm install ${PLAYWRIGHT_TGZ}+ PLAYWRIGHT_BROWSERS_PATH="${BROWSERS}" npm install ${PLAYWRIGHT_FIREFOX_TGZ}+ PLAYWRIGHT_BROWSERS_PATH="${BROWSERS}" npm install ${PLAYWRIGHT_WEBKIT_TGZ}+ PLAYWRIGHT_BROWSERS_PATH="${BROWSERS}" npm install ${PLAYWRIGHT_CHROMIUM_TGZ}++ PLAYWRIGHT_BROWSERS_PATH="${BROWSERS}" node screencast.js playwright+ PLAYWRIGHT_BROWSERS_PATH="${BROWSERS}" node screencast.js playwright-chromium+ PLAYWRIGHT_BROWSERS_PATH="${BROWSERS}" node screencast.js playwright-webkit+ PLAYWRIGHT_BROWSERS_PATH="${BROWSERS}" node screencast.js playwright-firefox+}+function test_typescript_types {initialize_test "${FUNCNAME[0]}"diff --git a/packages/installation-tests/screencast.js b/packages/installation-tests/screencast.jsnew file mode 100644index 0000000000..b3c2658659--- /dev/null+++ b/packages/installation-tests/screencast.js@@ -0,0 +1,61 @@+/**+ * 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];+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 playwright = require(requireName);+const path = require('path');+const fs = require('fs');++(async () => {+ for (const browserType of success) {+ try {+ const browser = await playwright[browserType].launch({+ _videosPath: __dirname,+ });+ const context = await browser.newContext({+ _recordVideos: {width: 320, height: 240},+ });+ const page = await context.newPage();+ const video = await page.waitForEvent('_videostarted');+ // Wait fo 1 second to actually record something.+ await new Promise(x => setTimeout(x, 1000));+ const [videoFile] = await Promise.all([+ video.path(),+ context.close(),+ ]);+ await browser.close();+ if (!fs.existsSync(videoFile)) {+ console.error(`ERROR: Package "${requireName}", browser "${browserType}" should have created screencast!`);+ process.exit(1);+ }+ } catch (err) {+ console.error(`ERROR: Should be able to launch ${browserType} from ${requireName}`);+ console.error(err);+ process.exit(1);+ }+ }+})();