galenframework / galen

Layout and functional testing framework for websites
http://galenframework.com
1.41k stars 163 forks source link

TEXT IS only supports ANSI #87

Open claytonneal opened 10 years ago

claytonneal commented 10 years ago

Im validating a french website, using notepad++ i set the encoding of the spec file to UTF-8 and i use:

text is: LA QUALITÉ

this fails with:

.. should by "LA QUALITÃ%"

ishubin commented 10 years ago

Thanks, will work on it

claytonneal commented 10 years ago

Great, its a problem when testing localised websites

ishubin commented 10 years ago

I have just checked using VIM editor (in Mac OS) and it works for me. Could you maybe try some other editors? In a mean time I will investigate how to support multiple encodings

claytonneal commented 10 years ago

I was using notepad++ on windows, set to uft-8.

valermor commented 10 years ago

It could be a problem with the default encoding in your system. At any rate, I had the same problem when implementing localization tests. A workaround that worked for me was to use 'text matches' along with UNICODE_CHARACTER_CLASS of Pattern java class (what the implementation uses). You can use the embedded flag expression. In your case: text matches: (?U)LA QUALITÉ

ishubin commented 10 years ago

I was right about to fix this issue when I stumble upon this line of code in galen:

BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream, System.getProperty("file.encoding")));

So it seems that you can just set your own encoding through "file.encoding" system property In order to set the system property just add it to your galen command like this: galen test . --htmlreport reports -Dfile.encoding=UTF-8

Could you please try it and check if it works for you?

teintinu commented 8 years ago

-Dfile.encoding=UTF-8 don't works to me.

I'm solving it running command bellow after galen execution:

for f in `find htmlreport-dir -name *.html` ; do sed -i "s/<head>/<head><meta charset='utf\-8'>/g" $f ; done
ishubin commented 8 years ago

@thr0w You mean it doesn't work in your html reports? Then I guess it is a different issue then. This specific story was about actual text validation and not about html report. So does the text validation work for you? As for the html related issue I guess we should just fix that in report template

teintinu commented 8 years ago

Sorry. i'd mistake.

ishubin commented 8 years ago

@thr0w well, I don't think its a mistake :) If it is an issue in the report - then we should still fix it there. could you please create a new story for this? I will assign it to the current milestone