From f23d047e4cf29d701ce99cac6eeda6efa871e3c6 Mon Sep 17 00:00:00 2001 From: Eric Bremner <ebremner@uwaterloo.ca> Date: Mon, 16 Dec 2024 12:14:07 -0500 Subject: [PATCH] ISTWCMS-7160: add script to try running each file --- run_files.sh | 49 ++++++++++++++++++++++++++++++++++++++++++++ setup_codeception.sh | 1 + 2 files changed, 50 insertions(+) create mode 100755 run_files.sh diff --git a/run_files.sh b/run_files.sh new file mode 100755 index 0000000..a3f4fd7 --- /dev/null +++ b/run_files.sh @@ -0,0 +1,49 @@ +rm -rf tests/_output +rm -rf tests/_data + +# Ensure we are not using the recorder. +cp tests/acceptance_norecorder.suite.yml tests/acceptance.suite.yml + +while getopts 'r' OPTION; do + case "$OPTION" in + r) + cp tests/acceptance_recorder.suite.yml tests/acceptance.suite.yml + ;; + s) + stepper=1 + ;; + ?) + echo "script usage: [-r]" >&2 + exit 1 + ;; + esac +done + +# Directory to iterate through +directory="tests/acceptance" + +files=() +for file in "$directory"/*; do + if [[ -f "$file" ]]; then + file="${file//tests\/acceptance\//}" + file="${file//\.php/}" + files+=("$file") + fi +done + +# Perform the tests using the groups +for value in "${files[@]}"; do + pgrep chrome | xargs kill -9 + chromedriver --port=9515 --url-base=/wd/hub & + echo "**************************************" + echo "Current Test: $value" + echo "**************************************" + if [[ $stepper == 1 ]]; then + php vendor/bin/codecept run acceptance "$value" --fail-fast --steps + else + php vendor/bin/codecept run acceptance "$value" --fail-fast + fi + if [[ $? -ne 0 ]]; then + break + fi +done diff --git a/setup_codeception.sh b/setup_codeception.sh index aa6e7bf..12ddf4b 100755 --- a/setup_codeception.sh +++ b/setup_codeception.sh @@ -4,4 +4,5 @@ cp tests/codeception.yml . cp tests/index.php web cp tests/run_tests.sh . cp tests/run_groups.sh . +cp tests/run_files.sh . sed -i 's/self::COVERAGE_COOKIE,\s$value,\s$cookieParams/self::COVERAGE_COOKIE, $value/g' /var/www/html/vendor/codeception/codeception/src/Codeception/Coverage/Subscriber/LocalServer.php -- GitLab