title: nightwatch: distribute test with specific firefox profile
body: <p>Here is my problem: I want be abble to set firefox in specific language to run our e2e tests, and be abble to distribute them.</p>
  
  <p>all verions:</p>
  
  <p>Mozilla Firefox 53.0.3</p>
  
  <p>Selenium 3.4.0 (from npm)</p>
  
  <p>geckodriver 0.17.0 (from npm)</p>
  
  <p>nightwatch.conf.js:</p>
  
  <pre><code>const seleniumServer = require('selenium-server');
  
  module.exports = {
      "src_folders": [
          "test/functional/features"
      ],
      "custom_commands_path": [
          "test/functional/commands/commun",
          "test/functional/commands/project"
      ],
      "output_folder": false,
      "selenium": {
          "start_process": true,
          "server_path": seleniumServer.path,
          "port": 4444,
          "cli_args": {
              "webdriver.gecko.driver": "./node_modules/.bin/geckodriver"
          }
      },
      "test_settings": {
          "default": {
              "selenium_port": 4444,
              "selenium_host": "localhost",
              "silent": true,
              "screenshots": {
                  "enabled": false
              },
              "detailed_output": false,
              "desiredCapabilities": {
                  "javascriptEnabled": true,
                  "acceptSslCerts": true,
                  "marionette": true,
                  "browserName": "firefox"
              }
          }
      }
  };
  </code></pre>
  
  <p>In general I tryed two way:</p>
  
  <ul>
  <li>dynamically create a firefox profile, and use it.</li>
  </ul>
  
  <p>In theorie, I can use a before(Each) and use <code>firefox-profile</code>. In practice it create my profile but doesn't use it.</p>
  
  <pre><code>const FirefoxProfile = require('firefox-profile');
  
  function setProfile(browser, profile, callback) {
      profile.encoded(function (encodedProfile) {
          browser.options.desiredCapabilities['firefox_profile'] = encodedProfile;
          callback();
      });
  }
  
  function setPrefToFrench(browser, done) {
      var FFprofile = new FirefoxProfile();
  
      FFprofile.setPreference('general.useragent.locale', 'fr');
      FFprofile.setPreference('intl.accept_languages', 'fr');
  
      setProfile(browser, FFprofile, done);
  }
  
  module.exports = {
      'default' : {
          isLocal : true
      },
  
      beforeEach: function(browser, done) {
          setPrefToFrench(browser, done);
          done();
      }
  };
  </code></pre>
  
  <ul>
  <li>Save a profile (why not ziped) and include it in project</li>
  </ul>
  
  <p>The same, in theorie, i just have to add it on the nightwatch.conf.js</p>
  
  <pre><code>"selenium": {
      "start_process": true,
      "server_path": seleniumServer.path,
      "port": 4444,
      "cli_args": {
          "webdriver.gecko.driver": "./node_modules/.bin/geckodriver",
          "webdriver.firefox.profile": "path/to/my/profile(or base64 zip)"
      }
  },
  </code></pre>
  
  <p>But all time the same, my firefox is still in english.</p>
  
  <p>Does anyone whould have a solution, or maybe I made something wrong?</p>