The recommended solution to install Playwright with chromium support is through a Docker file.
However, for Puppeteer we can just install it and handle the binaries cache with the PUPPETEER_CACHE_DIR
env variable as recommended in this solution.
Can we do the same with Playwright, i.e. install it with deps and manage the location of the binaries with the PLAYWRIGHT_BROWSERS_PATH
variable:
#!/usr/bin/env bash
set -e
yarn playwright install chromium
# Store/pull Playwright cache with build cache
if [[! -d $PLAYWRIGHT_BROWSERS_PATH]]; then
echo "...Copying Playwright Cache from Build Cache"
cp -R $XDG_CACHE_HOME/playwright/ $PLAYWRIGHT_BROWSERS_PATH
else
echo "...Storing Playwright Cache in Build Cache"
cp -R $PLAYWRIGHT_BROWSERS_PATH $XDG_CACHE_HOME
fi
Can anyone confirm this works?