Support docker-selenium (#7583)
* Support use of selenium-docker * Apply suggestion * Add documentation
This commit is contained in:
parent
67a1109f6b
commit
2ea320a245
2 changed files with 26 additions and 1 deletions
|
|
@ -218,5 +218,21 @@ cd automake-1.10/
|
|||
make
|
||||
```
|
||||
|
||||
### WSL2 and System test
|
||||
|
||||
In WSL2, hostname/IP address are no longer shared between Windows and Linux.
|
||||
There are currently two work-arounds.
|
||||
|
||||
1. Use dockerized selenium, ie docker-selenium. You will need docker for the
|
||||
following steps
|
||||
|
||||
1. `docker run -d --name selenium-hub -p 4444:4444 selenium/hub:3.141.59-20200409`
|
||||
2. `CH=$(docker run --rm --name=ch --link selenium-hub:hub -v /dev/shm:/dev/shm selenium/node-chrome:3.141.59-20200409)`
|
||||
3. Add `SELENIUM_URL: "http://localhost:4444/wd/hub"` to your
|
||||
`application.yml`
|
||||
4. Run your System test!
|
||||
|
||||
2. Port forward with `socats` (more info needed).
|
||||
|
||||
> If you encountered any errors that you subsequently resolved, **please
|
||||
> consider updating this section** with your errors and their solutions.
|
||||
|
|
|
|||
|
|
@ -21,7 +21,16 @@ RSpec.configure do |config|
|
|||
end
|
||||
|
||||
config.before(:each, type: :system, js: true) do
|
||||
driven_by :headless_chrome
|
||||
if ENV["SELENIUM_URL"].present?
|
||||
# Support use of remote chrome testing.
|
||||
Capybara.server_host = ENV.fetch("CAPYBARA_SERVER_HOST") { "0.0.0.0" }
|
||||
ip = Socket.ip_address_list.detect(&:ipv4_private?).ip_address
|
||||
host! URI::HTTP.build(host: ip, port: Capybara.server_port).to_s
|
||||
|
||||
driven_by :selenium, using: :chrome, screen_size: [1400, 2000], options: { url: ENV["SELENIUM_URL"] }
|
||||
else
|
||||
driven_by :headless_chrome
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue