selenium: Add JUnit reporter

JUnit reporter is required to create the XML file that Jenkins uses to
create Test Result Trend chart for selenium-daily-beta-Math
job.

Bug: T214686
Change-Id: Ic2373f3b89946cf191cfcb1dd9ed99608deb660c
This commit is contained in:
Željko Filipin 2021-04-29 15:56:30 +02:00
parent d98a6e2699
commit 5c37603c23
3 changed files with 94 additions and 3 deletions

77
package-lock.json generated
View file

@ -723,6 +723,12 @@
"integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==", "integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==",
"dev": true "dev": true
}, },
"@types/cucumber": {
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/@types/cucumber/-/cucumber-6.0.1.tgz",
"integrity": "sha512-+GZV6xfN0MeN9shDCdny8GbC8N0+U6uca8cjyaJndcwmrUhwS6qOU2vmYn0d71EOwJF568/v3SxJ8VKxuZNYRw==",
"dev": true
},
"@types/http-cache-semantics": { "@types/http-cache-semantics": {
"version": "4.0.0", "version": "4.0.0",
"resolved": "https://registry.npmjs.org/@types/http-cache-semantics/-/http-cache-semantics-4.0.0.tgz", "resolved": "https://registry.npmjs.org/@types/http-cache-semantics/-/http-cache-semantics-4.0.0.tgz",
@ -896,6 +902,30 @@
"glob": "^7.1.2" "glob": "^7.1.2"
} }
}, },
"@wdio/junit-reporter": {
"version": "6.11.0",
"resolved": "https://registry.npmjs.org/@wdio/junit-reporter/-/junit-reporter-6.11.0.tgz",
"integrity": "sha512-wOc1SYEHdGaLdO3zdcJ0U55p/LxMZL4erHSeqHMSJZLtuNPJYvj3RgRrhnVYMcnR6OjzIMC/acQ/hU2QwrzXNQ==",
"dev": true,
"requires": {
"@wdio/reporter": "6.11.0",
"json-stringify-safe": "^5.0.1",
"junit-report-builder": "^2.1.0",
"validator": "^13.0.0"
},
"dependencies": {
"@wdio/reporter": {
"version": "6.11.0",
"resolved": "https://registry.npmjs.org/@wdio/reporter/-/reporter-6.11.0.tgz",
"integrity": "sha512-SStNZZUI0bXI+omyIU6ql4Rh+Dews1dz1GlowHDrBxwKMPyAwytgYokXLn3zr+E3tkHDiRyJjQxfDetBWBGmtg==",
"dev": true,
"requires": {
"@types/cucumber": "^6.0.1",
"fs-extra": "^9.0.0"
}
}
}
},
"@wdio/local-runner": { "@wdio/local-runner": {
"version": "6.1.16", "version": "6.1.16",
"resolved": "https://registry.npmjs.org/@wdio/local-runner/-/local-runner-6.1.16.tgz", "resolved": "https://registry.npmjs.org/@wdio/local-runner/-/local-runner-6.1.16.tgz",
@ -2117,6 +2147,12 @@
"assert-plus": "^1.0.0" "assert-plus": "^1.0.0"
} }
}, },
"date-format": {
"version": "0.0.2",
"resolved": "https://registry.npmjs.org/date-format/-/date-format-0.0.2.tgz",
"integrity": "sha1-+v1Ej3IRXvHitzkVWukvK+bCjdE=",
"dev": true
},
"dateformat": { "dateformat": {
"version": "3.0.3", "version": "3.0.3",
"resolved": "https://registry.npmjs.org/dateformat/-/dateformat-3.0.3.tgz", "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-3.0.3.tgz",
@ -5311,6 +5347,18 @@
"verror": "1.10.0" "verror": "1.10.0"
} }
}, },
"junit-report-builder": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/junit-report-builder/-/junit-report-builder-2.1.0.tgz",
"integrity": "sha512-Ioj5I4w18ZcHFaaisqCKdh1z+ipzN7sA2JB+h+WOlGcOMWm0FFN1dfxkgc2I4EXfhSP/mOfM3W43uFzEdz4sTw==",
"dev": true,
"requires": {
"date-format": "0.0.2",
"lodash": "^4.17.15",
"make-dir": "^1.3.0",
"xmlbuilder": "^10.0.0"
}
},
"keyv": { "keyv": {
"version": "4.0.1", "version": "4.0.1",
"resolved": "https://registry.npmjs.org/keyv/-/keyv-4.0.1.tgz", "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.0.1.tgz",
@ -5838,6 +5886,23 @@
"yallist": "^2.1.2" "yallist": "^2.1.2"
} }
}, },
"make-dir": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/make-dir/-/make-dir-1.3.0.tgz",
"integrity": "sha512-2w31R7SJtieJJnQtGc7RVL2StM2vGYVfqUOvUDxH6bC6aJTxPxTF0GnIgCyu7tjockiUWAYQRbxa7vKn34s5sQ==",
"dev": true,
"requires": {
"pify": "^3.0.0"
},
"dependencies": {
"pify": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz",
"integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=",
"dev": true
}
}
},
"make-iterator": { "make-iterator": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/make-iterator/-/make-iterator-1.0.1.tgz", "resolved": "https://registry.npmjs.org/make-iterator/-/make-iterator-1.0.1.tgz",
@ -8908,6 +8973,12 @@
"spdx-expression-parse": "^3.0.0" "spdx-expression-parse": "^3.0.0"
} }
}, },
"validator": {
"version": "13.6.0",
"resolved": "https://registry.npmjs.org/validator/-/validator-13.6.0.tgz",
"integrity": "sha512-gVgKbdbHgtxpRyR8K0O6oFZPhhB5tT1jeEHZR0Znr9Svg03U0+r9DXWMrnRAB+HtCStDQKlaIZm42tVsVjqtjg==",
"dev": true
},
"verror": { "verror": {
"version": "1.10.0", "version": "1.10.0",
"resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz",
@ -9250,6 +9321,12 @@
"integrity": "sha512-iFtXzngZVXPGgpTlP1rBqsUK82p9tKqsWRPg5L56egiljujJT3vGAYnHANvFxBieXrTFavhzhxW52jnaWV+w2w==", "integrity": "sha512-iFtXzngZVXPGgpTlP1rBqsUK82p9tKqsWRPg5L56egiljujJT3vGAYnHANvFxBieXrTFavhzhxW52jnaWV+w2w==",
"dev": true "dev": true
}, },
"xmlbuilder": {
"version": "10.1.1",
"resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-10.1.1.tgz",
"integrity": "sha512-OyzrcFLL/nb6fMGHbiRDuPup9ljBycsdCypwuyg5AAHvyWzGfChJpCXMG88AGTIMFhGZ9RccFN1e6lhg3hkwKg==",
"dev": true
},
"xtend": { "xtend": {
"version": "4.0.2", "version": "4.0.2",
"resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz",

View file

@ -7,6 +7,7 @@
}, },
"devDependencies": { "devDependencies": {
"@wdio/cli": "6.1.16", "@wdio/cli": "6.1.16",
"@wdio/junit-reporter": "6.11.0",
"@wdio/local-runner": "6.1.16", "@wdio/local-runner": "6.1.16",
"@wdio/mocha-framework": "6.1.14", "@wdio/mocha-framework": "6.1.14",
"@wdio/spec-reporter": "6.1.14", "@wdio/spec-reporter": "6.1.14",

View file

@ -5,6 +5,8 @@
'use strict'; 'use strict';
const fs = require( 'fs' ), const fs = require( 'fs' ),
path = require( 'path' ),
logPath = process.env.LOG_DIR || path.join( __dirname, '/log' ),
saveScreenshot = require( 'wdio-mediawiki' ).saveScreenshot; saveScreenshot = require( 'wdio-mediawiki' ).saveScreenshot;
exports.config = { exports.config = {
@ -58,13 +60,24 @@ exports.config = {
// Setting this enables automatic screenshots for when a browser command fails // Setting this enables automatic screenshots for when a browser command fails
// It is also used by afterTest for capturig failed assertions. // It is also used by afterTest for capturig failed assertions.
screenshotPath: process.env.LOG_DIR || __dirname + '/log', screenshotPath: logPath,
// Default timeout for each waitFor* command. // Default timeout for each waitFor* command.
waitforTimeout: 10 * 1000, waitforTimeout: 10 * 1000,
// See also: http://webdriver.io/guide/testrunner/reporters.html // See:
reporters: [ 'spec' ], // https://webdriver.io/docs/dot-reporter
// https://webdriver.io/docs/junit-reporter
reporters: [
'spec',
[ 'junit', {
outputDir: logPath,
outputFileFormat: function () {
const makeFilenameDate = new Date().toISOString().replace( /[:.]/g, '-' );
return `WDIO.xunit-${makeFilenameDate}.xml`;
}
} ]
],
// See also: http://mochajs.org // See also: http://mochajs.org
mochaOpts: { mochaOpts: {