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
|
||||
scripts/scratch*
|
||||
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;
|
||||
}
|
||||
|
||||
grunt.config.set('open_browser_tests.' + browser, {
|
||||
grunt.config.set('__open_browser_tests.' + browser, {
|
||||
appName: appName
|
||||
});
|
||||
|
||||
@ -251,7 +251,7 @@ module.exports = function (grunt) {
|
||||
'generate',
|
||||
'build',
|
||||
'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.
|
||||
* 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 port = grunt.option('port') || 9200;
|
||||
var taskData = this.data;
|
||||
@ -275,7 +275,9 @@ module.exports = function (grunt) {
|
||||
]);
|
||||
|
||||
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
|
||||
});
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
(function (global) {
|
||||
/* jshint browser:true */
|
||||
/* global alert */
|
||||
/* global alert, BROWSER_NAME */
|
||||
|
||||
/**
|
||||
* 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 **/
|
||||
|
||||
@ -19,8 +19,9 @@
|
||||
|
||||
<!-- global vars -->
|
||||
<script>
|
||||
var ES_HOSTNAME = '<%- es_hostname %>';
|
||||
var ES_PORT = <%= es_port %>;
|
||||
var ES_HOSTNAME = <%= JSON.stringify(es_hostname) %>;
|
||||
var ES_PORT = <%= JSON.stringify(es_port) %>;
|
||||
var BROWSER_NAME = <%= JSON.stringify(browser) %>;
|
||||
</script>
|
||||
|
||||
<!-- test -->
|
||||
|
||||
@ -48,6 +48,7 @@ function sendBundle(req, resp, files, opts, extend) {
|
||||
|
||||
function collectTestResults(req, resp) {
|
||||
var body = '';
|
||||
var logFilename = path.join(__dirname, 'test-output-' + req.query.browser + '.xml');
|
||||
|
||||
req.on('data', function (chunk) {
|
||||
body += chunk;
|
||||
@ -142,14 +143,13 @@ function collectTestResults(req, resp) {
|
||||
suite.ele('system-err', {}).cdata(suiteInfo.stderr);
|
||||
});
|
||||
|
||||
var filename = path.join(__dirname, 'test-output.xml');
|
||||
fs.writeFile(filename, suites.toString({ pretty: true}), function (err) {
|
||||
fs.writeFile(logFilename, suites.toString({ pretty: true}), function (err) {
|
||||
if (err) {
|
||||
console.log('unable to save test-output', err.message);
|
||||
console.log('unable to save test-output to', err.message);
|
||||
console.trace();
|
||||
process.exit(1);
|
||||
} else {
|
||||
console.log('test output written to ', filename);
|
||||
console.log('test output written to', logFilename);
|
||||
process.exit(testDetails.stats.failures ? 1 : 0);
|
||||
}
|
||||
});
|
||||
@ -268,6 +268,7 @@ middleware.push(function (req, resp, next) {
|
||||
resp.end(_.template(data, _.defaults(req.query, {
|
||||
es_hostname: 'localhost',
|
||||
es_port: 9200,
|
||||
browser: 'unknown',
|
||||
ts: rand(5)
|
||||
})));
|
||||
} else {
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user