playwright/installation-tests/test_playwright_test_should_work.sh
Andrey Lushnikov e9ca11d91b
chore(installation-tests): introduce npm_i to install local packages (#12093)
This patch introduces `npm_i` command to install locally-built versions of
Playwright packages instead of fetching them from the registry.

With this patch:

```bash
npm i ${PLAYWRIGHT_CORE_TGZ}` # never needed anymore
npm_i playwright-core # the right way to install local package
```

Note that you can pass any NPM arguments to `npm_i` and cannot use it to install non-playwright packages.
2022-02-14 14:52:15 -08:00

29 lines
776 B
Bash
Executable File

#!/bin/bash
source ./initialize_test.sh && initialize_test "$@"
npm_i playwright-core
npm_i @playwright/test
echo "Running playwright test without install"
if npx playwright test -c .; then
echo "ERROR: should not be able to run tests without installing browsers"
exit 1
fi
echo "Running playwright install"
PLAYWRIGHT_BROWSERS_PATH="0" npx playwright install
echo "Running playwright test"
PLAYWRIGHT_JSON_OUTPUT_NAME=report.json PLAYWRIGHT_BROWSERS_PATH="0" npx playwright test -c . --browser=all --reporter=list,json sample.spec.js
echo "Checking the report"
node ./read-json-report.js ./report.json
echo "Running sanity.js"
node sanity.js "@playwright/test"
if [[ "${NODE_VERSION}" == *"v14."* ]]; then
echo "Running esm.js"
node esm-playwright-test.mjs
fi