DEV Community

Discussion on: How did you setup Capybara + Webdrivers on WSL for testing?

Collapse
 
amorpheuz profile image
Yash Dave

So I managed to get tackle the chrome issue by using WSL's feature to access Windows binaries from Linux and calling the chrome installed to my windows. But the problem I am getting stuck at now is that it isn't able to perform any actions. It opens blank chrome console windows and just sits until it timesout with:

2.1) Failure/Error: visit "/#{user.username}/#{article.slug}/edit"

          Net::ReadTimeout:
            Net::ReadTimeout with #<TCPSocket:(closed)>



          # ./spec/system/articles/user_edits_an_article_spec.rb:20:in `block (2 levels) in <main>'
          # ./spec/rails_helper.rb:85:in `block (3 levels) in <top (required)>'
          # ./spec/rails_helper.rb:85:in `block (2 levels) in <top (required)>'
          # ./spec/support/initializers/rspec_retry.rb:8:in `block (2 levels) in <main>'

     2.2) Failure/Error: VCR.turned_off { ex.run }

          Net::ReadTimeout:
            Net::ReadTimeout with #<TCPSocket:(closed)>



          # ./spec/rails_helper.rb:85:in `block (3 levels) in <top (required)>'
          # ./spec/rails_helper.rb:85:in `block (2 levels) in <top (required)>'
          # ./spec/support/initializers/rspec_retry.rb:8:in `block (2 levels) in <main>'
Enter fullscreen mode Exit fullscreen mode

Also a debug.log file is generated in the repo with content:

[0927/164130.672:ERROR:registration_protocol_win.cc(84)] TransactNamedPipe: The pipe has been ended. (0x6D)
[0927/164130.685:ERROR:file_io_win.cc(193)] LockFileEx: Incorrect function. (0x1)
[0927/164130.693:ERROR:file_io_win.cc(193)] LockFileEx: Incorrect function. (0x1)
[0927/164230.740:ERROR:file_io_win.cc(193)] LockFileEx: Incorrect function. (0x1)
[0927/164230.748:ERROR:file_io_win.cc(193)] LockFileEx: Incorrect function. (0x1)
Enter fullscreen mode Exit fullscreen mode

Seems to be a firewall issue? But disabling windows firewall doesn't allow it through too.

Collapse
 
jbaxter6 profile image
Johnnathan Baxter

Hi did you end up fixing this issue?

Collapse
 
amorpheuz profile image
Yash Dave • Edited

Hey, the issues I was facing got resolved once WSL2 came out. With WSL2, it became possible to install chrome directly to my Linux distro without any problems. I followed the following steps for Ubuntu 18.04 with bash:

sudo apt install fonts-liberation libappindicator3-1 libasound2 libgbm1 libnspr4 libnss3 libxss1 xdg-utils
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo dpkg -i google-chrome-stable_current_amd64.deb
echo 'alias chrome="google-chrome-stable"' >> ~/.bashrc
exec $SHELL
Enter fullscreen mode Exit fullscreen mode

If you get an error while running dpkg, run sudo apt --fix-broken install after which run the dpkg command again. You can run the following command to test your install:

chrome --headless --disable-gpu --dump-dom https://www.chromestatus.com/
Enter fullscreen mode Exit fullscreen mode
Thread Thread
 
mirzalazuardi profile image
Mirzalazuardi Hermawan

thanks , it works. this what I been searching for