canvas-lms/karma.conf.js

92 lines
2.9 KiB
JavaScript
Raw Normal View History

var fs = require("fs");
var karmaFiles = [];
var webpackFileExists = false;
var webpackFilePath = __dirname + "/config/WEBPACK";
try {
fs.statSync(webpackFilePath);
webpackFileExists = true;
}
catch (e) {
console.log("no webpack file....")
}
var usingWebpack = (process.env.USE_WEBPACK == 'True' ||
process.env.USE_WEBPACK == 'true' ||
webpackFileExists);
// If we're using webpack, we don't want to load all the requirejs stuff;
if(usingWebpack){
karmaFiles = [
'spec/javascripts/support/sinon/sinon-1.17.2.js',
Add automated a11y testing helper for qunit tests refs SD-743 fixes CNVS-26721 This adds a qunit assertion helper that wraps the aXe library. Rules can be ignored by passing an array of rules in the options argument to the helper. e.g. `assertions.isAccessible $html, done, { ignores: 'aria-valid-attr-value'}` Test plan: Undo the changes that I made to the DashboardCard.jsx component. You should get a warning about invalid aria attributes because the aria-controls attribute is referring to an element that doesn't exist. To fix this, I modified the component to hide/show the color picker so that the aria attribute value is valid. If you add the ignores option as described above, the test should pass without my changes. To verify the dashboard card color picker changes: - Verify that you can click or use the ENTER key on a dashboard card cog button to bring up the color picker - Verify that you can select a color and apply it to the card. - Verify that you can click outside the color picker to close it - Verify that you can hit the ESC key to close the color picker - When the color picker is closed, focus should return to the the cog button trigger - After selecting a color you should be able to open the color picker again and select a different color The color picker in the Calendar should be regression tested as well. Change-Id: I5d5bfdaf39df1e0cb8776144771baeb1ed31ff2a Reviewed-on: https://gerrit.instructure.com/70638 Reviewed-by: Ryan Shaw <ryan@instructure.com> Product-Review: Colleen Palmer <colleen@instructure.com> QA-Review: Myller de Araujo <myller@instructure.com> Tested-by: Jenkins
2016-01-20 12:32:39 +08:00
'spec/javascripts/support/axe.js',
{pattern: 'spec/javascripts/webpack/*.bundle.test.js', included: true, served: true},
{pattern: 'spec/javascripts/fixtures/*', included: false, served: true}
];
}else{
karmaFiles = [
'spec/javascripts/requirejs_config.js',
'spec/javascripts/tests.js',
'public/javascripts/vendor/require.js',
'node_modules/karma-requirejs/lib/adapter.js',
'spec/javascripts/support/sinon/sinon-1.17.2.js',
'spec/javascripts/support/sinon/sinon-qunit-1.0.0.js',
Add automated a11y testing helper for qunit tests refs SD-743 fixes CNVS-26721 This adds a qunit assertion helper that wraps the aXe library. Rules can be ignored by passing an array of rules in the options argument to the helper. e.g. `assertions.isAccessible $html, done, { ignores: 'aria-valid-attr-value'}` Test plan: Undo the changes that I made to the DashboardCard.jsx component. You should get a warning about invalid aria attributes because the aria-controls attribute is referring to an element that doesn't exist. To fix this, I modified the component to hide/show the color picker so that the aria attribute value is valid. If you add the ignores option as described above, the test should pass without my changes. To verify the dashboard card color picker changes: - Verify that you can click or use the ENTER key on a dashboard card cog button to bring up the color picker - Verify that you can select a color and apply it to the card. - Verify that you can click outside the color picker to close it - Verify that you can hit the ESC key to close the color picker - When the color picker is closed, focus should return to the the cog button trigger - After selecting a color you should be able to open the color picker again and select a different color The color picker in the Calendar should be regression tested as well. Change-Id: I5d5bfdaf39df1e0cb8776144771baeb1ed31ff2a Reviewed-on: https://gerrit.instructure.com/70638 Reviewed-by: Ryan Shaw <ryan@instructure.com> Product-Review: Colleen Palmer <colleen@instructure.com> QA-Review: Myller de Araujo <myller@instructure.com> Tested-by: Jenkins
2016-01-20 12:32:39 +08:00
'spec/javascripts/support/axe.js',
{pattern: 'public/javascripts/*.js', included: false, served: true},
{pattern: 'spec/javascripts/fixtures/*.html', included: false, served: true},
{pattern: 'spec/javascripts/tests.js', included: false, served: true},
{pattern: 'spec/javascripts/compiled/*.js', included: false, served: true},
{pattern: 'spec/javascripts/compiled/**/*.js', included: false, served: true},
{pattern: 'spec/**/javascripts/compiled/**/*.js', included: false, served: true},
{pattern: 'spec/javascripts/fixtures/*', included: false, served: true},
{pattern: 'public/javascripts/**/*.js', included: false, served: true},
{pattern: 'public/dist/brandable_css/**/*.css', included: false, served: true},
'spec/javascripts/load_tests.js'
]
}
var karmaConfig = {
basePath: '',
frameworks: ['qunit'],
files: karmaFiles,
proxies: {
"/dist/brandable_css/": "/base/public/dist/brandable_css/"
},
exclude: [],
// 'dots', 'progress', 'junit', 'growl', 'coverage', 'spec'
reporters: ['progress'],
port: 9876,
colors: true,
autoWatch: true,
// - Chrome
// - ChromeCanary
// - Firefox
// - Opera (has to be installed with `npm install karma-opera-launcher`)
// - Safari (only Mac; has to be installed with `npm install karma-safari-launcher`)
// - PhantomJS
// - IE (only Windows; has to be installed with `npm install karma-ie-launcher`)
browsers: ['Chrome'],
// If browser does not capture in given timeout [ms], kill it
captureTimeout: 60000,
// Continuous Integration mode
// if true, it capture browsers, run tests and exit
singleRun: false
};
module.exports = function(config) {
// config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
karmaConfig.logLevel = config.LOG_ERROR,
config.set(karmaConfig);
};