diff options
author | Stas Vilchik <vilchiks@gmail.com> | 2014-07-15 18:00:27 +0600 |
---|---|---|
committer | Stas Vilchik <vilchiks@gmail.com> | 2014-07-15 18:00:45 +0600 |
commit | ed5d70181b6b3c8302b44755bc01bd2ab58bb287 (patch) | |
tree | 98f507448b9ff4a04d8c6f40504960448492956b | |
parent | d9db3a41408730d4c7fbd33d453cb81d2f936ef4 (diff) | |
download | sonarqube-ed5d70181b6b3c8302b44755bc01bd2ab58bb287.tar.gz sonarqube-ed5d70181b6b3c8302b44755bc01bd2ab58bb287.zip |
Come back to CasperJS
12 files changed, 1198 insertions, 344 deletions
diff --git a/server/sonar-web/Gruntfile.coffee b/server/sonar-web/Gruntfile.coffee index 329ff3476a5..6e5bfd0f136 100644 --- a/server/sonar-web/Gruntfile.coffee +++ b/server/sonar-web/Gruntfile.coffee @@ -253,15 +253,13 @@ module.exports = (grunt) -> src: '<%= pkg.sources %>js/require.js', dest: '<%= pkg.assets %>js/require.js' - karma: - unit: - configFile: 'karma.conf.js' - singleRun: true - - express: + test: + options: + script: '<%= pkg.assets %>js/tests/e2e/server.js' dev: options: + background: false script: '<%= pkg.assets %>js/tests/e2e/server.js' @@ -321,4 +319,5 @@ module.exports = (grunt) -> 'concat:build', 'requirejs', 'clean:js', 'copy:build', 'copy:requirejs', 'clean:build'] - grunt.registerTask 'test', ['clean:js', 'coffee:build', 'handlebars:build', 'copy:js', 'concat:dev', 'karma:unit'] + grunt.registerTask 'test', ['clean:js', 'coffee:build', 'handlebars:build', 'copy:js', 'concat:dev', + 'express:test', 'casper:test'] diff --git a/server/sonar-web/src/main/coffee/tests/common/inputsSpec.coffee b/server/sonar-web/src/main/coffee/tests/common/inputsSpec.coffee deleted file mode 100644 index 3cbc6591925..00000000000 --- a/server/sonar-web/src/main/coffee/tests/common/inputsSpec.coffee +++ /dev/null @@ -1,87 +0,0 @@ -$ = jQuery - -describe 'WORK_DUR suite', -> - - beforeEach -> - window.SS = {} - window.SS.phrases = - 'work_duration': - 'x_days': '{0}d', 'x_hours': '{0}h', 'x_minutes': '{0}min' - - @input = $('<input type="text">') - @input.appendTo $('body') - @input.data 'type', 'WORK_DUR' - - - it 'converts', -> - @input.originalVal '2d 7h 13min' - expect(@input.val()).toBe 1393 - - it 'converts only days', -> - @input.originalVal '1d' - expect(@input.val()).toBe 480 - - it 'converts hours with minutes', -> - @input.originalVal '2h 30min' - expect(@input.val()).toBe 150 - - it 'converts zero', -> - @input.originalVal '0' - expect(@input.val()).toBe 0 - - - it 'restores', -> - @input.val 1393 - expect(@input.originalVal()).toBe '2d 7h 13min' - - it 'restores zero', -> - @input.val '0' - expect(@input.originalVal()).toBe '0' - - - it 'returns initially incorrect value', -> - @input.val 'something' - expect(@input.val()).toBe 'something' - - -describe 'RATING suite', -> - - beforeEach -> - @input = $('<input type="text">') - @input.appendTo $('body') - @input.data 'type', 'RATING' - - - it 'converts A', -> - @input.originalVal 'A' - expect(@input.val()).toBe 1 - - - it 'converts B', -> - @input.originalVal 'B' - expect(@input.val()).toBe 2 - - - it 'converts E', -> - @input.originalVal 'E' - expect(@input.val()).toBe 5 - - - it 'does not convert F', -> - @input.originalVal 'F' - expect(@input.val()).toBe 'F' - - - it 'restores A', -> - @input.val 1 - expect(@input.originalVal()).toBe 'A' - - - it 'restores E', -> - @input.val 5 - expect(@input.originalVal()).toBe 'E' - - - it 'returns initially incorrect value', -> - @input.val 'something' - expect(@input.val()).toBe 'something' diff --git a/server/sonar-web/src/main/coffee/tests/component-viewer/baseSpec.coffee b/server/sonar-web/src/main/coffee/tests/component-viewer/baseSpec.coffee deleted file mode 100644 index 7fd5a4cbe50..00000000000 --- a/server/sonar-web/src/main/coffee/tests/component-viewer/baseSpec.coffee +++ /dev/null @@ -1,30 +0,0 @@ -$ = jQuery -window.baseUrl = '' -window.suppressTranslationWarnings = true - - -define [ - 'component-viewer/main' -], ( - ComponentViewer -) -> - - describe 'Component Viewer Base Test Suite', -> - - beforeEach -> - @viewer = new ComponentViewer() - @viewer.render().$el.appendTo $('body') - - - afterEach -> - @viewer.close() - - - it 'attaches to the page', -> - expect($('.component-viewer', 'body').length).toBe 1 - - - it 'has all parts', -> - expect(@viewer.$('.component-viewer-header').length).toBe 1 - expect(@viewer.$('.component-viewer-source').length).toBe 1 - expect(@viewer.$('.component-viewer-workspace').length).toBe 1 diff --git a/server/sonar-web/src/main/coffee/tests/translateSpec.coffee b/server/sonar-web/src/main/coffee/tests/translateSpec.coffee deleted file mode 100644 index 7b4576bcfff..00000000000 --- a/server/sonar-web/src/main/coffee/tests/translateSpec.coffee +++ /dev/null @@ -1,75 +0,0 @@ -$ = jQuery - -describe 'translation "t" suite', -> - - beforeEach -> - window.messages = - 'something': 'SOMETHING' - 'something_with_underscore': 'SOMETHING_WITH_UNDERSCORE' - 'something_with{braces}': 'SOMETHING_WITH{braces}' - - window.SS = - phrases: - 'something': 'SOMETHING ANOTHER' - - - afterEach -> - window.messages = window.SS = undefined - - - it 'translates', -> - expect(t('something')).toBe 'SOMETHING' - - - it 'translates with underscore', -> - expect(t('something_with_underscore')).toBe 'SOMETHING_WITH_UNDERSCORE' - - - it 'translates with braces', -> - expect(t('something_with{braces}')).toBe 'SOMETHING_WITH{braces}' - - - it 'fallbacks to "translate"', -> - window.messages = undefined - expect(t('something')).toBe 'SOMETHING ANOTHER' - - - it 'returns the key when no translation', -> - expect(t('something_another')).toBe 'something_another' - - - -describe 'translation "translate" suite', -> - - beforeEach -> - window.SS = - phrases: - 'something': 'SOMETHING' - 'something_with_underscore': 'SOMETHING_WITH_UNDERSCORE' - 'something_with{braces}': 'SOMETHING_WITH{braces}' - - - afterEach -> - window.messages = window.SS = undefined - - - it 'translates', -> - expect(translate('something')).toBe 'SOMETHING' - - - it 'translates with underscore', -> - expect(translate('something_with_underscore')).toBe 'SOMETHING_WITH_UNDERSCORE' - - - it 'translates with braces', -> - expect(translate('something_with{braces}')).toBe 'SOMETHING_WITH{braces}' - - - it 'returns the key when no translation', -> - expect(translate('something_another')).toBe 'something_another' - - - it 'does not fail when there is no dictionary', -> - window.SS = undefined - expect(translate('something_another')).toBe 'something_another' - diff --git a/server/sonar-web/src/main/coffee/tests/widgets/BaseSpec.coffee b/server/sonar-web/src/main/coffee/tests/widgets/BaseSpec.coffee deleted file mode 100644 index b869aed84d5..00000000000 --- a/server/sonar-web/src/main/coffee/tests/widgets/BaseSpec.coffee +++ /dev/null @@ -1,47 +0,0 @@ -$ = jQuery - -describe 'base widget suite', -> - - it 'exists', -> - expect(window.SonarWidgets).toBeDefined() - expect(window.SonarWidgets.BaseWidget).toBeDefined() - - - it 'adds fields', -> - widget = new window.SonarWidgets.BaseWidget() - widget.addField 'fieldName', 1 - - expect(typeof widget.fieldName).toBe 'function' - expect(widget.fieldName()).toBe 1 - - expect(widget.fieldName(2)).toBe widget - expect(widget.fieldName()).toBe 2 - - - it 'adds metrics', -> - widget = new window.SonarWidgets.BaseWidget() - widget.addField 'metrics', 'metricA': { name: 'Metric A', someField: 2 } - widget.addField 'metricsPriority', ['metricA'] - widget.addMetric 'myMetric', 0 - - expect(widget.myMetric).toBeDefined() - expect(widget.myMetric.key).toBe 'metricA' - expect(widget.myMetric.name).toBe 'Metric A' - expect(widget.myMetric.someField).toBe 2 - expect(typeof widget.myMetric.value).toBe 'function' - expect(typeof widget.myMetric.formattedValue).toBe 'function' - - - it 'has default properties', -> - widget = new window.SonarWidgets.BaseWidget() - - expect(widget.components).toBeDefined() - expect(widget.metrics).toBeDefined() - expect(widget.metricsPriority).toBeDefined() - expect(widget.options).toBeDefined() - - - it 'created "translate" string', -> - widget = new window.SonarWidgets.BaseWidget() - - expect(widget.trans(1, 2)).toBe 'translate(1,2)' diff --git a/server/sonar-web/src/main/js/tests/e2e/pages/treemap.html b/server/sonar-web/src/main/js/tests/e2e/pages/treemap.html new file mode 100644 index 00000000000..8f1779061e7 --- /dev/null +++ b/server/sonar-web/src/main/js/tests/e2e/pages/treemap.html @@ -0,0 +1,16 @@ +<!DOCTYPE html> +<html> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> + <link href="../css/sonar.css" rel="stylesheet" media="all"/> + <script src="../js/sonar.js"></script> + <script src="../js/third-party/jquery.mockjax.js"></script> + <script type="text/javascript"> + var baseUrl = ''; + window.suppressTranslationWarnings = true; + </script> +</head> +<body> +<div id="container"></div> +</body> +</html> diff --git a/server/sonar-web/src/main/js/tests/e2e/tests/treemap-spec.js b/server/sonar-web/src/main/js/tests/e2e/tests/treemap-spec.js new file mode 100644 index 00000000000..97af41cdb16 --- /dev/null +++ b/server/sonar-web/src/main/js/tests/e2e/tests/treemap-spec.js @@ -0,0 +1,64 @@ +// Dump log messages +casper.on('remote.message', function(message) { + this.echo('Log: '+ message, 'LOG'); +}); + +// Dump uncaught errors +casper.on('page.error', function(msg, trace) { + this.echo('Error: ' + msg, 'ERROR'); +}); + +var fs = require('fs'); +var utils = require('utils'); + +// Since Casper has control, the invoked script is deep in the argument stack +var currentFile = require('system').args[4]; +var curFilePath = fs.absolute(currentFile).split(fs.separator); +if (curFilePath.length > 1) { + curFilePath.pop(); // PhantomJS does not have an equivalent path.baseName()-like method + curFilePath.push('treemap-spec'); + fs.changeWorkingDirectory(curFilePath.join(fs.separator)); +} + + +casper.test.begin('Treemap', function suite(test) { + + // Load MockJax responses from FS + var treemapData = JSON.parse(fs.read('treemap.json')); + var resourceResponse = fs.read('treemap-resources.json'); + + + casper.start('http://localhost:3000/pages/treemap.html', function () { + casper.evaluate(function (treemapData, resourceResponse) { + jQuery.mockjax({ url: '/api/resources/index', responseText: resourceResponse }); + var widget = new SonarWidgets.Treemap(); + widget + .metrics(treemapData.metrics) + .metricsPriority(['coverage', 'ncloc']) + .components(treemapData.components) + .options({ + heightInPercents: 55, + maxItems: 30, + maxItemsReachedMessage: '', + baseUrl: '/dashboard/index/', + noData: '', + resource: '' + }) + .render('#container'); + }, treemapData, resourceResponse) + }); + + casper + .then(function () { + casper.waitWhileSelector('.spinner', function() { + test.assertElementCount('.treemap-cell', 30); + test.assertSelectorHasText('.treemap-cell', 'SonarQube'); + test.assertMatch(casper.getElementAttribute('.treemap-link', 'href'), /dashboard\/index/, + 'Treemap cells have links to dashboards'); + }); + }); + + casper.run(function() { + test.done(); + }); +}); diff --git a/server/sonar-web/src/main/js/tests/e2e/tests/treemap-spec/treemap-resources.json b/server/sonar-web/src/main/js/tests/e2e/tests/treemap-spec/treemap-resources.json new file mode 100644 index 00000000000..bc1c20845fa --- /dev/null +++ b/server/sonar-web/src/main/js/tests/e2e/tests/treemap-spec/treemap-resources.json @@ -0,0 +1,616 @@ +[ + { + "id": 258, + "key": "org.codehaus.sonar:sonar-core", + "name": "SonarQube :: Core", + "scope": "PRJ", + "qualifier": "BRC", + "date": "2014-07-09T23:19:45+0600", + "creationDate": null, + "lname": "SonarQube :: Core", + "version": "4.5-SNAPSHOT", + "description": "Core components shared to batch and server", + "msr": [ + { + "key": "coverage", + "val": 83.3, + "frmt_val": "83.3%" + }, + { + "key": "ncloc", + "val": 17854.0, + "frmt_val": "17,854" + } + ] + }, + { + "id": 17221, + "key": "org.codehaus.sonar:sonar-home", + "name": "SonarQube :: Home", + "scope": "PRJ", + "qualifier": "BRC", + "date": "2014-07-09T23:19:45+0600", + "creationDate": "2013-02-08T22:22:38+0600", + "lname": "SonarQube :: Home", + "version": "4.5-SNAPSHOT", + "description": "Access the user home directory that contains cache of files", + "msr": [ + { + "key": "coverage", + "val": 75.1, + "frmt_val": "75.1%" + }, + { + "key": "ncloc", + "val": 280.0, + "frmt_val": "280" + } + ] + }, + { + "id": 2867, + "key": "org.codehaus.sonar:sonar-batch-maven-compat", + "name": "SonarQube :: Batch Maven Compat", + "scope": "PRJ", + "qualifier": "BRC", + "date": "2014-07-09T23:19:45+0600", + "creationDate": null, + "lname": "SonarQube :: Batch Maven Compat", + "version": "4.5-SNAPSHOT", + "description": "Compatibility layer, which provides MavenProject for non-Maven environments." + }, + { + "id": 2871, + "key": "org.codehaus.sonar:sonar-maven3-plugin", + "name": "SonarQube :: Maven3 Plugin", + "scope": "PRJ", + "qualifier": "BRC", + "date": "2014-07-09T23:19:45+0600", + "creationDate": null, + "lname": "SonarQube :: Maven3 Plugin", + "version": "4.5-SNAPSHOT", + "description": "Open source platform for continuous inspection of code quality" + }, + { + "id": 2872, + "key": "org.codehaus.sonar:sonar-server", + "name": "SonarQube :: Server", + "scope": "PRJ", + "qualifier": "BRC", + "date": "2014-07-09T23:19:45+0600", + "creationDate": null, + "lname": "SonarQube :: Server", + "version": "4.5-SNAPSHOT", + "description": "Open source platform for continuous inspection of code quality", + "msr": [ + { + "key": "coverage", + "val": 87.8, + "frmt_val": "87.8%" + }, + { + "key": "ncloc", + "val": 35987.0, + "frmt_val": "35,987" + } + ] + }, + { + "id": 1227, + "key": "org.codehaus.sonar:sonar-ws-client", + "name": "SonarQube :: Web Service Client", + "scope": "PRJ", + "qualifier": "BRC", + "date": "2014-07-09T23:19:45+0600", + "creationDate": null, + "lname": "SonarQube :: Web Service Client", + "version": "4.5-SNAPSHOT", + "description": "Java Client Library for SonarQube Web Services", + "msr": [ + { + "key": "coverage", + "val": 77.2, + "frmt_val": "77.2%" + }, + { + "key": "ncloc", + "val": 6393.0, + "frmt_val": "6,393" + } + ] + }, + { + "id": 1627, + "key": "org.codehaus.sonar.plugins:sonar-dbcleaner-plugin", + "name": "SonarQube :: Plugins :: Database Cleaner", + "scope": "PRJ", + "qualifier": "BRC", + "date": "2014-07-09T23:19:45+0600", + "creationDate": null, + "lname": "SonarQube :: Plugins :: Database Cleaner", + "version": "4.5-SNAPSHOT", + "description": "Optimizes database performances by removing old and useless data.", + "msr": [ + { + "key": "coverage", + "val": 80.8, + "frmt_val": "80.8%" + }, + { + "key": "ncloc", + "val": 397.0, + "frmt_val": "397" + } + ] + }, + { + "id": 2881, + "key": "org.codehaus.sonar.plugins:sonar-design-plugin", + "name": "SonarQube :: Plugins :: Design", + "scope": "PRJ", + "qualifier": "BRC", + "date": "2014-07-09T23:19:45+0600", + "creationDate": null, + "lname": "SonarQube :: Plugins :: Design", + "version": "4.5-SNAPSHOT", + "description": "Open source platform for continuous inspection of code quality", + "msr": [ + { + "key": "coverage", + "val": 28.4, + "frmt_val": "28.4%" + }, + { + "key": "ncloc", + "val": 359.0, + "frmt_val": "359" + } + ] + }, + { + "id": 2882, + "key": "org.codehaus.sonar.plugins:sonar-l10n-en-plugin", + "name": "SonarQube :: Plugins :: English Pack", + "scope": "PRJ", + "qualifier": "BRC", + "date": "2014-07-09T23:19:45+0600", + "creationDate": null, + "lname": "SonarQube :: Plugins :: English Pack", + "version": "4.5-SNAPSHOT", + "description": "Open source platform for continuous inspection of code quality", + "msr": [ + { + "key": "coverage", + "val": 100.0, + "frmt_val": "100.0%" + }, + { + "key": "ncloc", + "val": 9.0, + "frmt_val": "9" + } + ] + }, + { + "id": 25120, + "key": "org.codehaus.sonar.plugins:sonar-xoo-plugin", + "name": "SonarQube :: Plugins :: Xoo", + "scope": "PRJ", + "qualifier": "BRC", + "date": "2014-07-09T23:19:45+0600", + "creationDate": "2014-01-17T16:38:52+0600", + "lname": "SonarQube :: Plugins :: Xoo", + "version": "4.5-SNAPSHOT", + "description": "Sample of plugin to document and test available APIs", + "msr": [ + { + "key": "coverage", + "val": 50.0, + "frmt_val": "50.0%" + }, + { + "key": "ncloc", + "val": 86.0, + "frmt_val": "86" + } + ] + }, + { + "id": 2866, + "key": "org.codehaus.sonar:sonar-application", + "name": "SonarQube :: Application", + "scope": "PRJ", + "qualifier": "BRC", + "date": "2014-07-09T23:19:45+0600", + "creationDate": null, + "lname": "SonarQube :: Application", + "version": "4.5-SNAPSHOT", + "description": "Package the standalone distribution", + "msr": [ + { + "key": "coverage", + "val": 90.2, + "frmt_val": "90.2%" + }, + { + "key": "ncloc", + "val": 610.0, + "frmt_val": "610" + } + ] + }, + { + "id": 33484, + "key": "org.codehaus.sonar:sonar-process", + "name": "SonarQube :: Process", + "scope": "PRJ", + "qualifier": "BRC", + "date": "2014-07-09T23:19:45+0600", + "creationDate": "2014-07-08T17:17:01+0600", + "lname": "SonarQube :: Process", + "version": "4.5-SNAPSHOT", + "description": "Open source platform for continuous inspection of code quality", + "msr": [ + { + "key": "coverage", + "val": 68.9, + "frmt_val": "68.9%" + }, + { + "key": "ncloc", + "val": 409.0, + "frmt_val": "409" + } + ] + }, + { + "id": 33505, + "key": "org.codehaus.sonar:sonar-search", + "name": "SonarQube :: Search", + "scope": "PRJ", + "qualifier": "BRC", + "date": "2014-07-09T23:19:45+0600", + "creationDate": "2014-07-09T23:19:46+0600", + "lname": "SonarQube :: Search", + "version": "4.5-SNAPSHOT", + "description": "Open source platform for continuous inspection of code quality", + "msr": [ + { + "key": "coverage", + "val": 24.2, + "frmt_val": "24.2%" + }, + { + "key": "ncloc", + "val": 226.0, + "frmt_val": "226" + } + ] + }, + { + "id": 1624, + "key": "org.codehaus.sonar:sonar-batch", + "name": "SonarQube :: Batch", + "scope": "PRJ", + "qualifier": "BRC", + "date": "2014-07-09T23:19:45+0600", + "creationDate": null, + "lname": "SonarQube :: Batch", + "version": "4.5-SNAPSHOT", + "description": "Open source platform for continuous inspection of code quality", + "msr": [ + { + "key": "coverage", + "val": 76.7, + "frmt_val": "76.7%" + }, + { + "key": "ncloc", + "val": 15301.0, + "frmt_val": "15,301" + } + ] + }, + { + "id": 17, + "key": "org.codehaus.sonar:sonar-check-api", + "name": "SonarQube :: Check API", + "scope": "PRJ", + "qualifier": "BRC", + "date": "2014-07-09T23:19:45+0600", + "creationDate": null, + "lname": "SonarQube :: Check API", + "version": "4.5-SNAPSHOT", + "description": "Check API", + "msr": [ + { + "key": "ncloc", + "val": 57.0, + "frmt_val": "57" + } + ] + }, + { + "id": 18, + "key": "org.codehaus.sonar:sonar-colorizer", + "name": "SonarQube :: Code Colorizer", + "scope": "PRJ", + "qualifier": "BRC", + "date": "2014-07-09T23:19:45+0600", + "creationDate": null, + "lname": "SonarQube :: Code Colorizer", + "version": "4.5-SNAPSHOT", + "description": "Code syntax highlighter", + "msr": [ + { + "key": "coverage", + "val": 89.2, + "frmt_val": "89.2%" + }, + { + "key": "ncloc", + "val": 784.0, + "frmt_val": "784" + } + ] + }, + { + "id": 1625, + "key": "org.codehaus.sonar:sonar-deprecated", + "name": "SonarQube :: Deprecated", + "scope": "PRJ", + "qualifier": "BRC", + "date": "2014-07-09T23:19:45+0600", + "creationDate": null, + "lname": "SonarQube :: Deprecated", + "version": "4.5-SNAPSHOT", + "description": "Open source platform for continuous inspection of code quality", + "msr": [ + { + "key": "coverage", + "val": 52.0, + "frmt_val": "52.0%" + }, + { + "key": "ncloc", + "val": 1375.0, + "frmt_val": "1,375" + } + ] + }, + { + "id": 20, + "key": "org.codehaus.sonar:sonar-duplications", + "name": "SonarQube :: Duplications", + "scope": "PRJ", + "qualifier": "BRC", + "date": "2014-07-09T23:19:45+0600", + "creationDate": null, + "lname": "SonarQube :: Duplications", + "version": "4.5-SNAPSHOT", + "description": "Detect duplicated code", + "msr": [ + { + "key": "coverage", + "val": 85.1, + "frmt_val": "85.1%" + }, + { + "key": "ncloc", + "val": 2693.0, + "frmt_val": "2,693" + } + ] + }, + { + "id": 21, + "key": "org.codehaus.sonar:sonar-graph", + "name": "SonarQube :: Graph", + "scope": "PRJ", + "qualifier": "BRC", + "date": "2014-07-09T23:19:45+0600", + "creationDate": null, + "lname": "SonarQube :: Graph", + "version": "4.5-SNAPSHOT", + "description": "Open source platform for continuous inspection of code quality", + "msr": [ + { + "key": "coverage", + "val": 93.0, + "frmt_val": "93.0%" + }, + { + "key": "ncloc", + "val": 997.0, + "frmt_val": "997" + } + ] + }, + { + "id": 1626, + "key": "org.codehaus.sonar:sonar-java-api", + "name": "SonarQube :: Java API", + "scope": "PRJ", + "qualifier": "BRC", + "date": "2014-07-09T23:19:45+0600", + "creationDate": null, + "lname": "SonarQube :: Java API", + "version": "4.5-SNAPSHOT", + "description": "Open source platform for continuous inspection of code quality", + "msr": [ + { + "key": "coverage", + "val": 60.9, + "frmt_val": "60.9%" + }, + { + "key": "ncloc", + "val": 265.0, + "frmt_val": "265" + } + ] + }, + { + "id": 2869, + "key": "org.codehaus.sonar:sonar-markdown", + "name": "SonarQube :: Markdown", + "scope": "PRJ", + "qualifier": "BRC", + "date": "2014-07-09T23:19:45+0600", + "creationDate": null, + "lname": "SonarQube :: Markdown", + "version": "4.5-SNAPSHOT", + "description": "Open source platform for continuous inspection of code quality", + "msr": [ + { + "key": "coverage", + "val": 95.5, + "frmt_val": "95.5%" + }, + { + "key": "ncloc", + "val": 340.0, + "frmt_val": "340" + } + ] + }, + { + "id": 2870, + "key": "org.codehaus.sonar:sonar-maven-plugin", + "name": "SonarQube :: Maven2 Plugin", + "scope": "PRJ", + "qualifier": "BRC", + "date": "2014-07-09T23:19:45+0600", + "creationDate": null, + "lname": "SonarQube :: Maven2 Plugin", + "version": "4.5-SNAPSHOT", + "description": "Open source platform for continuous inspection of code quality", + "msr": [ + { + "key": "coverage", + "val": 16.9, + "frmt_val": "16.9%" + }, + { + "key": "ncloc", + "val": 122.0, + "frmt_val": "122" + } + ] + }, + { + "id": 16, + "key": "org.codehaus.sonar:sonar-plugin-api", + "name": "SonarQube :: Plugin API", + "scope": "PRJ", + "qualifier": "BRC", + "date": "2014-07-09T23:19:45+0600", + "creationDate": null, + "lname": "SonarQube :: Plugin API", + "version": "4.5-SNAPSHOT", + "description": "Open source platform for continuous inspection of code quality", + "msr": [ + { + "key": "coverage", + "val": 71.8, + "frmt_val": "71.8%" + }, + { + "key": "ncloc", + "val": 22421.0, + "frmt_val": "22,421" + } + ] + }, + { + "id": 251, + "key": "org.codehaus.sonar:sonar-testing-harness", + "name": "SonarQube :: Testing Harness", + "scope": "PRJ", + "qualifier": "BRC", + "date": "2014-07-09T23:19:45+0600", + "creationDate": null, + "lname": "SonarQube :: Testing Harness", + "version": "4.5-SNAPSHOT", + "description": "Open source platform for continuous inspection of code quality", + "msr": [ + { + "key": "ncloc", + "val": 265.0, + "frmt_val": "265" + } + ] + }, + { + "id": 2873, + "key": "org.codehaus.sonar.plugins:sonar-core-plugin", + "name": "SonarQube :: Plugins :: Core", + "scope": "PRJ", + "qualifier": "BRC", + "date": "2014-07-09T23:19:45+0600", + "creationDate": null, + "lname": "SonarQube :: Plugins :: Core", + "version": "4.5-SNAPSHOT", + "description": "Open source platform for continuous inspection of code quality", + "msr": [ + { + "key": "coverage", + "val": 86.4, + "frmt_val": "86.4%" + }, + { + "key": "ncloc", + "val": 4904.0, + "frmt_val": "4,904" + } + ] + }, + { + "id": 2879, + "key": "org.codehaus.sonar.plugins:sonar-cpd-plugin", + "name": "SonarQube :: Plugins :: CPD", + "scope": "PRJ", + "qualifier": "BRC", + "date": "2014-07-09T23:19:45+0600", + "creationDate": null, + "lname": "SonarQube :: Plugins :: CPD", + "version": "4.5-SNAPSHOT", + "description": "Find duplicated source code within project.", + "msr": [ + { + "key": "coverage", + "val": 42.6, + "frmt_val": "42.6%" + }, + { + "key": "ncloc", + "val": 722.0, + "frmt_val": "722" + } + ] + }, + { + "id": 2883, + "key": "org.codehaus.sonar.plugins:sonar-email-notifications-plugin", + "name": "SonarQube :: Plugins :: Email Notifications", + "scope": "PRJ", + "qualifier": "BRC", + "date": "2014-07-09T23:19:45+0600", + "creationDate": null, + "lname": "SonarQube :: Plugins :: Email Notifications", + "version": "4.5-SNAPSHOT", + "description": "Email Notifications", + "msr": [ + { + "key": "coverage", + "val": 80.6, + "frmt_val": "80.6%" + }, + { + "key": "ncloc", + "val": 267.0, + "frmt_val": "267" + } + ] + } +] diff --git a/server/sonar-web/src/main/js/tests/e2e/tests/treemap-spec/treemap.json b/server/sonar-web/src/main/js/tests/e2e/tests/treemap-spec/treemap.json new file mode 100644 index 00000000000..1125b3a7cf4 --- /dev/null +++ b/server/sonar-web/src/main/js/tests/e2e/tests/treemap-spec/treemap.json @@ -0,0 +1,496 @@ +{"metrics": { + "coverage": { + "name": "Coverage", + "type": "PERCENT", + "direction": 1, + "worstValue": 0.0, + "bestValue": 100.0 + }, + "ncloc": { + "name": "Lines of code", + "type": "INT", + "direction": -1 + } +}, "components": [ + { + "key": "org.codehaus.sonar:sonar", + "name": "SonarQube", + "longName": "SonarQube", + "qualifier": "TRK", + "measures": { + "coverage": { + "val": 80.4, + "fval": "80.4%" + }, + "ncloc": { + "val": 113123.0, + "fval": "113,123" + } + } + }, + { + "key": "org.codehaus.sonar:sonar-persistit", + "name": "sonar-persistit", + "longName": "sonar-persistit", + "qualifier": "TRK", + "measures": { + "ncloc": { + "val": 45330.0, + "fval": "45,330" + } + } + }, + { + "key": "com.sonarsource.cpp:cpp", + "name": "SonarSource :: CPP", + "longName": "SonarSource :: CPP", + "qualifier": "TRK", + "measures": { + "coverage": { + "val": 90.4, + "fval": "90.4%" + }, + "ncloc": { + "val": 31250.0, + "fval": "31,250" + } + } + }, + { + "key": "org.codehaus.sonar-plugins.java:java", + "name": "SonarQube Java", + "longName": "SonarQube Java", + "qualifier": "TRK", + "measures": { + "coverage": { + "val": 90.1, + "fval": "90.1%" + }, + "ncloc": { + "val": 22588.0, + "fval": "22,588" + } + } + }, + { + "key": "com.sonarsource.cobol:cobol", + "name": "SonarSource :: Cobol", + "longName": "SonarSource :: Cobol", + "qualifier": "TRK", + "measures": { + "coverage": { + "val": 83.5, + "fval": "83.5%" + }, + "ncloc": { + "val": 20879.0, + "fval": "20,879" + } + } + }, + { + "key": "com.sonarsource.plsql:plsql", + "name": "SonarSource :: PL/SQL", + "longName": "SonarSource :: PL/SQL", + "qualifier": "TRK", + "measures": { + "coverage": { + "val": 96.6, + "fval": "96.6%" + }, + "ncloc": { + "val": 12110.0, + "fval": "12,110" + } + } + }, + { + "key": "org.codehaus.sonar.sslr:sslr", + "name": "SonarSource :: Language Recognizer", + "longName": "SonarSource :: Language Recognizer", + "qualifier": "TRK", + "measures": { + "coverage": { + "val": 80.3, + "fval": "80.3%" + }, + "ncloc": { + "val": 8698.0, + "fval": "8,698" + } + } + }, + { + "key": "org.codehaus.sonar-ide.eclipse:eclipse-parent", + "name": "SonarQube Integration for Eclipse (parent)", + "longName": "SonarQube Integration for Eclipse (parent)", + "qualifier": "TRK", + "measures": { + "coverage": { + "val": 17.2, + "fval": "17.2%" + }, + "ncloc": { + "val": 7924.0, + "fval": "7,924" + } + } + }, + { + "key": "org.codehaus.sonar-plugins.php:parent", + "name": "PHP", + "longName": "PHP", + "qualifier": "TRK", + "measures": { + "coverage": { + "val": 94.9, + "fval": "94.9%" + }, + "ncloc": { + "val": 7134.0, + "fval": "7,134" + } + } + }, + { + "key": "org.codehaus.sonar-plugins.javascript:javascript", + "name": "JavaScript", + "longName": "JavaScript", + "qualifier": "TRK", + "measures": { + "coverage": { + "val": 94.0, + "fval": "94.0%" + }, + "ncloc": { + "val": 6820.0, + "fval": "6,820" + } + } + }, + { + "key": "com.maif.sonar:maif-cobol-plugin", + "name": "MAIF :: Cobol plugin", + "longName": "MAIF :: Cobol plugin", + "qualifier": "TRK", + "measures": { + "coverage": { + "val": 91.6, + "fval": "91.6%" + }, + "ncloc": { + "val": 6684.0, + "fval": "6,684" + } + } + }, + { + "key": "com.sonarsource.vbnet:vbnet", + "name": "SonarSource :: Visual Basic .NET", + "longName": "SonarSource :: Visual Basic .NET", + "qualifier": "TRK", + "measures": { + "coverage": { + "val": 94.3, + "fval": "94.3%" + }, + "ncloc": { + "val": 6416.0, + "fval": "6,416" + } + } + }, + { + "key": "com.sonarsource.orchestrator:orchestrator-parent", + "name": "SonarSource :: Orchestrator :: Parent", + "longName": "SonarSource :: Orchestrator :: Parent", + "qualifier": "TRK", + "measures": { + "coverage": { + "val": 76.1, + "fval": "76.1%" + }, + "ncloc": { + "val": 5815.0, + "fval": "5,815" + } + } + }, + { + "key": "org.codehaus.sonar-plugins.flex:flex", + "name": "Flex", + "longName": "Flex", + "qualifier": "TRK", + "measures": { + "coverage": { + "val": 93.1, + "fval": "93.1%" + }, + "ncloc": { + "val": 5401.0, + "fval": "5,401" + } + } + }, + { + "key": "org.codehaus.sonar-plugins.dotnet.csharp:sonar-csharp-squid", + "name": "SonarQube C# Plugin", + "longName": "SonarQube C# Plugin", + "qualifier": "TRK", + "measures": { + "coverage": { + "val": 90.3, + "fval": "90.3%" + }, + "ncloc": { + "val": 4930.0, + "fval": "4,930" + } + } + }, + { + "key": "com.sonarsource.rpg:rpg", + "name": "SonarSource :: RPG", + "longName": "SonarSource :: RPG", + "qualifier": "TRK", + "measures": { + "coverage": { + "val": 92.7, + "fval": "92.7%" + }, + "ncloc": { + "val": 4235.0, + "fval": "4,235" + } + } + }, + { + "key": "com.sonarsource.plugins.vb:vb", + "name": "SonarSource :: Visual Basic", + "longName": "SonarSource :: Visual Basic", + "qualifier": "TRK", + "measures": { + "coverage": { + "val": 96.1, + "fval": "96.1%" + }, + "ncloc": { + "val": 4190.0, + "fval": "4,190" + } + } + }, + { + "key": "org.codehaus.sonar-plugins.erlang:erlang", + "name": "Erlang", + "longName": "Erlang", + "qualifier": "TRK", + "measures": { + "coverage": { + "val": 88.6, + "fval": "88.6%" + }, + "ncloc": { + "val": 3843.0, + "fval": "3,843" + } + } + }, + { + "key": "org.codehaus.sonar-plugins:sonar-web-plugin", + "name": "SonarQube Web Plugin", + "longName": "SonarQube Web Plugin", + "qualifier": "TRK", + "measures": { + "coverage": { + "val": 94.4, + "fval": "94.4%" + }, + "ncloc": { + "val": 3816.0, + "fval": "3,816" + } + } + }, + { + "key": "org.codehaus.sonar-plugins.python:python", + "name": "Python", + "longName": "Python", + "qualifier": "TRK", + "measures": { + "coverage": { + "val": 91.5, + "fval": "91.5%" + }, + "ncloc": { + "val": 3631.0, + "fval": "3,631" + } + } + }, + { + "key": "com.sonarsource.abap:abap", + "name": "SonarSource :: ABAP", + "longName": "SonarSource :: ABAP", + "qualifier": "TRK", + "measures": { + "coverage": { + "val": 95.1, + "fval": "95.1%" + }, + "ncloc": { + "val": 3603.0, + "fval": "3,603" + } + } + }, + { + "key": "com.sonarsource.pli:pli", + "name": "SonarSource :: PL/I", + "longName": "SonarSource :: PL/I", + "qualifier": "TRK", + "measures": { + "coverage": { + "val": 95.7, + "fval": "95.7%" + }, + "ncloc": { + "val": 3387.0, + "fval": "3,387" + } + } + }, + { + "key": "org.codehaus.sonar.sslr-squid-bridge:sslr-squid-bridge", + "name": "SonarSource :: Language Recognizer :: Squid Bridge", + "longName": "SonarSource :: Language Recognizer :: Squid Bridge", + "qualifier": "TRK", + "measures": { + "coverage": { + "val": 85.2, + "fval": "85.2%" + }, + "ncloc": { + "val": 3250.0, + "fval": "3,250" + } + } + }, + { + "key": "org.codehaus.sonar:sonar-update-center", + "name": "Sonar :: Update Center", + "longName": "Sonar :: Update Center", + "qualifier": "TRK", + "measures": { + "coverage": { + "val": 89.0, + "fval": "89.0%" + }, + "ncloc": { + "val": 3192.0, + "fval": "3,192" + } + } + }, + { + "key": "com.sonarsource.infra:jobs-creator", + "name": "Infra Jenkins Job Creator", + "longName": "Infra Jenkins Job Creator", + "qualifier": "TRK", + "measures": { + "coverage": { + "val": 50.6, + "fval": "50.6%" + }, + "ncloc": { + "val": 2757.0, + "fval": "2,757" + } + } + }, + { + "key": "com.sonarsource:sonar-dev-cockpit-plugin", + "name": "SonarSource :: Developer Cockpit", + "longName": "SonarSource :: Developer Cockpit", + "qualifier": "TRK", + "measures": { + "coverage": { + "val": 92.7, + "fval": "92.7%" + }, + "ncloc": { + "val": 2692.0, + "fval": "2,692" + } + } + }, + { + "key": "org.codehaus.sonar-ide.intellij:sonar-intellij-plugin", + "name": "SonarQube Integration for IntelliJ", + "longName": "SonarQube Integration for IntelliJ", + "qualifier": "TRK", + "measures": { + "coverage": { + "val": 0.2, + "fval": "0.2%" + }, + "ncloc": { + "val": 2679.0, + "fval": "2,679" + } + } + }, + { + "key": "com.sonarsource.views:sonar-views-plugin", + "name": "SonarSource :: Views", + "longName": "SonarSource :: Views", + "qualifier": "TRK", + "measures": { + "coverage": { + "val": 94.6, + "fval": "94.6%" + }, + "ncloc": { + "val": 2630.0, + "fval": "2,630" + } + } + }, + { + "key": "org.codehaus.sonar-plugins.css:css", + "name": "CSS", + "longName": "CSS", + "qualifier": "TRK", + "measures": { + "coverage": { + "val": 81.9, + "fval": "81.9%" + }, + "ncloc": { + "val": 2485.0, + "fval": "2,485" + } + } + }, + { + "key": "org.codehaus.sonar-plugins.xml:xml", + "name": "XML", + "longName": "XML", + "qualifier": "TRK", + "measures": { + "coverage": { + "val": 83.8, + "fval": "83.8%" + }, + "ncloc": { + "val": 2122.0, + "fval": "2,122" + } + } + } +], "maxResultsReached": false, "paging": { + "page": 1, + "pages": 3, + "pageSize": 30, + "total": 73 +}} diff --git a/server/sonar-web/src/main/js/tests/main.js b/server/sonar-web/src/main/js/tests/main.js deleted file mode 100644 index eb95545cb5b..00000000000 --- a/server/sonar-web/src/main/js/tests/main.js +++ /dev/null @@ -1,44 +0,0 @@ -window.__karma__.loaded = function() {}; - -var tests = []; -for (var file in window.__karma__.files) { - if (window.__karma__.files.hasOwnProperty(file)) { - if (/Spec\.js$/.test(file)) { - tests.push(file); - } - } -} - -requirejs.config({ - baseUrl: '/base', - - paths: { - 'backbone': 'third-party/backbone', - 'backbone.marionette': 'third-party/backbone.marionette', - 'handlebars': 'third-party/handlebars', - 'moment': 'third-party/moment' - }, - - shim: { - 'backbone.marionette': { - deps: ['backbone'], - exports: 'Marionette' - }, - 'backbone': { - exports: 'Backbone' - }, - 'handlebars': { - exports: 'Handlebars' - }, - 'moment': { - exports: 'moment' - } - }, - - // ask Require.js to load these files (all our tests) - deps: tests, - - // start test run, once Require.js is done - callback: window.__karma__.start - -}); diff --git a/server/sonar-web/src/main/js/tests/navigator/filters/BaseFilterViewSpec.js b/server/sonar-web/src/main/js/tests/navigator/filters/BaseFilterViewSpec.js deleted file mode 100644 index b1a0ab15c4f..00000000000 --- a/server/sonar-web/src/main/js/tests/navigator/filters/BaseFilterViewSpec.js +++ /dev/null @@ -1,15 +0,0 @@ -define(['navigator/filters/base-filters'], function(BaseFilters) { - - describe('BaseFilterView', function() { - - it('initializes', function() { - var baseFilterView = new BaseFilters.BaseFilterView({ - model: new BaseFilters.Filter() - }); - expect(baseFilterView.detailsView).toBeDefined(); - expect(baseFilterView.detailsView.options.filterView).toBe(baseFilterView); - }); - - }); - -}); diff --git a/server/sonar-web/src/main/js/tests/navigator/filters/ChoiceFilterViewSpec.js b/server/sonar-web/src/main/js/tests/navigator/filters/ChoiceFilterViewSpec.js deleted file mode 100644 index 3b905a9f88f..00000000000 --- a/server/sonar-web/src/main/js/tests/navigator/filters/ChoiceFilterViewSpec.js +++ /dev/null @@ -1,39 +0,0 @@ -define(['navigator/filters/base-filters', 'navigator/filters/choice-filters'], function(BaseFilters, ChoiceFilters) { - - describe('BaseFilterView', function() { - var choices, choiceFilter, choiceFilterView; - - beforeEach(function() { - choices = { - 'ONE': 'one', - 'TWO': 'two', - 'THREE': 'three', - '!OPPOSITE': 'opposite' - }; - - choiceFilter = new BaseFilters.Filter({ - name: 'Choice Filter Name', - property: 'choiceFilterProperty', - type: ChoiceFilters.ChoiceFilterView, - enabled: true, - optional: false, - choices: choices - }); - - choiceFilterView = new ChoiceFilters.ChoiceFilterView({ - model: choiceFilter - }); - }); - - it('creates choices', function() { - expect(choiceFilterView.choices).toBeDefined(); - expect(choiceFilterView.choices.length).toBe(Object.keys(choices).length); - }); - - it('does not have selected by default', function() { - expect(choiceFilterView.getSelected().length).toBe(0); - }); - - }); - -}); |