This commit is contained in:
Vlad Filippov 2014-12-30 00:57:38 -05:00
Родитель 983eb33bfe
Коммит f602b456e0
5 изменённых файлов: 88 добавлений и 2 удалений

1
.gitignore поставляемый
Просмотреть файл

@ -7,3 +7,4 @@ selenium-*
node_modules
pm2
dump.rdb
*.log

Просмотреть файл

@ -24,6 +24,15 @@ After installation completes you can visit [127.0.0.1:3030](http://127.0.0.1:303
- Run `npm run update`.
### Firefox configurations
Use `npm start` to start Firefox with **local sync** configurations.
Available options:
* `FXA_ENV=local` or `latest or `stable` (NOTE: `local` is default).
* `FIREFOX_BIN=/Applications/FirefoxNightly.app/Contents/MacOS/firefox-bin npm start`
### Dependencies
[Git](http://git-scm.com/book/en/v2/Getting-Started-Installing-Git), [node.js](http://nodejs.org/), Redis, libgmp.

39
_scripts/profile.js Normal file
Просмотреть файл

@ -0,0 +1,39 @@
var FirefoxProfile = require('firefox-profile');
var fxaProfile = new FirefoxProfile();
var CONFIGS = {
'local': {
auth: 'http://127.0.0.1:9000/v1',
content: 'http://127.0.0.1:3030/',
token: 'http://localhost:5000/token/1.0/sync/1.5'
},
'latest': {
auth: 'https://latest.dev.lcip.org/auth/v1',
content: 'https://latest.dev.lcip.org/',
token: 'https://token.dev.lcip.org/1.0/sync/1.5'
},
'stable': {
auth: 'https://stable.dev.lcip.org/auth/v1',
content: 'https://stable.dev.lcip.org/',
token: 'https://token.dev.lcip.org/1.0/sync/1.5'
}
};
var env = process.env.FXA_ENV || 'local';
var fxaEnv = CONFIGS[env];
// Configuration for local sync development
fxaProfile.setPreference('services.sync.log.appender.file.logOnSuccess', true);
fxaProfile.setPreference('identity.fxaccounts.auth.uri', fxaEnv.auth);
fxaProfile.setPreference('identity.fxaccounts.allowHttp', true);
fxaProfile.setPreference('identity.fxaccounts.remote.force_auth.uri', fxaEnv.content + 'force_auth?service=sync&context=fx_desktop_v1');
fxaProfile.setPreference('identity.fxaccounts.remote.signin.uri', fxaEnv.content + 'signin?service=sync&context=fx_desktop_v1');
fxaProfile.setPreference('identity.fxaccounts.remote.signup.uri', fxaEnv.content + 'signup?service=sync&context=fx_desktop_v1');
fxaProfile.setPreference('identity.fxaccounts.settings.uri', fxaEnv.content + 'settings');
fxaProfile.setPreference('services.sync.tokenServerURI', fxaEnv.token);
fxaProfile.updatePreferences();
module.exports = function (cb) {
if (cb) fxaProfile.encoded(cb);
};

29
_scripts/start.js Normal file
Просмотреть файл

@ -0,0 +1,29 @@
#!/usr/bin/env node
var selenium = require('selenium-standalone');
var webdriverio = require('webdriverio');
var profile = require('./profile');
var server = selenium({}, []);
profile(function (profile) {
var opts = {
desiredCapabilities: {
browserName: 'firefox',
// set a custom profile
firefox_profile: profile
}
};
// support $FIREFOX_BIN
if (process.env.FIREFOX_BIN) {
opts.desiredCapabilities.firefox_binary = process.env.FIREFOX_BIN;
}
setTimeout(function () {
webdriverio
.remote(opts)
.init()
.url('about:accounts')
}, 3000);
});

Просмотреть файл

@ -4,11 +4,19 @@
"description": "An easy way to contribute to Firefox Accounts",
"scripts": {
"postinstall": "_scripts/postinstall.sh",
"update": "./pm2 kill && _scripts/update_all.sh"
"update": "./pm2 kill && _scripts/update_all.sh",
"start": "node _scripts/start.js"
},
"repository": {
"type": "git",
"url": "https://github.com/vladikoff/fxa-local-dev"
},
"author": "",
"license": "MPL",
"dependencies": {
"pm2": "git://github.com/Unitech/PM2#44a9be19cb3c2a28ba2c93092844816c50d31912"
"firefox-profile": "0.3.6",
"pm2": "git://github.com/Unitech/PM2#44a9be19cb3c2a28ba2c93092844816c50d31912",
"selenium-standalone": "2.44.0-1",
"webdriverio": "2.4.0"
}
}