Skip to content

Commit

Permalink
added a test
Browse files Browse the repository at this point in the history
  • Loading branch information
mxschmitt committed Apr 19, 2021
1 parent b3a180a commit 67005e3
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 0 deletions.
34 changes: 34 additions & 0 deletions packages/installation-tests/installation-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ function copy_test_scripts {
cp "${SCRIPTS_PATH}/inspector-custom-executable.js" .
cp "${SCRIPTS_PATH}/sanity.js" .
cp "${SCRIPTS_PATH}/screencast.js" .
cp "${SCRIPTS_PATH}/validate-dependencies.js" .
cp "${SCRIPTS_PATH}/validate-dependencies-skip-executable-path.js" .
cp "${SCRIPTS_PATH}/esm.mjs" .
cp "${SCRIPTS_PATH}/esm-playwright.mjs" .
cp "${SCRIPTS_PATH}/esm-playwright-chromium.mjs" .
Expand All @@ -64,6 +66,8 @@ function run_tests {
test_playwright_chromium_should_work
test_playwright_webkit_should_work
test_playwright_firefox_should_work
test_playwright_validate_dependencies
test_playwright_validate_dependencies_skip_executable_path
test_playwright_global_installation
test_playwright_global_installation_cross_package
test_playwright_electron_should_work
Expand Down Expand Up @@ -359,6 +363,36 @@ function test_playwright_firefox_should_work {
echo "${FUNCNAME[0]} success"
}

function test_playwright_validate_dependencies {
initialize_test "${FUNCNAME[0]}"

npm install ${PLAYWRIGHT_TGZ}
copy_test_scripts

OUTPUT="$(node validate-dependencies.js)"
if [[ "${OUTPUT}" != *"PLAYWRIGHT_SKIP_VALIDATE_HOST_REQUIREMENTS"* ]]; then
echo "ERROR: validateDependencies was not called"
exit 1
fi

echo "${FUNCNAME[0]} success"
}

function test_playwright_validate_dependencies_skip_executable_path {
initialize_test "${FUNCNAME[0]}"

npm install ${PLAYWRIGHT_TGZ}
copy_test_scripts

OUTPUT="$(node validate-dependencies-skip-executable-path.js)"
if [[ "${OUTPUT}" == *"PLAYWRIGHT_SKIP_VALIDATE_HOST_REQUIREMENTS"* ]]; then
echo "ERROR: validateDependencies was called"
exit 1
fi

echo "${FUNCNAME[0]} success"
}

function test_playwright_electron_should_work {
initialize_test "${FUNCNAME[0]}"

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const playwright = require('playwright');

process.env.PLAYWRIGHT_SKIP_VALIDATE_HOST_REQUIREMENTS = 1;

(async () => {
const browser = await playwright.chromium.launch({
executablePath: playwright.chromium.executablePath()
});
await browser.close();
})();
8 changes: 8 additions & 0 deletions packages/installation-tests/validate-dependencies.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const playwright = require('playwright');

process.env.PLAYWRIGHT_SKIP_VALIDATE_HOST_REQUIREMENTS = 1;

(async () => {
const browser = await playwright.chromium.launch();
await browser.close();
})();

0 comments on commit 67005e3

Please sign in to comment.