thoughtbot / capybara-webkit

A Capybara driver for headless WebKit to test JavaScript web apps
https://thoughtbot.com/open-source
MIT License
1.97k stars 428 forks source link

Issue with testing special characters #1041

Closed codydalerodgers closed 6 years ago

codydalerodgers commented 6 years ago

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">