Test update and cleanup for selenium and capybara

This commit is contained in:
Ari Timonen 2020-03-22 06:13:47 +02:00
parent a41b28ae23
commit 32cf1ee6b8
5 changed files with 26 additions and 10 deletions

View file

@ -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=

View file

@ -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

View file

@ -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`
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

View file

@ -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

View file

@ -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,
@ -40,11 +43,13 @@ Capybara.register_driver :selenium_remote do |app|
end
#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`.