-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
122 additions
and
9 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,4 +39,4 @@ | |
end | ||
end | ||
end | ||
end | ||
end |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# frozen_string_literal: true | ||
|
||
RSpec.configure do |config| | ||
headless = ENV.fetch('HEADLESS', true) != 'false' | ||
|
||
config.before(:each, type: :system) do | ||
driven_by :rack_test | ||
end | ||
|
||
config.before :each, type: :system, js: true do | ||
# Docker environment | ||
url = if headless | ||
"http://#{ENV['SELENIUM_REMOTE_HOST']}:4444/wd/hub" | ||
else | ||
'http://host.docker.internal:9515' | ||
end | ||
|
||
driven_by :selenium, using: :chrome, options: { | ||
browser: :remote, | ||
url: url, | ||
desired_capabilities: :chrome | ||
} | ||
|
||
# Find Docker IP address | ||
Capybara.server_host = if headless | ||
`/sbin/ip route|awk '/scope/ { print $9 }'`.strip | ||
else | ||
'0.0.0.0' | ||
end | ||
Capybara.server_port = '43447' | ||
Capybara.app_host = "http://#{Capybara.current_session.server.host}:#{Capybara.current_session.server.port}" | ||
end | ||
|
||
config.after :each, type: :system, js: true do | ||
page.driver.browser.manage.logs.get(:browser).each do |log| | ||
case log.message | ||
when /This page includes a password or credit card input in a non-secure context/ | ||
# Ignore this warning in tests | ||
next | ||
else | ||
message = "[#{log.level}] #{log.message}" | ||
raise message | ||
end | ||
end | ||
end | ||
end |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'rails_helper' | ||
|
||
RSpec.describe "Something", type: :system, js: true do | ||
|
||
describe 'home page' do | ||
it 'does something' do | ||
visit '/' | ||
expect(page).to have_text('Log In') | ||
end | ||
end | ||
end | ||
|
||
|