#!/bin/bash printf "Doing a quick bundle check to make sure gems are all up to date.\n\n" bundle check # ensure gems are up to date if [ $? -eq 1 ]; then echo "Unable to launch end to end tests. Ensure that all your gems are installed and up to date." exit; fi yarn install # ensure npm packages are up to date if [ $? -eq 1 ]; then echo "Unable to launch end to end tests. An error occurred while running yarn install." exit; fi printf "\n" # Wait 10 seconds and if the user does not respond, assume they do not want to rebuild the test E2E database read -t 10 -p "Choose yes to setup a test database or if you're running the script for the first time, choose no or wait 10 seconds otherwise (y/n) " -n 1 -r if [[ $REPLY =~ ^[Yy]$ ]]; then printf "\n\nSetting up the E2E database before running E2E tests...\n\n" RAILS_ENV=test E2E=true bin/e2e-setup else printf "\n\nSkipping database setup...\n\n" fi printf "Starting the test runner...\n\n" bundle exec rails assets:precompile; if [ "$1" = "--creator-onboarding-seed" ]; then echo "Running E2E tests with creator onboarding seed data" CYPRESS_RAILS_CYPRESS_OPTS="--config-file cypress.dev.config.js --e2e" RAILS_ENV=test E2E=true CREATOR_ONBOARDING_SEED_DATA=1 E2E_FOLDER=creatorOnboardingFlows bundle exec rake cypress:open else CYPRESS_RAILS_CYPRESS_OPTS="--config-file cypress.dev.config.js --e2e" RAILS_ENV=test E2E=true bundle exec rake cypress:open fi