31 Matching Annotations
  1. Jun 2021
    1. That’s not the only way of writing end-to-end tests in Rails. For example, you can use Cypress JS framework and IDE. The only reason stopping me from trying this approach is the lack of multiple sessions support, which is required for testing real-time applications (i.e., those with AnyCable 😉).
    1. Setting Capybara.server_port worked when the selenium integration test ran independent of other integration tests, but failed to change the port when run with other tests, at least in my env. Asking for the port number capybara wanted to use, seemed to work better with running multiple tests. Maybe it would have worked if I changed the port for all tests, instead of letting some choose on their own.
    1. app_host is used whenever you call visit to generate the url, server_host sets the ip the server should accept connections from to use (0.0.0.0 means all network interfaces) and finally server_port sets the server port (auto generated by default).You are correct in that both app and server host should be set. Could you try server_host = “0.0.0.0” and app_host = “http://rails:#{Capybara.server_port}”.

      app_host ~ server_host

  2. Apr 2021
    1. The default fill_in method of Capybara is case sensitive. This is apparently due to their use of XPath. Anyhow, this seems to not be very well aligned with the entire idea of DSLs and letting non programmers write tests.

      not very well aligned

    2. After some searching i found a stack overflow problem that didn't fix my issue but anyhow… I simply used a little ruby and the capybara library to find the field myself with some case insensitive regex and the ruby detect method
    1. fill_in('Foo', with: 'bar', fill_options: { clear: :backspace })

      first sighting: fill_options: { clear: :backspace })

      first sighting: fill_options as an option at all (for fill_in only, I presume)

      I wonder they added at all as a response to this:

      See also: https://hyp.is/ZcXVJJMyEeucgmPXYFP9yg/github.com/teamcapybara/capybara/issues/203

      (which key should have been pressed, backspace, space?)

    1. why do you guys think have_css matcher is named the way it is? I mean, it sure deals with css identifiers, but have_css gives(at least to me) the impression that the page has certain stylesheet loading.
  3. Oct 2020
  4. Nov 2019
  5. Oct 2019
  6. Sep 2019
  7. Aug 2019
    1. Just by looking at the page you can see that it's not a normal check box. You are hiding the checkbox via CSS (opacity: 0) and replacing it with an image for styling reasons. Since the checkbox isn't visible Capybara can't find it. There are a couple of ways to deal with this, either find the element that contains the image being used as a replacement for the checkbox and click on that, or tell check/uncheck that it's allowed to click on the label if necessary to switch the checkbox
  8. Dec 2018
    1. Capybaras can run very fast with a top speed of about 22 mph (35 km an hour).  They can run as fast as a small horse.
    2. . The distance from the main grazing areas to the nearest pond is never more than 300 m. Most mating takes place in water
    3. Capybaras are very agile in water and can swim very fast. They can spend long hours in water, in part to thermoregulate (maintain a lower body temperature) as their sweat glands are not well developed. They can remain under water for up to 5 minutes.
    4. A Jaguar has to be within 3 feet of a capybara to have a chance of a successful attack.
  9. Jan 2016
    1. Jeff Atwood tweeted a picture of someone's pet capybara, and a reply led me to this page. They are not suitable as pets -- unless you are willing to be a full time caretaker.