Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    marc graff
    @mgraffx
    @twalpole Tried (minus disabled) and received "ArgumentError: Invalid option(s) :with, should be one of ..."
    Thomas Walpole
    @twalpole
    @mgraffx What's the full error -- the Capybara have_field matcher definitely supports with - https://github.com/teamcapybara/capybara/blob/master/lib/capybara/selector.rb#L37 - which implies you're not using the Capybara matchers
    marc graff
    @mgraffx
     ArgumentError:
       Invalid option(s) :with, should be one of :above, :below, :left_of, :right_of, :near, :count, :minimum, :maximum, :between, :text, :id, :class, :style, :visible, :obscured, :exact, :exact_text, :normalize_ws, :match, :wait, :filter_set
    Thomas Walpole
    @twalpole
    @mgraffx That's the set for normal have_selector/'have_css' (no placeholder, name, type, etc)- what's the exact statement you're calling
    marc graff
    @mgraffx
    expect(page.test_section).to have_element with: variable_containing_text - the exact call is based on page object sections and element defined
    Thomas Walpole
    @twalpole
    Right so that wouldn’t actually be using the field selector unless your element definition did - what is your element definition
    marc graff
    @mgraffx
    element :user_name, "[aria-label='User name']"
    Thomas Walpole
    @twalpole
    hmmm
    does it have to use the aria-label or is there an element id
    marc graff
    @mgraffx
    no id and no name attributes
    Thomas Walpole
    @twalpole
    well that's terrible html for a field ....
    what type of element is it actually?
    marc graff
    @mgraffx
    generally either data-qa or aria-label
    i know. i have been recommending using id/name since it provide better interoperability with capybara
    Thomas Walpole
    @twalpole
    Do you have enable_aria_label configured to true?
    if you do you could change your element definition to element :user_name, :field, 'User name'
    then it would be using the field selector when you do have_element
    *should if i remember how site_prism is written correctly
    Thomas Walpole
    @twalpole
    for data-qa assuming that's just for a test id then you could also set Capybara.test_id = 'data-qa' and it would be matched by most locators too
    element :blah, :field, 'my_test_id' - would match a field with data-qa of my_test_id
    marc graff
    @mgraffx
    ok. there is little consistency in support of test creation. Will tinker some more with suggestions above, thanks.
    marc graff
    @mgraffx
    Trying to come up with a set of design system recommendations that help support the creation and stability of tests.
    Thomas Walpole
    @twalpole
    If you're using fields (input, etc), buttons, links, etc you're going to be better off specifying the selector type in your element definitions because it then lets you use the Capybara element type specific matchers
    dropping down to just CSS or XPath really throws away 90% of Capybaras functionality
    and if you're using aria-label a lot of the time definitely set Capybara.enable_aria_label = true in your config
    marc graff
    @mgraffx
    trouble with input is they are hidden
    Thomas Walpole
    @twalpole
    how does the user interact with them then?
    you need to be interacting with the elements the user does, otherwise theres no point to the tests
    marc graff
    @mgraffx
    think of something elser, sorry
    some other component
    marc graff
    @mgraffx
    this is run via rspec. could it be using the wrong matchers

    element :connection_name, :field, "[aria-label='Connection name']"

    expect(transaction_details_page.connection_details).to have_connection_name with: connection.name, disabled: true

    RSpec::Expectations::ExpectationNotMetError: expected #<ConnectionDetails:0x00007fae5c15b618 @parent=#<TransactionDetailsPage:0x00007fae7ab47230>, @root_el..."/HTML/BODY[1]/DIV[1]/DIV[2]/DIV[2]/DIV[1]/MAIN[1]/DIV[2]/DIV[1]/DIV[1]/FORM[1]/DIV[2]/SECTION[1]">> to have connection name {:disabled=>true, :with=>"Gale Harber"}

    <input placeholder="" type="text" aria-disabled="true" aria-label="Connection name" class="styled__InputWrapper-sc-1bcbvs9-0 lmUlVO styled__InfoInput-sc-1jf34lp-4 faRNdl" disabled="" value="Gale Harber">

    Thomas Walpole
    @twalpole
    element :connection_name, :field, 'Connection name'
    when you're using the :field selector type it doesn't take CSS - it takes a locator
    The locator will match against aria-label if you have set Capybara.enable_aria_label = true
    @mgraffx ^^^
    marc graff
    @mgraffx
    nice, thanks
    marc graff
    @mgraffx
    so if the field is disabled and you do not have that included in the matcher, it won't match so this is all or nothing
    and ty for the link to selectors
    Thomas Walpole
    @twalpole
    Disabled defaults to false for the field selector
    You could pass disabled: :all in the element definition if you wanted it ignored
    marc graff
    @mgraffx
    I notice that if the expect for this passes it returns true but when it fails i expected it to return false but doesn't. Shows in console as "Failure/Error: expect ..."
    Thomas Walpole
    @twalpole
    expectations raise exceptions when they fail - if you want true/false you need to be using a predicate - although tests really should be predictable and therefore not need predicates
    marc graff
    @mgraffx
    Thanks again
    Thomas VIAL
    @tvial_twitter
    Hi, I'm working on a form with ajax file upload to China using Capybara.
    As you can imagine, the latency can change a lot depending multiple factors.
    Instead of increasing a lot Capybara.default_max_wait_time, is there a smarter way to achieve be sure that I finalize my uploads? I have an upload progress bar on the bar that I could use. Any idea? Thanks!
    Thomas Walpole
    @twalpole
    You can increase the max wait time on a per call basis via the :wait option
    so just increase it for the call that matters
    Additionally -- if you have an error dialog, etc that shows up when you have a real failure you can wait for either the error or the success to show up -- that could provide a faster failure in the case there was an indicated failure
    Thomas VIAL
    @tvial_twitter
    Thanks, gonna do that and wait for the upload to display 100%. Thanks.