Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Thomas Walpole
    @twalpole
    ok -- you should be able to just use fill_in - fill_in(class: 'js-ad-bill-message', with: '50')
    Boris Petrov
    @boris-petrov
    @twalpole I believe Capybara has a bug when used with Selenium 4.3.0. A test of mine started failing after updating Selenium's version. Capybara is the latest. The specific code that is not working right is find('.foobar').click(x: 120, y: 10). When running on Selenium 4.2.1, this code works fine. I do see a warning however - WARN Selenium moving to an element with offset currently tries to use the top left corner of the element as the origin; in Selenium 4.3 it will use the in-view center point of the element as the origin. - which comes exactly from that line. I guess that is related to the problem?
    Thomas Walpole
    @twalpole
    @boris-petrov yes if you e updated to a version of Selenium which changes the behavior you’re going to have a problem. Unfortunately selenium doesn’t follow semantic versioning which sometimes makes supporting it difficult - try the master branch of Capybara
    Thomas Walpole
    @twalpole
    and see the history.md file for the setting which controls the offset origin
    Boris Petrov
    @boris-petrov
    Oh, so this has been fixed? Thank you! I'll eagerly await a release then. :)
    I should have checked the changelog before writing here. Sorry about that!
    Thomas Walpole
    @twalpole
    No problem - you may need to change the setting mentioned in the changelog when using the latest
    Boris Petrov
    @boris-petrov
    Yep, I saw that, thanks! Why did you decide to make the other one default? Because W3C's default is that and you want to be consistent?
    Thomas Walpole
    @twalpole
    Exactly
    Boris Petrov
    @boris-petrov
    Is it possible to access the current running example via a Session object (page for example).
    I want to access the example.metadata or example.example_group.before_context_ivars or something.
    Thomas Walpole
    @twalpole
    No. The current example is an RSpec construct. It’s passed to the blocks passed to a number of the RSpec methods (it, let, before, after, etc). If you want to access it later you could store that in an instance variable like anything else you want accessible in other methods
    Boris Petrov
    @boris-petrov
    have_no_text works with an array (have_no_text(['a', 'b', 'c'])) but have_no_css doesn't? Why?
    Thomas Walpole
    @twalpole
    @boris-petrov have_no_text isn't defined to work with an array, and I would be shocked if it did. It'll call to_s on the array and then verify that your page doesn't have whatever that string equivalent of the array is. I also wonder why you'd think what have_no_text accepts would have any relevance on what have_no_css accepts?
    If you want multiple selector support you should look at have_none_of_selectors - https://rubydoc.info/github/teamcapybara/capybara/Capybara/RSpecMatchers#have_none_of_selectors-instance_method
    Boris Petrov
    @boris-petrov
    hm, so I've been using have_no_text in the wrong way for a while! :D Thankfully just in one place. have_none_of_selectors doesn't seem to fit exactly what I need I believe - I want to check that something doesn't contain any of the strings that I pass - for example expect(page).to have_no_text(['foo', 'bar', 'baz']) - i.e. I want the current scope to not contain either of the three strings. I'm not sure that's possible with have_none_of_selectors? Perhaps that could be a feature request. :)
    Linden
    @LindenMikus
    hello, I'm trying to run chrome in docker. Running headless works fine but confused about how I can get it to show a GUI (using x11 server or something else type thing). If anyone has ideas would appreciate
    2 replies
    m g
    @mgraffx
    I am seeing more usage of aria-disabled for elements like buttons and fields, etc. recently. While testing for some_button.disabled?, I get false when the button is disabled via aria-disabled. If the element just has the vanilla disabled attribute, that same element registers as disabled. Is there some setting needed for capybara to handle aria-disabled and treat it as disabled when true? Currently using "3.35.3". Would a newer version handle this? Thanks.
    Thomas Walpole
    @twalpole
    @boris-petrov To test for multiple strings easiest approach is to use a regex have_no_text(/foo|bar/)
    Thomas Walpole
    @twalpole
    or you can do something like expect(page).to ['foo', 'bar'].map { |t| have_no_text(t) }.reduce(:and) - write a helper method to implement the complicated part of that
    1 reply
    @mgraffx aria-disabled doesn't actually disable the button, it's only informational. Therefore disabled? does not take it into account .
    1 reply
    Thomas Walpole
    @twalpole
    Using include will lead to flaky tests due to no retry
    1 reply
    Boris Petrov
    @boris-petrov
    @twalpole could you release a new version of Capybara? :) I'm eagerly awaiting some of the fixes and features. :D
    Gus P
    @staycreativedesign
    @twalpole whatup man!
    Boris Petrov
    @boris-petrov
    I'm trying to test what the currently-dragged-link looks like (by default Chrome just shows the URL however this can be changed). I try to take a screenshot with capybara-screenshot after I've done page.driver.browser.action.move_to(link).click_and_hold.move_to(link, 100, 100).perform (which means the page is in a "dragging" state) but the mouse (and hence what is dragged) is not captured in the screenshot. Any ideas?
    lxxxvi
    @lxxxvi:matrix.org
    [m]
    Hi, (how) is it possible to run a specific file/test in the Capybara test suite? For example I'd like to run this test only: ./lib/capybara/spec/session/accept_confirm_spec.rb