local_browser_tests.sh 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #!/bin/bash
  2. while true; do
  3. read -p "Do you wish to drop database ane 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. bundle install
  13. rm -rf tmp/screenshot*
  14. rm -rf tmp/cache*
  15. rm -f public/assets/*.css*
  16. rm -f public/assets/*.js*
  17. echo "rake assets:precompile"
  18. time rake assets:precompile
  19. echo "rake db:drop"
  20. time rake db:drop
  21. echo "rake db:create"
  22. time rake db:create
  23. echo "rake db:migrate"
  24. time rake db:migrate
  25. echo "rake db:seed"
  26. time rake db:seed
  27. # modify production.rb to serve assets
  28. sed -i -e 's/config.serve_static_assets = false/config.serve_static_assets = true/' config/environments/production.rb
  29. # set system to develop mode
  30. rails r "Setting.set('developer_mode', true)"
  31. pumactl --pidfile tmp/pids/puma.pid stop
  32. script/websocket-server.rb stop
  33. pumactl start --pidfile tmp/pids/puma.pid -d -p 4444 -e $RAILS_ENV
  34. script/websocket-server.rb start -d
  35. script/scheduler.rb start
  36. sleep 15
  37. #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
  38. #export REMOTE_URL='http://192.168.178.32:4444/wd/hub'
  39. #export REMOTE_URL='http://192.168.178.45: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:4444"]
  48. #rake test:browser["BROWSER_URL=http://localhost:4444 BROWSER=chrome"]
  49. #rake test:browser["BROWSER_URL=http://192.168.178.28:4444"]
  50. script/scheduler.rb stop
  51. script/websocket-server.rb stop
  52. pumactl --pidfile tmp/pids/puma.pid stop
  53. rm -f public/assets/*.css*
  54. rm -f public/assets/*.js*