зеркало из https://github.com/mozilla/fxa.git
add local testing
This commit is contained in:
Родитель
dfe272fc33
Коммит
99deb3caed
36
README.md
36
README.md
|
@ -9,7 +9,7 @@
|
|||
git clone https://github.com/vladikoff/fxa-local-dev.git && cd fxa-local-dev && npm i
|
||||
```
|
||||
|
||||
After installation completes you can visit [127.0.0.1:3030](http://127.0.0.1:3030/) and use the [PM2 tool](https://github.com/Unitech/PM2#main-features) to start, stop and read server logs. Most common commands are as follows:
|
||||
After installation completes visit [127.0.0.1:3030](http://127.0.0.1:3030/). Use the [PM2 tool](https://github.com/Unitech/PM2#main-features) to start, stop and read server logs. Most common commands are as follows:
|
||||
|
||||
- `./pm2 start servers.json` **- start all servers.**
|
||||
- ^ (WARNING: running the above command multiple times will spawn more of the same servers).
|
||||
|
@ -17,19 +17,37 @@ After installation completes you can visit [127.0.0.1:3030](http://127.0.0.1:303
|
|||
- `./pm2 status` - display running servers.
|
||||
- `./pm2 logs` - logs for all servers (note: this must be used to verify accounts).
|
||||
- `./pm2 logs 1` - display logs for process `1`.
|
||||
- `./pm2 stop 1` - stop process `1`.
|
||||
- `./pm2 restart 1` - restart process `1`.
|
||||
- More commands on the [PM2 Readme](https://github.com/Unitech/PM2#main-features).
|
||||
|
||||
**Use `npm run update` to fetch the latest changes on the `master` branch.**
|
||||
**Use `npm run update` to [fetch the latest changes](_scripts/update_all.sh) to servers**
|
||||
|
||||
**Use `npm start` to start Firefox with local sync configurations.**
|
||||
*******
|
||||
|
||||
### Firefox Custom Profile
|
||||
|
||||
**Use `npm start` to start Firefox with local server 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`
|
||||
|
||||
### Workflow
|
||||
*******
|
||||
|
||||
This is an example workflow for **fxa-local-dev**. After installing **fxa-local-dev** the servers should automatically start up. Use `./pm2 status` command to check the status of the servers:
|
||||
### Functional Tests
|
||||
> The following requires [Java](https://www.java.com/en/download/).
|
||||
|
||||
**Use `npm test` - all functional tests**
|
||||
|
||||
**Use `npm run test-oauth` - only OAuth functional tests**
|
||||
|
||||
*******
|
||||
|
||||
### Workflow
|
||||
> This is an example workflow for **fxa-local-dev**.
|
||||
|
||||
After installing **fxa-local-dev** the servers should automatically start up. Use `./pm2 status` command to check the status of the servers:
|
||||
|
||||
![](http://i.imgur.com/eqL8FiZ.png)
|
||||
|
||||
|
@ -42,8 +60,10 @@ Use the `./pm2 logs` command to get the logs of all servers. You may also use `.
|
|||
|
||||
If you get an `error` status for any of the servers please verify that you installed all required dependencies. Otherwise file an issue on this repository.
|
||||
|
||||
### Dependencies
|
||||
*******
|
||||
|
||||
### Dependencies
|
||||
> Required dependencies:
|
||||
[Git](http://git-scm.com/book/en/v2/Getting-Started-Installing-Git),
|
||||
[node.js](http://nodejs.org/),
|
||||
[Python 2.6+](https://www.python.org/),
|
||||
|
@ -51,11 +71,11 @@ If you get an `error` status for any of the servers please verify that you insta
|
|||
[libgmp](https://gmplib.org/),
|
||||
[graphicsmagick](http://www.graphicsmagick.org/).
|
||||
|
||||
#### OSX (with [Brew](http://brew.sh/)):
|
||||
#### OS X (with [Brew](http://brew.sh/)):
|
||||
##### `brew install gmp redis graphicsmagick`
|
||||
##### `sudo easy_install pip && sudo pip install virtualenv`
|
||||
|
||||
(You might also need to run `xcode-select --install` to get OS X Command Line Tools)
|
||||
> You might also need to run `xcode-select --install` to get OS X Command Line Tools
|
||||
|
||||
#### Ubuntu:
|
||||
```
|
||||
|
|
|
@ -6,9 +6,6 @@ var chalk = require('chalk');
|
|||
|
||||
var profile = require('./profile');
|
||||
|
||||
var bunyan = require('bunyan');
|
||||
var log = bunyan.createLogger({name: "firefox"});
|
||||
|
||||
selenium.install({
|
||||
// check for more recent versions of selenium here:
|
||||
// http://selenium-release.storage.googleapis.com/index.html
|
||||
|
@ -74,9 +71,9 @@ var tailLogs = function() {
|
|||
console.log('ERROR: ', error);
|
||||
});
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
var w = function(s) {
|
||||
console.log(s);
|
||||
}
|
||||
};
|
|
@ -5,7 +5,10 @@
|
|||
"scripts": {
|
||||
"postinstall": "_scripts/postinstall.sh",
|
||||
"update": "./pm2 kill && _scripts/update_all.sh",
|
||||
"start": "node _scripts/start.js"
|
||||
"start": "node _scripts/start.js",
|
||||
"test": "node test/functional.js --suite=full",
|
||||
"test-core": "node test/functional.js --suite=core",
|
||||
"test-oauth": "node test/functional.js --suite=oauth"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
@ -14,11 +17,11 @@
|
|||
"author": "",
|
||||
"license": "MPL",
|
||||
"dependencies": {
|
||||
"bunyan": "1.3.4",
|
||||
"chalk": "1.0.0",
|
||||
"firefox-profile": "0.3.6",
|
||||
"minimist": "1.1.1",
|
||||
"pm2": "0.12.7",
|
||||
"selenium-standalone": "4.2.0",
|
||||
"selenium-standalone": "4.4.0",
|
||||
"tail": "0.4.0",
|
||||
"webdriverio": "2.4.5"
|
||||
}
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
var startSelenium = require('./lib/start-selenium');
|
||||
var argv = require('minimist')(process.argv.slice(2));
|
||||
|
||||
var chalk = require('chalk');
|
||||
|
||||
startSelenium(function (selenium) {
|
||||
var suiteType = 'tests/intern_functional_full';
|
||||
|
||||
if (argv.suite === 'oauth') {
|
||||
suiteType = 'tests/intern_functional_oauth';
|
||||
}
|
||||
|
||||
if (argv.suite === 'core') {
|
||||
suiteType = 'tests/intern_functional';
|
||||
}
|
||||
|
||||
var COMMAND = 'node_modules/.bin/intern-runner';
|
||||
var WORK_DIR = 'fxa-content-server';
|
||||
var ARGS = ['config=' + suiteType];
|
||||
|
||||
var spawn = require('child_process').spawn;
|
||||
console.log(chalk.green('Running:', COMMAND, ARGS));
|
||||
var tests = spawn(COMMAND, ARGS, {
|
||||
cwd: WORK_DIR
|
||||
});
|
||||
|
||||
tests.stdout.on('data', function (data) {
|
||||
process.stdout.write(chalk.green(data));
|
||||
});
|
||||
|
||||
tests.stderr.on('data', function (data) {
|
||||
process.stdout.write(chalk.red(data));
|
||||
});
|
||||
|
||||
tests.on('close', function () {
|
||||
console.log(chalk.green('Intern tests shut down...'));
|
||||
});
|
||||
|
||||
function exit() {
|
||||
console.log(chalk.green('Stopping Selenium...'));
|
||||
selenium.kill();
|
||||
}
|
||||
|
||||
process.on('SIGINT', exit);
|
||||
process.on('SIGTERM', exit);
|
||||
});
|
|
@ -0,0 +1,21 @@
|
|||
var selenium = require('selenium-standalone');
|
||||
var isUp = require('is-up');
|
||||
var chalk = require('chalk');
|
||||
|
||||
module.exports = function (cb) {
|
||||
selenium.install({
|
||||
version: '2.45.0',
|
||||
drivers: {},
|
||||
logger: function(message) {
|
||||
process.stdout.write(chalk.green(message));
|
||||
}
|
||||
}, function (err) {
|
||||
if (err) { throw err; }
|
||||
selenium.start(function (err, child) {
|
||||
if (err) { throw err; }
|
||||
|
||||
console.log(chalk.green('Selenium started or already running...'));
|
||||
cb(child);
|
||||
});
|
||||
});
|
||||
};
|
Загрузка…
Ссылка в новой задаче