Truncated text in 0.14.0 release?

50 views
Skip to first unread message

Brad Werth

unread,
Jan 4, 2013, 5:10:26 PM1/4/13
to capybar...@googlegroups.com
I have just updated to 0.14 from 0.13 in a project where everything was working well.

Now, with HTML like this:

  <div class="alert alert-info"><a data-dismiss="alert" class="close" href="#">×</a>Logged in</div>

This test:

  within( :xpath, "//div[@class=\"alert alert-info\"]" ) do
    page.send should_or_should_not, have_text( 'Logged in')
  end

Results in this output:

  expected there to be text "Logged in" in "ogged in" (RSpec::Expectations::ExpectationNotMetError)

Which seems to indicate that the text is being truncated somehow.

I get the similar results with:

  page.send should_or_should_not, have_xpath( "//div[@class=\"alert alert-info\"]", :text => 'Logged in' )

Which results in:

  expected to find xpath "//div[@class=\"alert alert-info\"]" with text "Logged in" but there were no matches. Also found "ogged in", which matched the selector but not all filters. (Capybara::ExpectationNotMet)

Thanks for looking into this, and for all of your previous work on this great tool - please let me know if I can provide any additional information.

Thanks,
Brad

Matt Horan

unread,
Jan 4, 2013, 7:02:48 PM1/4/13
to capybar...@googlegroups.com
On Friday, January 4, 2013 5:10:26 PM UTC-5, Brad Werth wrote:
I have just updated to 0.14 from 0.13 in a project where everything was working well.

Now, with HTML like this:

  <div class="alert alert-info"><a data-dismiss="alert" class="close" href="#">×</a>Logged in</div>

This test:

  within( :xpath, "//div[@class=\"alert alert-info\"]" ) do
    page.send should_or_should_not, have_text( 'Logged in')
  end

Results in this output:

  expected there to be text "Logged in" in "ogged in" (RSpec::Expectations::ExpectationNotMetError)

Interesting. My guess is this is related to https://github.com/thoughtbot/capybara-webkit/issues/444. I modified the user stylesheet in 0.14.0 to prevent web fonts from loading for all pseudo elements, including first-letter.

I was unable to reproduce this with a simple test, however it's possible that you've got some CSS somewhere that's applying something to the L which causes xpath to strip out the letter. Could you tell me a bit more about the failing test, or preferably provide an isolated failing example?

Thanks.

Matt Horan

unread,
Jan 13, 2013, 6:36:11 PM1/13/13
to capybar...@googlegroups.com
On Fri, Jan 04, 2013 at 04:02:48PM -0800, Matt Horan wrote:
> Interesting. My guess is this is related to
> https://github.com/thoughtbot/capybara-webkit/issues/444. I modified the
> user stylesheet in 0.14.0 to prevent web fonts from loading for all pseudo
> elements, including first-letter.

I've released 0.14.1 to address this issue. We now only override web
fonts for ::before and ::after pseudo elements and leave ::first-letter
and ::first-line as is. This could cause segfaults for OS X users with
web fonts applied to those pseudo elements, but that seems like less of
an issue than the breakage reported here.

Thanks,

--
Matt Horan ma...@matthoran.com http://matthoran.com/
Reply all
Reply to author
Forward
0 new messages