mirror of
https://github.com/Smaug123/KaTeX
synced 2025-10-05 03:08:40 +00:00
* Support Browserstack in screenshotter * Support Browserstack in CircleCI * Test screenshots on Safari 13.1 * Don't run Safari screenshotter on forked PRs * Update a screenshot * Ignore *.log in .gitignore
56 lines
1.7 KiB
Bash
Executable File
56 lines
1.7 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# This script does a one-shot creation of screenshots, creating needed
|
|
# docker containers and removing them afterwards. During development,
|
|
# it might be desirable to avoid the overhead for starting and
|
|
# stopping the containers. Developers are encouraged to manage
|
|
# suitable containers themselves, calling the screenshotter.js script
|
|
# directly.
|
|
|
|
cleanup() {
|
|
[[ "${container}" ]] \
|
|
&& docker stop "${container}" >/dev/null \
|
|
&& docker rm "${container}" >/dev/null
|
|
container=
|
|
}
|
|
|
|
container=
|
|
trap cleanup EXIT
|
|
status=0
|
|
for browserTag in firefox:3.141.59-20200525 chrome:3.141.59-20200525; do
|
|
browser=${browserTag%:*}
|
|
image=selenium/standalone-${browserTag}
|
|
echo "Starting container for ${image}"
|
|
container=$(docker run -d -P ${image})
|
|
[[ ${container} ]] || continue
|
|
echo "Container ${container:0:12} started, creating screenshots..."
|
|
if yarn node "$(dirname "$0")"/screenshotter.js \
|
|
--browser="${browser}" --container="${container}" "$@"; then
|
|
res=Done
|
|
else
|
|
res=Failed
|
|
status=1
|
|
fi
|
|
echo "${res} taking screenshots, stopping and removing ${container:0:12}"
|
|
cleanup
|
|
done
|
|
|
|
if [[ $BROWSERSTACK_USER ]]; then
|
|
echo "Creating screenshots for Safari..."
|
|
if yarn node "$(dirname "$0")"/screenshotter.js \
|
|
--browser=safari --browserstack --selenium-capabilities '{
|
|
"browserName": "Safari",
|
|
"browser_version": "13.1",
|
|
"os": "OS X",
|
|
"os_version": "Catalina"
|
|
}' "$@"; then
|
|
res=Done
|
|
else
|
|
res=Failed
|
|
status=1
|
|
fi
|
|
echo "${res} taking screenshots"
|
|
fi
|
|
|
|
exit ${status}
|