Closed Bug 872424 Opened 11 years ago Closed 10 years ago

Localization race condition when running Test Agent

Categories

(Firefox OS Graveyard :: Gaia, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: gerard-majax, Assigned: gerard-majax)

Details

Attachments

(1 file)

There seems to be a race condition regarding localization when running tests. Following the methoded described on https://developer.mozilla.org/en-US/docs/Mozilla/Firefox_OS/Platform/Testing/Gaia_unit_tests#Advanced.3A_launch_from_the_CLI_and_launch-as-you-save one will end up running directly the Test Agent App of Gaia inside Firefox Nightly.

While running tests for Calendar app, I ran into an issue of tests failing:
  13) [calendar] db #open on version change #setupDefaults default calendar:
     Error: expected 'Agenda hors-ligne' to equal 'Offline calendar'
      at chaiAssert (http://test-agent.gaiamobile.org:8080/common/test/helper.js:30)
      at equal (http://test-agent.gaiamobile.org:8080/common/vendor/chai/chai.js:1250)
      at (anonymous) (http://calendar.gaiamobile.org:8080/test/unit/db_test.js:157)
      at wrapper (http://test-agent.gaiamobile.org:8080/common/test/mocha_generators.js:62)
      at run (http://test-agent.gaiamobile.org:8080/common/vendor/mocha/mocha.js:3709)
      at runTest (http://test-agent.gaiamobile.org:8080/common/vendor/mocha/mocha.js:4081)
      at (anonymous) (http://test-agent.gaiamobile.org:8080/common/vendor/mocha/mocha.js:4127)
      at next (http://test-agent.gaiamobile.org:8080/common/vendor/mocha/mocha.js:4007)
      at (anonymous) (http://test-agent.gaiamobile.org:8080/common/vendor/mocha/mocha.js:4016)
      at next (http://test-agent.gaiamobile.org:8080/common/vendor/mocha/mocha.js:3964)
      at (anonymous) (http://test-agent.gaiamobile.org:8080/common/vendor/mocha/mocha.js:3979)
      at done (http://test-agent.gaiamobile.org:8080/common/vendor/mocha/mocha.js:3700)
      at (anonymous) (http://test-agent.gaiamobile.org:8080/common/vendor/mocha/mocha.js:3712)
      at (anonymous) (http://test-agent.gaiamobile.org:8080/common/test/mocha_generators.js:46)
      at (anonymous) (http://calendar.gaiamobile.org:8080/test/unit/db_test.js:133)
      at fireQueue (http://calendar.gaiamobile.org:8080/js/store/abstract.js:173)
      at oncomplete (http://calendar.gaiamobile.org:8080/js/store/abstract.js:186)
  

  14) [calendar] Views.ModifyEvent #_updateUI dates and time are displayed according to the locale:
     Error: expected '30/12/2012' to equal '12/30/2012'
      at chaiAssert (http://test-agent.gaiamobile.org:8080/common/test/helper.js:30)
      at equal (http://test-agent.gaiamobile.org:8080/common/vendor/chai/chai.js:1250)
      at (anonymous) (http://calendar.gaiamobile.org:8080/test/unit/views/modify_event_test.js:388)
      at (anonymous) (http://test-agent.gaiamobile.org:8080/common/test/mocha_generators.js:40)
      at (anonymous) (http://calendar.gaiamobile.org:8080/test/unit/views/modify_event_test.js:386)
      at verify (http://calendar.gaiamobile.org:8080/test/unit/views/modify_event_test.js:274)
      at fetchEventCaps (http://calendar.gaiamobile.org:8080/js/views/event_base.js:163)
      at (anonymous) (http://calendar.gaiamobile.org:8080/test/unit/support/mock_provider.js:213)
      at handleNextTick (http://calendar.gaiamobile.org:8080/js/calendar.js:159)

One can notice the messages like "Error: expected '30/12/2012' to equal '12/30/2012'" and "Error: expected 'Agenda hors-ligne' to equal 'Offline calendar'".

This happens when running directly the Test Agent application, i.e., ~/bin/firefox-nightly/firefox -profile ./profile/ -no-remote http://test-agent.gaiamobile.org:8080/. If you start Gaia by running ~/bin/firefox-nightly/firefox -profile ./profile/ -no-remote, then that you wait a couple of seconds and start Test Agent App, then it works correctly, thus suggesting a race condition. Please note that my Firefox Nightly is in french locale.

Steps to reproduce:
0. Setup the test environment
1. make test-agent-server
2. firefox-nightly/firefox -profile ./profile/ -no-remote http://test-agent.gaiamobile.org:8080/
3. make APP=calendar test-agent-test

Expected result: Tests should not fail because of the locale
Actual restult: Tests are failing because of the locale
Assignee: nobody → lissyx+mozillians
The issue was in fact just that the language is set when running the system application. In the case described, we are directly running test-agent, thus the code in initSystem() can't get executed. Forcing preferences allows to ensure the tests are run in english locale (which seems to be what is expected, regarding the source code).

Also, I've checked that it does not breaks multilocale build and as far as I can say, it seems to be okay.
Status: NEW → ASSIGNED
note- this is calendar only right now we do horrible things to force l10n to load.
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: