thoughtbot/capybara-webkit

Issue with testing special characters

codydalerodgers opened this issue · 0 comments

It appears that there is an issue when writing tests to match or find strings/elements with special characters and/or html tags.

For example, I am currently working on supporting multiple languages in our capybara tests and a test that might have been the following in English:
find('span', text: 'Unverified', count: 1)

should be as straightforward as the following for Portuguese:
find('span', text: "Não verificado", count: 1)

What is happening when printing out the html body when running the test, the following is returned:
<span class="text-bold text-negative"> (Não verificado)</span>

ã is being "replaced"/displayed as ã, so that span is "unable to be found" by Capybara.

The issue is not replicated when running the source code directly so it definitely seems there is an issue with the special characters through Capybara directly.

Other pertinent meta data that might be helpful:
<meta charset="UTF-8" content="text/html" http-equiv="content-type">