Created
February 7, 2016 22:08
-
-
Save ahmetkizilay/d6c3b42fa4b741a81d1c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LOCAL_IP="$(ifconfig eth0 | grep "inet " | awk -F'[: ]+' '{ print $4 }')" \ | |
SELENIUM_URL=http://firefox-browser:4444 \ | |
RAILS_ENV=test \ | |
rspec spec/integrations/login_spec.rb |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scenario "Displaying sign in dialogue", js: true do | |
setup_driver | |
visit root_path | |
click_link "Sign in" | |
expect(page).to have_selector('input#username') | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scenario "Displaying sign in dialogue", js: true do | |
visit root_path | |
click_link "Sign in" | |
expect(page).to have_selector('input#username') | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Capybara.register_driver :docker_firefox do |app| | |
Capybara::Selenium::Driver.new(app, { | |
browser: :remote, | |
url: "#{ENV['SELENIUM_URL']}/wd/hub", | |
desired_capabilities: Selenium::WebDriver::Remote::Capabilities.firefox | |
}) | |
end | |
def setup_driver | |
unless ENV['SELENIUM_URL'].nil? || ENV['SELENIUM_URL'].empty? | |
Capybara.current_driver = :docker_firefox | |
Capybara.javascript_driver = :docker_firefox | |
Capybara.server_port = 55555 | |
Capybara.server_host = "#{ENV['LOCAL_IP']}" | |
Capybara.app_host = "http://#{ENV['LOCAL_IP']}:#{Capybara.server_port}" | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
firefox: | |
image: selenium/standalone-firefox:2.48.2 | |
container_name: firefox-browser | |
net: demo-network | |
rails: | |
build: . | |
container_name: demo-app | |
volumes: | |
- ".:/demo-app" | |
command: /bin/bash -l scripts/start-tests.sh | |
ports: | |
- "3000:3000" | |
net: demo-network |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment