forked from forem/forem
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathe2e
executable file
·38 lines (29 loc) · 1.42 KB
/
e2e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/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