Update a11y tests to output files in log/
This makes built assets available in jenkins, Also addresses miscellaneous feedback relating to configuration variable name and track topic name. Change-Id: Ic70d517eba96aab6512a96ea19d6be56b3664871
This commit is contained in:
parent
66ee043a6e
commit
a77fed0a55
|
@ -1,5 +1,6 @@
|
||||||
/.storybook/
|
/.storybook/
|
||||||
/docs/
|
/docs/
|
||||||
|
/log/
|
||||||
/i18n/
|
/i18n/
|
||||||
/node_modules/
|
/node_modules/
|
||||||
/vendor/
|
/vendor/
|
||||||
|
|
|
@ -20,6 +20,7 @@ sftp-config.json
|
||||||
# Building & testing
|
# Building & testing
|
||||||
/composer.lock
|
/composer.lock
|
||||||
/docs
|
/docs
|
||||||
|
/log
|
||||||
/node_modules
|
/node_modules
|
||||||
/vendor
|
/vendor
|
||||||
/coverage
|
/coverage
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
"lint:js": "eslint --cache .",
|
"lint:js": "eslint --cache .",
|
||||||
"lint:styles": "stylelint \"**/*.{less,css}\"",
|
"lint:styles": "stylelint \"**/*.{less,css}\"",
|
||||||
"lint:i18n": "banana-checker --requireLowerCase=0 i18n/",
|
"lint:i18n": "banana-checker --requireLowerCase=0 i18n/",
|
||||||
"doc": "jsdoc -c jsdoc.json && npm run build-storybook -s resources/skins.vector.styles && npm run test:a11y",
|
"doc": "jsdoc -c jsdoc.json && npm run build-storybook -s resources/skins.vector.styles",
|
||||||
"build-storybook": "bash dev-scripts/setup-storybook.sh && build-storybook --quiet --loglevel warn -o docs/ui",
|
"build-storybook": "bash dev-scripts/setup-storybook.sh && build-storybook --quiet --loglevel warn -o docs/ui",
|
||||||
"minify-svg": "svgo --config=.svgo.config.js --quiet --recursive --folder resources/",
|
"minify-svg": "svgo --config=.svgo.config.js --quiet --recursive --folder resources/",
|
||||||
"pre-commit": "[ \"${PRE_COMMIT:-1}\" -eq 0 ] || npm -s t"
|
"pre-commit": "[ \"${PRE_COMMIT:-1}\" -eq 0 ] || npm -s t"
|
||||||
|
|
|
@ -8,7 +8,7 @@ const testData = {
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
reportDir: 'docs/a11y',
|
reportDir: 'log/a11y',
|
||||||
namespace: 'Vector',
|
namespace: 'Vector',
|
||||||
defaults: {
|
defaults: {
|
||||||
viewport: {
|
viewport: {
|
||||||
|
@ -33,11 +33,14 @@ module.exports = {
|
||||||
tests: [
|
tests: [
|
||||||
{
|
{
|
||||||
name: 'default',
|
name: 'default',
|
||||||
url: testData.baseUrl + testData.defaultPage
|
url: testData.baseUrl + testData.pageUrl,
|
||||||
|
actions: [
|
||||||
|
'click #mw-sidebar-button'
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'logged_in',
|
name: 'logged_in',
|
||||||
url: testData.baseUrl + testData.defaultPage,
|
url: testData.baseUrl + testData.pageUrl,
|
||||||
wait: '500',
|
wait: '500',
|
||||||
actions: [
|
actions: [
|
||||||
'click #p-personal-checkbox',
|
'click #p-personal-checkbox',
|
||||||
|
@ -47,12 +50,13 @@ module.exports = {
|
||||||
'set field #wpName1 to ' + testData.loginUser,
|
'set field #wpName1 to ' + testData.loginUser,
|
||||||
'set field #wpPassword1 to ' + testData.loginPassword,
|
'set field #wpPassword1 to ' + testData.loginPassword,
|
||||||
'click #wpLoginAttempt',
|
'click #wpLoginAttempt',
|
||||||
'wait for #pt-userpage-2 to be visible' // Confirm login was successful
|
'wait for #pt-userpage-2 to be visible', // Confirm login was successful
|
||||||
|
'click #mw-sidebar-button'
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'search',
|
name: 'search',
|
||||||
url: testData.baseUrl + testData.defaultPage,
|
url: testData.baseUrl + testData.pageUrl,
|
||||||
rootElement: '#p-search',
|
rootElement: '#p-search',
|
||||||
wait: '500',
|
wait: '500',
|
||||||
actions: [
|
actions: [
|
||||||
|
|
|
@ -14,7 +14,7 @@ const config = require( path.resolve( __dirname, 'a11y.config.js' ) );
|
||||||
*/
|
*/
|
||||||
function resetReportDir() {
|
function resetReportDir() {
|
||||||
// Delete and create report directory
|
// Delete and create report directory
|
||||||
fs.rmdirSync( config.reportDir, { recursive: true } );
|
fs.rmSync( config.reportDir, { recursive: true } );
|
||||||
fs.mkdirSync( config.reportDir, { recursive: true } );
|
fs.mkdirSync( config.reportDir, { recursive: true } );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,8 +27,8 @@ function resetReportDir() {
|
||||||
* @return {Promise<any>}
|
* @return {Promise<any>}
|
||||||
*/
|
*/
|
||||||
function sendMetrics( namespace, name, count ) {
|
function sendMetrics( namespace, name, count ) {
|
||||||
const metricPrefix = 'MediaWiki.a11y';
|
const metricPrefix = 'ci_a11y';
|
||||||
const url = `${process.env.BEACON_URL}${metricPrefix}.${namespace}.${name}=${count}c`;
|
const url = `${process.env.WMF_JENKINS_BEACON_URL}${metricPrefix}.${namespace}.${name}=${count}c`;
|
||||||
return fetch( url );
|
return fetch( url );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,6 +38,12 @@ function sendMetrics( namespace, name, count ) {
|
||||||
* @param {Object} opts
|
* @param {Object} opts
|
||||||
*/
|
*/
|
||||||
async function runTests( opts ) {
|
async function runTests( opts ) {
|
||||||
|
if ( !process.env.MW_SERVER ||
|
||||||
|
!process.env.MEDIAWIKI_USER ||
|
||||||
|
!process.env.MEDIAWIKI_PASSWORD ) {
|
||||||
|
throw new Error( 'Missing env variables' );
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const tests = config.tests;
|
const tests = config.tests;
|
||||||
const allValidTests = tests.filter( ( test ) => test.name ).length === tests.length;
|
const allValidTests = tests.filter( ( test ) => test.name ).length === tests.length;
|
||||||
|
@ -45,7 +51,7 @@ async function runTests( opts ) {
|
||||||
throw new Error( 'Config missing test name' );
|
throw new Error( 'Config missing test name' );
|
||||||
}
|
}
|
||||||
|
|
||||||
const canLogResults = process.env.BEACON_URL && config.namespace;
|
const canLogResults = process.env.WMF_JENKINS_BEACON_URL && config.namespace;
|
||||||
if ( opts.logResults && !canLogResults ) {
|
if ( opts.logResults && !canLogResults ) {
|
||||||
throw new Error( 'Unable to log results, missing config or env variables' );
|
throw new Error( 'Unable to log results, missing config or env variables' );
|
||||||
}
|
}
|
||||||
|
@ -78,7 +84,7 @@ async function runTests( opts ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send data to Graphite
|
// Send data to Graphite
|
||||||
// BEACON_URL is only defined in CI env
|
// WMF_JENKINS_BEACON_URL is only defined in CI env
|
||||||
if ( opts.logResults && canLogResults ) {
|
if ( opts.logResults && canLogResults ) {
|
||||||
await sendMetrics( config.namespace, testResult.name, errorNum )
|
await sendMetrics( config.namespace, testResult.name, errorNum )
|
||||||
.then( ( response ) => {
|
.then( ( response ) => {
|
||||||
|
|
Loading…
Reference in New Issue