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

ISTWCMS-7160: update run files to create site and use sql file

parent 10b60092
No related branches found
No related tags found
2 merge requests!83ISTWCMS-7160 Fix service content type in testAutomaticListBlocksSettings in...,!81ISTWCMS-7160 Make existing Codeception tests pass
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 while getopts 'r' OPTION; do
case "$OPTION" in case "$OPTION" in
r) r)
...@@ -19,9 +13,29 @@ while getopts 'r' OPTION; do ...@@ -19,9 +13,29 @@ while getopts 'r' OPTION; do
esac esac
done 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 to iterate through
directory="tests/acceptance" directory="tests/acceptance"
# Get the file names of the tests.
files=() files=()
for file in "$directory"/*; do for file in "$directory"/*; do
if [[ -f "$file" ]]; then if [[ -f "$file" ]]; then
...@@ -31,30 +45,30 @@ for file in "$directory"/*; do ...@@ -31,30 +45,30 @@ for file in "$directory"/*; do
fi fi
done done
drush sql-dump > start.sql # Perform the tests using the files.
# Perform the tests using the groups
for value in "${files[@]}"; do for value in "${files[@]}"; do
pgrep chrome | xargs kill -9 echo "*********************************************************"
echo "**************************************"
echo "Current Test: $value" echo "Current Test: $value"
echo "**************************************" echo "*********************************************************"
echo "Waiting ..." echo "Setting up site ..."
sleep 10s pgrep chrome | xargs kill -9
echo "Done waiting."
echo "**************************************"
echo "Installing site ..."
drush sql-drop -y drush sql-drop -y
drush sql-cli < start.sql drush sql-cli < "$sqlfile"
echo "Done installing site."
echo "**************************************"
chromedriver --port=9515 --url-base=/wd/hub & chromedriver --port=9515 --url-base=/wd/hub &
echo "Done setting up site."
echo "*********************************************************"
echo "Starting test ... $value"
if [[ $stepper == 1 ]]; then if [[ $stepper == 1 ]]; then
php vendor/bin/codecept run acceptance "$value" --fail-fast --steps php vendor/bin/codecept run acceptance "$value" --fail-fast --steps
else else
php vendor/bin/codecept run acceptance "$value" --fail-fast php vendor/bin/codecept run acceptance "$value" --fail-fast
fi fi
if [[ $? -ne 0 ]]; then if [[ $? -ne 0 ]]; then
rm "$sqlfile"
echo "Test $value failed, done test."
echo "*********************************************************"
break break
fi fi
echo "Done test $value."
echo "*********************************************************"
done done
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