diff --git a/run_files.sh b/run_files.sh index 3629a91a2aedc018b061dfdf0f65921e38696306..c27c102a15d1a458e9d264222ee1c7af563a1f2b 100755 --- a/run_files.sh +++ b/run_files.sh @@ -1,9 +1,3 @@ -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) @@ -19,9 +13,29 @@ while getopts 'r' OPTION; do esac done +# 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 + +# 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 "*********************************************************" + # Directory to iterate through directory="tests/acceptance" +# Get the file names of the tests. files=() for file in "$directory"/*; do if [[ -f "$file" ]]; then @@ -31,30 +45,30 @@ for file in "$directory"/*; do fi done -drush sql-dump > start.sql - -# Perform the tests using the groups +# Perform the tests using the files. for value in "${files[@]}"; do - pgrep chrome | xargs kill -9 - echo "**************************************" + echo "*********************************************************" echo "Current Test: $value" - echo "**************************************" - echo "Waiting ..." - sleep 10s - echo "Done waiting." - echo "**************************************" - echo "Installing site ..." + echo "*********************************************************" + echo "Setting up site ..." + pgrep chrome | xargs kill -9 drush sql-drop -y - drush sql-cli < start.sql - echo "Done installing site." - echo "**************************************" + drush sql-cli < "$sqlfile" chromedriver --port=9515 --url-base=/wd/hub & + echo "Done setting up site." + echo "*********************************************************" + echo "Starting test ... $value" 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 + rm "$sqlfile" + echo "Test $value failed, done test." + echo "*********************************************************" break fi + echo "Done test $value." + echo "*********************************************************" done