GREEN=$(tput setaf 2)
YELLOW=$(tput setaf 3)
RESET=$(tput sgr0)

for site in "d7perf" "d8perf" "kickperf"; do
    cd "$site";
    echo "Starting $site tests"

    echo "${YELLOW}Running kbox start${RESET}"
    time kbox start
    echo "${GREEN}Completed kbox start${RESET}"

    echo "${YELLOW}Running curl not-installed site${RESET}"
    time curl -fL http://"$site".kbox.site > /dev/null
    echo "${GREEN}Completed curl not-installed site${RESET}"

    echo "${YELLOW}Running drush site-install${RESET}"
    if [[ "$site" == "kickperf" ]]; then
        time kbox drush si commerce_kickstart -y --db-url=mysql://drupal:drupal@database/drupal
    else
        time kbox drush si -y --db-url=mysql://drupal:drupal@database/drupal
    fi
    echo "${GREEN}Completed drush site-install${RESET}"

    echo "${YELLOW}Running curl after site install${RESET}"
    time curl -fL http://"$site".kbox.site > /dev/null
    echo "${GREEN}Completed curl after site install${RESET}"

    echo "${YELLOW}Running drush pml${RESET}"
    time kbox drush pml
    echo "${GREEN}Completed drush pml${RESET}"

    echo "Tests completed for $site. Stopping..."
    kbox stop
    cd -
done
