equal-access
equal-access copied to clipboard
Karma plugin doesn't scan Local files Workaround
APPLIES TO:
@ibma/karma plugin
PROBLEM DESCRIPTION:
karma plugin doesn't load the page into iframe and keep trying until run out of tries
STEPS TO REPRODUCE:
(Steps to reproduce the issues from start to finish.) (Include a sample html file when possible (attach under the "Links" section), Include a link if sample file cannot be produced.) 1.provide local file to scan 2.see browser opens and empty iframe 3.browser crashes
EXPECTED OUTPUT:
should be able to load the local file to iframe and scan it
ACTUAL OUTPUT:
doesn't scan local file
For scanning local file, there is a work around which can be used to scan them, following are the steps to set this up.
Update karma.config.js file with the following:
module.exports = function (config) {
config.set({
browsers: ['Chrome'],
frameworks: ['jasmine', 'AAT'],
// Load the local html file that you want to scan here
files: [
'src/**/*.html',
"test/**/*.js"
],
// Use the html2js preprocessor to convert the local html files into javascript which can be accessed in karma browser. Need to install ```karma-html2js-preprocessor``` module
preprocessors: {
'src/**/*.html': ['html2js']
},
reporters: ['progress', 'AAT'],
....
});
}
Currently this is a limitation to Karma at this point, the issues is in Karma which is causing file protocol to not work in iframe src when loaded in an iframe through karma. Open issues in public karma project: https://github.com/karma-runner/karma/issues/2518