Skip to content
Snippets Groups Projects
Commit c52fb7e2 authored by Eric Bremner's avatar Eric Bremner
Browse files

ISTWCMS-7189: Update scripts to only have one that works now

parent 929ec27c
No related branches found
No related tags found
1 merge request!83ISTWCMS-7160 Fix service content type in testAutomaticListBlocksSettings in...
rm -rf tests/_output
rm -rf tests/_data
codecoverage=0
stepper=0
debugger=0
testname=""
# Set the variables to start.
endtoend=0;
stepper=0;
installsite=0;
testname="";
cp tests/acceptance_norecorder.suite.yml tests/acceptance.suite.yml
while getopts 'crsdt:' OPTION; do
# Get the options from the command line.
while getopts 'rsiet:' OPTION; do
case "$OPTION" in
r)
cp tests/acceptance_recorder.suite.yml tests/acceptance.suite.yml
;;
c)
codecoverage=1
;;
s)
stepper=1
;;
d)
debugger=1
i)
installsite=1
;;
e)
endtoend=1
;;
t)
testname=$OPTARG
;;
?)
echo "script usage: [-c] [-r] [-s] [-d] [-t] <TestName>" >&2
echo "script usage: [-rsiet]" >&2
exit 1
;;
esac
done
if [ $stepper == 0 ] && [ $codecoverage == 0 ]; then
if [ $debugger == 1 ]; then
if [ $testname ]; then
php vendor/bin/codecept run acceptance $testname --fail-fast --debug
else
php vendor/bin/codecept run acceptance --fail-fast --debug
fi
else
if [ $testname ]; then
php vendor/bin/codecept run acceptance $testname --fail-fast
else
php vendor/bin/codecept run acceptance --fail-fast
fi
fi
# Ensure that we have either end to end or specific test.
if [[ $endtoend == 0 ]] && [[ $testname == "" ]]; then
echo "You must specify a test if not using end to end tests";
exit 1;
fi;
# Remove all the old test data.
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
if [[ $installsite == 1 ]]; then
# Generate a file name for the sql file.
sqlfile=$(cat /proc/sys/kernel/random/uuid)
sqlfile="$sqlfile.sql"
# Install a site and get an sql file from site install.
echo "*********************************************************"
echo "Installing site ..."
drush si uw_base_profile --db-url=mysql://drupal:drupal@mariadb/drupal --account-name=wcmsadmin --account-pass=a --site-name="WCMS Test" -y
drush sql-dump > "$sqlfile"
echo "Done installing site."
echo "*********************************************************"
fi
if [ $stepper == 1 ] && [ $codecoverage == 1 ]; then
if [ $debugger == 1 ]; then
if [ $testname ]; then
php vendor/bin/codecept run acceptance $testname --steps --coverage-html --fail-fast --debug
else
php vendor/bin/codecept run acceptance --steps --coverage-html --fail-fast --debug
fi
else
if [ $testname ]; then
php vendor/bin/codecept run acceptance $testname --steps --coverage-html --fail-fast
else
php vendor/bin/codecept run acceptance --steps --coverage-html --fail-fast
fi
fi
else
if [ $stepper == 1 ]; then
if [ $debugger == 1 ]; then
if [ $testname ]; then
php vendor/bin/codecept run acceptance $testname --steps --fail-fast --debug
else
php vendor/bin/codecept run acceptance --steps --fail-fast --debug
fi
else
if [ $testname ]; then
php vendor/bin/codecept run acceptance $testname --steps --fail-fast
else
php vendor/bin/codecept run acceptance --steps --fail-fast
if [[ $endtoend == 1 ]]; then
# Directory to iterate through
directory="tests/acceptance"
# Get the file names of the tests.
files=()
for file in "$directory"/*; do
if [[ -f "$file" ]]; then
file="${file//tests\/acceptance\//}"
file="${file//\.php/}"
files+=("$file")
fi
fi
done
else
files=("$testname")
fi
# Perform the tests using the files.
for value in "${files[@]}"; do
echo "*********************************************************"
echo "Current Test: $value"
echo "*********************************************************"
if [[ $endtoend == 1 ]]; then
echo "Stopping chrome driver ..."
echo "*********************************************************"
pgrep chrome | xargs kill -9
fi
if [ $codecoverage == 1 ]; then
if [ $debugger == 1 ]; then
if [ $testname ]; then
php vendor/bin/codecept run acceptance $testname --coverage-html --debug
else
php vendor/bin/codecept run acceptance --coverage-html --debug
fi
else
if [ $testname ]; then
php vendor/bin/codecept run acceptance $testname --coverage-html --fail-fast
else
php vendor/bin/codecept run acceptance --coverage-html --fail-fast
fi
fi
if [[ $installsite == 1 ]]; then
echo "Dropping database ..."
echo "*********************************************************"
drush sql-drop -y
echo "Importing database ..."
echo "*********************************************************"
drush sql-cli < "$sqlfile"
fi
fi
files=(tests/_output/*.fail.html)
if [[ $endtoend == 1 ]]; then
echo "Starting chrome driver ..."
echo "*********************************************************"
chromedriver --port=9515 --url-base=/wd/hub &
echo "Sleeping ..."
echo "*********************************************************"
sleep 15s
echo ""
fi
if [ -e "${files[0]}" ]; then
sed -i -- 's/link rel\=\"stylesheet\" media\=\"all\" href\=\"\/core/link rel\=\"stylesheet\" media\=\"all\" href\=\"\.\.\/\.\.\/web\/core/g' tests/_output/*.fail.html
sed -i -- 's/link rel\=\"stylesheet\" media\=\"all\" href\=\"\/profiles/link rel\=\"stylesheet\" media\=\"all\" href\=\"\.\.\/\.\.\/web\/profiles/g' tests/_output/*.fail.html
fi
echo "*********************************************************"
echo "Starting 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 [[ $installsite == 1 ]]; then
if [[ $? -ne 0 ]]; then
rm "$sqlfile"
echo ""
echo "*********************************************************"
echo "Test $value failed, done test."
echo "*********************************************************"
echo ""
break
fi
fi
echo ""
echo "*********************************************************"
echo "Done test $value."
echo "*********************************************************"
echo ""
done
......@@ -3,6 +3,4 @@ cp tests/c3.php .
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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment