playwright/installation-tests/run_all_tests.sh
Andrey Lushnikov 9bce817a92
chore: improve installation tests (#12092)
* chore: improve installation tests

- all helper scripts and files are moved to `fixture-scripts`
  subfolder.
- `./run_all_tests.sh` now shows a counter to estimate progress
- function `copy_test_scripts` is no longer needed; all fixture
  scripts are automatically copied to test folder

Co-authored-by: Max Schmitt <max@schmitt.mx>

Co-authored-by: Max Schmitt <max@schmitt.mx>
2022-02-14 12:23:08 -08:00

61 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
set -e
set +x
function report_results() {
echo
if [[ -n "${FAILED_TESTS}" ]]; then
cecho "RED" "SOME TESTS FAILED! To debug:"
cecho "RED" "${FAILED_TESTS}"
exit 1
else
cecho "GREEN" "All tests passed!"
exit 0
fi
}
trap "report_results; cd $(pwd -P)" EXIT
cd "$(dirname $0)"
source ./initialize_test.sh
setup_env_variables
echo "Building packages..."
build_packages
clean_test_root
function gh_echo {
if [[ -z "${GITHUB_ACTIONS}" ]]; then
return
fi
echo "$@"
}
FAILED_TESTS=""
TOTAL=$(ls -1 test_*.sh | wc -l | tr -d ' ')
COUNTER=1
for i in test_*.sh
do
set +e
cecho "YELLOW" "Running ${COUNTER}/${TOTAL} - $i..."
COUNTER=$(( COUNTER + 1 ))
OUTPUT=$(bash $i --multitest --no-build 2>&1)
RV=$?
set -e
if [[ "${RV}" != 0 ]]; then
FAILED_TESTS="${FAILED_TESTS}- ${i}\n"
gh_echo "::group::FAILED - $i"
cecho "RED" "FAILED - $i"
echo "${OUTPUT}"
gh_echo "::endgroup::"
else
gh_echo "::group::PASSED - $i"
cecho "GREEN" "PASSED - $i"
gh_echo "${OUTPUT}"
gh_echo "::endgroup::"
fi
done