Initial commit of UI testing framework
This patch adds support for testing the UI using Karma, Jasmine and the React test utils. Change-Id: Ia3251a3c5d2f674de91da0465e614d660cc0d3c3 Implements: blueprint ui-test-suite
This commit is contained in:
parent
70b42f2711
commit
20ec2b97f4
3
ui/.babelrc
Normal file
3
ui/.babelrc
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
presets: ['es2015', 'react']
|
||||||
|
}
|
77
ui/karma.conf.js
Normal file
77
ui/karma.conf.js
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
// Karma configuration
|
||||||
|
// Generated on Tue Nov 01 2016 14:35:38 GMT-0700 (PDT)
|
||||||
|
|
||||||
|
module.exports = function(config) {
|
||||||
|
config.set({
|
||||||
|
|
||||||
|
// base path that will be used to resolve all patterns (eg. files, exclude)
|
||||||
|
basePath: '',
|
||||||
|
|
||||||
|
|
||||||
|
// frameworks to use
|
||||||
|
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
|
||||||
|
frameworks: ['jasmine', 'browserify'],
|
||||||
|
|
||||||
|
|
||||||
|
// list of files / patterns to load in the browser
|
||||||
|
files: [
|
||||||
|
'https://code.jquery.com/jquery-1.11.2.min.js',
|
||||||
|
'src/js/components/*',
|
||||||
|
'spec/*'
|
||||||
|
],
|
||||||
|
|
||||||
|
|
||||||
|
// list of files to exclude
|
||||||
|
exclude: [
|
||||||
|
],
|
||||||
|
|
||||||
|
|
||||||
|
// preprocess matching files before serving them to the browser
|
||||||
|
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
|
||||||
|
preprocessors: {
|
||||||
|
'src/js/components/*': ['browserify'],
|
||||||
|
'spec/*': ['browserify']
|
||||||
|
},
|
||||||
|
|
||||||
|
browserify: {
|
||||||
|
debug: true,
|
||||||
|
transform: ['babelify']
|
||||||
|
},
|
||||||
|
|
||||||
|
// test results reporter to use
|
||||||
|
// possible values: 'dots', 'progress'
|
||||||
|
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
|
||||||
|
reporters: ['progress'],
|
||||||
|
|
||||||
|
|
||||||
|
// web server port
|
||||||
|
port: 9876,
|
||||||
|
|
||||||
|
|
||||||
|
// enable / disable colors in the output (reporters and logs)
|
||||||
|
colors: true,
|
||||||
|
|
||||||
|
|
||||||
|
// level of logging
|
||||||
|
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
|
||||||
|
logLevel: config.LOG_INFO,
|
||||||
|
|
||||||
|
|
||||||
|
// enable / disable watching file and executing tests whenever any file changes
|
||||||
|
autoWatch: true,
|
||||||
|
|
||||||
|
|
||||||
|
// start these browsers
|
||||||
|
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
|
||||||
|
browsers: ['Chrome'],
|
||||||
|
|
||||||
|
|
||||||
|
// Continuous Integration mode
|
||||||
|
// if true, Karma captures browsers, runs the tests and exits
|
||||||
|
singleRun: true,
|
||||||
|
|
||||||
|
// Concurrency level
|
||||||
|
// how many browser should be started simultaneous
|
||||||
|
concurrency: Infinity
|
||||||
|
})
|
||||||
|
}
|
@ -12,8 +12,8 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"bootstrap-sass": "^3.3.6",
|
"bootstrap-sass": "^3.3.6",
|
||||||
"jquery": "^3.1.0",
|
"jquery": "^3.1.0",
|
||||||
"react": "^0.14.6",
|
"react": "^15.3.2",
|
||||||
"react-dom": "^0.14.6"
|
"react-dom": "^15.3.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"babel-core": "^6.4.5",
|
"babel-core": "^6.4.5",
|
||||||
@ -23,18 +23,28 @@
|
|||||||
"babel-plugin-transform-class-properties": "^6.3.13",
|
"babel-plugin-transform-class-properties": "^6.3.13",
|
||||||
"babel-plugin-transform-decorators-legacy": "^1.3.4",
|
"babel-plugin-transform-decorators-legacy": "^1.3.4",
|
||||||
"babel-preset-es2015": "^6.3.13",
|
"babel-preset-es2015": "^6.3.13",
|
||||||
"babel-preset-react": "^6.3.13",
|
"babel-preset-react": "^6.16.0",
|
||||||
"babel-preset-stage-0": "^6.3.13",
|
"babel-preset-stage-0": "^6.3.13",
|
||||||
|
"babelify": "^7.3.0",
|
||||||
"bootstrap-loader": "^1.1.0",
|
"bootstrap-loader": "^1.1.0",
|
||||||
|
"browserify": "^13.1.1",
|
||||||
"css-loader": "^0.23.1",
|
"css-loader": "^0.23.1",
|
||||||
"extract-text-webpack-plugin": "^1.0.1",
|
"extract-text-webpack-plugin": "^1.0.1",
|
||||||
"file-loader": "^0.9.0",
|
"file-loader": "^0.9.0",
|
||||||
"imports-loader": "^0.6.5",
|
"imports-loader": "^0.6.5",
|
||||||
|
"jasmine": "^2.5.2",
|
||||||
|
"jasmine-core": "^2.5.2",
|
||||||
|
"karma": "^1.3.0",
|
||||||
|
"karma-browserify": "^5.1.0",
|
||||||
|
"karma-chrome-launcher": "^2.0.0",
|
||||||
|
"karma-jasmine": "^1.0.2",
|
||||||
"node-sass": "^3.8.0",
|
"node-sass": "^3.8.0",
|
||||||
|
"react-addons-test-utils": "^15.3.2",
|
||||||
"resolve-url-loader": "^1.6.0",
|
"resolve-url-loader": "^1.6.0",
|
||||||
"sass-loader": "^4.0.0",
|
"sass-loader": "^4.0.0",
|
||||||
"style-loader": "^0.13.1",
|
"style-loader": "^0.13.1",
|
||||||
"url-loader": "^0.5.7",
|
"url-loader": "^0.5.7",
|
||||||
|
"watchify": "^3.7.0",
|
||||||
"webpack": "^1.13.1",
|
"webpack": "^1.13.1",
|
||||||
"webpack-dev-server": "^1.14.1"
|
"webpack-dev-server": "^1.14.1"
|
||||||
},
|
},
|
||||||
|
34
ui/spec/RenderSpec.js
Normal file
34
ui/spec/RenderSpec.js
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
/*Copyright (c) 2016 Intel, Inc.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
* not use this file except in compliance with the License. You may obtain
|
||||||
|
* a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import Layout from '../src/js/components/Layout';
|
||||||
|
|
||||||
|
var React = require('react');
|
||||||
|
var TestUtils = require('react-addons-test-utils');
|
||||||
|
|
||||||
|
describe('Tests for successful rendering', function() {
|
||||||
|
|
||||||
|
it('can render without error', function() {
|
||||||
|
var component, element;
|
||||||
|
element = React.createElement(
|
||||||
|
Layout,
|
||||||
|
{}
|
||||||
|
);
|
||||||
|
expect(function() {
|
||||||
|
component = TestUtils.renderIntoDocument(element);
|
||||||
|
}).not.toThrow();
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
Loading…
x
Reference in New Issue
Block a user