diff --git a/.env.example b/.env.example index 49a8759..164fa81 100644 --- a/.env.example +++ b/.env.example @@ -29,6 +29,10 @@ MYSQL_PASSWORD=randomstringhere # More MySQL vars MYSQL_CONNECTION_POOL=32 +SELENIUM_HOST=selenium +TEST_APP_HOST=localhost +TEST_APP_PORT=3005 + NEW_RELIC_APP_NAME=ENSL NEW_RELIC_LICENSE_KEY= diff --git a/.env.test b/.env.test index 8ef02f5..fb020ce 100644 --- a/.env.test +++ b/.env.test @@ -10,6 +10,10 @@ PUMA_MAX_THREADS=16 PUMA_PORT=4000 PUMA_TIMEOUT=30 +SELENIUM_HOST=selenium +TEST_APP_HOST=localhost +TEST_APP_PORT=3005 + MYSQL_HOST=db MYSQL_DATABASE=ensl_test MYSQL_USERNAME=ensl diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 99e2c6c..9b4a919 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -13,8 +13,9 @@ This is just random tips for development. Not a full documentation. # Handy commands -`docker-compose -f docker-compose.dev.yml exec -u web web /bin/bash` -`docker-compose -f docker-compose.dev.yml exec -u web test /bin/bash` -`docker-compose -f docker-compose.dev.yml restart web` -`docker-compose -f docker-compose.dev.yml exec -u web test bundle exec rspec` -`docker-compose -f docker-compose.dev.yml exec -u web test bundle exec rspec spec/controllers/shoutmsgs_controller_spec.rb` \ No newline at end of file + docker-compose -f docker-compose.dev.yml exec -u web web /bin/bash` + docker-compose -f docker-compose.dev.yml exec -u web test /bin/bash` + docker-compose -f docker-compose.dev.yml restart web` + docker-compose -f docker-compose.dev.yml exec -u web test bundle exec rspec` + docker-compose -f docker-compose.dev.yml exec -u web test bundle exec rspec spec/controllers/shoutmsgs_controller_spec.rb` + docker-compose -f docker-compose.dev.yml run --rm selenium \ No newline at end of file diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index 2947a9e..5ac43ce 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -22,6 +22,7 @@ services: #- spring #- selenium #- redis + container_name: ensl_dev test: # Debug @@ -57,6 +58,7 @@ services: selenium: image: selenium/standalone-chrome-debug + container_name: ensl_dev_selenium ports: - 5900:5900 - 4444:4444 diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 4b037f6..05807ec 100755 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -30,6 +30,9 @@ SELENIUM_HOST = ENV['SELENIUM_HOST'] TEST_APP_HOST = ENV['TEST_APP_HOST'] TEST_APP_PORT = ENV['TEST_APP_PORT'] +Capybara.server_port = TEST_APP_PORT +Capybara.server_host = '0.0.0.0' +Capybara.app_host = "http://#{TEST_APP_HOST}:#{TEST_APP_PORT}" Capybara.register_driver :selenium_remote do |app| Capybara::Selenium::Driver.new( app, @@ -39,12 +42,14 @@ Capybara.register_driver :selenium_remote do |app| ) end -# Capybara.javascript_driver = :selenium - +#Capybara.javascript_driver = :selenium #Capybara.javascript_driver = :selenium_remote -#Capybara.server_port = TEST_APP_PORT -#Capybara.server_host = '0.0.0.0' -#Capybara.app_host = "http://#{TEST_APP_HOST}:#{TEST_APP_PORT}" + +#print('selenium %s' % SELENIUM_HOST) +#print('port %d' % [TEST_APP_PORT]) +#print('host %s' % TEST_APP_HOST) + + # This file was generated by the `rails generate rspec:install` command. Conventionally, all # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.