local_browser_tests.sh 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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/cache/file_store
  14. rm -f public/assets/*.css*
  15. rm -f public/assets/*.js*
  16. rake assets:precompile
  17. rake db:drop
  18. rake db:create
  19. rake db:migrate
  20. rake db:seed
  21. # modify production.rb to serve assets
  22. cat config/environments/production.rb | sed -e 's/config.serve_static_assets = false/config.serve_static_assets = true/' > /tmp/production.rb && cp /tmp/production.rb config/environments/production.rb
  23. # mofidy auth backend
  24. cat lib/auth/test.rb | sed 's/development/production/' > /tmp/test.rb && cp /tmp/test.rb lib/auth/test.rb
  25. pumactl --pidfile tmp/pids/puma.pid stop
  26. script/websocket-server.rb stop
  27. pumactl start --pidfile tmp/pids/puma.pid -d -p 4444 -e $RAILS_ENV
  28. script/websocket-server.rb start -d
  29. sleep 15
  30. #export REMOTE_URL='http://medenhofer:765d0dd4-994b-4e15-9f89-13f3aedeb462@ondemand.saucelabs.com:80/wd/hub' BROWSER_OS='Windows 2012' BROWSER_VERSION=20 BROWSER=firefox
  31. rake test:browser["BROWSER_URL=http://localhost:4444"]
  32. #rake test:browser["BROWSER_URL=http://192.168.178.20:4444"]
  33. script/websocket-server.rb stop
  34. pumactl --pidfile tmp/pids/puma.pid stop
  35. rm -f public/assets/*.css*
  36. rm -f public/assets/*.js*