ruby - In Capybara, does :exact or Capybara.exact apply to have_selector? -
I'm having trouble using CapAbra's Believing that I have a page (called "test page"). On this page is: I have a cucumber feature test that looks like this: The definition of my motion looks like this: I get the following error: This makes me believe that Am I missing something? Or is there a misunderstanding that how should this option be used? I know that I can always use regular expression syntax for matte hing an exact text string, but I would have thought that the is an open feature request, However, it does not apply to the current (in CapeBara 2.x), Accordingly, the Control that This is basically used only in that location, where text (or id, name, etc.) is not specified as an option - eg: has_selector , actually < / Em>. I know that this can be done using a regular expression, but by my reading I came to believe that I
: exact arg or set
Capybara.exact = true I can use. I am currently using CapAbara 2.2.1. Here's what I have:
& lt; Div id = "my_div" & gt; Abcdef & lt; / Div & gt;
Feature: Exact text matches Test has_selector scenario for: I am on the test page, then I should get a partial text match "bcde" in my div and I should get partial text match "abcdef" in my div and I get an exact text match using regexp "abcdef Should be "in my div and use a regexp in my div" bcde "using an exact form The match should not be met and I should get an exact text match using "abcdef" RG in my div and I should not get an exact text match using "bcde" in my div
then / ^ I should partially get the text matching "([^ \"] *) "My div $ / do | Text | in page.should_selector ('div # my_div', text = & gt; text) end then / ^ i should get an exact text match using regexp "([^ \"] *) "my div $ / do | text | in | Page.should_selector ('div # my_div',: text = & gt; / ^ # {text} $ /) end then / ^ exact text using me "regexp" ([^ \ "] *)" Should not match my div $ / do | Text | page.should_not has_selector ('div # my_div',: text = & gt; / ^ # {text} $ /) end then / ^ i should get an exact text using arg "([^ \"] *) " In my div $ / do | text | in | Page.should_selector ('div # my_div',: text = & gt; text, exact = & gt; true) end then / ^ me arg ("[^ \"] * ) "Should not match exact text, contrary to my expectations, my div $ / do | Text | page.should_not has_selector ('div # my_div', text = & gt; text, exact => true) end
and I should not get an exact text match using "bcde" in my div which will not match the CSS "div # my_div" with the text "bcde" 1 match: "abcdef" (cappa :: Expectation Notmat)
: exact => True is not doing anything in my
my_silcutor call I have tried to set
Capybara.exact = true in my test setup configuration like this, but this also does not affect my tests, the way I expected
: exact option is specifically for this kind of situation.
is_selector (and others) Near to exact text matching
: exact option
: text if I miss it correctly , Then this is the following code (from) that filters text options. As you can see, the
: exact option has no argument or idea
def match_filters? (Node) if option [: text] regexp = options [: text] .is_a? (Regexp)? Option [: Text]: Regexp.escape (option [: text] .to_s) does not return false if node is not (visible) .mail (regexp) termination
: Precise option is actually:
# 'password The word 'password' - 'password confirmation' click_link ('password', exact = & gt; incorrect) will be the word 'click' link_link ('password', = exact = & gt; true) # link will match; / Code>
Comments
Post a Comment