local_browser_tests.sh 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #!/bin/bash
  2. while true; do
  3. read -p "Do you wish to drop the database and execute all browser tests?" yn
  4. case $yn in
  5. [Yy]* ) echo "Start tests..."; break;;
  6. [Nn]* ) exit;;
  7. * ) echo "Please answer yes or no.";;
  8. esac
  9. done
  10. #export RAILS_ENV=test
  11. export RAILS_ENV=production
  12. export RAILS_SERVE_STATIC_FILES=true
  13. bundle install
  14. rm -rf tmp/screenshot*
  15. rm -rf tmp/cache*
  16. rm -f public/assets/*.css*
  17. rm -f public/assets/*.js*
  18. echo "rake assets:precompile"
  19. time rake assets:precompile
  20. echo "rake db:drop"
  21. time rake db:drop
  22. echo "rake db:create"
  23. time rake db:create
  24. echo "rake db:migrate"
  25. time rake db:migrate
  26. echo "rake db:seed"
  27. time rake db:seed
  28. # set system to develop mode
  29. rails r "Setting.set('developer_mode', true)"
  30. pumactl --pidfile tmp/pids/puma.pid stop
  31. script/websocket-server.rb stop
  32. pumactl start --pidfile tmp/pids/puma.pid -d -p 4445 -e $RAILS_ENV
  33. script/websocket-server.rb start -d
  34. script/scheduler.rb start
  35. sleep 15
  36. #export REMOTE_URL='http://medenhofer:765d0dd4-994b-4e15-9f89-13f3aedeb462@ondemand.saucelabs.com:80/wd/hub' BROWSER_OS='Windows 2012' BROWSER_VERSION=35 BROWSER=firefox
  37. #export REMOTE_URL='http://192.168.178.32:4444/wd/hub'
  38. #export REMOTE_URL='http://192.168.178.45:4444/wd/hub'
  39. export REMOTE_URL='http://10.0.0.9:4444/wd/hub'
  40. export RAILS_ENV=test
  41. echo "rake db:drop"
  42. time rake db:drop
  43. echo "rake db:create"
  44. time rake db:create
  45. echo "rake db:migrate"
  46. time rake db:migrate
  47. rake test:browser["BROWSER_URL=http://localhost:4445"]
  48. #rake test:browser["BROWSER_URL=http://10.0.0.3:4445"]
  49. #rake test:browser["BROWSER_URL=http://localhost:4445 BROWSER=chrome"]
  50. #rake test:browser["BROWSER_URL=http://192.168.178.28:4445"]
  51. script/scheduler.rb stop
  52. script/websocket-server.rb stop
  53. pumactl --pidfile tmp/pids/puma.pid stop
  54. rm -f public/assets/*.css*
  55. rm -f public/assets/*.js*