updated the browser tests to write the name of the browser in their log file
This commit is contained in:
6
.gitignore
vendored
6
.gitignore
vendored
@ -1,5 +1,7 @@
|
|||||||
node_modules
|
node_modules
|
||||||
scripts/scratch*
|
scripts/scratch*
|
||||||
test/integration/yaml_suite/log
|
test/integration/yaml_suite/log
|
||||||
test/integration/yaml_suite/tests
|
|
||||||
test/browser_integration/test-output.xml
|
## generated files
|
||||||
|
test/browser_integration/*.xml
|
||||||
|
test/browser_integration/yaml_tests.js
|
||||||
|
|||||||
10
Gruntfile.js
10
Gruntfile.js
@ -243,7 +243,7 @@ module.exports = function (grunt) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
grunt.config.set('open_browser_tests.' + browser, {
|
grunt.config.set('__open_browser_tests.' + browser, {
|
||||||
appName: appName
|
appName: appName
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -251,7 +251,7 @@ module.exports = function (grunt) {
|
|||||||
'generate',
|
'generate',
|
||||||
'build',
|
'build',
|
||||||
'run:integration_server',
|
'run:integration_server',
|
||||||
'open_browser_tests:' + browser
|
'__open_browser_tests:' + browser
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -263,7 +263,7 @@ module.exports = function (grunt) {
|
|||||||
* You must always run the build task first, to ensure that the lastest API and yaml tests are available.
|
* You must always run the build task first, to ensure that the lastest API and yaml tests are available.
|
||||||
* This is run in the default and browser_tests:{{browser}} tests.
|
* This is run in the default and browser_tests:{{browser}} tests.
|
||||||
*/
|
*/
|
||||||
grunt.registerMultiTask('open_browser_tests', function () {
|
grunt.registerMultiTask('__open_browser_tests', function () {
|
||||||
var host = grunt.option('host') || 'localhost';
|
var host = grunt.option('host') || 'localhost';
|
||||||
var port = grunt.option('port') || 9200;
|
var port = grunt.option('port') || 9200;
|
||||||
var taskData = this.data;
|
var taskData = this.data;
|
||||||
@ -275,7 +275,9 @@ module.exports = function (grunt) {
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
grunt.config.set('open.yaml_suite_' + this.target, {
|
grunt.config.set('open.yaml_suite_' + this.target, {
|
||||||
path: 'http://localhost:8888?es_hostname=' + encodeURIComponent(host) + '&es_port=' + encodeURIComponent(port),
|
path: 'http://localhost:8888?es_hostname=' + encodeURIComponent(host) +
|
||||||
|
'&es_port=' + encodeURIComponent(port) +
|
||||||
|
'&browser=' + encodeURIComponent(this.target),
|
||||||
app: taskData.appName
|
app: taskData.appName
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
(function (global) {
|
(function (global) {
|
||||||
/* jshint browser:true */
|
/* jshint browser:true */
|
||||||
/* global alert */
|
/* global alert, BROWSER_NAME */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save timer references to avoid Sinon interfering (see GH-237).
|
* Save timer references to avoid Sinon interfering (see GH-237).
|
||||||
@ -155,7 +155,9 @@
|
|||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
$.post('/tests-complete', JSON.stringify(testResults));
|
$.post('/tests-complete?browser=' + BROWSER_NAME, JSON.stringify(testResults), function () {
|
||||||
|
window.close();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/** override console to force all output to go to log and err, then we have all the output **/
|
/** override console to force all output to go to log and err, then we have all the output **/
|
||||||
|
|||||||
@ -19,8 +19,9 @@
|
|||||||
|
|
||||||
<!-- global vars -->
|
<!-- global vars -->
|
||||||
<script>
|
<script>
|
||||||
var ES_HOSTNAME = '<%- es_hostname %>';
|
var ES_HOSTNAME = <%= JSON.stringify(es_hostname) %>;
|
||||||
var ES_PORT = <%= es_port %>;
|
var ES_PORT = <%= JSON.stringify(es_port) %>;
|
||||||
|
var BROWSER_NAME = <%= JSON.stringify(browser) %>;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<!-- test -->
|
<!-- test -->
|
||||||
|
|||||||
@ -48,6 +48,7 @@ function sendBundle(req, resp, files, opts, extend) {
|
|||||||
|
|
||||||
function collectTestResults(req, resp) {
|
function collectTestResults(req, resp) {
|
||||||
var body = '';
|
var body = '';
|
||||||
|
var logFilename = path.join(__dirname, 'test-output-' + req.query.browser + '.xml');
|
||||||
|
|
||||||
req.on('data', function (chunk) {
|
req.on('data', function (chunk) {
|
||||||
body += chunk;
|
body += chunk;
|
||||||
@ -142,14 +143,13 @@ function collectTestResults(req, resp) {
|
|||||||
suite.ele('system-err', {}).cdata(suiteInfo.stderr);
|
suite.ele('system-err', {}).cdata(suiteInfo.stderr);
|
||||||
});
|
});
|
||||||
|
|
||||||
var filename = path.join(__dirname, 'test-output.xml');
|
fs.writeFile(logFilename, suites.toString({ pretty: true}), function (err) {
|
||||||
fs.writeFile(filename, suites.toString({ pretty: true}), function (err) {
|
|
||||||
if (err) {
|
if (err) {
|
||||||
console.log('unable to save test-output', err.message);
|
console.log('unable to save test-output to', err.message);
|
||||||
console.trace();
|
console.trace();
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
} else {
|
} else {
|
||||||
console.log('test output written to ', filename);
|
console.log('test output written to', logFilename);
|
||||||
process.exit(testDetails.stats.failures ? 1 : 0);
|
process.exit(testDetails.stats.failures ? 1 : 0);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -268,6 +268,7 @@ middleware.push(function (req, resp, next) {
|
|||||||
resp.end(_.template(data, _.defaults(req.query, {
|
resp.end(_.template(data, _.defaults(req.query, {
|
||||||
es_hostname: 'localhost',
|
es_hostname: 'localhost',
|
||||||
es_port: 9200,
|
es_port: 9200,
|
||||||
|
browser: 'unknown',
|
||||||
ts: rand(5)
|
ts: rand(5)
|
||||||
})));
|
})));
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user