Skip to content

Commit 315db1f

Browse files
authored
fix system spec in local environment (#1834)
1 parent f177174 commit 315db1f

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

docker-compose.test.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ services:
44
web:
55
environment:
66
- WEBPACKER_DEV_SERVER_HOST=webpacker
7+
- SELENIUM_DRIVER_URL=http://selenium:4444/wd/hub
78

89
selenium:
910
image: selenium/standalone-chrome:114.0

spec/support/capybara.rb

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,12 @@
1515

1616
RSpec.configure do |config|
1717
config.before(:each, type: :system) do
18-
Capybara.server_host = IPSocket.getaddress(Socket.gethostname)
19-
Capybara.app_host = "http://#{Capybara.server_host}"
20-
driven_by :remote_chrome
18+
if ENV['SELENIUM_DRIVER_URL']
19+
Capybara.server_host = IPSocket.getaddress(Socket.gethostname)
20+
Capybara.app_host = "http://#{Capybara.server_host}"
21+
driven_by :remote_chrome
22+
else
23+
driven_by :selenium, using: :headless_chrome, screen_size: [1400, 1400]
24+
end
2125
end
2226
end

0 commit comments

Comments
 (0)