Merge pull request #4570 from umbraco/temp8-js-test-fixing

v8 - fixing js unit tests + build + CI
This commit is contained in:
Robert
2019-02-14 14:18:03 +01:00
committed by GitHub
8 changed files with 70 additions and 67 deletions
+1
View File
@@ -160,3 +160,4 @@ build/temp/
# eof
/src/Umbraco.Web.UI.Client/TESTS-*.xml
@@ -6,5 +6,5 @@ var runSequence = require('run-sequence');
// Build - build the files ready for production
gulp.task('build', function(cb) {
runSequence(["js", "dependencies", "less", "views"], /*"test:unit",*/ cb);
runSequence(["js", "dependencies", "less", "views"], "test:unit", cb);
});
+16
View File
@@ -8664,6 +8664,16 @@
"jasmine-core": "^3.3"
}
},
"karma-junit-reporter": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/karma-junit-reporter/-/karma-junit-reporter-1.2.0.tgz",
"integrity": "sha1-T5xAzt+xo5X4rvh2q/lhiZF8Y5Y=",
"dev": true,
"requires": {
"path-is-absolute": "^1.0.0",
"xmlbuilder": "8.2.2"
}
},
"karma-phantomjs-launcher": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/karma-phantomjs-launcher/-/karma-phantomjs-launcher-1.0.4.tgz",
@@ -16436,6 +16446,12 @@
"ultron": "~1.1.0"
}
},
"xmlbuilder": {
"version": "8.2.2",
"resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-8.2.2.tgz",
"integrity": "sha1-aSSGc0ELS6QuGmE2VR0pIjNap3M=",
"dev": true
},
"xmlhttprequest-ssl": {
"version": "1.5.5",
"resolved": "https://registry.npmjs.org/xmlhttprequest-ssl/-/xmlhttprequest-ssl-1.5.5.tgz",
+4 -3
View File
@@ -48,6 +48,7 @@
"@babel/preset-env": "7.1.6",
"autoprefixer": "9.3.1",
"cssnano": "4.1.7",
"fs": "0.0.2",
"gulp": "^3.9.1",
"gulp-babel": "8.0.0",
"gulp-clean-css": "4.0.0",
@@ -58,6 +59,7 @@
"gulp-imagemin": "^4.1.0",
"gulp-less": "4.0.1",
"gulp-ngdocs": "0.3.0",
"gulp-notify": "^3.0.0",
"gulp-open": "3.0.1",
"gulp-postcss": "8.0.0",
"gulp-rename": "1.4.0",
@@ -65,16 +67,15 @@
"gulp-watch": "5.0.1",
"gulp-wrap": "0.14.0",
"gulp-wrap-js": "0.4.1",
"gulp-notify": "^3.0.0",
"jasmine-core": "3.3.0",
"karma": "3.1.1",
"karma-jasmine": "2.0.1",
"karma-junit-reporter": "^1.2.0",
"karma-phantomjs-launcher": "1.0.4",
"less": "3.9.0",
"lodash": "4.17.11",
"marked": "^0.5.2",
"merge-stream": "1.0.1",
"run-sequence": "2.2.1",
"fs": "0.0.2"
"run-sequence": "2.2.1"
}
}
@@ -191,7 +191,7 @@ function contentPickerController($scope, entityResource, editorState, iconHelper
//if we have a query for the startnode, we will use that.
var rootId = $routeParams.id;
entityResource.getByQuery($scope.model.config.startNode.query, rootId, "Document").then(function (ent) {
dialogOptions.startNodeId = $scope.model.config.idType === "udi" ? ent.udi : ent.id;
dialogOptions.startNodeId = ($scope.model.config.idType === "udi" ? ent.udi : ent.id).toString();
});
}
else {
@@ -261,7 +261,7 @@ function contentPickerController($scope, entityResource, editorState, iconHelper
$scope.add = function (item) {
var currIds = $scope.model.value ? $scope.model.value.split(',') : [];
var itemId = $scope.model.config.idType === "udi" ? item.udi : item.id;
var itemId = ($scope.model.config.idType === "udi" ? item.udi : item.id).toString();
if (currIds.indexOf(itemId) < 0) {
currIds.push(itemId);
@@ -1,7 +1,7 @@
module.exports = function (config) {
config.set({
// base path, that will be used to resolve files and exclude
basePath: '../..',
@@ -52,7 +52,7 @@ module.exports = function (config) {
// use dolts reporter, as travis terminal does not support escaping sequences
// possible values: 'dots', 'progress', 'junit', 'teamcity'
// CLI --reporters progress
reporters: ['progress'],
reporters: ['progress', 'junit'],
// web server port
// CLI --port 9876
@@ -60,7 +60,7 @@ module.exports = function (config) {
// cli runner port
// CLI --runner-port 9100
runnerPort: 9100,
runnerPort: 9100,
// enable / disable colors in the output (reporters and logs)
// CLI --colors --no-colors
@@ -89,7 +89,7 @@ module.exports = function (config) {
// allow waiting a bit longer, some machines require this
browserNoActivityTimeout: 100000, // default 10,000ms
// Auto run tests on start (when browsers are captured) and exit
// CLI --single-run --no-single-run
singleRun: true,
@@ -100,7 +100,25 @@ module.exports = function (config) {
plugins: [
require('karma-jasmine'),
require('karma-phantomjs-launcher')
]
require('karma-phantomjs-launcher'),
require('karma-junit-reporter')
],
// the default configuration
junitReporter: {
outputDir: '', // results will be saved as $outputDir/$browserName.xml
outputFile: undefined, // if included, results will be saved as $outputDir/$browserName/$outputFile
suite: '', // suite will become the package name attribute in xml testsuite element
useBrowserName: true, // add browser name to report and classes names
nameFormatter: undefined, // function (browser, result) to customize the name attribute in xml testcase element
classNameFormatter: undefined, // function (browser, result) to customize the classname attribute in xml testcase element
properties: {} // key value pair of properties to add to the <properties> section of the report
},
client: {
jasmine: {
random: false
}
}
});
};
@@ -12,6 +12,7 @@ describe('Content picker controller tests', function () {
httpBackend = $httpBackend;
scope = $rootScope.$new();
scope.model = {
alias: "property",
value:"1233,1231,23121",
@@ -52,11 +53,15 @@ describe('Content picker controller tests', function () {
describe('content edit controller save and publish', function () {
var item = {
name: "meh",
id: 666,
icon: "woop"
};
var item;
beforeEach(function () {
item = {
name: "meh",
id: 666,
icon: "woop"
};
});
it('should define the default properties on construction', function () {
expect(scope.model.value).not.toBeUndefined();
@@ -82,29 +87,28 @@ describe('Content picker controller tests', function () {
});
it("Adding an item should update renderModel, ids and model.value", function(){
scope.add(item);
scope.$apply();
setTimeout(function(){
expect(scope.renderModel.length).toBe(4);
expect(scope.model.value).toBe("1233,1231,23121,666");
}, 1000);
httpBackend.flush();
expect(scope.renderModel.length).toBe(4);
expect(scope.model.value).toBe("1233,1231,23121,666");
});
it("Adding a duplicate item should note update renderModel, ids and model.value", function(){
scope.add(item);
scope.$apply();
setTimeout(function(){
expect(scope.renderModel.length).toBe(4);
expect(scope.model.value).toBe("1233,1231,23121,666");
}, 1000);
httpBackend.flush();
expect(scope.renderModel.length).toBe(4);
expect(scope.model.value).toBe("1233,1231,23121,666");
scope.add(item);
scope.$apply();
setTimeout(function(){
expect(scope.renderModel.length).toBe(4);
expect(scope.model.value).toBe("1233,1231,23121,666");
}, 1000);
expect(scope.renderModel.length).toBe(4);
expect(scope.model.value).toBe("1233,1231,23121,666");
});
});
});
});
@@ -102,43 +102,6 @@
it("has ace editor", function () {
expect(controller.editor).toBe(ace);
});
it("sets masterpage on template", function () {
controller.setLayout = function() {};
controller.openMasterTemplateOverlay();
setTimeout(function(){
controller.masterTemplateOverlay.submit({
selectedItem: {
alias: "NewMasterPage"
}
});
expect(controller.template.masterTemplateAlias).toBe("NewMasterPage");
}, 1000);
});
//// TODO: THIS FAILED
//it("changes layout value when masterpage is selected", function() {
// var newTemplate;
// ace.clearSelection = nada;
// ace.navigateFileStart = nada;
// ace.getValue = function () {
// return "@{ Layout = null; }";
// }
// ace.setValue = function (value) {
// newTemplate = value;
// }
// controller.openMasterTemplateOverlay();
// setTimeout(function(){
// controller.masterTemplateOverlay.submit({
// selectedItem: {
// alias: "NewMasterPage"
// }
// });
// expect(newTemplate).toBe("@{ Layout = \"NewMasterPage.cshtml\"; }");
// }, 1000);
//});
});