Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running the test of the web-app (In France) #242

Closed
ThibautGery opened this issue May 26, 2016 · 2 comments
Closed

Running the test of the web-app (In France) #242

ThibautGery opened this issue May 26, 2016 · 2 comments
Milestone

Comments

@ThibautGery
Copy link
Contributor

ThibautGery commented May 26, 2016

Bug report

Description

The test of the web-app fails because part of the labels are translated in French and the assertions are made in english 😢

Environment

I work on the master branch

$ echo $LANG
en_US.UTF-8
$ phantomjs --version
1.9.0
$ ruby --version
ruby 2.2.3p173 

Step to reproduce

Be in France ?

$ bundle exec rake
[...]
  Failure/Error: fill_in "Restrict Access to IPs", :with => "127.0.0.1\n10.1.1.1/16"
  Capybara::ElementNotFound:
    Unable to find field "Restrict Access to IPs"

Screenshot of the failing test

screenshot
The label Restrict Access to IPs was translated in Liste noire IP

In index.html I have tried to insert the following snippet (as discussed here) but it didn't worked (it wasn't a satisfying solution either)

<script>
   localStorage.lang = 'en';
</script>

How the translation is working ? Is it based on the browser language ? It doesn't seems possible to force the language of phantomJS (at least with the command line)
Is it possible de assert the label with the term translated in the correct language ? I will gladly do a pull request on this issue but I need a bit of help

@GUI
Copy link
Member

GUI commented May 27, 2016

Very interesting, thanks for reporting this!

We base the default language on the Accept-Language HTTP header browsers will supply (but we'd also be interested if that's not a good approach for international users, or if you'd prefer a more explicit option to set the language in the UI). I wasn't aware PhantomJS was setting a default, but I think it must be picking up your system language default somehow.

Could you try again after pulling the latest down from master? I've committed a change that I believe should fix this by explicitly setting the default language to english for the integration tests: 875db7f (but then we also have some existing tests to do some very basic locale support testing separately).

If that update doesn't fix things, could you supply the output of running the locale command on your computer?

We could also potentially update any of our tests to be locale aware (so, for example, our tests would look for the presence of I18n.t("mongoid.attributes.api/settings.allowed_ips") rather than "Restrict Access to IPs"). But my initial sense is that having a default language (and testing locale support separately) might be less error prone, so people can't accidentally commit tests that only work depending on your computer's default language. But let us know if you have any any other thoughts or preferences regarding this.

@ThibautGery
Copy link
Contributor Author

Thank you very much your commit fixed my issue.

@GUI GUI added this to the v0.12 milestone Jun 26, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants